Package org.apache.camel.main
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.main.Main
-
public class Main extends MainCommandLineSupport
A Main class for booting up Camel in standalone mode.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.camel.main.MainCommandLineSupport
MainCommandLineSupport.Option, MainCommandLineSupport.ParameterOption
-
-
Field Summary
Fields Modifier and Type Field Description protected static Main
instance
protected MainRegistry
registry
-
Fields inherited from class org.apache.camel.main.MainCommandLineSupport
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, INITIAL_PROPERTIES_LOCATION, initialProperties, listeners, mainConfigurationProperties, OVERRIDE_PROPERTIES_LOCATION, overrideProperties, PROPERTY_PLACEHOLDER_LOCATION, propertyPlaceholderLocations, routesCollector, wildcardProperties
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind(String name, Object bean)
Binds the givenname
to thebean
object, so that it can be looked up inside the CamelContext this command line tool runs with.protected org.apache.camel.CamelContext
createCamelContext()
protected void
doInit()
protected void
doStart()
protected void
doStop()
protected org.apache.camel.ProducerTemplate
findOrCreateCamelTemplate()
static Main
getInstance()
Returns the currently executing mainObject
lookup(String name)
Using the givenname
does lookup for the bean being already bound using thebind(String, Object)
method.<T> T
lookup(String name, Class<T> type)
Using the givenname
andtype
does lookup for the bean being already bound using thebind(String, Object)
method.<T> Map<String,T>
lookupByType(Class<T> type)
Using the giventype
does lookup for the bean being already bound using thebind(String, Object)
method.static void
main(String... args)
-
Methods inherited from class org.apache.camel.main.MainCommandLineSupport
addOption, initOptions, 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, configureStartupRecorder, doAutowireWildcardProperties, doConfigureCamelContextFromMainConfiguration, getCamelContext, getDefaultPropertyPlaceholderLocation, getInitialProperties, getOverrideProperties, getPropertyPlaceholderLocations, getRoutesCollector, isAutoConfigurationEnabled, loadConfigurations, postProcessCamelContext, removeMainListener, setAutoConfigurationEnabled, 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
-
instance
protected static Main instance
-
registry
protected final MainRegistry registry
-
-
Constructor Detail
-
Main
public Main()
-
Main
public Main(Class<?>... configurationClass)
-
-
Method Detail
-
getInstance
public static Main getInstance()
Returns the currently executing main- Returns:
- the current running instance
-
bind
public void bind(String name, Object bean)
Binds the givenname
to thebean
object, so that it can be looked up inside the CamelContext this command line tool runs with.- Parameters:
name
- the used name through which we do bindbean
- the object to bind
-
lookup
public Object lookup(String name)
Using the givenname
does lookup for the bean being already bound using thebind(String, Object)
method.- See Also:
BeanRepository.lookupByName(String)
-
lookup
public <T> T lookup(String name, Class<T> type)
Using the givenname
andtype
does lookup for the bean being already bound using thebind(String, Object)
method.- See Also:
BeanRepository.lookupByNameAndType(String, Class)
-
lookupByType
public <T> Map<String,T> lookupByType(Class<T> type)
Using the giventype
does lookup for the bean being already bound using thebind(String, Object)
method.- See Also:
BeanRepository.findByTypeWithName(Class)
-
doInit
protected void doInit() throws Exception
- Overrides:
doInit
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStart
protected void doStart() throws Exception
- Overrides:
doStart
in classMainSupport
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in classMainSupport
- Throws:
Exception
-
findOrCreateCamelTemplate
protected org.apache.camel.ProducerTemplate findOrCreateCamelTemplate()
- Specified by:
findOrCreateCamelTemplate
in classMainSupport
-
createCamelContext
protected org.apache.camel.CamelContext createCamelContext()
- Specified by:
createCamelContext
in classMainSupport
-
-