Interface Model

All Known Subinterfaces:
ModelCamelContext

public interface Model
Model interface
  • Method Details

    • addModelLifecycleStrategy

      void addModelLifecycleStrategy(ModelLifecycleStrategy modelLifecycleStrategy)
      Adds the given model lifecycle strategy to be used.
      Parameters:
      modelLifecycleStrategy - the strategy
    • getModelLifecycleStrategies

      List<ModelLifecycleStrategy> getModelLifecycleStrategies()
      Returns the model lifecycle strategies used to handle lifecycle notifications
      Returns:
      the lifecycle strategies
    • addRouteConfigurations

      void addRouteConfigurations(List<RouteConfigurationDefinition> routesConfigurations)
      Adds a collection of route configuration definitions to the context
      Parameters:
      routesConfigurations - the route configuration(s) definition to add
    • addRouteConfiguration

      void addRouteConfiguration(RouteConfigurationDefinition routesConfiguration)
      Adds a single route configuration definition to the context
      Parameters:
      routesConfiguration - the route configuration to add
    • getRouteConfigurationDefinitions

      List<RouteConfigurationDefinition> getRouteConfigurationDefinitions()
      Returns a list of the current route configuration definitions
      Returns:
      list of the current route configuration definitions
    • removeRouteConfiguration

      void removeRouteConfiguration(RouteConfigurationDefinition routeConfigurationDefinition) throws Exception
      Removes a route configuration from the context
      Parameters:
      routeConfigurationDefinition - route configuration to remove
      Throws:
      Exception - if the route configuration could not be removed for whatever reason
    • getRouteConfigurationDefinition

      RouteConfigurationDefinition getRouteConfigurationDefinition(String id)
      Gets the route configuration definition with the given id
      Parameters:
      id - id of the route configuration
      Returns:
      the route configuration definition or null if not found
    • getRouteDefinitions

      List<RouteDefinition> getRouteDefinitions()
      Returns a list of the current route definitions
      Returns:
      list of the current route definitions
    • getRouteDefinition

      RouteDefinition getRouteDefinition(String id)
      Gets the route definition with the given id
      Parameters:
      id - id of the route
      Returns:
      the route definition or null if not found
    • addRouteDefinitions

      void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception
      Adds a collection of route definitions to the context

      Important: Each route in the same CamelContext 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.

      Parameters:
      routeDefinitions - the route(s) definition to add
      Throws:
      Exception - if the route definitions could not be added for whatever reason
    • addRouteDefinition

      void addRouteDefinition(RouteDefinition routeDefinition) throws Exception
      Add a route definition to the context

      Important: Each route in the same CamelContext 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.

      Parameters:
      routeDefinition - the route definition to add
      Throws:
      Exception - if the route definition could not be added for whatever reason
    • removeRouteDefinitions

      void removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception
      Removes a collection of route definitions from the context - stopping any previously running routes if any of them are actively running
      Parameters:
      routeDefinitions - route(s) definitions to remove
      Throws:
      Exception - if the route definitions could not be removed for whatever reason
    • removeRouteDefinition

      void removeRouteDefinition(RouteDefinition routeDefinition) throws Exception
      Removes a route definition from the context - stopping any previously running routes if any of them are actively running
      Parameters:
      routeDefinition - route definition to remove
      Throws:
      Exception - if the route definition could not be removed for whatever reason
    • getRouteTemplateDefinitions

      List<RouteTemplateDefinition> getRouteTemplateDefinitions()
      Returns a list of the current route template definitions
      Returns:
      list of the current route template definitions
    • getRouteTemplateDefinition

      RouteTemplateDefinition getRouteTemplateDefinition(String id)
      Gets the route template definition with the given id
      Parameters:
      id - id of the route template
      Returns:
      the route template definition or null if not found
    • addRouteTemplateDefinitions

      void addRouteTemplateDefinitions(Collection<RouteTemplateDefinition> routeTemplateDefinitions) throws Exception
      Adds a collection of route template definitions to the context

      Important: Each route in the same CamelContext must have an unique route template id.

      Parameters:
      routeTemplateDefinitions - the route template(s) definition to add
      Throws:
      Exception - if the route template definitions could not be added for whatever reason
    • addRouteTemplateDefinition

      void addRouteTemplateDefinition(RouteTemplateDefinition routeTemplateDefinition) throws Exception
      Add a route definition to the context

      Important: Each route template in the same CamelContext must have an unique route id.

      Parameters:
      routeTemplateDefinition - the route template definition to add
      Throws:
      Exception - if the route template definition could not be added for whatever reason
    • removeRouteTemplateDefinitions

      void removeRouteTemplateDefinitions(Collection<RouteTemplateDefinition> routeTemplateDefinitions) throws Exception
      Removes a collection of route template definitions from the context
      Parameters:
      routeTemplateDefinitions - route template(s) definitions to remove
      Throws:
      Exception - if the route template definitions could not be removed for whatever reason
    • removeRouteTemplateDefinition

      void removeRouteTemplateDefinition(RouteTemplateDefinition routeTemplateDefinition) throws Exception
      Removes a route template definition from the context
      Parameters:
      routeTemplateDefinition - route template definition to remove
      Throws:
      Exception - if the route template definition could not be removed for whatever reason
    • removeRouteTemplateDefinitions

      void removeRouteTemplateDefinitions(String pattern) throws Exception
      Removes the route templates matching the pattern - stopping any previously running routes if any of them are actively running
      Parameters:
      pattern - pattern, such as * for all, or foo* to remove all foo templates
      Throws:
      Exception
    • addRouteTemplateDefinitionConverter

      void addRouteTemplateDefinitionConverter(String templateIdPattern, RouteTemplateDefinition.Converter converter)
      Add a converter to translate a RouteTemplateDefinition to a RouteDefinition.
      Parameters:
      templateIdPattern - the route template ut to whom a pattern should eb applied
      converter - the RouteTemplateDefinition.Converter used to convert a RouteTemplateDefinition to a RouteDefinition
    • addRouteFromTemplate

      String addRouteFromTemplate(String routeId, String routeTemplateId, Map<String,Object> parameters) throws Exception
      Adds a new route from a given route template
      Parameters:
      routeId - the id of the new route to add (optional)
      routeTemplateId - the id of the route template (mandatory)
      parameters - parameters to use for the route template when creating the new route
      Returns:
      the id of the route added (for example when an id was auto assigned)
      Throws:
      Exception - is thrown if error creating and adding the new route
    • addRouteFromTemplate

      String addRouteFromTemplate(String routeId, String routeTemplateId, String prefixId, Map<String,Object> parameters) throws Exception
      Adds a new route from a given route template
      Parameters:
      routeId - the id of the new route to add (optional)
      routeTemplateId - the id of the route template (mandatory)
      prefixId - prefix to use when assigning route and node IDs (optional)
      parameters - parameters to use for the route template when creating the new route
      Returns:
      the id of the route added (for example when an id was auto assigned)
      Throws:
      Exception - is thrown if error creating and adding the new route
    • addRouteFromTemplate

      String addRouteFromTemplate(String routeId, String routeTemplateId, String prefixId, org.apache.camel.RouteTemplateContext routeTemplateContext) throws Exception
      Adds a new route from a given route template
      Parameters:
      routeId - the id of the new route to add (optional)
      routeTemplateId - the id of the route template (mandatory)
      prefixId - prefix to use when assigning route and node IDs (optional)
      routeTemplateContext - the route template context (mandatory)
      Returns:
      the id of the route added (for example when an id was auto assigned)
      Throws:
      Exception - is thrown if error creating and adding the new route
    • addRouteFromTemplatedRoute

      void addRouteFromTemplatedRoute(TemplatedRouteDefinition templatedRouteDefinition) throws Exception
      Adds a new route from a given templated route definition
      Parameters:
      templatedRouteDefinition - the templated route definition to add as a route (mandatory)
      Throws:
      Exception - is thrown if error creating and adding the new route
    • addRouteFromTemplatedRoutes

      default void addRouteFromTemplatedRoutes(Collection<TemplatedRouteDefinition> templatedRouteDefinitions) throws Exception
      Adds new routes from a given templated route definitions
      Parameters:
      templatedRouteDefinitions - the templated route definitions to add as a route (mandatory)
      Throws:
      Exception - is thrown if error creating and adding the new route
    • getRestDefinitions

      List<RestDefinition> getRestDefinitions()
      Returns a list of the current REST definitions
      Returns:
      list of the current REST definitions
    • addRestDefinitions

      void addRestDefinitions(Collection<RestDefinition> restDefinitions, boolean addToRoutes) throws Exception
      Adds a collection of rest definitions to the context
      Parameters:
      restDefinitions - the rest(s) definition to add
      addToRoutes - whether the rests should also automatically be added as routes
      Throws:
      Exception - if the rest definitions could not be created for whatever reason
    • setDataFormats

      void setDataFormats(Map<String,DataFormatDefinition> dataFormats)
      Sets the data formats that can be referenced in the routes.
      Parameters:
      dataFormats - the data formats
    • getDataFormats

      Map<String,DataFormatDefinition> getDataFormats()
      Gets the data formats that can be referenced in the routes.
      Returns:
      the data formats available
    • resolveDataFormatDefinition

      DataFormatDefinition resolveDataFormatDefinition(String name)
      Resolve a data format definition given its name
      Parameters:
      name - the data format definition name or a reference to it in the Registry
      Returns:
      the resolved data format definition, or null if not found
    • getProcessorDefinition

      ProcessorDefinition<?> getProcessorDefinition(String id)
      Gets the processor definition from any of the routes which with the given id
      Parameters:
      id - id of the processor definition
      Returns:
      the processor definition or null if not found
    • getProcessorDefinition

      <T extends ProcessorDefinition<T>> T getProcessorDefinition(String id, Class<T> type)
      Gets the processor definition from any of the routes which with the given id
      Parameters:
      id - id of the processor definition
      type - the processor definition type
      Returns:
      the processor definition or null if not found
      Throws:
      ClassCastException - is thrown if the type is not correct type
    • setValidators

      void setValidators(List<ValidatorDefinition> validators)
      Sets the validators that can be referenced in the routes.
      Parameters:
      validators - the validators
    • getResilience4jConfiguration

      Resilience4jConfigurationDefinition getResilience4jConfiguration(String id)
      Gets the Resilience4j configuration by the given name. If no name is given the default configuration is returned, see setResilience4jConfiguration
      Parameters:
      id - id of the configuration, or null to return the default configuration
      Returns:
      the configuration, or null if no configuration has been registered
    • setResilience4jConfiguration

      void setResilience4jConfiguration(Resilience4jConfigurationDefinition configuration)
      Sets the default Resilience4j configuration
      Parameters:
      configuration - the configuration
    • setResilience4jConfigurations

      void setResilience4jConfigurations(List<Resilience4jConfigurationDefinition> configurations)
      Sets the Resilience4j configurations
      Parameters:
      configurations - the configuration list
    • addResilience4jConfiguration

      void addResilience4jConfiguration(String id, Resilience4jConfigurationDefinition configuration)
      Adds the Resilience4j configuration
      Parameters:
      id - name of the configuration
      configuration - the configuration
    • getFaultToleranceConfiguration

      FaultToleranceConfigurationDefinition getFaultToleranceConfiguration(String id)
      Gets the MicroProfile Fault Tolerance configuration by the given name. If no name is given the default configuration is returned, see setFaultToleranceConfigurationDefinition
      Parameters:
      id - id of the configuration, or null to return the default configuration
      Returns:
      the configuration, or null if no configuration has been registered
    • setFaultToleranceConfiguration

      void setFaultToleranceConfiguration(FaultToleranceConfigurationDefinition configuration)
      Sets the default MicroProfile Fault Tolerance configuration
      Parameters:
      configuration - the configuration
    • setFaultToleranceConfigurations

      void setFaultToleranceConfigurations(List<FaultToleranceConfigurationDefinition> configurations)
      Sets the MicroProfile Fault Tolerance configurations
      Parameters:
      configurations - the configuration list
    • addFaultToleranceConfiguration

      void addFaultToleranceConfiguration(String id, FaultToleranceConfigurationDefinition configuration)
      Adds the MicroProfile Fault Tolerance configuration
      Parameters:
      id - name of the configuration
      configuration - the configuration
    • getValidators

      List<ValidatorDefinition> getValidators()
      Gets the validators that can be referenced in the routes.
      Returns:
      the validators available
    • setTransformers

      void setTransformers(List<TransformerDefinition> transformers)
      Sets the transformers that can be referenced in the routes.
      Parameters:
      transformers - the transformers
    • getTransformers

      List<TransformerDefinition> getTransformers()
      Gets the transformers that can be referenced in the routes.
      Returns:
      the transformers available
    • getServiceCallConfiguration

      ServiceCallConfigurationDefinition getServiceCallConfiguration(String serviceName)
      Gets the service call configuration by the given name. If no name is given the default configuration is returned, see setServiceCallConfiguration
      Parameters:
      serviceName - name of service, or null to return the default configuration
      Returns:
      the configuration, or null if no configuration has been registered
    • setServiceCallConfiguration

      void setServiceCallConfiguration(ServiceCallConfigurationDefinition configuration)
      Sets the default service call configuration
      Parameters:
      configuration - the configuration
    • setServiceCallConfigurations

      void setServiceCallConfigurations(List<ServiceCallConfigurationDefinition> configurations)
      Sets the service call configurations
      Parameters:
      configurations - the configuration list
    • addServiceCallConfiguration

      void addServiceCallConfiguration(String serviceName, ServiceCallConfigurationDefinition configuration)
      Adds the service call configuration
      Parameters:
      serviceName - name of the service
      configuration - the configuration
    • setRouteFilterPattern

      void setRouteFilterPattern(String include, String exclude)
      Used for filtering routes routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression as documented by PatternHelper.matchPattern(String, String). For example to only include routes which starts with foo in their route id's, use: include=foo* And to exclude routes which starts from JMS endpoints, use: exclude=jms:* Exclude takes precedence over include.
      Parameters:
      include - the include pattern
      exclude - the exclude pattern
    • setRouteFilter

      void setRouteFilter(Function<RouteDefinition,Boolean> filter)
      Sets a custom route filter to use for filtering unwanted routes when routes are added.
      Parameters:
      filter - the filter
    • getRouteFilter

      Function<RouteDefinition,Boolean> getRouteFilter()
      Gets the current route filter
      Returns:
      the filter, or null if no custom filter has been configured.
    • getModelReifierFactory

      org.apache.camel.spi.ModelReifierFactory getModelReifierFactory()
      Gets the ModelReifierFactory
    • setModelReifierFactory

      void setModelReifierFactory(org.apache.camel.spi.ModelReifierFactory modelReifierFactory)
      Sets a custom ModelReifierFactory
    • addRegistryBean

      void addRegistryBean(RegistryBeanDefinition bean)
      Adds the custom bean
    • getRegistryBeans

      List<RegistryBeanDefinition> getRegistryBeans()
      Gets the custom beans