org.apache.camel.main
Class Main

java.lang.Object
  extended by org.apache.camel.support.ServiceSupport
      extended by org.apache.camel.main.MainSupport
          extended by org.apache.camel.main.Main
All Implemented Interfaces:
Service, ShutdownableService, StatefulService, SuspendableService
Direct Known Subclasses:
Main

public class Main
extends MainSupport

A command line tool for booting up a CamelContext

Version:

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.camel.main.MainSupport
MainSupport.Option, MainSupport.ParameterOption
 
Field Summary
protected static Main instance
           
protected  SimpleRegistry registry
           
 
Fields inherited from class org.apache.camel.main.MainSupport
aggregateDot, camelContexts, camelTemplate, completed, dotOutputDir, duration, latch, LOG, options, routeBuilders, routesOutputFile, timeUnit, trace
 
Fields inherited from class org.apache.camel.support.ServiceSupport
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
 
Constructor Summary
Main()
           
 
Method Summary
 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  ModelFileGenerator createModelFileGenerator()
           
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
 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)
           
 
Methods inherited from class org.apache.camel.main.MainSupport
addOption, addRouteBuilder, afterStart, beforeStop, completed, enableHangupSupport, enableTrace, generateDot, getCamelContexts, getCamelTemplate, getDotOutputDir, getDuration, getRouteBuilders, getRouteDefinitions, getRoutesOutputFile, getTimeUnit, isAggregateDot, isTrace, outputRoutesToFile, parseArguments, postProcessCamelContext, postProcessContext, run, run, setAggregateDot, setDotOutputDir, setDuration, setRouteBuilders, setRoutesOutputFile, setTimeUnit, showOptions, showOptionsHeader, waitUntilCompleted
 
Methods inherited from class org.apache.camel.support.ServiceSupport
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected static Main instance

registry

protected final SimpleRegistry registry
Constructor Detail

Main

public Main()
Method Detail

main

public static void main(String... args)
                 throws Exception
Throws:
Exception

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 given name to the bean 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 bind
bean - the object to bind

lookup

public Object lookup(String name)
Using the given name does lookup for the bean being already bound using the bind(String, Object) method.

See Also:
Registry.lookup(String)

lookup

public <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.

See Also:
Registry.lookup(String, Class)

lookupByType

public <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.

See Also:
Registry.lookupByType(Class)

doStart

protected void doStart()
                throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized start/stop.

Important: See ServiceSupport.doStop() for more details.

Overrides:
doStart in class MainSupport
Throws:
Exception
See Also:
ServiceSupport.doStop()

doStop

protected void doStop()
               throws Exception
Description copied from class: ServiceSupport
Implementations override this method to support customized start/stop.

Important: Camel will invoke this ServiceSupport.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.

Overrides:
doStop in class MainSupport
Throws:
Exception
See Also:
ServiceSupport.doStart()

findOrCreateCamelTemplate

protected ProducerTemplate findOrCreateCamelTemplate()
Specified by:
findOrCreateCamelTemplate in class MainSupport

getCamelContextMap

protected Map<String,CamelContext> getCamelContextMap()
Specified by:
getCamelContextMap in class MainSupport

createContext

protected CamelContext createContext()

createModelFileGenerator

protected ModelFileGenerator createModelFileGenerator()
                                               throws JAXBException
Specified by:
createModelFileGenerator in class MainSupport
Throws:
JAXBException


Apache CAMEL