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
Fields Modifier and Type Field Description protected org.apache.camel.CamelContext
camelContext
static String
DEFAULT_PROPERTY_PLACEHOLDER_LOCATION
protected String
defaultPropertyPlaceholderLocation
protected MainHelper
helper
static String
INITIAL_PROPERTIES_LOCATION
protected Properties
initialProperties
protected List<MainListener>
listeners
protected MainConfigurationProperties
mainConfigurationProperties
static String
OVERRIDE_PROPERTIES_LOCATION
protected Properties
overrideProperties
static String
PROPERTY_PLACEHOLDER_LOCATION
protected String
propertyPlaceholderLocations
protected RoutesCollector
routesCollector
protected boolean
standalone
protected org.apache.camel.util.OrderedLocationProperties
wildcardProperties
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseMainSupport()
protected
BaseMainSupport(org.apache.camel.CamelContext camelContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInitialProperty(String key, String value)
Adds a property (initial) for the properties component, which will be used before any locations are resolved.void
addMainListener(MainListener listener)
Adds aMainListener
to receive callbacks when the main is started or stoppingvoid
addOverrideProperty(String key, String value)
Adds an override property that take precedence and will use first, if a property exist.void
addProperty(String key, String value)
Adds a property (initial) for the properties component, which will be used before any locations are resolved.protected void
autoConfigurationFailFast(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties)
protected void
autoConfigurationFromProperties(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties)
protected void
autoConfigurationMainConfiguration(org.apache.camel.CamelContext camelContext, MainConfigurationProperties config, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties)
protected void
autoConfigurationPropertiesComponent(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties)
protected void
autoConfigurationSingleOption(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties, String optionName, Function<String,Object> setter)
protected void
autoconfigure(org.apache.camel.CamelContext camelContext)
protected void
autowireWildcardProperties(org.apache.camel.CamelContext camelContext)
MainConfigurationProperties
configure()
To configure options on Camel Main.protected void
configureLifecycle(org.apache.camel.CamelContext camelContext)
protected void
configurePackageScan(org.apache.camel.CamelContext camelContext)
protected void
configurePropertiesService(org.apache.camel.CamelContext camelContext)
protected void
configureRoutes(org.apache.camel.CamelContext camelContext)
protected void
configureRoutesLoader(org.apache.camel.CamelContext camelContext)
protected void
configureStartupRecorder(org.apache.camel.CamelContext camelContext)
protected void
doAutowireWildcardProperties(String name, org.apache.camel.Component component)
protected void
doConfigureCamelContextFromMainConfiguration(org.apache.camel.CamelContext camelContext, MainConfigurationProperties config, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties)
Configures CamelContext from theMainConfigurationProperties
properties.org.apache.camel.CamelContext
getCamelContext()
String
getDefaultPropertyPlaceholderLocation()
Properties
getInitialProperties()
Properties
getOverrideProperties()
String
getPropertyPlaceholderLocations()
RoutesCollector
getRoutesCollector()
protected void
loadConfigurations(org.apache.camel.CamelContext camelContext)
protected void
modelineRoutes(org.apache.camel.CamelContext camelContext)
protected void
postProcessCamelContext(org.apache.camel.CamelContext camelContext)
void
removeMainListener(MainListener listener)
Removes theMainListener
void
setDefaultPropertyPlaceholderLocation(String defaultPropertyPlaceholderLocation)
Set the default location for application properties if no locations have been set.void
setInitialProperties(Map<String,Object> initialProperties)
Sets initial properties for the properties component, which will be used before any locations are resolved.void
setInitialProperties(Properties initialProperties)
Sets initial properties for the properties component, which will be used before any locations are resolved.void
setOverrideProperties(Map<String,Object> initialProperties)
Sets a special list of override properties that take precedence and will use first, if a property exist.void
setOverrideProperties(Properties overrideProperties)
Sets a special list of override properties that take precedence and will use first, if a property exist.void
setPropertyPlaceholderLocations(String location)
A list of locations to add for loading properties.void
setRoutesCollector(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 Detail
-
DEFAULT_PROPERTY_PLACEHOLDER_LOCATION
public static final String DEFAULT_PROPERTY_PLACEHOLDER_LOCATION
- See Also:
- Constant Field Values
-
INITIAL_PROPERTIES_LOCATION
public static final String INITIAL_PROPERTIES_LOCATION
- See Also:
- Constant Field Values
-
OVERRIDE_PROPERTIES_LOCATION
public static final String OVERRIDE_PROPERTIES_LOCATION
- See Also:
- Constant Field Values
-
PROPERTY_PLACEHOLDER_LOCATION
public static final String PROPERTY_PLACEHOLDER_LOCATION
- See Also:
- Constant Field Values
-
listeners
protected final List<MainListener> listeners
-
camelContext
protected volatile org.apache.camel.CamelContext camelContext
-
mainConfigurationProperties
protected MainConfigurationProperties mainConfigurationProperties
-
wildcardProperties
protected org.apache.camel.util.OrderedLocationProperties wildcardProperties
-
routesCollector
protected RoutesCollector routesCollector
-
propertyPlaceholderLocations
protected String propertyPlaceholderLocations
-
defaultPropertyPlaceholderLocation
protected String defaultPropertyPlaceholderLocation
-
initialProperties
protected Properties initialProperties
-
overrideProperties
protected Properties overrideProperties
-
standalone
protected boolean standalone
-
helper
protected final MainHelper helper
-
-
Method Detail
-
configure
public MainConfigurationProperties configure()
To configure options on Camel Main.
-
getRoutesCollector
public RoutesCollector getRoutesCollector()
-
setRoutesCollector
public void setRoutesCollector(RoutesCollector routesCollector)
To use a customRoutesCollector
.
-
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".
-
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.
-
addProperty
public void addProperty(String key, String value)
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(String, String)
,addOverrideProperty(String, String)
-
addInitialProperty
public void addInitialProperty(String key, String value)
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
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 keyvalue
- the property value
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()
-
addMainListener
public void addMainListener(MainListener listener)
Adds aMainListener
to receive callbacks when the main is started or stopping- Parameters:
listener
- the listener
-
removeMainListener
public void removeMainListener(MainListener listener)
Removes theMainListener
- 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)
-
configurePackageScan
protected void configurePackageScan(org.apache.camel.CamelContext camelContext)
-
configureRoutesLoader
protected void configureRoutesLoader(org.apache.camel.CamelContext camelContext)
-
modelineRoutes
protected void modelineRoutes(org.apache.camel.CamelContext camelContext) throws Exception
- Throws:
Exception
-
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, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) throws Exception
- Throws:
Exception
-
autoConfigurationSingleOption
protected void autoConfigurationSingleOption(org.apache.camel.CamelContext camelContext, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties, String optionName, Function<String,Object> setter)
-
doConfigureCamelContextFromMainConfiguration
protected void doConfigureCamelContextFromMainConfiguration(org.apache.camel.CamelContext camelContext, MainConfigurationProperties config, org.apache.camel.util.OrderedLocationProperties autoConfiguredProperties) throws Exception
Configures CamelContext from theMainConfigurationProperties
properties.- Throws:
Exception
-
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
-
autowireWildcardProperties
protected void autowireWildcardProperties(org.apache.camel.CamelContext camelContext)
-
doAutowireWildcardProperties
protected void doAutowireWildcardProperties(String name, org.apache.camel.Component component)
-
-