org.apache.camel.spring
Class Main

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.spring.Main
All Implemented Interfaces:
Service

public class Main
extends ServiceSupport

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

Version:
$Revision: 674203 $

Nested Class Summary
 class Main.Option
           
 class Main.ParameterOption
           
 
Constructor Summary
Main()
           
 
Method Summary
 void addOption(Main.Option option)
           
 void addRouteBuilder(RouteBuilder routeBuilder)
           
 void completed()
          Marks this process as being completed
protected  org.springframework.context.support.AbstractApplicationContext createDefaultApplicationContext()
           
protected  void doStart()
           
protected  void doStop()
           
 void enableDebug()
           
 void enableTrace()
           
protected  ProducerTemplate findOrCreateCamelTemplate()
           
protected  void generateDot(String name, SpringCamelContext camelContext, int size)
           
 org.springframework.context.support.AbstractApplicationContext getApplicationContext()
           
 String getApplicationContextUri()
           
 List<SpringCamelContext> getCamelContexts()
           
 ProducerTemplate getCamelTemplate()
          Returns a ProducerTemplate from the Spring ApplicationContext instances or lazily creates a new one dynamically
 Debugger getDebugger()
          Returns the currently active debugger if one is enabled
 String getDotOutputDir()
           
 long getDuration()
           
 String getFileApplicationContextUri()
           
 org.springframework.context.support.AbstractApplicationContext getParentApplicationContext()
           
 String getParentApplicationContextUri()
           
 List<RouteBuilder> getRouteBuilders()
           
 List<RouteType> getRouteDefinitions()
           
 TimeUnit getTimeUnit()
           
protected  String getVersion()
           
 boolean isAggregateDot()
           
 boolean isDebug()
           
 boolean isTrace()
           
static void main(String... args)
           
 void parseArguments(String[] arguments)
          Parses the commandl ine arguments
protected  void postProcesCamelContext(CamelContext camelContext)
           
protected  void postProcessContext()
           
 void run()
          Runs this process with the given arguments
 void run(String[] args)
          Parses the command line arguments then runs the program
 void setAggregateDot(boolean aggregateDot)
           
 void setApplicationContext(org.springframework.context.support.AbstractApplicationContext applicationContext)
           
 void setApplicationContextUri(String applicationContextUri)
           
 void setDotOutputDir(String dotOutputDir)
          Sets the output directory of the generated DOT Files to show the visual representation of the routes.
 void setDuration(long duration)
          Sets the duration to run the application for in milliseconds until it should be terminated.
 void setFileApplicationContextUri(String fileApplicationContextUri)
           
 void setParentApplicationContext(org.springframework.context.support.AbstractApplicationContext parentApplicationContext)
           
 void setParentApplicationContextUri(String parentApplicationContextUri)
           
 void setRouteBuilders(List<RouteBuilder> routeBuilders)
           
 void setTimeUnit(TimeUnit timeUnit)
          Sets the time unit duration
 void showOptions()
          Displays the command line options
protected  void waitUntilCompleted()
           
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getThreadName, isRunAllowed, isStarted, isStarting, isStopped, isStopping, nextThreadCounter, removeChildService, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Main

public Main()
Method Detail

main

public static void main(String... args)

run

public void run(String[] args)
Parses the command line arguments then runs the program


run

public void run()
Runs this process with the given arguments


completed

public void completed()
Marks this process as being completed


addRouteBuilder

public void addRouteBuilder(RouteBuilder routeBuilder)

showOptions

public void showOptions()
Displays the command line options


parseArguments

public void parseArguments(String[] arguments)
Parses the commandl ine arguments


addOption

public void addOption(Main.Option option)

getApplicationContext

public org.springframework.context.support.AbstractApplicationContext getApplicationContext()

setApplicationContext

public void setApplicationContext(org.springframework.context.support.AbstractApplicationContext applicationContext)

getApplicationContextUri

public String getApplicationContextUri()

setApplicationContextUri

public void setApplicationContextUri(String applicationContextUri)

getFileApplicationContextUri

public String getFileApplicationContextUri()

setFileApplicationContextUri

public void setFileApplicationContextUri(String fileApplicationContextUri)

getParentApplicationContext

public org.springframework.context.support.AbstractApplicationContext getParentApplicationContext()

setParentApplicationContext

public void setParentApplicationContext(org.springframework.context.support.AbstractApplicationContext parentApplicationContext)

getParentApplicationContextUri

public String getParentApplicationContextUri()

setParentApplicationContextUri

public void setParentApplicationContextUri(String parentApplicationContextUri)

getCamelContexts

public List<SpringCamelContext> getCamelContexts()

getDuration

public long getDuration()

setDuration

public void setDuration(long duration)
Sets the duration to run the application for in milliseconds until it should be terminated. Defaults to -1. Any value <= 0 will run forever.

Parameters:
duration -

getTimeUnit

public TimeUnit getTimeUnit()

setTimeUnit

public void setTimeUnit(TimeUnit timeUnit)
Sets the time unit duration


getDotOutputDir

public String getDotOutputDir()

setDotOutputDir

public void setDotOutputDir(String dotOutputDir)
Sets the output directory of the generated DOT Files to show the visual representation of the routes. A null value disables the dot file generation


getRouteBuilders

public List<RouteBuilder> getRouteBuilders()

setRouteBuilders

public void setRouteBuilders(List<RouteBuilder> routeBuilders)

setAggregateDot

public void setAggregateDot(boolean aggregateDot)

isAggregateDot

public boolean isAggregateDot()

isDebug

public boolean isDebug()

enableDebug

public void enableDebug()

isTrace

public boolean isTrace()

enableTrace

public void enableTrace()

getDebugger

public Debugger getDebugger()
Returns the currently active debugger if one is enabled

Returns:
the current debugger or null if none is active
See Also:
enableDebug()

getRouteDefinitions

public List<RouteType> getRouteDefinitions()

getCamelTemplate

public ProducerTemplate getCamelTemplate()
Returns a ProducerTemplate from the Spring ApplicationContext instances or lazily creates a new one dynamically

Returns:

findOrCreateCamelTemplate

protected ProducerTemplate findOrCreateCamelTemplate()

doStart

protected void doStart()
                throws Exception
Specified by:
doStart in class ServiceSupport
Throws:
Exception

createDefaultApplicationContext

protected org.springframework.context.support.AbstractApplicationContext createDefaultApplicationContext()

doStop

protected void doStop()
               throws Exception
Specified by:
doStop in class ServiceSupport
Throws:
Exception

waitUntilCompleted

protected void waitUntilCompleted()

postProcessContext

protected void postProcessContext()
                           throws Exception
Throws:
Exception

generateDot

protected void generateDot(String name,
                           SpringCamelContext camelContext,
                           int size)
                    throws IOException
Throws:
IOException

postProcesCamelContext

protected void postProcesCamelContext(CamelContext camelContext)
                               throws Exception
Throws:
Exception

getVersion

protected String getVersion()


Copyright © 2008 Apache Software Foundation. All Rights Reserved.