Class ValidatingProcessor
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.AsyncProcessorSupport
org.apache.camel.support.processor.validation.ValidatingProcessor
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.AsyncProcessor,org.apache.camel.Processor,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
public class ValidatingProcessor
extends org.apache.camel.support.AsyncProcessorSupport
A processor which validates the XML version of the inbound message body against some schema either in XSD or RelaxNG
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Schemaprotected SchemaFactoryprotected Sourceprotected voiddoProcess(org.apache.camel.Exchange exchange) byte[]protected Sourcebooleanbooleanprotected booleanisInputStreamNeeded(org.apache.camel.Exchange exchange) Checks whether we need anInputStreamto access the message body or header.booleanvoidbooleanprocess(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) voidsetErrorHandler(ValidatorErrorHandler errorHandler) voidsetFailOnNullBody(boolean failOnNullBody) voidsetFailOnNullHeader(boolean failOnNullHeader) voidsetHeaderName(String headerName) voidsetResourceResolver(LSResourceResolver resourceResolver) voidvoidsetSchemaAsByteArray(byte[] schemaAsByteArray) voidsetSchemaFactory(SchemaFactory schemaFactory) voidsetSchemaFile(File schemaFile) voidsetSchemaLanguage(String schemaLanguage) voidsetSchemaSource(Source schemaSource) voidsetSchemaUrl(URL schemaUrl) voidsetUseSharedSchema(boolean useSharedSchema) Methods inherited from class org.apache.camel.support.AsyncProcessorSupport
process, processAsyncMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
ValidatingProcessor
public ValidatingProcessor() -
ValidatingProcessor
-
-
Method Details
-
process
public boolean process(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) -
doProcess
- Throws:
Exception
-
loadSchema
- Throws:
Exception
-
getSchema
- Throws:
IOExceptionSAXException
-
setSchema
-
getSchemaLanguage
-
setSchemaLanguage
-
getSchemaSource
- Throws:
IOException
-
setSchemaSource
-
getSchemaUrl
-
setSchemaUrl
-
getSchemaFile
-
setSchemaFile
-
getSchemaAsByteArray
public byte[] getSchemaAsByteArray() -
setSchemaAsByteArray
public void setSchemaAsByteArray(byte[] schemaAsByteArray) -
getSchemaFactory
-
setSchemaFactory
-
getErrorHandler
-
setErrorHandler
-
getResourceResolver
-
setResourceResolver
-
isFailOnNullBody
public boolean isFailOnNullBody() -
setFailOnNullBody
public void setFailOnNullBody(boolean failOnNullBody) -
isFailOnNullHeader
public boolean isFailOnNullHeader() -
setFailOnNullHeader
public void setFailOnNullHeader(boolean failOnNullHeader) -
getHeaderName
-
setHeaderName
-
createSchemaFactory
-
createSchemaSource
- Throws:
IOException
-
createSchema
- Throws:
SAXExceptionIOException
-
isInputStreamNeeded
protected boolean isInputStreamNeeded(org.apache.camel.Exchange exchange) Checks whether we need anInputStreamto access the message body or header. Depending on the content in the message body or header, we may not need to convert toInputStream.- Parameters:
exchange- the current exchange- Returns:
- true to convert to
InputStreambeforehand converting toSourceafterward.
-
getSource
-