org.codehaus.mojo.javacc
Class AbstractPreprocessorMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.codehaus.mojo.javacc.AbstractPreprocessorMojo
All Implemented Interfaces:
ContextEnabled, Mojo
Direct Known Subclasses:
JJTreeMojo, JTBMojo

public abstract class AbstractPreprocessorMojo
extends AbstractMojo

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

Version:
$Id: AbstractPreprocessorMojo.java 6353 2008-02-27 22:14:08Z bentmann $
Author:
Benjamin Bentmann

Field Summary
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractPreprocessorMojo()
           
 
Method Summary
protected  void addCompileSourceRoot()
          Registers the configured output directory as a compile source root for the current project.
protected  void createTimestamp(org.codehaus.mojo.javacc.GrammarInfo grammarInfo)
          Creates the timestamp file for the specified grammar file.
 void execute()
          Execute the tool.
protected abstract  String[] getExcludes()
          Gets a set of Ant-like exclusion patterns used to unselect files from the source directory for processing.
protected abstract  String[] getIncludes()
          Gets a set of Ant-like inclusion patterns used to select files from the source directory for processing.
protected abstract  File getOutputDirectory()
          Gets the absolute path to the directory where the generated Java files for the parser will be stored.
protected abstract  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 abstract  File getTimestampDirectory()
          Gets the absolute path to the directory where the processed input files will be stored for later detection of stale sources.
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

AbstractPreprocessorMojo

public AbstractPreprocessorMojo()
Method Detail

getSourceDirectory

protected abstract 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 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 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 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.

getTimestampDirectory

protected abstract File getTimestampDirectory()
Gets the absolute path to the directory where the processed input files will be stored for later detection of stale sources.

Returns:
The absolute path to the directory where the processed input files will be stored for later detection of stale sources, 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.

execute

public void execute()
             throws MojoExecutionException,
                    MojoFailureException
Execute the tool.

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

processGrammar

protected abstract void processGrammar(org.codehaus.mojo.javacc.GrammarInfo grammarInfo)
                                throws MojoExecutionException,
                                       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:
MojoExecutionException - If the invocation of the tool failed.
MojoFailureException - If the tool reported a non-zero exit code.

createTimestamp

protected void createTimestamp(org.codehaus.mojo.javacc.GrammarInfo grammarInfo)
Creates the timestamp file for the specified grammar file.

Parameters:
grammarInfo - The grammar info describing the grammar file to process, must not be null.

addCompileSourceRoot

protected void addCompileSourceRoot()
Registers the configured output directory as a compile source root for the current project.



Copyright © 2005-2012 Codehaus. All Rights Reserved.