public class Main extends MainSupport
MainSupport.Option, MainSupport.ParameterOption| Modifier and Type | Field and Description |
|---|---|
protected static Main |
instance |
protected SimpleRegistry |
registry |
camelContexts, camelTemplate, completed, DEFAULT_EXIT_CODE, duration, durationHitExitCode, exitCode, hangupInterceptorEnabled, latch, listeners, LOG, options, routeBuilderClasses, routeBuilders, timeUnit, trace, UNINITIALIZED_EXIT_CODEshutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending| Constructor and Description |
|---|
Main() |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(String name,
Object bean)
Binds the given
name to the bean object, so
that it can be looked up inside the CamelContext this command line tool
runs with. |
protected CamelContext |
createContext() |
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
protected ProducerTemplate |
findOrCreateCamelTemplate() |
protected Map<String,CamelContext> |
getCamelContextMap() |
static Main |
getInstance()
Returns the currently executing main
|
CamelContext |
getOrCreateCamelContext()
Gets or creates the
CamelContext this main class is using. |
Object |
lookup(String name)
Using the given
name does lookup for the bean being already
bound using the bind(String, Object) method. |
<T> T |
lookup(String name,
Class<T> type)
Using the given
name and type does lookup for
the bean being already bound using the bind(String, Object)
method. |
<T> Map<String,T> |
lookupByType(Class<T> type)
Using the given
type does lookup for the bean being already
bound using the bind(String, Object) method. |
static void |
main(String... args) |
addMainListener, addOption, addRouteBuilder, afterStart, afterStop, beforeStart, beforeStop, completed, disableHangupSupport, enableHangupSupport, enableTrace, getCamelContexts, getCamelTemplate, getDuration, getDurationHitExitCode, getExitCode, getModelJAXBContextFactory, getRouteBuilderClasses, getRouteBuilders, getRouteDefinitions, getTimeUnit, isTrace, loadRouteBuilders, parseArguments, postProcessCamelContext, postProcessContext, removeMainListener, run, run, setDuration, setDurationHitExitCode, setRouteBuilderClasses, setRouteBuilders, setTimeUnit, showOptions, showOptionsHeader, waitUntilCompleteddoResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendprotected final SimpleRegistry registry
public Main()
public static Main getInstance()
public void bind(String name, Object bean)
name to the bean object, so
that it can be looked up inside the CamelContext this command line tool
runs with.name - the used name through which we do bindbean - the object to bindpublic Object lookup(String name)
name does lookup for the bean being already
bound using the bind(String, Object) method.Registry.lookupByName(String)public <T> T lookup(String name, Class<T> type)
name and type does lookup for
the bean being already bound using the bind(String, Object)
method.public <T> Map<String,T> lookupByType(Class<T> type)
type does lookup for the bean being already
bound using the bind(String, Object) method.Registry.findByTypeWithName(Class)public CamelContext getOrCreateCamelContext()
CamelContext this main class is using.
It just create a new CamelContextMap per call, please don't use it to access the camel context that will be ran by main.
If you want to setup the CamelContext please use MainListener to get the new created camel context.protected void doStart() throws Exception
ServiceSupportServiceSupport.doStop() for more details.doStart in class MainSupportExceptionServiceSupport.doStop()protected void doStop() throws Exception
ServiceSupportServiceSupport.doStop() method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext is shutting down.doStop in class MainSupportExceptionServiceSupport.doStart()protected ProducerTemplate findOrCreateCamelTemplate()
findOrCreateCamelTemplate in class MainSupportprotected Map<String,CamelContext> getCamelContextMap()
getCamelContextMap in class MainSupportprotected CamelContext createContext()
Apache Camel