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: 643788 $

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()
           
protected  void generateDot(String name, SpringCamelContext camelContext, int size)
           
 org.springframework.context.support.AbstractApplicationContext getApplicationContext()
           
 String getApplicationContextUri()
           
 List<SpringCamelContext> getCamelContexts()
           
 String getDotOutputDir()
           
 long getDuration()
           
 List<RouteBuilder> getRouteBuilders()
           
 TimeUnit getTimeUnit()
           
protected  String getVersion()
           
 boolean isAggregateDot()
           
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 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)

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()

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.