|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.impl.ServiceSupport
org.apache.camel.impl.DefaultComponent
public abstract class DefaultComponent
Default component to use for base for components implementations.
Constructor Summary | |
---|---|
DefaultComponent()
|
|
DefaultComponent(CamelContext context)
|
Method Summary | ||
---|---|---|
protected void |
afterConfiguration(String uri,
String remaining,
Endpoint endpoint,
Map<String,Object> parameters)
Strategy to do post configuration logic. |
|
Endpoint |
createEndpoint(String uri)
Attempt to resolve an endpoint for the given URI if the component is capable of handling the URI |
|
protected abstract 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 |
doStart()
|
|
protected void |
doStop()
|
|
|
getAndRemoveParameter(Map<String,Object> parameters,
String key,
Class<T> type)
Gets the parameter and remove it from the parameter map. |
|
|
getAndRemoveParameter(Map<String,Object> parameters,
String key,
Class<T> type,
T defaultValue)
Gets the parameter and remove it from the parameter map. |
|
CamelContext |
getCamelContext()
Get the CamelContext |
|
protected String |
ifStartsWithReturnRemainder(String prefix,
String text)
Returns the reminder of the text if it starts with the prefix. |
|
|
resolveAndRemoveReferenceListParameter(Map<String,Object> parameters,
String key,
Class<T> elementType)
Resolves a reference list parameter in the registry and removes it from the map. |
|
|
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. |
|
|
resolveAndRemoveReferenceParameter(Map<String,Object> parameters,
String key,
Class<T> type)
Resolves a reference parameter in the registry and removes it from the map. |
|
|
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 |
setCamelContext(CamelContext context)
Injects the 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 |
|
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. |
Methods inherited from class org.apache.camel.impl.ServiceSupport |
---|
addChildService, doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, start, stop, suspend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultComponent()
public DefaultComponent(CamelContext context)
Method Detail |
---|
public Endpoint createEndpoint(String uri) throws Exception
Component
createEndpoint
in interface Component
uri
- the URI to create
Exception
- is thrown if error creating the endpointprotected void afterConfiguration(String uri, String remaining, Endpoint endpoint, Map<String,Object> parameters) throws Exception
endpoint
- the created endpointparameters
- the remaining parameters after the endpoint has been created and parsed the parameters
Exception
- can be thrown to indicate error creating the endpointprotected void validateParameters(String uri, Map<String,Object> parameters, String optionPrefix)
uri
- the uri - the uri the end user provided untouchedparameters
- the parameters, an empty map if no parameters givenoptionPrefix
- optional prefix to filter the parameters for validation. Use null for validate all.
ResolveEndpointFailedException
- should be thrown if the URI validation failedprotected void validateURI(String uri, String path, Map<String,Object> parameters)
uri
- the uri - the uri the end user provided untouchedpath
- the path - part after the schemeparameters
- the parameters, an empty map if no parameters given
ResolveEndpointFailedException
- should be thrown if the URI validation failedpublic CamelContext getCamelContext()
CamelContextAware
CamelContext
getCamelContext
in interface CamelContextAware
public void setCamelContext(CamelContext context)
CamelContextAware
CamelContext
setCamelContext
in interface CamelContextAware
context
- the Camel contextprotected void doStart() throws Exception
doStart
in class ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class ServiceSupport
Exception
protected abstract 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 in
Exception
protected void setProperties(Object bean, Map<String,Object> parameters) throws Exception
bean
- the beanparameters
- properties to set
Exception
protected boolean useIntrospectionOnEndpoint()
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 parameter
resolveAndRemoveReferenceParameter(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 key
resolveAndRemoveReferenceParameter(Map, String, Class, Object)
public <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 text
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |