Class JsonValidatorEndpoint
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultEndpoint
org.apache.camel.support.ScheduledPollEndpoint
org.apache.camel.support.DefaultPollingEndpoint
org.apache.camel.support.ProcessorEndpoint
org.apache.camel.component.ResourceEndpoint
org.apache.camel.component.jsonvalidator.JsonValidatorEndpoint
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.api.management.mbean.ManagedResourceEndpointMBean,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 JsonValidatorEndpoint")
@UriEndpoint(scheme="json-validator",
firstVersion="2.20.0",
title="JSON Schema Validator",
syntax="json-validator:resourceUri",
remote=false,
producerOnly=true,
category=VALIDATION)
public class JsonValidatorEndpoint
extends org.apache.camel.component.ResourceEndpoint
Validate JSON payloads using NetworkNT JSON Schema.
-
Field Summary
Fields inherited from class org.apache.camel.component.ResourceEndpoint
logFields 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
ConstructorsConstructorDescriptionJsonValidatorEndpoint(String endpointUri, org.apache.camel.Component component, String resourceUri) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected Stringprotected voiddoInit()org.apache.camel.ExchangePatternbooleanbooleanprotected voidonExchange(org.apache.camel.Exchange exchange) voidsetDisabledDeserializationFeatures(String disabledDeserializationFeatures) voidsetEnabledDeserializationFeatures(String enabledDeserializationFeatures) voidsetErrorHandler(JsonValidatorErrorHandler errorHandler) To use a custom 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.voidsetUriSchemaLoader(JsonUriSchemaLoader uriSchemaLoader) To use a custom schema loader allowing for adding custom format validation.Methods inherited from class org.apache.camel.component.ResourceEndpoint
getCamelId, getCamelManagementName, getResourceAsInputStream, getResourceAsInputStreamWithoutCache, getResourceUri, getState, isAllowContextMapAll, isContentCache, isContentCacheCleared, loadResource, setAllowContextMapAll, setContentCache, setResourceUriMethods inherited from class org.apache.camel.support.ProcessorEndpoint
createPollingConsumer, createProcessor, createProducer, getProcessor, setProcessorMethods inherited from class org.apache.camel.support.DefaultPollingEndpoint
createConsumerMethods inherited from class org.apache.camel.support.ScheduledPollEndpoint
configureConsumer, configureProperties, configureScheduledPollConsumerProperties, doConfigureConsumer, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDefaultDelay, getDelay, getInitialDelay, getPollStrategy, getRepeatCount, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setDelay, setGreedy, setInitialDelay, setPollStrategy, setRepeatCount, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelayMethods inherited from class org.apache.camel.support.DefaultEndpoint
configureExchange, configurePollingConsumer, createAsyncProducer, createExchange, createExchange, equals, getCamelContext, getComponent, getEndpointKey, getEndpointUri, getExceptionHandler, 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, doStart, doStop, 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.ComponentAware
getComponentMethods 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
-
JsonValidatorEndpoint
-
-
Method Details
-
clearContentCache
public void clearContentCache()- Specified by:
clearContentCachein interfaceorg.apache.camel.api.management.mbean.ManagedResourceEndpointMBean- Overrides:
clearContentCachein classorg.apache.camel.component.ResourceEndpoint
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.DefaultEndpoint- Throws:
Exception
-
getExchangePattern
public org.apache.camel.ExchangePattern getExchangePattern()- Specified by:
getExchangePatternin interfaceorg.apache.camel.Endpoint- Overrides:
getExchangePatternin classorg.apache.camel.support.DefaultEndpoint
-
onExchange
- Overrides:
onExchangein classorg.apache.camel.support.ProcessorEndpoint- Throws:
Exception
-
createEndpointUri
- Overrides:
createEndpointUriin classorg.apache.camel.support.DefaultEndpoint
-
getErrorHandler
-
setErrorHandler
To use a custom ValidatorErrorHandler. The default error handler captures the errors and throws an exception. -
getUriSchemaLoader
-
setUriSchemaLoader
To use a custom schema loader allowing for adding custom format validation. The default implementation will create a schema loader that tries to determine the schema version from the $schema property of the specified schema. -
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. -
getEnabledDeserializationFeatures
-
setEnabledDeserializationFeatures
-
getDisabledDeserializationFeatures
-
setDisabledDeserializationFeatures
-