Package org.apache.camel
Interface RouteTemplateContext
- All Superinterfaces:
HasCamelContext
The context used during creating a
Route
from a route template.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Used for template beans to supply the local bean the route template should use when creating route(s). -
Method Summary
Modifier and TypeMethodDescriptionvoid
Binds the bean to the repository (if possible).void
Binds the bean (via a supplier) to the repository (if possible).default void
Binds the bean to the repository (if possible).void
bindAsPrototype
(String id, Class<?> type, Supplier<Object> bean) Binds the bean (via a supplier) to the repository (if possible).Gets the custom configurer.getEnvironmentVariable
(String name) Gets the environment variable parameter that matches the given property name.Gets the local bean repository for the route template when creating the new routeThe parameters to use for the route template when creating the new routegetProperty
(String name) Gets the property with the given name<T> T
getProperty
(String name, Class<?> type) Gets the property with the given nameboolean
hasEnvironmentVariable
(String name) Whether the route template has an environment variable parameter that matches the given parameter name.boolean
hasParameter
(String name) Whether the route template has a parameter with the given namevoid
registerDestroyMethod
(String id, String method) Registers an optional destroy method to invoke on the bean when stopping Camel.void
setConfigurer
(Consumer<RouteTemplateContext> configurer) Sets a custom configurer which allows to do configuration while the route template is being used to create a route.void
setParameter
(String name, Object value) Sets a parameterMethods inherited from interface org.apache.camel.spi.HasCamelContext
getCamelContext
-
Method Details
-
bind
Binds the bean to the repository (if possible). If the bean isCamelContextAware
then the registry will automatically inject the context if possible.- Parameters:
id
- the id of the beanbean
- the bean
-
bind
Binds the bean to the repository (if possible). Binding by id and type allows to bind multiple entries with the same id but with different type. If the bean isCamelContextAware
then the registry will automatically inject the context if possible.- Parameters:
id
- the id of the beantype
- the type of the bean to associate the bindingbean
- the bean
-
bind
Binds the bean (via a supplier) to the repository (if possible). Camel will cache the result from the supplier from first lookup (singleton scope). If you do not need cached then usebindAsPrototype(String, Class, Supplier)
instead. Binding by id and type allows to bind multiple entries with the same id but with different type. If the bean isCamelContextAware
then the registry will automatically inject the context if possible.- Parameters:
id
- the id of the beantype
- the type of the bean to associate the bindingbean
- a supplier for the bean
-
bindAsPrototype
Binds the bean (via a supplier) to the repository (if possible). Notice that the supplier will be called each time the bean is being looked up (not cached). Binding by id and type allows to bind multiple entries with the same id but with different type. If the bean isCamelContextAware
then the registry will automatically inject the context if possible.- Parameters:
id
- the id of the beantype
- the type of the bean to associate the bindingbean
- a supplier for the bean
-
registerDestroyMethod
Registers an optional destroy method to invoke on the bean when stopping Camel.- Parameters:
id
- the id of the beanmethod
- the destroy method name
-
getProperty
Gets the property with the given name- Parameters:
name
- name of property- Returns:
- the property value or null if no property exists
-
getEnvironmentVariable
Gets the environment variable parameter that matches the given property name. The match is performed by normalizing the given property name as an OS environment variable name. The environment variable name may use pure uppercase or camelCase converted to underscore property names. As an example bucketNameOrArn property matches BUCKETNAMEORARN and BUCKET_NAME_OR_ARN environment variables.- Parameters:
name
- name of property- Returns:
- the property value or null if no property exists
-
getProperty
Gets the property with the given name- Parameters:
name
- name of propertytype
- the type of the property- Returns:
- the property value or null if no property exists
- Throws:
TypeConversionException
- is thrown if error during type conversion
-
setParameter
Sets a parameter- Parameters:
name
- the parameter namevalue
- the parameter value
-
getParameters
The parameters to use for the route template when creating the new route -
hasParameter
Whether the route template has a parameter with the given name- Parameters:
name
- the parameter name- Returns:
- true if exists
-
hasEnvironmentVariable
Whether the route template has an environment variable parameter that matches the given parameter name. The match is performed by normalizing the given name as an OS environment variable name. The environment variable name may use pure uppercase or camelCase converted to underscore property names. As an example bucketNameOrArn property matches BUCKETNAMEORARN and BUCKET_NAME_OR_ARN environment variables.- Parameters:
name
- the parameter name- Returns:
- true if exists
-
getLocalBeanRepository
BeanRepository getLocalBeanRepository()Gets the local bean repository for the route template when creating the new route -
setConfigurer
Sets a custom configurer which allows to do configuration while the route template is being used to create a route. This gives control over the creating process, such as binding local beans and doing other kind of customization.- Parameters:
configurer
- the configurer with callback to invoke with the given route template context
-
getConfigurer
Consumer<RouteTemplateContext> getConfigurer()Gets the custom configurer.
-