public abstract class DefaultComponent
extends org.apache.camel.support.service.ServiceSupport
implements org.apache.camel.Component
Constructor and Description |
---|
DefaultComponent() |
DefaultComponent(org.apache.camel.CamelContext context) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterConfiguration(String uri,
String remaining,
org.apache.camel.Endpoint endpoint,
Map<String,Object> parameters)
Strategy to do post configuration logic.
|
org.apache.camel.Endpoint |
createEndpoint(String uri) |
org.apache.camel.Endpoint |
createEndpoint(String uri,
Map<String,Object> properties) |
protected abstract org.apache.camel.Endpoint |
createEndpoint(String uri,
String remaining,
Map<String,Object> parameters)
A factory method allowing derived components to create a new endpoint
from the given URI, remaining path and optional parameters
|
protected void |
doInit() |
protected void |
doStart() |
protected void |
doStop() |
<T> T |
getAndRemoveOrResolveReferenceParameter(Map<String,Object> parameters,
String key,
Class<T> type)
Gets the parameter and remove it from the parameter map.
|
<T> T |
getAndRemoveOrResolveReferenceParameter(Map<String,Object> parameters,
String key,
Class<T> type,
T defaultValue)
Gets the parameter and remove it from the parameter map.
|
<T> T |
getAndRemoveParameter(Map<String,Object> parameters,
String key,
Class<T> type)
Gets the parameter and remove it from the parameter map.
|
<T> T |
getAndRemoveParameter(Map<String,Object> parameters,
String key,
Class<T> type,
T defaultValue)
Gets the parameter and remove it from the parameter map.
|
org.apache.camel.CamelContext |
getCamelContext() |
org.apache.camel.spi.PropertyConfigurer |
getComponentPropertyConfigurer() |
org.apache.camel.spi.PropertyConfigurer |
getEndpointPropertyConfigurer() |
<T extends org.apache.camel.component.extension.ComponentExtension> |
getExtension(Class<T> extensionType) |
Collection<Class<? extends org.apache.camel.component.extension.ComponentExtension>> |
getSupportedExtensions() |
protected String |
ifStartsWithReturnRemainder(String prefix,
String text)
Returns the reminder of the text if it starts with the prefix.
|
boolean |
isBasicPropertyBinding()
Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities.
|
protected String |
preProcessUri(String uri)
Deprecated.
|
protected void |
registerExtension(org.apache.camel.component.extension.ComponentExtension extension) |
protected void |
registerExtension(Supplier<org.apache.camel.component.extension.ComponentExtension> supplier) |
<T> List<T> |
resolveAndRemoveReferenceListParameter(Map<String,Object> parameters,
String key,
Class<T> elementType)
Resolves a reference list parameter in the registry and removes it from
the map.
|
<T> List<T> |
resolveAndRemoveReferenceListParameter(Map<String,Object> parameters,
String key,
Class<T> elementType,
List<T> defaultValue)
Resolves a reference list parameter in the registry and removes it from
the map.
|
<T> T |
resolveAndRemoveReferenceParameter(Map<String,Object> parameters,
String key,
Class<T> type)
Resolves a reference parameter in the registry and removes it from the map.
|
<T> T |
resolveAndRemoveReferenceParameter(Map<String,Object> parameters,
String key,
Class<T> type,
T defaultValue)
Resolves a reference parameter in the registry and removes it from the map.
|
void |
setBasicPropertyBinding(boolean basicPropertyBinding)
Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities.
|
void |
setCamelContext(org.apache.camel.CamelContext context) |
protected void |
setProperties(org.apache.camel.CamelContext camelContext,
Object bean,
Map<String,Object> parameters)
Sets the bean properties on the given bean using the given
CamelContext . |
protected void |
setProperties(Object bean,
Map<String,Object> parameters)
Sets the bean properties on the given bean
|
protected boolean |
useIntrospectionOnEndpoint()
Derived classes may wish to overload this to prevent the default introspection of URI parameters
on the created
Endpoint instance. |
boolean |
useRawUri() |
protected void |
validateParameters(String uri,
Map<String,Object> parameters,
String optionPrefix)
Strategy for validation of parameters, that was not able to be resolved to any endpoint options.
|
protected void |
validateURI(String uri,
String path,
Map<String,Object> parameters)
Strategy for validation of the uri when creating the endpoint.
|
doResume, doShutdown, doSuspend, getStatus, init, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public DefaultComponent()
public DefaultComponent(org.apache.camel.CamelContext context)
@Deprecated protected String preProcessUri(String uri)
public org.apache.camel.Endpoint createEndpoint(String uri, Map<String,Object> properties) throws Exception
createEndpoint
in interface org.apache.camel.Component
Exception
public org.apache.camel.Endpoint createEndpoint(String uri) throws Exception
createEndpoint
in interface org.apache.camel.Component
Exception
public boolean useRawUri()
useRawUri
in interface org.apache.camel.Component
public boolean isBasicPropertyBinding()
public void setBasicPropertyBinding(boolean basicPropertyBinding)
protected void afterConfiguration(String uri, String remaining, org.apache.camel.Endpoint endpoint, Map<String,Object> parameters) throws Exception
uri
- the uriremaining
- the remaining part of the URI without the query parameters or component prefixendpoint
- the created endpointparameters
- the remaining parameters after the endpoint has been created and parsed the parametersException
- can be thrown to indicate error creating the endpointprotected void validateParameters(String uri, Map<String,Object> parameters, String optionPrefix)
uri
- the uriparameters
- the parameters, an empty map if no parameters givenoptionPrefix
- optional prefix to filter the parameters for validation. Use null for validate all.org.apache.camel.ResolveEndpointFailedException
- should be thrown if the URI validation failedprotected void validateURI(String uri, String path, Map<String,Object> parameters)
uri
- the uripath
- the path - part after the schemeparameters
- the parameters, an empty map if no parameters givenorg.apache.camel.ResolveEndpointFailedException
- should be thrown if the URI validation failedpublic org.apache.camel.CamelContext getCamelContext()
getCamelContext
in interface org.apache.camel.CamelContextAware
public void setCamelContext(org.apache.camel.CamelContext context)
setCamelContext
in interface org.apache.camel.CamelContextAware
protected void doInit() throws Exception
doInit
in class org.apache.camel.support.service.ServiceSupport
Exception
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.service.ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class org.apache.camel.support.service.ServiceSupport
Exception
protected abstract org.apache.camel.Endpoint createEndpoint(String uri, String remaining, Map<String,Object> parameters) throws Exception
uri
- the full URI of the endpointremaining
- the remaining part of the URI without the query
parameters or component prefixparameters
- the optional parameters passed inException
- is thrown if error creating the endpointprotected void setProperties(Object bean, Map<String,Object> parameters) throws Exception
bean
- the beanparameters
- properties to setException
protected void setProperties(org.apache.camel.CamelContext camelContext, Object bean, Map<String,Object> parameters) throws Exception
CamelContext
.camelContext
- the CamelContext
to usebean
- the beanparameters
- properties to setException
public org.apache.camel.spi.PropertyConfigurer getComponentPropertyConfigurer()
getComponentPropertyConfigurer
in interface org.apache.camel.Component
public org.apache.camel.spi.PropertyConfigurer getEndpointPropertyConfigurer()
getEndpointPropertyConfigurer
in interface org.apache.camel.Component
protected boolean useIntrospectionOnEndpoint()
Endpoint
instance.public <T> T getAndRemoveParameter(Map<String,Object> parameters, String key, Class<T> type)
parameters
- the parameterskey
- the keytype
- the requested type to convert the value from the parameterresolveAndRemoveReferenceParameter(Map, String, Class)
public <T> T getAndRemoveParameter(Map<String,Object> parameters, String key, Class<T> type, T defaultValue)
parameters
- the parameterskey
- the keytype
- the requested type to convert the value from the parameterdefaultValue
- use this default value if the parameter does not contain the keyresolveAndRemoveReferenceParameter(Map, String, Class, Object)
public <T> T getAndRemoveOrResolveReferenceParameter(Map<String,Object> parameters, String key, Class<T> type)
parameters
- the parameterskey
- the keytype
- the requested type to convert the value from the parameterpublic <T> T getAndRemoveOrResolveReferenceParameter(Map<String,Object> parameters, String key, Class<T> type, T defaultValue)
parameters
- the parameterskey
- the keytype
- the requested type to convert the value from the parameterdefaultValue
- use this default value if the parameter does not contain the keypublic <T> T resolveAndRemoveReferenceParameter(Map<String,Object> parameters, String key, Class<T> type)
T
- type of object to lookup in the registry.parameters
- parameter map.key
- parameter map key.type
- type of object to lookup in the registry.null
if the parameter map
doesn't contain the key.IllegalArgumentException
- if a non-null reference was not found in
registry.public <T> T resolveAndRemoveReferenceParameter(Map<String,Object> parameters, String key, Class<T> type, T defaultValue)
T
- type of object to lookup in the registry.parameters
- parameter map.key
- parameter map key.type
- type of object to lookup in the registry.defaultValue
- default value to use if the parameter map doesn't
contain the key.IllegalArgumentException
- if referenced object was not found in
registry.public <T> List<T> resolveAndRemoveReferenceListParameter(Map<String,Object> parameters, String key, Class<T> elementType)
parameters
- parameter map.key
- parameter map key.elementType
- result list element type.IllegalArgumentException
- if any of the referenced objects was
not found in registry.EndpointHelper.resolveReferenceListParameter(CamelContext, String, Class)
public <T> List<T> resolveAndRemoveReferenceListParameter(Map<String,Object> parameters, String key, Class<T> elementType, List<T> defaultValue)
parameters
- parameter map.key
- parameter map key.elementType
- result list element type.defaultValue
- default value to use if the parameter map doesn't
contain the key.IllegalArgumentException
- if any of the referenced objects was
not found in registry.EndpointHelper.resolveReferenceListParameter(CamelContext, String, Class)
protected String ifStartsWithReturnRemainder(String prefix, String text)
prefix
- the prefixtext
- the textprotected void registerExtension(org.apache.camel.component.extension.ComponentExtension extension)
protected void registerExtension(Supplier<org.apache.camel.component.extension.ComponentExtension> supplier)
public Collection<Class<? extends org.apache.camel.component.extension.ComponentExtension>> getSupportedExtensions()
getSupportedExtensions
in interface org.apache.camel.Component
Apache Camel