public abstract class BaseMainSupport
extends org.apache.camel.support.service.BaseService
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.camel.CamelContext |
camelContext |
protected org.apache.camel.ProducerTemplate |
camelTemplate |
static String |
DEFAULT_PROPERTY_PLACEHOLDER_LOCATION |
protected String |
defaultPropertyPlaceholderLocation |
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 Properties |
wildcardProperties |
| Constructor and Description |
|---|
BaseMainSupport() |
| Modifier and Type | Method and Description |
|---|---|
void |
addInitialProperty(String key,
String value)
Adds a initial property for the properties component,
which will be used before any locations are resolved.
|
void |
addMainListener(MainListener listener)
Adds a
MainListener to receive callbacks when the main is started or stopping |
void |
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,
Map<String,String> autoConfiguredProperties) |
protected void |
autoConfigurationFromProperties(org.apache.camel.CamelContext camelContext,
Map<String,String> autoConfiguredProperties) |
protected void |
autoConfigurationMainConfiguration(org.apache.camel.CamelContext camelContext,
MainConfigurationProperties config,
Map<String,String> autoConfiguredProperties) |
protected void |
autoConfigurationPropertiesComponent(org.apache.camel.CamelContext camelContext,
Map<String,String> autoConfiguredProperties) |
protected void |
autoconfigure(org.apache.camel.CamelContext camelContext) |
protected void |
autowireConfigurationFromRegistry(org.apache.camel.CamelContext camelContext,
boolean bindNullOnly,
boolean deepNesting) |
protected void |
autowireWildcardProperties(org.apache.camel.CamelContext camelContext) |
protected static void |
computeProperties(String keyPrefix,
String key,
Properties prop,
Map<org.apache.camel.main.BaseMainSupport.PropertyOptionKey,Map<String,Object>> properties,
Function<String,Iterable<Object>> supplier) |
MainConfigurationProperties |
configure()
To configure options on Camel Main.
|
protected void |
configureLifecycle(org.apache.camel.CamelContext camelContext) |
protected void |
configurePropertiesService(org.apache.camel.CamelContext camelContext) |
protected void |
configureRoutes(org.apache.camel.CamelContext camelContext) |
protected abstract org.apache.camel.CamelContext |
createCamelContext() |
protected void |
doAutowireWildcardProperties(String name,
org.apache.camel.Component component) |
protected void |
doConfigureCamelContextFromMainConfiguration(org.apache.camel.CamelContext camelContext,
MainConfigurationProperties config,
Map<String,String> autoConfiguredProperties)
Configures CamelContext from the
MainConfigurationProperties properties. |
protected abstract org.apache.camel.ProducerTemplate |
findOrCreateCamelTemplate() |
org.apache.camel.CamelContext |
getCamelContext() |
org.apache.camel.ProducerTemplate |
getCamelTemplate() |
String |
getDefaultPropertyPlaceholderLocation() |
Properties |
getInitialProperties() |
Properties |
getOverrideProperties() |
String |
getPropertyPlaceholderLocations() |
List<org.apache.camel.model.RouteDefinition> |
getRouteDefinitions() |
RoutesCollector |
getRoutesCollector() |
protected void |
initCamelContext() |
boolean |
isAutoConfigurationEnabled()
Deprecated.
|
protected static boolean |
isServiceEnabled(String prefix,
String name,
Properties properties) |
protected void |
loadConfigurations(org.apache.camel.CamelContext camelContext) |
protected void |
loadRouteBuilders(org.apache.camel.CamelContext camelContext) |
protected static String |
optionKey(String key) |
protected void |
postProcessCamelContext(org.apache.camel.CamelContext camelContext) |
void |
removeMainListener(MainListener listener)
Removes the
MainListener |
void |
setAutoConfigurationEnabled(boolean autoConfigurationEnabled)
Deprecated.
use
configure() |
void |
setDefaultPropertyPlaceholderLocation(String defaultPropertyPlaceholderLocation)
Set the default location for application properties if no locations have been set.
|
void |
setInitialProperties(Properties initialProperties)
Sets initial properties for the properties component,
which will be used before any locations are resolved.
|
void |
setOverrideProperties(Properties overrideProperties)
Sets a special list of override properties that take precedence
and will use first, if a property exist.
|
protected static boolean |
setPropertiesOnTarget(org.apache.camel.CamelContext context,
Object target,
Map<String,Object> properties,
String optionPrefix,
boolean failIfNotSet,
boolean ignoreCase,
Map<String,String> autoConfiguredProperties) |
void |
setPropertyPlaceholderLocations(String location)
A list of locations to add for loading properties.
|
void |
setRoutesCollector(RoutesCollector routesCollector)
To use a custom
RoutesCollector. |
protected static void |
validateOptionAndValue(String key,
String option,
String value) |
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, suspendpublic static final String DEFAULT_PROPERTY_PLACEHOLDER_LOCATION
public static final String INITIAL_PROPERTIES_LOCATION
public static final String OVERRIDE_PROPERTIES_LOCATION
public static final String PROPERTY_PLACEHOLDER_LOCATION
protected volatile org.apache.camel.CamelContext camelContext
protected volatile org.apache.camel.ProducerTemplate camelTemplate
protected final List<MainListener> listeners
protected final MainConfigurationProperties mainConfigurationProperties
protected final Properties wildcardProperties
protected RoutesCollector routesCollector
protected String propertyPlaceholderLocations
protected String defaultPropertyPlaceholderLocation
protected Properties initialProperties
protected Properties overrideProperties
protected static boolean setPropertiesOnTarget(org.apache.camel.CamelContext context,
Object target,
Map<String,Object> properties,
String optionPrefix,
boolean failIfNotSet,
boolean ignoreCase,
Map<String,String> autoConfiguredProperties)
throws Exception
Exceptionpublic MainConfigurationProperties configure()
public RoutesCollector getRoutesCollector()
public void setRoutesCollector(RoutesCollector routesCollector)
RoutesCollector.public String getPropertyPlaceholderLocations()
public void setPropertyPlaceholderLocations(String location)
public String getDefaultPropertyPlaceholderLocation()
public void setDefaultPropertyPlaceholderLocation(String defaultPropertyPlaceholderLocation)
@Deprecated public boolean isAutoConfigurationEnabled()
@Deprecated public void setAutoConfigurationEnabled(boolean autoConfigurationEnabled)
configure()Registry.bind(String, Object) method
or by using the BindToRegistry annotation style.
This option is default enabled.public Properties getInitialProperties()
public void setInitialProperties(Properties initialProperties)
public void addProperty(String key, String value)
key - the property keyvalue - the property valueaddInitialProperty(String, String),
addOverrideProperty(String, String)public void addInitialProperty(String key, String value)
key - the property keyvalue - the property valuepublic Properties getOverrideProperties()
public void setOverrideProperties(Properties overrideProperties)
public void addOverrideProperty(String key, String value)
key - the property keyvalue - the property valuepublic org.apache.camel.CamelContext getCamelContext()
public void addMainListener(MainListener listener)
MainListener to receive callbacks when the main is started or stoppinglistener - the listenerpublic void removeMainListener(MainListener listener)
MainListenerlistener - the listenerpublic List<org.apache.camel.model.RouteDefinition> getRouteDefinitions()
public org.apache.camel.ProducerTemplate getCamelTemplate()
throws Exception
Exceptionprotected abstract org.apache.camel.ProducerTemplate findOrCreateCamelTemplate()
protected abstract org.apache.camel.CamelContext createCamelContext()
protected void loadRouteBuilders(org.apache.camel.CamelContext camelContext)
throws Exception
Exceptionprotected void loadConfigurations(org.apache.camel.CamelContext camelContext)
throws Exception
Exceptionprotected void configurePropertiesService(org.apache.camel.CamelContext camelContext)
throws Exception
Exceptionprotected void configureLifecycle(org.apache.camel.CamelContext camelContext)
throws Exception
Exceptionprotected void autoconfigure(org.apache.camel.CamelContext camelContext)
throws Exception
Exceptionprotected void configureRoutes(org.apache.camel.CamelContext camelContext)
throws Exception
Exceptionprotected void postProcessCamelContext(org.apache.camel.CamelContext camelContext)
throws Exception
Exceptionprotected void autoConfigurationFailFast(org.apache.camel.CamelContext camelContext,
Map<String,String> autoConfiguredProperties)
throws Exception
Exceptionprotected void doConfigureCamelContextFromMainConfiguration(org.apache.camel.CamelContext camelContext,
MainConfigurationProperties config,
Map<String,String> autoConfiguredProperties)
throws Exception
MainConfigurationProperties properties.Exceptionprotected void autoConfigurationPropertiesComponent(org.apache.camel.CamelContext camelContext,
Map<String,String> autoConfiguredProperties)
throws Exception
Exceptionprotected void autoConfigurationMainConfiguration(org.apache.camel.CamelContext camelContext,
MainConfigurationProperties config,
Map<String,String> autoConfiguredProperties)
throws Exception
Exceptionprotected void autoConfigurationFromProperties(org.apache.camel.CamelContext camelContext,
Map<String,String> autoConfiguredProperties)
throws Exception
Exceptionprotected void autowireConfigurationFromRegistry(org.apache.camel.CamelContext camelContext,
boolean bindNullOnly,
boolean deepNesting)
throws Exception
Exceptionprotected void autowireWildcardProperties(org.apache.camel.CamelContext camelContext)
protected void doAutowireWildcardProperties(String name, org.apache.camel.Component component)
protected static void validateOptionAndValue(String key, String option, String value)
protected static void computeProperties(String keyPrefix, String key, Properties prop, Map<org.apache.camel.main.BaseMainSupport.PropertyOptionKey,Map<String,Object>> properties, Function<String,Iterable<Object>> supplier)
protected static boolean isServiceEnabled(String prefix, String name, Properties properties)
Apache Camel