org.apache.camel.spring
Class Main

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

public class Main
extends org.apache.camel.impl.MainSupport

A command line tool for booting up a CamelContext using an optional Spring ApplicationContext.

By placing a file in the LOCATION_PROPERTIES directory of any JARs on the classpath, allows this Main class to load those additional Spring XML files as Spring ApplicationContext to be included.

Each line in the LOCATION_PROPERTIES is a reference to a Spring XML file to include, which by default gets loaded from classpath.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.camel.main.MainSupport
org.apache.camel.main.MainSupport.Option, org.apache.camel.main.MainSupport.ParameterOption
 
Field Summary
protected static Main instance
           
static String LOCATION_PROPERTIES
           
 
Fields inherited from class org.apache.camel.main.MainSupport
aggregateDot, camelContexts, camelTemplate, completed, dotOutputDir, duration, latch, LOG, options, routeBuilderClasses, 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
protected  AbstractApplicationContext createAdditionalLocationsFromClasspath()
           
protected  AbstractApplicationContext createDefaultApplicationContext()
           
protected  org.apache.camel.view.ModelFileGenerator createModelFileGenerator()
           
protected  void doStart()
           
protected  void doStop()
           
protected  void findLocations(Set<String> locations, ClassLoader classLoader)
           
protected  org.apache.camel.ProducerTemplate findOrCreateCamelTemplate()
           
 AbstractApplicationContext getApplicationContext()
           
 String getApplicationContextUri()
           
protected  Map<String,org.apache.camel.CamelContext> getCamelContextMap()
           
 String getFileApplicationContextUri()
           
static Main getInstance()
          Returns the currently executing main
 AbstractApplicationContext getParentApplicationContext()
           
 String getParentApplicationContextUri()
           
static void main(String... args)
           
 void setApplicationContext(AbstractApplicationContext applicationContext)
           
 void setApplicationContextUri(String applicationContextUri)
           
 void setFileApplicationContextUri(String fileApplicationContextUri)
           
 void setParentApplicationContext(AbstractApplicationContext parentApplicationContext)
           
 void setParentApplicationContextUri(String parentApplicationContextUri)
           
 
Methods inherited from class org.apache.camel.main.MainSupport
addOption, addRouteBuilder, afterStart, beforeStop, completed, enableHangupSupport, enableTrace, generateDot, getCamelContexts, getCamelTemplate, getDotOutputDir, getDuration, getRouteBuilderClasses, getRouteBuilders, getRouteDefinitions, getRoutesOutputFile, getTimeUnit, isAggregateDot, isTrace, loadRouteBuilders, outputRoutesToFile, parseArguments, postProcessCamelContext, postProcessContext, run, run, setAggregateDot, setDotOutputDir, setDuration, setRouteBuilderClasses, 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, isStoppingOrStopped, 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

LOCATION_PROPERTIES

public static final String LOCATION_PROPERTIES
See Also:
Constant Field Values

instance

protected static Main instance
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

getApplicationContext

public AbstractApplicationContext getApplicationContext()

setApplicationContext

public void setApplicationContext(AbstractApplicationContext applicationContext)

getApplicationContextUri

public String getApplicationContextUri()

setApplicationContextUri

public void setApplicationContextUri(String applicationContextUri)

getFileApplicationContextUri

public String getFileApplicationContextUri()

setFileApplicationContextUri

public void setFileApplicationContextUri(String fileApplicationContextUri)

getParentApplicationContext

public AbstractApplicationContext getParentApplicationContext()

setParentApplicationContext

public void setParentApplicationContext(AbstractApplicationContext parentApplicationContext)

getParentApplicationContextUri

public String getParentApplicationContextUri()

setParentApplicationContextUri

public void setParentApplicationContextUri(String parentApplicationContextUri)

doStart

protected void doStart()
                throws Exception
Overrides:
doStart in class org.apache.camel.main.MainSupport
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Overrides:
doStop in class org.apache.camel.main.MainSupport
Throws:
Exception

findOrCreateCamelTemplate

protected org.apache.camel.ProducerTemplate findOrCreateCamelTemplate()
Specified by:
findOrCreateCamelTemplate in class org.apache.camel.main.MainSupport

createDefaultApplicationContext

protected AbstractApplicationContext createDefaultApplicationContext()
                                                              throws IOException
Throws:
IOException

getCamelContextMap

protected Map<String,org.apache.camel.CamelContext> getCamelContextMap()
Specified by:
getCamelContextMap in class org.apache.camel.main.MainSupport

createModelFileGenerator

protected org.apache.camel.view.ModelFileGenerator createModelFileGenerator()
                                                                     throws JAXBException
Specified by:
createModelFileGenerator in class org.apache.camel.main.MainSupport
Throws:
JAXBException

createAdditionalLocationsFromClasspath

protected AbstractApplicationContext createAdditionalLocationsFromClasspath()
                                                                     throws IOException
Throws:
IOException

findLocations

protected void findLocations(Set<String> locations,
                             ClassLoader classLoader)
                      throws IOException
Throws:
IOException


Apache Camel