Package org.apache.camel.spring
Class Main
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.main.BaseMainSupport
-
- org.apache.camel.main.MainSupport
-
- org.apache.camel.main.MainCommandLineSupport
-
- org.apache.camel.spring.Main
-
public class Main extends org.apache.camel.main.MainCommandLineSupport
A command line tool for booting up a CamelContext using an optional SpringApplicationContext
. By placing a file in theLOCATION_PROPERTIES
directory of any JARs on the classpath, allows this Main class to load those additional Spring XML files as SpringApplicationContext
to be included. Each line in theLOCATION_PROPERTIES
is a reference to a Spring XML file to include, which by default gets loaded from classpath.
-
-
Field Summary
Fields Modifier and Type Field Description protected static Main
instance
static String
LOCATION_PROPERTIES
-
Fields inherited from class org.apache.camel.main.MainSupport
camelTemplate, DEFAULT_EXIT_CODE, exitCode, LOG, shutdownStrategy, UNINITIALIZED_EXIT_CODE
-
Fields inherited from class org.apache.camel.main.BaseMainSupport
camelContext, DEFAULT_PROPERTY_PLACEHOLDER_LOCATION, defaultPropertyPlaceholderLocation, INITIAL_PROPERTIES_LOCATION, initialProperties, listeners, mainConfigurationProperties, OVERRIDE_PROPERTIES_LOCATION, overrideProperties, PROPERTY_PLACEHOLDER_LOCATION, propertyPlaceholderLocations, routesCollector, wildcardProperties
-
-
Constructor Summary
Constructors Constructor Description Main()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.springframework.context.support.AbstractApplicationContext
createAdditionalLocationsFromClasspath()
protected org.apache.camel.CamelContext
createCamelContext()
protected org.springframework.context.support.AbstractApplicationContext
createDefaultApplicationContext()
protected void
doStart()
protected void
doStop()
protected void
findLocations(Set<String> locations, ClassLoader classLoader)
protected org.apache.camel.ProducerTemplate
findOrCreateCamelTemplate()
org.springframework.context.support.AbstractApplicationContext
getApplicationContext()
String
getApplicationContextUri()
String
getFileApplicationContextUri()
static Main
getInstance()
Returns the currently executing mainorg.springframework.context.support.AbstractApplicationContext
getParentApplicationContext()
String
getParentApplicationContextUri()
protected void
initOptions()
static void
main(String... args)
void
setApplicationContext(org.springframework.context.support.AbstractApplicationContext applicationContext)
void
setApplicationContextUri(String applicationContextUri)
void
setFileApplicationContextUri(String fileApplicationContextUri)
void
setParentApplicationContext(org.springframework.context.support.AbstractApplicationContext parentApplicationContext)
void
setParentApplicationContextUri(String parentApplicationContextUri)
-
Methods inherited from class org.apache.camel.main.MainCommandLineSupport
addOption, parseArguments, run, showOptions, showOptionsHeader
-
Methods inherited from class org.apache.camel.main.MainSupport
afterStart, afterStop, beforeStart, beforeStop, completed, configureLifecycle, enableTrace, getCamelTemplate, getCompleteTask, getDuration, getDurationHitExitCode, getDurationIdle, getDurationMaxMessages, getExitCode, getShutdownStrategy, initCamelContext, isTrace, run, setDuration, setDurationHitExitCode, setDurationIdle, setDurationMaxMessages, setShutdownStrategy, waitUntilCompleted
-
Methods inherited from class org.apache.camel.main.BaseMainSupport
addInitialProperty, addMainListener, addOverrideProperty, addProperty, autoConfigurationFailFast, autoConfigurationFromProperties, autoConfigurationMainConfiguration, autoConfigurationPropertiesComponent, autoconfigure, autowireWildcardProperties, configure, configurePropertiesService, configureRoutes, doAutowireWildcardProperties, doConfigureCamelContextFromMainConfiguration, getCamelContext, getDefaultPropertyPlaceholderLocation, getInitialProperties, getOverrideProperties, getPropertyPlaceholderLocations, getRoutesCollector, isAutoConfigurationEnabled, loadConfigurations, loadRouteBuilders, postProcessCamelContext, removeMainListener, setAutoConfigurationEnabled, setDefaultPropertyPlaceholderLocation, setInitialProperties, setInitialProperties, setOverrideProperties, setOverrideProperties, setPropertyPlaceholderLocations, setRoutesCollector
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, 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
-
LOCATION_PROPERTIES
public static final String LOCATION_PROPERTIES
- See Also:
- Constant Field Values
-
instance
protected static Main instance
-
-
Method Detail
-
initOptions
protected void initOptions()
- Overrides:
initOptions
in classorg.apache.camel.main.MainCommandLineSupport
-
getInstance
public static Main getInstance()
Returns the currently executing main- Returns:
- the current running instance
-
getApplicationContext
public org.springframework.context.support.AbstractApplicationContext getApplicationContext()
-
setApplicationContext
public void setApplicationContext(org.springframework.context.support.AbstractApplicationContext applicationContext)
-
getApplicationContextUri
public String getApplicationContextUri()
-
setApplicationContextUri
public void setApplicationContextUri(String applicationContextUri)
-
getFileApplicationContextUri
public String getFileApplicationContextUri()
-
setFileApplicationContextUri
public void setFileApplicationContextUri(String fileApplicationContextUri)
-
getParentApplicationContext
public org.springframework.context.support.AbstractApplicationContext getParentApplicationContext()
-
setParentApplicationContext
public void setParentApplicationContext(org.springframework.context.support.AbstractApplicationContext parentApplicationContext)
-
getParentApplicationContextUri
public String getParentApplicationContextUri()
-
setParentApplicationContextUri
public void setParentApplicationContextUri(String parentApplicationContextUri)
-
createCamelContext
protected org.apache.camel.CamelContext createCamelContext()
- Specified by:
createCamelContext
in classorg.apache.camel.main.MainSupport
-
doStart
protected void doStart() throws Exception
- Overrides:
doStart
in classorg.apache.camel.main.MainSupport
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in classorg.apache.camel.main.MainSupport
- Throws:
Exception
-
findOrCreateCamelTemplate
protected org.apache.camel.ProducerTemplate findOrCreateCamelTemplate()
- Specified by:
findOrCreateCamelTemplate
in classorg.apache.camel.main.MainSupport
-
createDefaultApplicationContext
protected org.springframework.context.support.AbstractApplicationContext createDefaultApplicationContext() throws IOException
- Throws:
IOException
-
createAdditionalLocationsFromClasspath
protected org.springframework.context.support.AbstractApplicationContext createAdditionalLocationsFromClasspath() throws IOException
- Throws:
IOException
-
findLocations
protected void findLocations(Set<String> locations, ClassLoader classLoader) throws IOException
- Throws:
IOException
-
-