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.MainCommandLineSupportA command line tool for booting up a CamelContext using an optional SpringApplicationContext. By placing a file in theLOCATION_PROPERTIESdirectory of any JARs on the classpath, allows this Main class to load those additional Spring XML files as SpringApplicationContextto be included. Each line in theLOCATION_PROPERTIESis 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 Maininstancestatic StringLOCATION_PROPERTIES-
Fields inherited from class org.apache.camel.main.MainCommandLineSupport
argumentProperties, options
-
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, helper, INITIAL_PROPERTIES_LOCATION, initialProperties, listeners, mainConfigurationProperties, OVERRIDE_PROPERTIES_LOCATION, overrideProperties, PROPERTY_PLACEHOLDER_LOCATION, propertyPlaceholderLocations, routesCollector, standalone, 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.AbstractApplicationContextcreateAdditionalLocationsFromClasspath()protected org.apache.camel.CamelContextcreateCamelContext()protected org.springframework.context.support.AbstractApplicationContextcreateDefaultApplicationContext()protected voiddoStart()protected voiddoStop()protected voidfindLocations(Set<String> locations, ClassLoader classLoader)protected org.apache.camel.ProducerTemplatefindOrCreateCamelTemplate()org.springframework.context.support.AbstractApplicationContextgetApplicationContext()StringgetApplicationContextUri()StringgetFileApplicationContextUri()static MaingetInstance()Returns the currently executing mainorg.springframework.context.support.AbstractApplicationContextgetParentApplicationContext()StringgetParentApplicationContextUri()protected voidinitOptions()booleanisAllowMultipleCamelContexts()static voidmain(String... args)voidsetAllowMultipleCamelContexts(boolean allowMultipleCamelContexts)Enable this to allow multiple CamelContexts to be loaded by this Main class.voidsetApplicationContext(org.springframework.context.support.AbstractApplicationContext applicationContext)voidsetApplicationContextUri(String applicationContextUri)voidsetFileApplicationContextUri(String fileApplicationContextUri)voidsetParentApplicationContext(org.springframework.context.support.AbstractApplicationContext parentApplicationContext)voidsetParentApplicationContextUri(String parentApplicationContextUri)-
Methods inherited from class org.apache.camel.main.MainCommandLineSupport
addArgumentProperty, addInitialOptions, addOption, configurePropertiesService, getArgumentProperties, parseArguments, run, setArgumentProperties, setArgumentProperties, showOptions, showOptionsHeader
-
Methods inherited from class org.apache.camel.main.MainSupport
afterStart, afterStop, autoconfigure, beforeStart, beforeStop, completed, configureLifecycle, doInit, enableTrace, enableTraceStandby, getAppName, getCamelTemplate, getCompleteTask, getDuration, getDurationHitExitCode, getDurationIdle, getDurationMaxMessages, getExitCode, getShutdownStrategy, initCamelContext, internalBeforeStart, isTrace, registerMainBootstrap, run, setAppName, setDuration, setDurationHitExitCode, setDurationIdle, setDurationMaxMessages, setShutdownStrategy, waitUntilCompleted
-
Methods inherited from class org.apache.camel.main.BaseMainSupport
addInitialProperty, addMainListener, addOverrideProperty, addProperty, autoConfigurationFailFast, autoConfigurationFromProperties, autoConfigurationMainConfiguration, autoConfigurationPropertiesComponent, autoConfigurationSingleOption, autowireWildcardProperties, configure, configurePackageScan, configureRoutes, configureRoutesLoader, configureStartupRecorder, configureVault, doAutowireWildcardProperties, doConfigureCamelContextFromMainConfiguration, getCamelContext, getDefaultPropertyPlaceholderLocation, getInitialProperties, getOverrideProperties, getPropertyPlaceholderLocations, getRoutesCollector, loadConfigurations, modelineRoutes, postProcessCamelContext, removeMainListener, setDefaultPropertyPlaceholderLocation, setInitialProperties, setInitialProperties, setOverrideProperties, setOverrideProperties, setPropertyPlaceholderLocations, setRoutesCollector
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, 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:
initOptionsin 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)
-
isAllowMultipleCamelContexts
public boolean isAllowMultipleCamelContexts()
-
setAllowMultipleCamelContexts
public void setAllowMultipleCamelContexts(boolean allowMultipleCamelContexts)
Enable this to allow multiple CamelContexts to be loaded by this Main class. By default only a single CamelContext is allowed.
-
createCamelContext
protected org.apache.camel.CamelContext createCamelContext()
- Specified by:
createCamelContextin classorg.apache.camel.main.MainSupport
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.main.MainSupport- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classorg.apache.camel.main.MainSupport- Throws:
Exception
-
findOrCreateCamelTemplate
protected org.apache.camel.ProducerTemplate findOrCreateCamelTemplate()
- Specified by:
findOrCreateCamelTemplatein classorg.apache.camel.main.MainSupport
-
createDefaultApplicationContext
protected org.springframework.context.support.AbstractApplicationContext createDefaultApplicationContext()
-
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
-
-