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 Maininstanceprotected MainRegistryregistry-
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, standalone, wildcardProperties
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbind(String name, Object bean)Binds the givennameto thebeanobject, so that it can be looked up inside the CamelContext this command line tool runs with.protected org.apache.camel.CamelContextcreateCamelContext()protected voiddoInit()protected voiddoStart()protected voiddoStop()protected org.apache.camel.ProducerTemplatefindOrCreateCamelTemplate()static MaingetInstance()Returns the currently executing mainObjectlookup(String name)Using the givennamedoes lookup for the bean being already bound using thebind(String, Object)method.<T> Tlookup(String name, Class<T> type)Using the givennameandtypedoes lookup for the bean being already bound using thebind(String, Object)method.<T> Map<String,T>lookupByType(Class<T> type)Using the giventypedoes lookup for the bean being already bound using thebind(String, Object)method.static voidmain(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, enableTraceStandby, getCamelTemplate, getCompleteTask, getDuration, getDurationHitExitCode, getDurationIdle, getDurationMaxMessages, getExitCode, getShutdownStrategy, initCamelContext, internalBeforeStart, isTrace, registerMainBootstrap, 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 givennameto thebeanobject, 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 givennamedoes 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 givennameandtypedoes 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 giventypedoes lookup for the bean being already bound using thebind(String, Object)method.- See Also:
BeanRepository.findByTypeWithName(Class)
-
doInit
protected void doInit() throws Exception- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classMainSupport- Throws:
Exception
-
doStop
protected void doStop() throws Exception- Overrides:
doStopin classMainSupport- Throws:
Exception
-
findOrCreateCamelTemplate
protected org.apache.camel.ProducerTemplate findOrCreateCamelTemplate()
- Specified by:
findOrCreateCamelTemplatein classMainSupport
-
createCamelContext
protected org.apache.camel.CamelContext createCamelContext()
- Specified by:
createCamelContextin classMainSupport
-
-