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 Spring
ApplicationContext.
By placing a file in the LOCATION_PROPERTIES directory of any JARs on the classpath, allows this Main class
to load those additional Spring XML files as Spring ApplicationContext to be
included.
Each line in the LOCATION_PROPERTIES is a reference to a Spring XML file to include, which by default gets
loaded from classpath.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.camel.main.MainCommandLineSupport
org.apache.camel.main.MainCommandLineSupport.Option, org.apache.camel.main.MainCommandLineSupport.ParameterOption -
Field Summary
FieldsFields inherited from class org.apache.camel.main.MainCommandLineSupport
argumentProperties, optionsFields inherited from class org.apache.camel.main.MainSupport
camelTemplate, DEFAULT_EXIT_CODE, exitCode, LOG, shutdownStrategy, UNINITIALIZED_EXIT_CODEFields inherited from class org.apache.camel.main.BaseMainSupport
camelContext, defaultPropertyPlaceholderLocation, helper, initialProperties, listeners, mainConfigurationProperties, overrideProperties, propertyPlaceholderLocations, routesCollector, standalone, wildcardPropertiesFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.context.support.AbstractApplicationContextprotected org.apache.camel.CamelContextprotected org.springframework.context.support.AbstractApplicationContextprotected voiddoStart()protected voiddoStop()protected voidfindLocations(Set<String> locations, ClassLoader classLoader) protected org.apache.camel.ProducerTemplateorg.springframework.context.support.AbstractApplicationContextstatic MainReturns the currently executing mainorg.springframework.context.support.AbstractApplicationContextprotected voidbooleanstatic voidvoidsetAllowMultipleCamelContexts(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, showOptionsHeaderMethods inherited from class org.apache.camel.main.MainSupport
afterStart, afterStop, autoconfigure, beforeStart, beforeStop, completed, configureLifecycle, doInit, enableTrace, enableTraceStandby, getAppName, getCamelTemplate, getCompleteTask, getExitCode, getShutdownStrategy, initCamelContext, internalBeforeStart, isTrace, registerMainBootstrap, run, setAppName, setShutdownStrategy, waitUntilCompletedMethods inherited from class org.apache.camel.main.BaseMainSupport
addInitialProperty, addMainListener, addOverrideProperty, addProperty, autoConfigurationFailFast, autoConfigurationFromProperties, autoConfigurationFromReloadedProperties, autoConfigurationMainConfiguration, autoConfigurationPropertiesComponent, autoConfigurationSingleOption, autoConfigurationStartupConditions, autowireWildcardProperties, configure, configureMainListener, configurePackageScan, configureRoutes, configureRoutesLoader, configureStartupRecorder, createLifecycleStrategy, detectCamelDebugJar, doAutoConfigurationFromProperties, doAutowireWildcardProperties, doConfigureCamelContextFromMainConfiguration, doConfigureVaultFromMainConfiguration, doInitFileConfigurations, getCamelContext, getDefaultPropertyPlaceholderLocation, getInitialProperties, getMainListeners, getOverrideProperties, getPropertyPlaceholderLocations, getRoutesCollector, loadConfigurations, loadCustomBeans, modelineRoutes, postProcessCamelContext, postProcessCamelRegistry, preProcessCamelRegistry, removeMainListener, setDefaultPropertyPlaceholderLocation, setInitialProperties, setInitialProperties, setOverrideProperties, setOverrideProperties, setPropertyPlaceholderLocations, setRoutesCollectorMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Field Details
-
LOCATION_PROPERTIES
- See Also:
-
instance
-
-
Constructor Details
-
Main
public Main()
-
-
Method Details
-
initOptions
protected void initOptions()- Overrides:
initOptionsin classorg.apache.camel.main.MainCommandLineSupport
-
main
- Throws:
Exception
-
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
-
setApplicationContextUri
-
getFileApplicationContextUri
-
setFileApplicationContextUri
-
getParentApplicationContext
public org.springframework.context.support.AbstractApplicationContext getParentApplicationContext() -
setParentApplicationContext
public void setParentApplicationContext(org.springframework.context.support.AbstractApplicationContext parentApplicationContext) -
getParentApplicationContextUri
-
setParentApplicationContextUri
-
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
- Overrides:
doStartin classorg.apache.camel.main.MainSupport- Throws:
Exception
-
doStop
- 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
- Throws:
IOException
-