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 Class<?>mainClassprotected MainRegistryregistry-
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()Camel main application It is recommended to useMain(Class)to specify the main class.Main(Class<?> mainClass)Camel main applicationMain(Class<?> mainClass, Class<org.apache.camel.CamelConfiguration>... configurationClasses)Camel main application
-
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
addArgumentProperty, addInitialOptions, addOption, configurePropertiesService, getArgumentProperties, initOptions, parseArguments, run, setArgumentProperties, setArgumentProperties, showOptions, showOptionsHeader
-
Methods inherited from class org.apache.camel.main.MainSupport
afterStart, afterStop, autoconfigure, beforeStart, beforeStop, completed, configureLifecycle, 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, autoConfigurationFromReloadedProperties, autoConfigurationMainConfiguration, autoConfigurationPropertiesComponent, autoConfigurationSingleOption, autowireWildcardProperties, configure, configurePackageScan, configureRoutes, configureRoutesLoader, configureStartupRecorder, configureVault, doAutoConfigurationFromProperties, 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
-
instance
protected static Main instance
-
registry
protected final MainRegistry registry
-
mainClass
protected Class<?> mainClass
-
-
Constructor Detail
-
Main
public Main()
Camel main application It is recommended to useMain(Class)to specify the main class.
-
Main
public Main(Class<?> mainClass)
Camel main application- Parameters:
mainClass- the main class
-
Main
@SafeVarargs public Main(Class<?> mainClass, Class<org.apache.camel.CamelConfiguration>... configurationClasses)
Camel main application- Parameters:
mainClass- the main classconfigurationClasses- additional camel configuration classes
-
-
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 classMainSupport- 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
-
-