org.apache.camel.util
Class MainSupport

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

public abstract class MainSupport
extends ServiceSupport

Version:
$Revision: 67260 $

Nested Class Summary
 class MainSupport.Option
           
 class MainSupport.ParameterOption
           
 
Field Summary
protected  String dotOutputDir
           
protected static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
protected MainSupport()
           
 
Method Summary
 void addOption(MainSupport.Option option)
           
 void addRouteBuilder(RouteBuilder routeBuilder)
           
 void completed()
          Marks this process as being completed
protected abstract  ModelFileGenerator createModelFileGenerator()
           
protected  void doStart()
           
protected  void doStop()
           
 void enableDebug()
           
 void enableTrace()
           
protected abstract  ProducerTemplate findOrCreateCamelTemplate()
           
protected  void generateDot(String name, CamelContext camelContext, int size)
           
protected abstract  Map<String,CamelContext> getCamelContextMap()
           
 List<CamelContext> 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()
           
 List<RouteBuilder> getRouteBuilders()
           
 List<RouteType> getRouteDefinitions()
           
 String getRoutesOutputFile()
           
 TimeUnit getTimeUnit()
           
 boolean isAggregateDot()
           
 boolean isDebug()
           
 boolean isTrace()
           
protected  void outputRoutesToFile()
           
 void parseArguments(String[] arguments)
          Parses the command line 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 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 setRoutesOutputFile(String routesOutputFile)
           
 void setTimeUnit(TimeUnit timeUnit)
          Sets the time unit duration
 void showOptions()
          Displays the command line options
 void showOptionsHeader()
          Displays the header message for the command line options
protected  void waitUntilCompleted()
           
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getThreadName, getVersion, 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
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG

dotOutputDir

protected String dotOutputDir
Constructor Detail

MainSupport

protected MainSupport()
Method Detail

run

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


completed

public void completed()
Marks this process as being completed


showOptions

public void showOptions()
Displays the command line options


parseArguments

public void parseArguments(String[] arguments)
Parses the command line arguments


addOption

public void addOption(MainSupport.Option option)

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.


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


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

setRoutesOutputFile

public void setRoutesOutputFile(String routesOutputFile)

getRoutesOutputFile

public String getRoutesOutputFile()

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

doStop

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

doStart

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

waitUntilCompleted

protected void waitUntilCompleted()

run

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


showOptionsHeader

public void showOptionsHeader()
Displays the header message for the command line options


getCamelContexts

public List<CamelContext> getCamelContexts()

getRouteBuilders

public List<RouteBuilder> getRouteBuilders()

setRouteBuilders

public void setRouteBuilders(List<RouteBuilder> routeBuilders)

getRouteDefinitions

public List<RouteType> getRouteDefinitions()

getCamelTemplate

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


findOrCreateCamelTemplate

protected abstract ProducerTemplate findOrCreateCamelTemplate()

getCamelContextMap

protected abstract Map<String,CamelContext> getCamelContextMap()

postProcessContext

protected void postProcessContext()
                           throws Exception
Throws:
Exception

outputRoutesToFile

protected void outputRoutesToFile()
                           throws IOException,
                                  JAXBException
Throws:
IOException
JAXBException

createModelFileGenerator

protected abstract ModelFileGenerator createModelFileGenerator()
                                                        throws JAXBException
Throws:
JAXBException

generateDot

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

postProcesCamelContext

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

addRouteBuilder

public void addRouteBuilder(RouteBuilder routeBuilder)


Copyright © 2009 IONA Open Source Community. All Rights Reserved.