org.codehaus.mojo.javacc
Class AbstractJavaCCMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.codehaus.mojo.javacc.AbstractJavaCCMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
JavaCCMojo, JJTreeJavaCCMojo, JTBJavaCCMojo

public abstract class AbstractJavaCCMojo
extends org.apache.maven.plugin.AbstractMojo

Provides common services for all mojos that compile JavaCC grammar files.

Version:
$Id: AbstractJavaCCMojo.java 6353 2008-02-27 22:14:08Z bentmann $
Author:
jruiz@exist.com, jesse

Field Summary
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractJavaCCMojo()
           
 
Method Summary
 void execute()
          Execute the tool.
protected abstract  java.lang.String[] getExcludes()
          Gets a set of Ant-like exclusion patterns used to unselect files from the source directory for processing.
protected abstract  java.lang.String[] getIncludes()
          Gets a set of Ant-like inclusion patterns used to select files from the source directory for processing.
protected  java.lang.Boolean getIsStatic()
          Gets the flag whether to generate static parser.
protected  java.lang.String getJdkVersion()
          Gets the Java version for which to generate source code.
protected abstract  java.io.File getOutputDirectory()
          Gets the absolute path to the directory where the generated Java files for the parser will be stored.
protected  java.lang.String getParserPackage()
          Gets the package into which the generated parser files should be stored.
protected abstract  java.io.File getSourceDirectory()
          Gets the absolute path to the directory where the grammar files are located.
protected abstract  int getStaleMillis()
          Gets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.
protected  org.codehaus.mojo.javacc.JavaCC newJavaCC()
          Creates a new facade to invoke JavaCC.
protected abstract  void processGrammar(org.codehaus.mojo.javacc.GrammarInfo grammarInfo)
          Passes the specified grammar file through the tool.
 
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
 

Constructor Detail

AbstractJavaCCMojo

public AbstractJavaCCMojo()
Method Detail

getJdkVersion

protected java.lang.String getJdkVersion()
Gets the Java version for which to generate source code.

Returns:
The Java version for which to generate source code, will be null if the user did not specify this mojo parameter.

getIsStatic

protected java.lang.Boolean getIsStatic()
Gets the flag whether to generate static parser.

Returns:
The flag whether to generate static parser, will be null if the user did not specify this mojo parameter.

getSourceDirectory

protected abstract java.io.File getSourceDirectory()
Gets the absolute path to the directory where the grammar files are located.

Returns:
The absolute path to the directory where the grammar files are located, never null.

getIncludes

protected abstract java.lang.String[] getIncludes()
Gets a set of Ant-like inclusion patterns used to select files from the source directory for processing.

Returns:
A set of Ant-like inclusion patterns used to select files from the source directory for processing, can be null if all files should be included.

getExcludes

protected abstract java.lang.String[] getExcludes()
Gets a set of Ant-like exclusion patterns used to unselect files from the source directory for processing.

Returns:
A set of Ant-like inclusion patterns used to unselect files from the source directory for processing, can be null if no files should be excluded.

getOutputDirectory

protected abstract java.io.File getOutputDirectory()
Gets the absolute path to the directory where the generated Java files for the parser will be stored.

Returns:
The absolute path to the directory where the generated Java files for the parser will be stored, never null.

getStaleMillis

protected abstract int getStaleMillis()
Gets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.

Returns:
The granularity in milliseconds of the last modification date for testing whether a source needs recompilation.

getParserPackage

protected java.lang.String getParserPackage()
Gets the package into which the generated parser files should be stored.

Returns:
The package into which the generated parser files should be stored, can be null to use the package declaration from the grammar file.

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException,
                    org.apache.maven.plugin.MojoFailureException
Execute the tool.

Throws:
org.apache.maven.plugin.MojoExecutionException - If the invocation of the tool failed.
org.apache.maven.plugin.MojoFailureException - If the tool reported a non-zero exit code.

processGrammar

protected abstract void processGrammar(org.codehaus.mojo.javacc.GrammarInfo grammarInfo)
                                throws org.apache.maven.plugin.MojoExecutionException,
                                       org.apache.maven.plugin.MojoFailureException
Passes the specified grammar file through the tool.

Parameters:
grammarInfo - The grammar info describing the grammar file to process, must not be null.
Throws:
org.apache.maven.plugin.MojoExecutionException - If the invocation of the tool failed.
org.apache.maven.plugin.MojoFailureException - If the tool reported a non-zero exit code.

newJavaCC

protected org.codehaus.mojo.javacc.JavaCC newJavaCC()
Creates a new facade to invoke JavaCC. Most options for the invocation are derived from the current values of the corresponding mojo parameters. The caller is responsible to set the input file and output directory on the returned facade.

Returns:
The facade for the tool invocation, never null.


Copyright © 2005-2009. All Rights Reserved.