Class BaseMainSupport

  • Direct Known Subclasses:
    MainSupport, SimpleMain

    public abstract class BaseMainSupport
    extends org.apache.camel.support.service.BaseService
    Base class for main implementations to allow bootstrapping Camel in standalone mode.
    • Field Detail

      • DEFAULT_PROPERTY_PLACEHOLDER_LOCATION

        public static final String DEFAULT_PROPERTY_PLACEHOLDER_LOCATION
        See Also:
        Constant Field Values
      • camelContext

        protected volatile org.apache.camel.CamelContext camelContext
      • wildcardProperties

        protected Properties wildcardProperties
      • propertyPlaceholderLocations

        protected String propertyPlaceholderLocations
      • defaultPropertyPlaceholderLocation

        protected String defaultPropertyPlaceholderLocation
      • initialProperties

        protected Properties initialProperties
      • overrideProperties

        protected Properties overrideProperties
    • Constructor Detail

      • BaseMainSupport

        protected BaseMainSupport()
      • BaseMainSupport

        protected BaseMainSupport​(org.apache.camel.CamelContext camelContext)
    • Method Detail

      • getPropertyPlaceholderLocations

        public String getPropertyPlaceholderLocations()
      • setPropertyPlaceholderLocations

        public void setPropertyPlaceholderLocations​(String location)
        A list of locations to add for loading properties. You can use comma to separate multiple locations.
      • getDefaultPropertyPlaceholderLocation

        public String getDefaultPropertyPlaceholderLocation()
      • setDefaultPropertyPlaceholderLocation

        public void setDefaultPropertyPlaceholderLocation​(String defaultPropertyPlaceholderLocation)
        Set the default location for application properties if no locations have been set. If the value is set to "false" or empty, the default location is not taken into account.

        Default value is "classpath:application.properties;optional=true".

      • isAutoConfigurationEnabled

        @Deprecated
        public boolean isAutoConfigurationEnabled()
        Deprecated.
      • setAutoConfigurationEnabled

        @Deprecated
        public void setAutoConfigurationEnabled​(boolean autoConfigurationEnabled)
        Deprecated.
        Whether auto-configuration of components/dataformats/languages is enabled or not. When enabled the configuration parameters are loaded from the properties component and configured as defaults (similar to spring-boot auto-configuration). You can prefix the parameters in the properties file with: - camel.component.name.option1=value1 - camel.component.name.option2=value2 - camel.dataformat.name.option1=value1 - camel.dataformat.name.option2=value2 - camel.language.name.option1=value1 - camel.language.name.option2=value2 Where name is the name of the component, dataformat or language such as seda,direct,jaxb.

        The auto-configuration also works for any options on components that is a complex type (not standard Java type) and there has been an explicit single bean instance registered to the Camel registry via the Registry.bind(String, Object) method or by using the BindToRegistry annotation style.

        This option is default enabled.

      • getInitialProperties

        public Properties getInitialProperties()
      • setInitialProperties

        public void setInitialProperties​(Properties initialProperties)
        Sets initial properties for the properties component, which will be used before any locations are resolved.
      • setInitialProperties

        public void setInitialProperties​(Map<String,​Object> initialProperties)
        Sets initial properties for the properties component, which will be used before any locations are resolved.
      • addInitialProperty

        public void addInitialProperty​(String key,
                                       String value)
        Adds a initial property for the properties component, which will be used before any locations are resolved.
        Parameters:
        key - the property key
        value - the property value
      • getOverrideProperties

        public Properties getOverrideProperties()
      • setOverrideProperties

        public void setOverrideProperties​(Properties overrideProperties)
        Sets a special list of override properties that take precedence and will use first, if a property exist.
      • setOverrideProperties

        public void setOverrideProperties​(Map<String,​Object> initialProperties)
        Sets a special list of override properties that take precedence and will use first, if a property exist.
      • addOverrideProperty

        public void addOverrideProperty​(String key,
                                        String value)
        Adds an override property that take precedence and will use first, if a property exist.
        Parameters:
        key - the property key
        value - the property value
      • getCamelContext

        public org.apache.camel.CamelContext getCamelContext()
      • addMainListener

        public void addMainListener​(MainListener listener)
        Adds a MainListener to receive callbacks when the main is started or stopping
        Parameters:
        listener - the listener
      • removeMainListener

        public void removeMainListener​(MainListener listener)
        Removes the MainListener
        Parameters:
        listener - the listener
      • loadConfigurations

        protected void loadConfigurations​(org.apache.camel.CamelContext camelContext)
                                   throws Exception
        Throws:
        Exception
      • configurePropertiesService

        protected void configurePropertiesService​(org.apache.camel.CamelContext camelContext)
                                           throws Exception
        Throws:
        Exception
      • configureLifecycle

        protected void configureLifecycle​(org.apache.camel.CamelContext camelContext)
                                   throws Exception
        Throws:
        Exception
      • autoconfigure

        protected void autoconfigure​(org.apache.camel.CamelContext camelContext)
                              throws Exception
        Throws:
        Exception
      • configureStartupRecorder

        protected void configureStartupRecorder​(org.apache.camel.CamelContext camelContext)
      • configureRoutes

        protected void configureRoutes​(org.apache.camel.CamelContext camelContext)
                                throws Exception
        Throws:
        Exception
      • postProcessCamelContext

        protected void postProcessCamelContext​(org.apache.camel.CamelContext camelContext)
                                        throws Exception
        Throws:
        Exception
      • autoConfigurationFailFast

        protected void autoConfigurationFailFast​(org.apache.camel.CamelContext camelContext,
                                                 Map<String,​String> autoConfiguredProperties)
                                          throws Exception
        Throws:
        Exception
      • autoConfigurationPropertiesComponent

        protected void autoConfigurationPropertiesComponent​(org.apache.camel.CamelContext camelContext,
                                                            Map<String,​String> autoConfiguredProperties)
                                                     throws Exception
        Throws:
        Exception
      • autoConfigurationFromProperties

        protected void autoConfigurationFromProperties​(org.apache.camel.CamelContext camelContext,
                                                       Map<String,​String> autoConfiguredProperties)
                                                throws Exception
        Throws:
        Exception
      • autowireWildcardProperties

        protected void autowireWildcardProperties​(org.apache.camel.CamelContext camelContext)
      • doAutowireWildcardProperties

        protected void doAutowireWildcardProperties​(String name,
                                                    org.apache.camel.Component component)