Package org.apache.camel.main
Class BaseMainSupport
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.main.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 Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.camel.CamelContextprotected Stringprotected final MainHelperprotected Propertiesprotected final List<MainListener> protected final MainConfigurationPropertiesprotected Propertiesprotected Stringprotected RoutesCollectorprotected booleanprotected final org.apache.camel.util.OrderedLocationPropertiesFields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedBaseMainSupport(org.apache.camel.CamelContext camelContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInitialProperty(String key, String value) Adds a property (initial) for the properties component, which will be used before any locations are resolved.voidaddMainListener(MainListener listener) Adds aMainListenerto receive callbacks when the main is started or stoppingvoidaddOverrideProperty(String key, String value) Adds an override property that take precedence and will use first, if a property exist.voidaddProperty(String key, String value) Adds a property (initial) for the properties component, which will be used before any locations are resolved.protected voidautoConfigurationFailFast(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) protected voidautoConfigurationFromProperties(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) protected voidautoConfigurationFromReloadedProperties(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties reloadedProperties) protected voidautoConfigurationMainConfiguration(org.apache.camel.CamelContext camelContext, MainConfigurationProperties config, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) protected voidautoConfigurationPropertiesComponent(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) protected voidautoConfigurationSingleOption(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties, String optionName, Function<String, Object> setter) protected voidautoconfigure(org.apache.camel.CamelContext camelContext) protected voidautowireWildcardProperties(org.apache.camel.CamelContext camelContext) To configure options on Camel Main.protected voidconfigureLifecycle(org.apache.camel.CamelContext camelContext) protected voidconfigurePackageScan(org.apache.camel.CamelContext camelContext) protected voidconfigurePropertiesService(org.apache.camel.CamelContext camelContext) protected voidconfigureRoutes(org.apache.camel.CamelContext camelContext) protected voidconfigureRoutesLoader(org.apache.camel.CamelContext camelContext) protected voidconfigureStartupRecorder(org.apache.camel.CamelContext camelContext) protected org.apache.camel.spi.LifecycleStrategycreateLifecycleStrategy(org.apache.camel.CamelContext camelContext) A specializedLifecycleStrategythat can handle autowiring of Camel components, dataformats, languages.protected voiddoAutoConfigurationFromProperties(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties prop, Map<org.apache.camel.main.PropertyOptionKey, org.apache.camel.util.OrderedLocationProperties> properties, boolean reload, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) protected voiddoAutowireWildcardProperties(String name, org.apache.camel.Component component) protected voiddoConfigureCamelContextFromMainConfiguration(org.apache.camel.CamelContext camelContext, MainConfigurationProperties config, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) Configures CamelContext from theMainConfigurationPropertiesproperties.org.apache.camel.CamelContextprotected voidloadConfigurations(org.apache.camel.CamelContext camelContext) protected voidloadCustomBeans(org.apache.camel.CamelContext camelContext) protected voidmodelineRoutes(org.apache.camel.CamelContext camelContext) protected voidpostProcessCamelContext(org.apache.camel.CamelContext camelContext) protected voidpostProcessCamelRegistry(org.apache.camel.CamelContext camelContext, MainConfigurationProperties config) Main implementation may do some additional configuration of theRegistryafter loading the routes, but before the routes are started.protected voidpreProcessCamelRegistry(org.apache.camel.CamelContext camelContext, MainConfigurationProperties config) Main implementation may do some additional configuration of theRegistrybefore it's used to (re)configure Camel context.voidremoveMainListener(MainListener listener) Removes theMainListenervoidsetDefaultPropertyPlaceholderLocation(String defaultPropertyPlaceholderLocation) Set the default location for application properties if no locations have been set.voidsetInitialProperties(Map<String, Object> initialProperties) Sets initial properties for the properties component, which will be used before any locations are resolved.voidsetInitialProperties(Properties initialProperties) Sets initial properties for the properties component, which will be used before any locations are resolved.voidsetOverrideProperties(Map<String, Object> initialProperties) Sets a special list of override properties that take precedence and will use first, if a property exist.voidsetOverrideProperties(Properties overrideProperties) Sets a special list of override properties that take precedence and will use first, if a property exist.voidsetPropertyPlaceholderLocations(String location) A list of locations to add for loading properties.voidsetRoutesCollector(RoutesCollector routesCollector) To use a customRoutesCollector.Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Field Details
-
listeners
-
camelContext
protected volatile org.apache.camel.CamelContext camelContext -
mainConfigurationProperties
-
wildcardProperties
protected final org.apache.camel.util.OrderedLocationProperties wildcardProperties -
routesCollector
-
propertyPlaceholderLocations
-
defaultPropertyPlaceholderLocation
-
initialProperties
-
overrideProperties
-
standalone
protected boolean standalone -
helper
-
-
Constructor Details
-
BaseMainSupport
protected BaseMainSupport() -
BaseMainSupport
protected BaseMainSupport(org.apache.camel.CamelContext camelContext)
-
-
Method Details
-
configure
To configure options on Camel Main. -
getRoutesCollector
-
setRoutesCollector
To use a customRoutesCollector. -
getPropertyPlaceholderLocations
-
setPropertyPlaceholderLocations
A list of locations to add for loading properties. You can use comma to separate multiple locations. -
getDefaultPropertyPlaceholderLocation
-
setDefaultPropertyPlaceholderLocation
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". -
getInitialProperties
-
setInitialProperties
Sets initial properties for the properties component, which will be used before any locations are resolved. -
setInitialProperties
Sets initial properties for the properties component, which will be used before any locations are resolved. -
addProperty
Adds a property (initial) for the properties component, which will be used before any locations are resolved.- Parameters:
key- the property keyvalue- the property value- See Also:
-
addInitialProperty
Adds a property (initial) for the properties component, which will be used before any locations are resolved.- Parameters:
key- the property keyvalue- the property value
-
getOverrideProperties
-
setOverrideProperties
Sets a special list of override properties that take precedence and will use first, if a property exist. -
setOverrideProperties
Sets a special list of override properties that take precedence and will use first, if a property exist. -
addOverrideProperty
Adds an override property that take precedence and will use first, if a property exist.- Parameters:
key- the property keyvalue- the property value
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext() -
addMainListener
Adds aMainListenerto receive callbacks when the main is started or stopping- Parameters:
listener- the listener
-
removeMainListener
Removes theMainListener- Parameters:
listener- the listener
-
loadCustomBeans
- Throws:
Exception
-
loadConfigurations
- Throws:
Exception
-
configurePropertiesService
protected void configurePropertiesService(org.apache.camel.CamelContext camelContext) throws Exception - Throws:
Exception
-
configureLifecycle
- Throws:
Exception
-
autoconfigure
- Throws:
Exception
-
configureStartupRecorder
protected void configureStartupRecorder(org.apache.camel.CamelContext camelContext) -
configurePackageScan
protected void configurePackageScan(org.apache.camel.CamelContext camelContext) -
configureRoutesLoader
protected void configureRoutesLoader(org.apache.camel.CamelContext camelContext) -
modelineRoutes
- Throws:
Exception
-
configureRoutes
- Throws:
Exception
-
createLifecycleStrategy
protected org.apache.camel.spi.LifecycleStrategy createLifecycleStrategy(org.apache.camel.CamelContext camelContext) A specializedLifecycleStrategythat can handle autowiring of Camel components, dataformats, languages. -
postProcessCamelContext
- Throws:
Exception
-
autoConfigurationFailFast
protected void autoConfigurationFailFast(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) throws Exception - Throws:
Exception
-
autoConfigurationSingleOption
-
doConfigureCamelContextFromMainConfiguration
protected void doConfigureCamelContextFromMainConfiguration(org.apache.camel.CamelContext camelContext, MainConfigurationProperties config, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) throws Exception Configures CamelContext from theMainConfigurationPropertiesproperties.- Throws:
Exception
-
preProcessCamelRegistry
protected void preProcessCamelRegistry(org.apache.camel.CamelContext camelContext, MainConfigurationProperties config) Main implementation may do some additional configuration of theRegistrybefore it's used to (re)configure Camel context. -
postProcessCamelRegistry
protected void postProcessCamelRegistry(org.apache.camel.CamelContext camelContext, MainConfigurationProperties config) Main implementation may do some additional configuration of theRegistryafter loading the routes, but before the routes are started. -
autoConfigurationPropertiesComponent
protected void autoConfigurationPropertiesComponent(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) throws Exception - Throws:
Exception
-
autoConfigurationMainConfiguration
protected void autoConfigurationMainConfiguration(org.apache.camel.CamelContext camelContext, MainConfigurationProperties config, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) throws Exception - Throws:
Exception
-
autoConfigurationFromProperties
protected void autoConfigurationFromProperties(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) throws Exception - Throws:
Exception
-
autoConfigurationFromReloadedProperties
protected void autoConfigurationFromReloadedProperties(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties reloadedProperties) throws Exception - Throws:
Exception
-
doAutoConfigurationFromProperties
protected void doAutoConfigurationFromProperties(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties prop, Map<org.apache.camel.main.PropertyOptionKey, org.apache.camel.util.OrderedLocationProperties> properties, boolean reload, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) throws Exception- Throws:
Exception
-
autowireWildcardProperties
protected void autowireWildcardProperties(org.apache.camel.CamelContext camelContext) -
doAutowireWildcardProperties
-