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.Endpoint,org.apache.camel.IsSingleton,org.apache.camel.Service,org.apache.camel.ShutdownableService,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",
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 TypeMethodDescriptionvoidprotected voidconfigureValidator(org.apache.camel.support.processor.validation.ValidatingProcessor validator) org.apache.camel.ConsumercreateConsumer(org.apache.camel.Processor processor) org.apache.camel.Producerorg.apache.camel.support.processor.validation.ValidatorErrorHandlerbooleanbooleanbooleanvoidsetErrorHandler(org.apache.camel.support.processor.validation.ValidatorErrorHandler errorHandler) To use a custom org.apache.camel.processor.validation.ValidatorErrorHandler.voidsetFailOnNullBody(boolean failOnNullBody) Whether to fail if no body exists.voidsetFailOnNullHeader(boolean failOnNullHeader) Whether to fail if no header exists when validating against a header.voidsetHeaderName(String headerName) To validate against a header instead of the message body.voidsetResourceResolver(LSResourceResolver resourceResolver) To use a custom LSResourceResolver.voidsetResourceResolverFactory(ValidatorResourceResolverFactory resourceResolverFactory) For creating a resource resolver which depends on the endpoint resource URI.voidsetResourceUri(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.voidsetSchemaFactory(SchemaFactory schemaFactory) To use a custom javax.xml.validation.SchemaFactoryvoidsetSchemaLanguage(String schemaLanguage) Configures the W3C XML Schema Namespace URI.voidsetUseSharedSchema(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, doStart, doStop, 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, toStringMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, 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, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.Endpoint
getEndpointBaseUri, isSingletonProducerMethods 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
-
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 thenDefaultValidatorResourceResolverFactoryis 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.
-