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, durationIdle, durationMaxMessages, exitCode, fileWatchDirectory, fileWatchDirectoryRecursively, hangupInterceptorEnabled, latch, listeners, LOG, options, propertyPlaceholderLocations, reloadStrategy, routeBuilderClasses, routeBuilders, timeUnit, trace, UNINITIALIZED_EXIT_CODE
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 org.apache.camel.CamelContext |
createContext() |
protected void |
doStart() |
protected void |
doStop() |
protected org.apache.camel.ProducerTemplate |
findOrCreateCamelTemplate() |
protected Map<String,org.apache.camel.CamelContext> |
getCamelContextMap() |
static Main |
getInstance()
Returns the currently executing main
|
org.apache.camel.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, getDurationIdle, getDurationMaxMessages, getExitCode, getFileWatchDirectory, getModelJAXBContextFactory, getPropertyPlaceholderLocations, getReloadStrategy, getRouteBuilderClasses, getRouteBuilders, getRouteDefinitions, getTimeUnit, isFileWatchDirectoryRecursively, isTrace, loadRouteBuilders, parseArguments, postProcessCamelContext, postProcessContext, removeMainListener, run, run, setDuration, setDurationHitExitCode, setDurationIdle, setDurationMaxMessages, setFileWatchDirectory, setFileWatchDirectoryRecursively, setPropertyPlaceholderLocations, setReloadStrategy, setRouteBuilderClasses, setRouteBuilders, setTimeUnit, showOptions, showOptionsHeader, waitUntilCompleted
doInit, doResume, doShutdown, doSuspend, getStatus, init, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
protected 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.Registry.lookupByNameAndType(String, Class)
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 org.apache.camel.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
doStart
in class MainSupport
Exception
protected void doStop() throws Exception
doStop
in class MainSupport
Exception
protected org.apache.camel.ProducerTemplate findOrCreateCamelTemplate()
findOrCreateCamelTemplate
in class MainSupport
protected Map<String,org.apache.camel.CamelContext> getCamelContextMap()
getCamelContextMap
in class MainSupport
protected org.apache.camel.CamelContext createContext()
Apache Camel