org.apache.camel.maven
Class DotMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.reporting.AbstractMavenReport
          extended by org.apache.camel.maven.DotMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.apache.maven.reporting.MavenReport

public class DotMojo
extends org.apache.maven.reporting.AbstractMavenReport

Runs Camel embedded with META-INF/services/*.xml spring files to try create DOT files for the routing rules, then converts the DOT files into another format such as PNG

Version:
See Also:
GraphViz

Field Summary
protected  String applicationContextUri
          The classpath based application context uri that spring wants to get.
static String[] DEFAULT_GRAPHVIZ_OUTPUT_TYPES
           
protected  String duration
          The duration to run the application for which by default is in milliseconds.
protected  String fileApplicationContextUri
          The filesystem based application context uri that spring wants to get.
protected  boolean runCamel
          Whether we should boot up camel with the META-INF/services/*.xml to generate the DOT file
protected static String SUBDIRECTORY
          Subdirectory for report.
protected  boolean useDot
          Should we try run the DOT executable on the generated .DOT file to generate images
 
Fields inherited from interface org.apache.maven.reporting.MavenReport
CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLE
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
DotMojo()
           
 
Method Summary
protected  void close(Closeable closeable, String description)
           
protected  String convertFile(File file, String format)
           
 void execute()
           
protected  void execute(File outputDir, Locale locale)
          Executes DOT generator.
protected  void executeReport(Locale locale)
           
 String getAggregate()
           
protected  ResourceBundle getBundle(Locale locale)
          Gets resource bundle for given locale.
 String getDescription(Locale locale)
           
 String getName(Locale locale)
           
protected  String getOutputDirectory()
           
 String getOutputName()
           
protected  org.apache.maven.project.MavenProject getProject()
           
protected  org.apache.maven.doxia.siterenderer.Renderer getSiteRenderer()
           
 boolean isUseDot()
           
protected  void printHtmlFileFooter(PrintWriter out, File file)
           
protected  void printHtmlFileHeader(PrintWriter out, File file)
           
protected  void printHtmlFooter(PrintWriter out)
           
protected  void printHtmlHeader(PrintWriter out, String contextName)
           
protected  String removeFileExtension(String name)
           
protected  void runCamelEmbedded(File outputDir)
           
 void setAggregate(String aggregate)
           
 void setUseDot(boolean useDot)
           
protected  void writeIndexHtmlFile(File dir, String fileName, String content)
           
 
Methods inherited from class org.apache.maven.reporting.AbstractMavenReport
canGenerateReport, closeReport, generate, getCategoryName, getReportOutputDirectory, getSink, isExternalReport, setReportOutputDirectory
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_GRAPHVIZ_OUTPUT_TYPES

public static final String[] DEFAULT_GRAPHVIZ_OUTPUT_TYPES

SUBDIRECTORY

protected static final String SUBDIRECTORY
Subdirectory for report.

See Also:
Constant Field Values

duration

protected String duration
The duration to run the application for which by default is in milliseconds. A value <= 0 will run forever. Adding a s indicates seconds - eg "5s" means 5 seconds.


runCamel

protected boolean runCamel
Whether we should boot up camel with the META-INF/services/*.xml to generate the DOT file


useDot

protected boolean useDot
Should we try run the DOT executable on the generated .DOT file to generate images


applicationContextUri

protected String applicationContextUri
The classpath based application context uri that spring wants to get.


fileApplicationContextUri

protected String fileApplicationContextUri
The filesystem based application context uri that spring wants to get.

Constructor Detail

DotMojo

public DotMojo()
Method Detail

getDescription

public String getDescription(Locale locale)
Parameters:
locale - report locale.
Returns:
report description.
See Also:
MavenReport.getDescription(Locale)

getName

public String getName(Locale locale)
See Also:
MavenReport.getName(Locale)

getOutputName

public String getOutputName()

getAggregate

public String getAggregate()

setAggregate

public void setAggregate(String aggregate)

isUseDot

public boolean isUseDot()

setUseDot

public void setUseDot(boolean useDot)

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
Specified by:
execute in interface org.apache.maven.plugin.Mojo
Overrides:
execute in class org.apache.maven.reporting.AbstractMavenReport
Throws:
org.apache.maven.plugin.MojoExecutionException

executeReport

protected void executeReport(Locale locale)
                      throws org.apache.maven.reporting.MavenReportException
Specified by:
executeReport in class org.apache.maven.reporting.AbstractMavenReport
Throws:
org.apache.maven.reporting.MavenReportException

execute

protected void execute(File outputDir,
                       Locale locale)
                throws org.apache.maven.plugin.MojoExecutionException
Executes DOT generator.

Parameters:
outputDir - report output directory.
locale - report locale.
Throws:
org.apache.maven.plugin.MojoExecutionException - if there were any execution errors.

runCamelEmbedded

protected void runCamelEmbedded(File outputDir)
                         throws org.apache.maven.artifact.DependencyResolutionRequiredException
Throws:
org.apache.maven.artifact.DependencyResolutionRequiredException

writeIndexHtmlFile

protected void writeIndexHtmlFile(File dir,
                                  String fileName,
                                  String content)
                           throws IOException
Throws:
IOException

printHtmlHeader

protected void printHtmlHeader(PrintWriter out,
                               String contextName)

printHtmlFileHeader

protected void printHtmlFileHeader(PrintWriter out,
                                   File file)

printHtmlFileFooter

protected void printHtmlFileFooter(PrintWriter out,
                                   File file)

printHtmlFooter

protected void printHtmlFooter(PrintWriter out)

close

protected void close(Closeable closeable,
                     String description)

convertFile

protected String convertFile(File file,
                             String format)
                      throws org.codehaus.plexus.util.cli.CommandLineException
Throws:
org.codehaus.plexus.util.cli.CommandLineException

removeFileExtension

protected String removeFileExtension(String name)

getBundle

protected ResourceBundle getBundle(Locale locale)
Gets resource bundle for given locale.

Parameters:
locale - locale
Returns:
resource bundle

getSiteRenderer

protected org.apache.maven.doxia.siterenderer.Renderer getSiteRenderer()
Specified by:
getSiteRenderer in class org.apache.maven.reporting.AbstractMavenReport

getOutputDirectory

protected String getOutputDirectory()
Specified by:
getOutputDirectory in class org.apache.maven.reporting.AbstractMavenReport

getProject

protected org.apache.maven.project.MavenProject getProject()
Specified by:
getProject in class org.apache.maven.reporting.AbstractMavenReport


Apache CAMEL