Class DefaultRestOpenapiProcessorStrategy
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.component.rest.openapi.DefaultRestOpenapiProcessorStrategy
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,RestOpenapiProcessorStrategy,org.apache.camel.NonManagedService,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasCamelContext,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
public class DefaultRestOpenapiProcessorStrategy
extends org.apache.camel.support.service.ServiceSupport
implements RestOpenapiProcessorStrategy, org.apache.camel.CamelContextAware, org.apache.camel.NonManagedService
Default
RestOpenapiProcessorStrategy that links the Rest DSL to routes called via direct:operationId.-
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 voiddoInit()protected voiddoStart()protected voiddoStop()org.apache.camel.CamelContextWhether the consumer should fail,ignore or return a dummy response for OpenAPI operations that are not mapped to a corresponding route.Used for inclusive filtering of mock data from directories.booleanprocess(io.swagger.v3.oas.models.OpenAPI openAPI, io.swagger.v3.oas.models.Operation operation, String verb, String path, org.apache.camel.support.processor.RestBindingAdvice binding, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) Strategy for processing the Rest DSL operationbooleanprocessApiSpecification(String specificationUri, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) Strategy for processing the OpenAPI specification (to return the contract)voidsetCamelContext(org.apache.camel.CamelContext camelContext) voidsetComponent(String component) Name of component to use for processing the Rest DSL requests.voidsetMissingOperation(String missingOperation) Whether the consumer should fail,ignore or return a dummy response for OpenAPI operations that are not mapped to a corresponding route.voidsetMockIncludePattern(String mockIncludePattern) Used for inclusive filtering of mock data from directories.voidvalidateOpenApi(io.swagger.v3.oas.models.OpenAPI openAPI, org.apache.camel.component.platform.http.spi.PlatformHttpConsumerAware platformHttpConsumer) Validates the OpenAPI specification on startupMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, 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
-
DefaultRestOpenapiProcessorStrategy
public DefaultRestOpenapiProcessorStrategy()
-
-
Method Details
-
validateOpenApi
public void validateOpenApi(io.swagger.v3.oas.models.OpenAPI openAPI, org.apache.camel.component.platform.http.spi.PlatformHttpConsumerAware platformHttpConsumer) throws Exception Description copied from interface:RestOpenapiProcessorStrategyValidates the OpenAPI specification on startup- Specified by:
validateOpenApiin interfaceRestOpenapiProcessorStrategy- Parameters:
openAPI- the openapi specificationplatformHttpConsumer- the platform http consumer- Throws:
Exception- is thrown if validation error on startup
-
processApiSpecification
public boolean processApiSpecification(String specificationUri, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) Description copied from interface:RestOpenapiProcessorStrategyStrategy for processing the OpenAPI specification (to return the contract)- Specified by:
processApiSpecificationin interfaceRestOpenapiProcessorStrategy- Parameters:
exchange- the exchangecallback- the AsyncCallback will be invoked when the processing of the exchange is completed. If the exchange is completed synchronously, then the callback is also invoked synchronously. The callback should therefore be careful of starting recursive loop.- Returns:
- (doneSync) true to continue execute synchronously, false to continue being executed asynchronously
-
process
public boolean process(io.swagger.v3.oas.models.OpenAPI openAPI, io.swagger.v3.oas.models.Operation operation, String verb, String path, org.apache.camel.support.processor.RestBindingAdvice binding, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) Description copied from interface:RestOpenapiProcessorStrategyStrategy for processing the Rest DSL operation- Specified by:
processin interfaceRestOpenapiProcessorStrategy- Parameters:
openAPI- the openapi specificationoperation- the rest operationverb- the HTTP verb (GET, POST etc.)path- the context-pathbinding- binding adviceexchange- the exchangecallback- the AsyncCallback will be invoked when the processing of the exchange is completed. If the exchange is completed synchronously, then the callback is also invoked synchronously. The callback should therefore be careful of starting recursive loop.- Returns:
- (doneSync) true to continue execute synchronously, false to continue being executed asynchronously
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()- Specified by:
getCamelContextin interfaceorg.apache.camel.spi.HasCamelContext
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext) - Specified by:
setCamelContextin interfaceorg.apache.camel.CamelContextAware
-
getComponent
-
setComponent
Name of component to use for processing the Rest DSL requests. -
getMissingOperation
Description copied from interface:RestOpenapiProcessorStrategyWhether the consumer should fail,ignore or return a dummy response for OpenAPI operations that are not mapped to a corresponding route.- Specified by:
getMissingOperationin interfaceRestOpenapiProcessorStrategy
-
setMissingOperation
Description copied from interface:RestOpenapiProcessorStrategyWhether the consumer should fail,ignore or return a dummy response for OpenAPI operations that are not mapped to a corresponding route.- Specified by:
setMissingOperationin interfaceRestOpenapiProcessorStrategy
-
getMockIncludePattern
Description copied from interface:RestOpenapiProcessorStrategyUsed for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma.- Specified by:
getMockIncludePatternin interfaceRestOpenapiProcessorStrategy
-
setMockIncludePattern
Description copied from interface:RestOpenapiProcessorStrategyUsed for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma.- Specified by:
setMockIncludePatternin interfaceRestOpenapiProcessorStrategy
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-