Class ValidatorEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.component.validator.ValidatorEndpoint
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.CamelContextAware
,org.apache.camel.ComponentAware
,org.apache.camel.Endpoint
,org.apache.camel.IsSingleton
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.HasCamelContext
,org.apache.camel.spi.HasId
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
@ManagedResource(description="Managed ValidatorEndpoint")
@UriEndpoint(firstVersion="1.1.0",
scheme="validator",
title="Validator",
syntax="validator:resourceUri",
remote=false,
producerOnly=true,
category={CORE,VALIDATION})
public class ValidatorEndpoint
extends org.apache.camel.support.DefaultEndpoint
Validate the payload using XML Schema and JAXP Validation.
-
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
ConstructorsConstructorDescriptionValidatorEndpoint
(String endpointUri, org.apache.camel.Component component, String resourceUri) -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
configureValidator
(org.apache.camel.support.processor.validation.ValidatingProcessor validator) org.apache.camel.Consumer
createConsumer
(org.apache.camel.Processor processor) org.apache.camel.Producer
org.apache.camel.support.processor.validation.ValidatorErrorHandler
boolean
boolean
boolean
void
setErrorHandler
(org.apache.camel.support.processor.validation.ValidatorErrorHandler errorHandler) To use a custom org.apache.camel.processor.validation.ValidatorErrorHandler.void
setFailOnNullBody
(boolean failOnNullBody) Whether to fail if no body exists.void
setFailOnNullHeader
(boolean failOnNullHeader) Whether to fail if no header exists when validating against a header.void
setHeaderName
(String headerName) To validate against a header instead of the message body.void
setResourceResolver
(LSResourceResolver resourceResolver) To use a custom LSResourceResolver.void
setResourceResolverFactory
(ValidatorResourceResolverFactory resourceResolverFactory) For creating a resource resolver which depends on the endpoint resource URI.void
setResourceUri
(String resourceUri) URL to a local resource on the classpath,or a reference to lookup a bean in the Registry, or a full URL to a remote resource or resource on the file system which contains the XSD to validate against.void
setSchemaFactory
(SchemaFactory schemaFactory) To use a custom javax.xml.validation.SchemaFactoryvoid
setSchemaLanguage
(String schemaLanguage) Configures the W3C XML Schema Namespace URI.void
setUseSharedSchema
(boolean useSharedSchema) Whether the Schema instance should be shared or not.Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureConsumer, configureExchange, configurePollingConsumer, configureProperties, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, isLenientProperties, isPollingConsumerBlockWhenFull, isPollingConsumerCopy, isSingleton, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setComponent, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setLazyStartProducer, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerCopy, setPollingConsumerQueueSize, setProperties, toString
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.camel.ComponentAware
getComponent
Methods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isSingletonProducer
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
ValidatorEndpoint
public ValidatorEndpoint() -
ValidatorEndpoint
-
-
Method Details
-
clearCachedSchema
@ManagedOperation(description="Clears the cached schema, forcing to re-load the schema on next request") public void clearCachedSchema() -
createProducer
- Throws:
Exception
-
createConsumer
public org.apache.camel.Consumer createConsumer(org.apache.camel.Processor processor) throws Exception - Throws:
Exception
-
configureValidator
protected void configureValidator(org.apache.camel.support.processor.validation.ValidatingProcessor validator) throws Exception - Throws:
Exception
-
getResourceUri
-
setResourceUri
URL to a local resource on the classpath,or a reference to lookup a bean in the Registry, or a full URL to a remote resource or resource on the file system which contains the XSD to validate against. -
getSchemaLanguage
-
setSchemaLanguage
Configures the W3C XML Schema Namespace URI. -
getSchemaFactory
-
setSchemaFactory
To use a custom javax.xml.validation.SchemaFactory -
getErrorHandler
public org.apache.camel.support.processor.validation.ValidatorErrorHandler getErrorHandler() -
setErrorHandler
public void setErrorHandler(org.apache.camel.support.processor.validation.ValidatorErrorHandler errorHandler) To use a custom org.apache.camel.processor.validation.ValidatorErrorHandler. The default error handler captures the errors and throws an exception. -
getResourceResolver
-
setResourceResolver
To use a custom LSResourceResolver. See alsosetResourceResolverFactory(ValidatorResourceResolverFactory)
-
getResourceResolverFactory
-
setResourceResolverFactory
For creating a resource resolver which depends on the endpoint resource URI. Must not be used in combination with methodsetResourceResolver(LSResourceResolver)
. If not set thenDefaultValidatorResourceResolverFactory
is used -
isFailOnNullBody
public boolean isFailOnNullBody() -
setFailOnNullBody
public void setFailOnNullBody(boolean failOnNullBody) Whether to fail if no body exists. -
isFailOnNullHeader
public boolean isFailOnNullHeader() -
setFailOnNullHeader
public void setFailOnNullHeader(boolean failOnNullHeader) Whether to fail if no header exists when validating against a header. -
getHeaderName
-
setHeaderName
To validate against a header instead of the message body.
-