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.Endpoint
,org.apache.camel.IsSingleton
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,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 Summary
Fields Modifier and Type Field Description protected E
apiName
protected T
configuration
protected String
inBody
protected org.slf4j.Logger
log
protected ApiMethodHelper<? extends ApiMethod>
methodHelper
protected String
methodName
-
Constructor Summary
Constructors Constructor Description AbstractApiEndpoint(String endpointUri, org.apache.camel.Component component, E apiName, String methodName, ApiMethodHelper<? extends ApiMethod> methodHelper, T endpointConfiguration)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
afterConfigureProperties()
Initialize proxies, create server connections, etc.protected void
configureConsumer(org.apache.camel.Consumer consumer)
void
configureProperties(Map<String,Object> options)
E
getApiName()
Returns API name.abstract Object
getApiProxy(ApiMethod method, Map<String,Object> args)
Returns an instance of an API Proxy based on apiName, method and args.List<ApiMethod>
getCandidates()
Returns candidate methods for this endpoint.T
getConfiguration()
Returns endpoint configuration object.Map<String,Object>
getConfigurationProperties()
Set<String>
getConfigurationPropertyNames()
Map<String,Object>
getEndpointProperties()
Set<String>
getEndpointPropertyNames()
ExecutorService
getExecutorService()
String
getInBody()
Returns name of parameter passed in the exchange In Body.ApiMethodHelper<? extends ApiMethod>
getMethodHelper()
Returns method helper.String
getMethodName()
Returns method name.protected abstract ApiMethodPropertiesHelper<T>
getPropertiesHelper()
Returns generated helper that extendsApiMethodPropertiesHelper
to work with API properties.protected abstract String
getThreadProfileName()
Returns Thread profile name.void
interceptProperties(Map<String,Object> properties)
Intercept method invocation arguments used to find and invoke API method.void
interceptPropertyNames(Set<String> propertyNames)
Intercept property names used to find API Method.void
setInBody(String inBody)
Sets the name of a parameter to be passed in the exchange In Body.-
Methods inherited from class org.apache.camel.support.ScheduledPollEndpoint
configureScheduledPollConsumerProperties, doConfigureConsumer, doStart, doStop, 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, setUseFixedDelay
-
Methods inherited from class org.apache.camel.support.DefaultEndpoint
configureExchange, configurePollingConsumer, createAsyncProducer, createEndpointUri, createExchange, createExchange, createPollingConsumer, doInit, 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, toString
-
Methods 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, suspend
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.camel.Endpoint
configureExchange, createAsyncProducer, createConsumer, createExchange, createExchange, createPollingConsumer, createProducer, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, getExchangePattern, isLenientProperties, isSingletonProducer, setCamelContext
-
-
-
-
Field Detail
-
log
protected final org.slf4j.Logger log
-
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
-
-
Method Detail
-
getPropertiesHelper
protected abstract ApiMethodPropertiesHelper<T> getPropertiesHelper()
Returns generated helper that extendsApiMethodPropertiesHelper
to work with API properties.- Returns:
- properties helper.
-
configureProperties
public void configureProperties(Map<String,Object> options)
- Specified by:
configureProperties
in interfaceorg.apache.camel.Endpoint
- Overrides:
configureProperties
in classScheduledPollEndpoint
-
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 classScheduledPollEndpoint
- 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 interfacePropertyNamesInterceptor
- 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 interfacePropertiesInterceptor
- 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.
-
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 byAbstractApiConsumer
orAbstractApiProducer
.- Parameters:
method
- method about to be invokedargs
- method arguments- Returns:
- a Java object that implements the method to be invoked.
- See Also:
AbstractApiProducer
,AbstractApiConsumer
-
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.
-
-