public class DefaultModel extends Object implements Model
| Constructor and Description |
|---|
DefaultModel(org.apache.camel.CamelContext camelContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHystrixConfiguration(String id,
HystrixConfigurationDefinition configuration)
Adds the Hystrix configuration
|
void |
addRestDefinitions(Collection<RestDefinition> restDefinitions,
boolean addToRoutes)
Adds a collection of rest definitions to the context
|
void |
addRestDefinitions(InputStream is,
boolean addToRoutes)
Adds a collection of rest definitions to the context
|
void |
addRouteDefinition(RouteDefinition routeDefinition)
Add a route definition to the context
Important: Each route in the same
CamelContext must have an unique route id. |
void |
addRouteDefinitions(Collection<RouteDefinition> routeDefinitions)
Adds a collection of route definitions to the context
Important: Each route in the same
CamelContext must have an unique route id. |
void |
addRouteDefinitions(InputStream is)
Adds a collection of route definitions to the context
Important: Each route in the same
CamelContext must have an unique route id. |
void |
addServiceCallConfiguration(String serviceName,
ServiceCallConfigurationDefinition configuration)
Adds the service call configuration
|
org.apache.camel.CamelContext |
getCamelContext() |
Map<String,DataFormatDefinition> |
getDataFormats()
Gets the data formats that can be referenced in the routes.
|
HystrixConfigurationDefinition |
getHystrixConfiguration(String id)
Gets the Hystrix configuration by the given name.
|
ProcessorDefinition |
getProcessorDefinition(String id)
Gets the processor definition from any of the routes which with the given id
|
<T extends ProcessorDefinition> |
getProcessorDefinition(String id,
Class<T> type)
Gets the processor definition from any of the routes which with the given id
|
List<RestDefinition> |
getRestDefinitions()
Returns a list of the current REST definitions
|
RouteDefinition |
getRouteDefinition(String id)
Gets the route definition with the given id
|
List<RouteDefinition> |
getRouteDefinitions()
Returns a list of the current route definitions
|
ServiceCallConfigurationDefinition |
getServiceCallConfiguration(String serviceName)
Gets the service call configuration by the given name.
|
List<TransformerDefinition> |
getTransformers()
Gets the transformers that can be referenced in the routes.
|
List<ValidatorDefinition> |
getValidators()
Gets the validators that can be referenced in the routes.
|
protected static <T> T |
lookup(org.apache.camel.CamelContext context,
String ref,
Class<T> type) |
protected void |
prepare(RouteDefinition routeDefinition) |
void |
removeRouteDefinition(RouteDefinition routeDefinition)
Removes a route definition from the context - stopping any previously running
routes if any of them are actively running
|
void |
removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions)
Removes a collection of route definitions from the context - stopping any previously running
routes if any of them are actively running
|
DataFormatDefinition |
resolveDataFormatDefinition(String name)
Resolve a data format definition given its name
|
void |
setDataFormats(Map<String,DataFormatDefinition> dataFormats)
Sets the data formats that can be referenced in the routes.
|
void |
setHystrixConfiguration(HystrixConfigurationDefinition configuration)
Sets the default Hystrix configuration
|
void |
setHystrixConfigurations(List<HystrixConfigurationDefinition> configurations)
Sets the Hystrix configurations
|
void |
setServiceCallConfiguration(ServiceCallConfigurationDefinition configuration)
Sets the default service call configuration
|
void |
setServiceCallConfigurations(List<ServiceCallConfigurationDefinition> configurations)
Sets the service call configurations
|
void |
setTransformers(List<TransformerDefinition> transformers)
Sets the transformers that can be referenced in the routes.
|
void |
setValidators(List<ValidatorDefinition> validators)
Sets the validators that can be referenced in the routes.
|
protected boolean |
shouldStartRoutes()
Should we start newly added routes?
|
protected void |
start(RouteDefinition routeDefinition) |
void |
startRoute(RouteDefinition routeDefinition) |
void |
startRouteDefinitions()
Start all routes from this model.
|
protected void |
startRouteDefinitions(Collection<RouteDefinition> list) |
public DefaultModel(org.apache.camel.CamelContext camelContext)
public org.apache.camel.CamelContext getCamelContext()
public void addRouteDefinitions(InputStream is) throws Exception
ModelCamelContext must have an unique route id.
If you use the API from CamelContext or Model to add routes, then any
new routes which has a route id that matches an old route, then the old route is replaced by the new route.addRouteDefinitions in interface Modelis - input stream with the route(s) definition to addException - if the route definitions could not be created for whatever reasonpublic void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception
ModelCamelContext must have an unique route id.
If you use the API from CamelContext or Model to add routes, then any
new routes which has a route id that matches an old route, then the old route is replaced by the new route.addRouteDefinitions in interface ModelrouteDefinitions - the route(s) definition to addException - if the route definitions could not be created for whatever reasonpublic void addRouteDefinition(RouteDefinition routeDefinition) throws Exception
ModelCamelContext must have an unique route id.
If you use the API from CamelContext or Model to add routes, then any
new routes which has a route id that matches an old route, then the old route is replaced by the new route.addRouteDefinition in interface ModelrouteDefinition - the route definition to addException - if the route definition could not be created for whatever reasonpublic void removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception
ModelremoveRouteDefinitions in interface ModelrouteDefinitions - route(s) definitions to removeException - if the route definitions could not be removed for whatever reasonpublic void removeRouteDefinition(RouteDefinition routeDefinition) throws Exception
ModelremoveRouteDefinition in interface ModelrouteDefinition - route definition to removeException - if the route definition could not be removed for whatever reasonpublic List<RouteDefinition> getRouteDefinitions()
ModelgetRouteDefinitions in interface Modelpublic RouteDefinition getRouteDefinition(String id)
ModelgetRouteDefinition in interface Modelid - id of the routepublic List<RestDefinition> getRestDefinitions()
ModelgetRestDefinitions in interface Modelpublic void addRestDefinitions(InputStream is, boolean addToRoutes) throws Exception
ModeladdRestDefinitions in interface Modelis - input stream with the rest(s) definition to addaddToRoutes - whether the rests should also automatically be added as routesException - if the rest definitions could not be created for whatever reasonpublic void addRestDefinitions(Collection<RestDefinition> restDefinitions, boolean addToRoutes) throws Exception
ModeladdRestDefinitions in interface ModelrestDefinitions - the rest(s) definition to addaddToRoutes - whether the rests should also automatically be added as routesException - if the rest definitions could not be created for whatever reasonpublic ServiceCallConfigurationDefinition getServiceCallConfiguration(String serviceName)
ModelgetServiceCallConfiguration in interface ModelserviceName - name of service, or null to return the default configurationpublic void setServiceCallConfiguration(ServiceCallConfigurationDefinition configuration)
ModelsetServiceCallConfiguration in interface Modelconfiguration - the configurationpublic void setServiceCallConfigurations(List<ServiceCallConfigurationDefinition> configurations)
ModelsetServiceCallConfigurations in interface Modelconfigurations - the configuration listpublic void addServiceCallConfiguration(String serviceName, ServiceCallConfigurationDefinition configuration)
ModeladdServiceCallConfiguration in interface ModelserviceName - name of the serviceconfiguration - the configurationpublic HystrixConfigurationDefinition getHystrixConfiguration(String id)
ModelgetHystrixConfiguration in interface Modelid - id of the configuration, or null to return the default configurationpublic void setHystrixConfiguration(HystrixConfigurationDefinition configuration)
ModelsetHystrixConfiguration in interface Modelconfiguration - the configurationpublic void setHystrixConfigurations(List<HystrixConfigurationDefinition> configurations)
ModelsetHystrixConfigurations in interface Modelconfigurations - the configuration listpublic void addHystrixConfiguration(String id, HystrixConfigurationDefinition configuration)
ModeladdHystrixConfiguration in interface Modelid - name of the configurationconfiguration - the configurationpublic DataFormatDefinition resolveDataFormatDefinition(String name)
ModelresolveDataFormatDefinition in interface Modelname - the data format definition name or a reference to it in the Registrypublic ProcessorDefinition getProcessorDefinition(String id)
ModelgetProcessorDefinition in interface Modelid - id of the processor definitionpublic <T extends ProcessorDefinition> T getProcessorDefinition(String id, Class<T> type)
ModelgetProcessorDefinition in interface Modelid - id of the processor definitiontype - the processor definition typepublic void setDataFormats(Map<String,DataFormatDefinition> dataFormats)
ModelsetDataFormats in interface ModeldataFormats - the data formatspublic Map<String,DataFormatDefinition> getDataFormats()
ModelgetDataFormats in interface Modelpublic void setTransformers(List<TransformerDefinition> transformers)
ModelsetTransformers in interface Modeltransformers - the transformerspublic List<TransformerDefinition> getTransformers()
ModelgetTransformers in interface Modelpublic void setValidators(List<ValidatorDefinition> validators)
ModelsetValidators in interface Modelvalidators - the validatorspublic List<ValidatorDefinition> getValidators()
ModelgetValidators in interface Modelpublic void startRouteDefinitions() throws Exception
ModelstartRouteDefinitions in interface ModelExceptionprotected void startRouteDefinitions(Collection<RouteDefinition> list) throws Exception
Exceptionpublic void startRoute(RouteDefinition routeDefinition) throws Exception
Exceptionprotected void prepare(RouteDefinition routeDefinition) throws Exception
Exceptionprotected void start(RouteDefinition routeDefinition) throws Exception
Exceptionprotected boolean shouldStartRoutes()
Apache Camel