Class AbstractApiEndpoint<E extends ApiName,T>

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.component.AbstractApiEndpoint<E,T>
All Implemented Interfaces:
AutoCloseable, org.apache.camel.ApiEndpoint, 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, PropertiesInterceptor, PropertyNamesInterceptor, org.apache.camel.SuspendableService

public abstract class AbstractApiEndpoint<E extends ApiName,T> extends ScheduledPollEndpoint implements org.apache.camel.ApiEndpoint, PropertyNamesInterceptor, PropertiesInterceptor
Abstract base class for API Component Endpoints.
  • Field Details

    • log

      protected final org.slf4j.Logger log
    • apiName

      protected final E extends ApiName apiName
    • methodName

      protected final String methodName
    • methodHelper

      protected final ApiMethodHelper<? extends ApiMethod> methodHelper
    • configuration

      protected final T configuration
    • inBody

      @UriParam(description="Sets the name of a parameter to be passed in the exchange In Body") protected String inBody
  • Constructor Details

    • AbstractApiEndpoint

      public AbstractApiEndpoint(String endpointUri, org.apache.camel.Component component, E apiName, String methodName, ApiMethodHelper<? extends ApiMethod> methodHelper, T endpointConfiguration)
  • Method Details

    • getPropertiesHelper

      protected abstract ApiMethodPropertiesHelper<T> getPropertiesHelper()
      Returns generated helper that extends ApiMethodPropertiesHelper to work with API properties.
      Returns:
      properties helper.
    • configureProperties

      public void configureProperties(Map<String,Object> options)
      Specified by:
      configureProperties in interface org.apache.camel.Endpoint
      Overrides:
      configureProperties in class ScheduledPollEndpoint
    • afterConfigureProperties

      protected abstract void afterConfigureProperties()
      Initialize proxies, create server connections, etc. after endpoint properties have been configured.
    • configureConsumer

      protected void configureConsumer(org.apache.camel.Consumer consumer) throws Exception
      Overrides:
      configureConsumer in class ScheduledPollEndpoint
      Throws:
      Exception
    • interceptPropertyNames

      public void interceptPropertyNames(Set<String> propertyNames)
      Description copied from interface: PropertyNamesInterceptor
      Intercept property names used to find API Method. Used to add any custom/hidden method arguments, which MUST be provided in interceptProperties() override.
      Specified by:
      interceptPropertyNames in interface PropertyNamesInterceptor
      Parameters:
      propertyNames - argument names.
    • interceptProperties

      public void interceptProperties(Map<String,Object> properties)
      Description copied from interface: PropertiesInterceptor
      Intercept method invocation arguments used to find and invoke API method. Can be overridden to add custom/hidden method arguments.
      Specified by:
      interceptProperties in interface PropertiesInterceptor
      Parameters:
      properties - method invocation arguments.
    • getConfiguration

      public final T getConfiguration()
      Returns endpoint configuration object. One of the generated EndpointConfiguration classes that extends component configuration class.
      Returns:
      endpoint configuration object
    • getApiName

      public final E getApiName()
      Returns API name.
      Returns:
      apiName property.
    • getMethodName

      public final String getMethodName()
      Returns method name.
      Returns:
      methodName property.
    • getMethodHelper

      public final ApiMethodHelper<? extends ApiMethod> getMethodHelper()
      Returns method helper.
      Returns:
      methodHelper property.
    • getCandidates

      public final List<ApiMethod> getCandidates()
      Returns candidate methods for this endpoint.
      Returns:
      list of candidate methods.
    • getInBody

      public final String getInBody()
      Returns name of parameter passed in the exchange In Body.
      Returns:
      inBody property.
    • setInBody

      public final void setInBody(String inBody) throws IllegalArgumentException
      Sets the name of a parameter to be passed in the exchange In Body.
      Parameters:
      inBody - parameter name
      Throws:
      IllegalArgumentException - for invalid parameter name.
    • getEndpointPropertyNames

      public final Set<String> getEndpointPropertyNames()
    • getEndpointProperties

      public final Map<String,Object> getEndpointProperties()
    • getConfigurationPropertyNames

      public Set<String> getConfigurationPropertyNames()
    • getConfigurationProperties

      public final Map<String,Object> getConfigurationProperties()
    • getApiProxy

      public abstract Object getApiProxy(ApiMethod method, Map<String,Object> args)
      Returns an instance of an API Proxy based on apiName, method and args. Called by AbstractApiConsumer or AbstractApiProducer.
      Parameters:
      method - method about to be invoked
      args - method arguments
      Returns:
      a Java object that implements the method to be invoked.
      See Also:
    • getExecutorService

      public final ExecutorService getExecutorService()
    • getThreadProfileName

      protected abstract String getThreadProfileName()
      Returns Thread profile name. Generated as a constant THREAD_PROFILE_NAME in *Constants.
      Returns:
      thread profile name to use.