Package org.apache.camel.model
Class RouteTemplateDefinition
- java.lang.Object
-
- org.apache.camel.model.OptionalIdentifiedDefinition
-
- org.apache.camel.model.RouteTemplateDefinition
-
- All Implemented Interfaces:
org.apache.camel.CamelContextAware,org.apache.camel.LineNumberAware,org.apache.camel.NamedNode,org.apache.camel.spi.HasId,org.apache.camel.spi.IdAware
@Metadata(label="configuration") public class RouteTemplateDefinition extends OptionalIdentifiedDefinition
Defines a route template (parameterized routes)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRouteTemplateDefinition.Converter
-
Constructor Summary
Constructors Constructor Description RouteTemplateDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RouteDefinitionasRouteDefinition()Creates a copy of this template as aRouteDefinitionwhich can be used to add as a new route.RouteTemplateDefinitionconfigure(Consumer<org.apache.camel.RouteTemplateContext> configurer)Sets a configurer which allows to do configuration while the route template is being used to create a route.RouteTemplateDefinitiondescription(String text)Sets the description of this nodeRouteDefinitionfrom(String uri)Creates an input to the routeRouteDefinitionfrom(EndpointConsumerBuilder endpoint)Creates an input to the routeRouteDefinitionfrom(org.apache.camel.Endpoint endpoint)Creates an input to the routeConsumer<org.apache.camel.RouteTemplateContext>getConfigurer()StringgetLabel()RouteDefinitiongetRoute()StringgetShortName()List<RouteTemplateBeanDefinition>getTemplateBeans()List<RouteTemplateParameterDefinition>getTemplateParameters()RouteDefinitionroute()To define the route in the templatevoidsetConfigurer(Consumer<org.apache.camel.RouteTemplateContext> configurer)voidsetRoute(RouteDefinition route)voidsetTemplateBeans(List<RouteTemplateBeanDefinition> templateBeans)voidsetTemplateParameters(List<RouteTemplateParameterDefinition> templateParameters)RouteTemplateBeanDefinitiontemplateBean(String name)Adds a local bean the route template uses (via fluent builder)RouteTemplateDefinitiontemplateBean(String name, Class<?> type)Adds a local bean the route template usesRouteTemplateDefinitiontemplateBean(String name, Class<?> type, String language, String script)Adds a local bean the route template usesRouteTemplateDefinitiontemplateBean(String name, Class<?> type, org.apache.camel.RouteTemplateContext.BeanSupplier<Object> bean)Adds a local bean the route template usesRouteTemplateDefinitiontemplateBean(String name, Object bean)Adds a local bean the route template usesRouteTemplateDefinitiontemplateBean(String name, String language, String script)Adds a local bean the route template usesRouteTemplateDefinitiontemplateBean(String name, Supplier<Object> bean)Adds a local bean the route template usesRouteTemplateDefinitiontemplateOptionalParameter(String name)Adds an optional parameter the route template usesRouteTemplateDefinitiontemplateOptionalParameter(String name, String description)Adds an optional parameter the route template usesRouteTemplateDefinitiontemplateParameter(String name)Adds a required parameter the route template usesRouteTemplateDefinitiontemplateParameter(String name, String defaultValue)Adds a parameter (will use default value if not provided) the route template usesRouteTemplateDefinitiontemplateParameter(String name, String defaultValue, String description)Adds a parameter (will use default value if not provided) the route template usesRouteTemplateDefinitiontemplateParameters(Map<String,String> parameters)Adds the parameters the route template uses.-
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, getCamelContext, getCustomId, getDescription, getDescriptionText, getId, getLineNumber, getLocation, getParent, hasCustomIdAssigned, id, idOrCreate, setCamelContext, setCustomId, setDescription, setGeneratedId, setId, setLineNumber, setLocation
-
-
-
-
Method Detail
-
getTemplateParameters
public List<RouteTemplateParameterDefinition> getTemplateParameters()
-
setTemplateParameters
public void setTemplateParameters(List<RouteTemplateParameterDefinition> templateParameters)
-
getTemplateBeans
public List<RouteTemplateBeanDefinition> getTemplateBeans()
-
setTemplateBeans
public void setTemplateBeans(List<RouteTemplateBeanDefinition> templateBeans)
-
getRoute
public RouteDefinition getRoute()
-
setRoute
public void setRoute(RouteDefinition route)
-
setConfigurer
public void setConfigurer(Consumer<org.apache.camel.RouteTemplateContext> configurer)
-
getConfigurer
public Consumer<org.apache.camel.RouteTemplateContext> getConfigurer()
-
from
public RouteDefinition from(@AsEndpointUri String uri)
Creates an input to the route- Parameters:
uri- the from uri- Returns:
- the builder
-
from
public RouteDefinition from(org.apache.camel.Endpoint endpoint)
Creates an input to the route- Parameters:
endpoint- the from endpoint- Returns:
- the builder
-
from
public RouteDefinition from(EndpointConsumerBuilder endpoint)
Creates an input to the route- Parameters:
endpoint- the from endpoint- Returns:
- the builder
-
route
public RouteDefinition route()
To define the route in the template
-
description
public RouteTemplateDefinition description(String text)
Description copied from class:OptionalIdentifiedDefinitionSets the description of this node- Overrides:
descriptionin classOptionalIdentifiedDefinition- Parameters:
text- sets the text description, use null to not set a text- Returns:
- the builder
-
templateParameter
public RouteTemplateDefinition templateParameter(String name)
Adds a required parameter the route template uses- Parameters:
name- the name of the parameter
-
templateOptionalParameter
public RouteTemplateDefinition templateOptionalParameter(String name)
Adds an optional parameter the route template uses- Parameters:
name- the name of the parameter
-
templateOptionalParameter
public RouteTemplateDefinition templateOptionalParameter(String name, String description)
Adds an optional parameter the route template uses- Parameters:
name- the name of the parameterdescription- the description of the parameter
-
templateParameter
public RouteTemplateDefinition templateParameter(String name, String defaultValue)
Adds a parameter (will use default value if not provided) the route template uses- Parameters:
name- the name of the parameterdefaultValue- default value of the parameter
-
templateParameter
public RouteTemplateDefinition templateParameter(String name, String defaultValue, String description)
Adds a parameter (will use default value if not provided) the route template uses- Parameters:
name- the name of the parameterdefaultValue- default value of the parameterdescription- the description of the parameter
-
templateParameters
public RouteTemplateDefinition templateParameters(Map<String,String> parameters)
Adds the parameters the route template uses. The keys in the map is the parameter names, and the values are optional default value. If a parameter has no default value then the parameter is required.- Parameters:
parameters- the parameters (only name and default values)
-
templateBean
public RouteTemplateDefinition templateBean(String name, Class<?> type)
Adds a local bean the route template uses- Parameters:
name- the name of the beantype- the type of the bean to associate the binding
-
templateBean
public RouteTemplateDefinition templateBean(String name, Object bean)
Adds a local bean the route template uses- Parameters:
name- the name of the beanbean- the bean, or reference to bean (#class or #type), or a supplier for the bean
-
templateBean
public RouteTemplateDefinition templateBean(String name, Supplier<Object> bean)
Adds a local bean the route template uses- Parameters:
name- the name of the beanbean- the supplier for the bean
-
templateBean
public RouteTemplateDefinition templateBean(String name, Class<?> type, org.apache.camel.RouteTemplateContext.BeanSupplier<Object> bean)
Adds a local bean the route template uses- Parameters:
name- the name of the beantype- the type of the bean to associate the bindingbean- a supplier for the bean
-
templateBean
public RouteTemplateDefinition templateBean(String name, String language, String script)
Adds a local bean the route template uses- Parameters:
name- the name of the beanlanguage- the language to usescript- the script to use for creating the local bean
-
templateBean
public RouteTemplateDefinition templateBean(String name, Class<?> type, String language, String script)
Adds a local bean the route template uses- Parameters:
name- the name of the beantype- the type of the bean to associate the bindinglanguage- the language to usescript- the script to use for creating the local bean
-
templateBean
public RouteTemplateBeanDefinition templateBean(String name)
Adds a local bean the route template uses (via fluent builder)- Parameters:
name- the name of the bean- Returns:
- fluent builder to choose which language and script to use for creating the bean
-
configure
public RouteTemplateDefinition configure(Consumer<org.apache.camel.RouteTemplateContext> configurer)
Sets a 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
-
getShortName
public String getShortName()
-
getLabel
public String getLabel()
-
asRouteDefinition
public RouteDefinition asRouteDefinition()
Creates a copy of this template as aRouteDefinitionwhich can be used to add as a new route.
-
-