|
||||||||||
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<E>
public abstract class DefaultComponent<E extends Exchange>
Default component to use for base for components implementations.
Constructor Summary | |
---|---|
DefaultComponent()
|
|
DefaultComponent(CamelContext context)
|
Method Summary | ||
---|---|---|
|
convertTo(Class<T> type,
Object value)
Converts the given value to the requested type |
|
Endpoint<E> |
createEndpoint(String uri)
Attempt to resolve an endpoint for the given URI if the component is capable of handling the URI |
|
protected abstract Endpoint<E> |
createEndpoint(String uri,
String remaining,
Map parameters)
A factory method allowing derived components to create a new endpoint from the given URI, remaining path and optional parameters |
|
protected ScheduledExecutorService |
createExecutorService()
A factory method to create a default thread pool and executor |
|
protected void |
doStart()
|
|
protected void |
doStop()
|
|
|
getAndRemoveParameter(Map parameters,
String key,
Class<T> type)
Gets the parameter and remove it from the parameter map. |
|
|
getAndRemoveParameter(Map parameters,
String key,
Class<T> type,
T defaultValue)
Gets the parameter and remove it from the parameter map. |
|
CamelContext |
getCamelContext()
Returns the context |
|
ScheduledExecutorService |
getExecutorService()
|
|
Object |
lookup(String name)
Look up the given named bean in the Registry on the
CamelContext |
|
|
lookup(String name,
Class<T> beanType)
Look up the given named bean of the given type in the Registry on the
CamelContext |
|
|
mandatoryConvertTo(Class<T> type,
Object value)
Converts the given value to the specified type throwing an IllegalArgumentException
if the value could not be converted to a non null value |
|
Object |
mandatoryLookup(String name)
Look up the given named bean in the Registry on the
CamelContext or throws |
|
|
mandatoryLookup(String name,
Class<T> beanType)
Look up the given named bean of the given type in the Registry on the
CamelContext |
|
|
newInstance(Class<T> beanType)
Creates a new instance of the given type using the Injector on the given
CamelContext |
|
void |
setCamelContext(CamelContext context)
The CamelContext is injected into the component when it is added
to it |
|
void |
setExecutorService(ScheduledExecutorService executorService)
|
|
protected void |
setProperties(Object bean,
Map 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 |
validateURI(String uri,
String path,
Map parameters)
Strategy for validation of the uri when creating the endpoint. |
Methods inherited from class org.apache.camel.impl.ServiceSupport |
---|
addChildService, getThreadName, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, nextThreadCounter, removeChildService, start, stop |
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<E> createEndpoint(String uri) throws Exception
Component
createEndpoint
in interface Component<E extends Exchange>
uri
- the URI to create
Exception
protected void validateURI(String uri, String path, Map parameters) throws ResolveEndpointFailedException
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()
Component
getCamelContext
in interface Component<E extends Exchange>
public void setCamelContext(CamelContext context)
Component
CamelContext
is injected into the component when it is added
to it
setCamelContext
in interface Component<E extends Exchange>
public ScheduledExecutorService getExecutorService()
public void setExecutorService(ScheduledExecutorService executorService)
protected ScheduledExecutorService createExecutorService()
protected void doStart() throws Exception
doStart
in class ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class ServiceSupport
Exception
protected abstract Endpoint<E> createEndpoint(String uri, String remaining, Map 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 parameters) throws Exception
Exception
protected boolean useIntrospectionOnEndpoint()
public <T> T convertTo(Class<T> type, Object value)
public <T> T mandatoryConvertTo(Class<T> type, Object value)
IllegalArgumentException
if the value could not be converted to a non null value
public <T> T newInstance(Class<T> beanType)
Injector
on the given
CamelContext
public Object lookup(String name)
Registry
on the
CamelContext
public <T> T lookup(String name, Class<T> beanType)
Registry
on the
CamelContext
public Object mandatoryLookup(String name)
Registry
on the
CamelContext
or throws
public <T> T mandatoryLookup(String name, Class<T> beanType)
Registry
on the
CamelContext
public <T> T getAndRemoveParameter(Map parameters, String key, Class<T> type)
parameters
- the parameterskey
- the keytype
- the requested type to convert the value from the parameter
public <T> T getAndRemoveParameter(Map 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |