|
||||||||||
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.DefaultCamelContext
public class DefaultCamelContext
Represents the context used to configure routes and the policies to use.
Constructor Summary | |
---|---|
DefaultCamelContext()
|
Method Summary | ||
---|---|---|
void |
addComponent(String componentName,
Component component)
Adds a component to the container. |
|
void |
addRoutes(Collection<Route> routes)
Adds a collection of routes to this context |
|
void |
addRoutes(RouteBuilder builder)
Adds a collection of routes to this context using the given builder to build them |
|
Endpoint |
addSingletonEndpoint(String uri,
Endpoint endpoint)
Adds the endpoint to the context using the given URI. |
|
protected ComponentResolver |
createComponentResolver()
Lazily create a default implementation |
|
protected ExchangeConverter |
createExchangeConverter()
Lazily create a default implementation |
|
protected Injector |
createInjector()
Lazily create a default implementation |
|
protected TypeConverter |
createTypeConverter()
Lazily create a default implementation |
|
protected void |
doStart()
|
|
protected void |
doStop()
|
|
Component |
getComponent(String name)
Gets a component from the context by name. |
|
|
getComponent(String name,
Class<T> componentType)
Gets a component from the context by name and specifying the expected type of component. |
|
ComponentResolver |
getComponentResolver()
|
|
Endpoint |
getEndpoint(String uri)
Resolves the given URI to an endpoint |
|
|
getEndpoint(String name,
Class<T> endpointType)
Resolves the given URI to an Endpoint of the specified type. |
|
ExchangeConverter |
getExchangeConverter()
Returns the converter of exchanges from one type to another |
|
Injector |
getInjector()
Returns the injector used to instantiate objects by type |
|
Component |
getOrCreateComponent(String componentName,
Callable<Component> factory)
Gets the a previously added component by name or lazily creates the component using the factory Callback. |
|
List<Route> |
getRoutes()
Returns the current routes in this context |
|
Collection<Endpoint> |
getSingletonEndpoints()
Returns the collection of all registered singleton endpoints. |
|
TypeConverter |
getTypeConverter()
Returns the type converter used to coerce types from one type to another |
|
boolean |
isAutoCreateComponents()
|
|
Component |
removeComponent(String componentName)
Removes a previously added component. |
|
Endpoint |
removeSingletonEndpoint(String uri)
Removes the singleton endpoint with the given URI |
|
void |
setAutoCreateComponents(boolean autoCreateComponents)
|
|
void |
setComponentResolver(ComponentResolver componentResolver)
|
|
void |
setExchangeConverter(ExchangeConverter exchangeConverter)
|
|
void |
setInjector(Injector injector)
|
|
void |
setRoutes(List<Route> routes)
Sets the routes for this context, replacing any current routes |
|
void |
setTypeConverter(TypeConverter typeConverter)
|
|
protected void |
startRoutes(Collection<Route> routeList)
|
Methods inherited from class org.apache.camel.impl.ServiceSupport |
---|
isStarted, isStopped, isStopping, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.camel.Service |
---|
start, stop |
Constructor Detail |
---|
public DefaultCamelContext()
Method Detail |
---|
public void addComponent(String componentName, Component component)
addComponent
in interface CamelContext
public Component getComponent(String name)
CamelContext
getComponent
in interface CamelContext
public <T extends Component> T getComponent(String name, Class<T> componentType)
CamelContext
getComponent
in interface CamelContext
public Component removeComponent(String componentName)
removeComponent
in interface CamelContext
componentName
-
public Component getOrCreateComponent(String componentName, Callable<Component> factory)
getOrCreateComponent
in interface CamelContext
componentName
- factory
- used to create a new component instance if the component was not previously added.
public Collection<Endpoint> getSingletonEndpoints()
CamelContext
getSingletonEndpoints
in interface CamelContext
public Endpoint addSingletonEndpoint(String uri, Endpoint endpoint) throws Exception
CamelContext
addSingletonEndpoint
in interface CamelContext
uri
- the URI to be used to resolve this endpointendpoint
- the endpoint to be added to the context
Exception
- if the new endpoint could not be started or the old endpoint could not be stoppedpublic Endpoint removeSingletonEndpoint(String uri) throws Exception
CamelContext
removeSingletonEndpoint
in interface CamelContext
uri
- the URI to be used to remove
Exception
- if endpoint could not be stoppedpublic Endpoint getEndpoint(String uri)
getEndpoint
in interface CamelContext
public <T extends Endpoint> T getEndpoint(String name, Class<T> endpointType)
CamelContext
Endpoint
of the specified type.
If the URI has a singleton endpoint registered, then the singleton is returned.
Otherwise, a new Endpoint
is created and if the endpoint is a
singleton it is registered as a singleton endpoint.
getEndpoint
in interface CamelContext
public List<Route> getRoutes()
CamelContext
getRoutes
in interface CamelContext
public void setRoutes(List<Route> routes)
CamelContext
setRoutes
in interface CamelContext
routes
- the new routes to usepublic void addRoutes(Collection<Route> routes) throws Exception
CamelContext
addRoutes
in interface CamelContext
routes
- the routes to add
Exception
public void addRoutes(RouteBuilder builder) throws Exception
CamelContext
addRoutes
in interface CamelContext
builder
- the builder which will create the routes and add them to this context
Exception
- if the routes could not be created for whatever reasonpublic ExchangeConverter getExchangeConverter()
CamelContext
getExchangeConverter
in interface CamelContext
public void setExchangeConverter(ExchangeConverter exchangeConverter)
public TypeConverter getTypeConverter()
CamelContext
getTypeConverter
in interface CamelContext
public void setTypeConverter(TypeConverter typeConverter)
public Injector getInjector()
CamelContext
getInjector
in interface CamelContext
public void setInjector(Injector injector)
public ComponentResolver getComponentResolver()
public void setComponentResolver(ComponentResolver componentResolver)
protected void doStart() throws Exception
doStart
in class ServiceSupport
Exception
protected void doStop() throws Exception
doStop
in class ServiceSupport
Exception
protected void startRoutes(Collection<Route> routeList) throws Exception
Exception
protected ExchangeConverter createExchangeConverter()
protected TypeConverter createTypeConverter()
protected Injector createInjector()
protected ComponentResolver createComponentResolver()
public boolean isAutoCreateComponents()
public void setAutoCreateComponents(boolean autoCreateComponents)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |