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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    protected void
     
    protected void
     
    org.apache.camel.CamelContext
     
     
    Whether 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.
    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)
    Strategy for processing the Rest DSL operation
    boolean
    processApiSpecification(String specificationUri, org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback)
    Strategy for processing the OpenAPI specification (to return the contract)
    void
    setCamelContext(org.apache.camel.CamelContext camelContext)
     
    void
    setComponent(String component)
    Name of component to use for processing the Rest DSL requests.
    void
    setMissingOperation(String missingOperation)
    Whether the consumer should fail,ignore or return a dummy response for OpenAPI operations that are not mapped to a corresponding route.
    void
    setMockIncludePattern(String mockIncludePattern)
    Used for inclusive filtering of mock data from directories.
    void
    validateOpenApi(io.swagger.v3.oas.models.OpenAPI openAPI, String basePath, org.apache.camel.component.platform.http.spi.PlatformHttpConsumerAware platformHttpConsumer)
    Validates the OpenAPI specification on startup

    Methods 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, suspend

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    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

    • DefaultRestOpenapiProcessorStrategy

      public DefaultRestOpenapiProcessorStrategy()
  • Method Details

    • validateOpenApi

      public void validateOpenApi(io.swagger.v3.oas.models.OpenAPI openAPI, String basePath, org.apache.camel.component.platform.http.spi.PlatformHttpConsumerAware platformHttpConsumer) throws Exception
      Description copied from interface: RestOpenapiProcessorStrategy
      Validates the OpenAPI specification on startup
      Specified by:
      validateOpenApi in interface RestOpenapiProcessorStrategy
      Parameters:
      openAPI - the openapi specification
      basePath - base path
      platformHttpConsumer - 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: RestOpenapiProcessorStrategy
      Strategy for processing the OpenAPI specification (to return the contract)
      Specified by:
      processApiSpecification in interface RestOpenapiProcessorStrategy
      Parameters:
      exchange - the exchange
      callback - 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 to 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: RestOpenapiProcessorStrategy
      Strategy for processing the Rest DSL operation
      Specified by:
      process in interface RestOpenapiProcessorStrategy
      Parameters:
      openAPI - the openapi specification
      operation - the rest operation
      verb - the HTTP verb (GET, POST etc.)
      path - the context-path
      binding - binding advice
      exchange - the exchange
      callback - 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 to execute synchronously, false to continue being executed asynchronously
    • getCamelContext

      public org.apache.camel.CamelContext getCamelContext()
      Specified by:
      getCamelContext in interface org.apache.camel.spi.HasCamelContext
    • setCamelContext

      public void setCamelContext(org.apache.camel.CamelContext camelContext)
      Specified by:
      setCamelContext in interface org.apache.camel.CamelContextAware
    • getComponent

      public String getComponent()
    • setComponent

      public void setComponent(String component)
      Name of component to use for processing the Rest DSL requests.
    • getMissingOperation

      public String getMissingOperation()
      Description copied from interface: RestOpenapiProcessorStrategy
      Whether the consumer should fail,ignore or return a dummy response for OpenAPI operations that are not mapped to a corresponding route.
      Specified by:
      getMissingOperation in interface RestOpenapiProcessorStrategy
    • setMissingOperation

      public void setMissingOperation(String missingOperation)
      Description copied from interface: RestOpenapiProcessorStrategy
      Whether the consumer should fail,ignore or return a dummy response for OpenAPI operations that are not mapped to a corresponding route.
      Specified by:
      setMissingOperation in interface RestOpenapiProcessorStrategy
    • getMockIncludePattern

      public String getMockIncludePattern()
      Description copied from interface: RestOpenapiProcessorStrategy
      Used 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:
      getMockIncludePattern in interface RestOpenapiProcessorStrategy
    • setMockIncludePattern

      public void setMockIncludePattern(String mockIncludePattern)
      Description copied from interface: RestOpenapiProcessorStrategy
      Used 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:
      setMockIncludePattern in interface RestOpenapiProcessorStrategy
    • doInit

      protected void doInit() throws Exception
      Overrides:
      doInit in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.apache.camel.support.service.BaseService
      Throws:
      Exception