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 Summary
FieldsModifier and TypeFieldDescriptionprotected final E
protected final T
protected String
protected final org.slf4j.Logger
protected final ApiMethodHelper<? extends ApiMethod>
protected final String
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
ConstructorsConstructorDescriptionAbstractApiEndpoint
(String endpointUri, org.apache.camel.Component component, E apiName, String methodName, ApiMethodHelper<? extends ApiMethod> methodHelper, T endpointConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
Initialize proxies, create server connections, etc.protected void
configureConsumer
(org.apache.camel.Consumer consumer) void
configureProperties
(Map<String, Object> options) final E
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.Returns candidate methods for this endpoint.final T
Returns endpoint configuration object.final ExecutorService
final String
Returns name of parameter passed in the exchange In Body.final ApiMethodHelper<? extends ApiMethod>
Returns method helper.final String
Returns method name.protected abstract ApiMethodPropertiesHelper<T>
Returns generated helper that extendsApiMethodPropertiesHelper
to work with API properties.protected abstract String
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.final void
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, 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, doStart, doStop, 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.ComponentAware
getComponent, getComponent, setComponent
Methods inherited from interface org.apache.camel.Endpoint
configureExchange, createAsyncProducer, createConsumer, createExchange, createExchange, createPollingConsumer, createProducer, getCamelContext, getEndpointBaseUri, getEndpointKey, getEndpointUri, getExchangePattern, isLenientProperties, isSingletonProducer, setCamelContext
Methods inherited from interface org.apache.camel.IsSingleton
isSingleton
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
-
Field Details
-
log
protected final org.slf4j.Logger log -
apiName
-
methodName
-
methodHelper
-
configuration
-
inBody
@UriParam(description="Sets the name of a parameter to be passed in the exchange In Body") protected String inBody
-
-
Constructor Details
-
AbstractApiEndpoint
-
-
Method Details
-
getPropertiesHelper
Returns generated helper that extendsApiMethodPropertiesHelper
to work with API properties.- Returns:
- properties helper.
-
configureProperties
- 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
- Overrides:
configureConsumer
in classScheduledPollEndpoint
- Throws:
Exception
-
interceptPropertyNames
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
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
Returns endpoint configuration object. One of the generated EndpointConfiguration classes that extends component configuration class.- Returns:
- endpoint configuration object
-
getApiName
Returns API name.- Returns:
- apiName property.
-
getMethodName
Returns method name.- Returns:
- methodName property.
-
getMethodHelper
Returns method helper.- Returns:
- methodHelper property.
-
getCandidates
Returns candidate methods for this endpoint.- Returns:
- list of candidate methods.
-
getInBody
Returns name of parameter passed in the exchange In Body.- Returns:
- inBody property.
-
setInBody
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
-
getEndpointProperties
-
getConfigurationPropertyNames
-
getConfigurationProperties
-
getApiProxy
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:
-
getExecutorService
-
getThreadProfileName
Returns Thread profile name. Generated as a constant THREAD_PROFILE_NAME in *Constants.- Returns:
- thread profile name to use.
-