org.codehaus.mojo.javacc

Class AbstractPreprocessorMojo

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

Method Summary
protected voidaddCompileSourceRoot()
Registers the configured output directory as a compile source root for the current project.
protected voidcreateTimestamp(GrammarInfo grammarInfo)
Creates the timestamp file for the specified grammar file.
voidexecute()
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 FilegetOutputDirectory()
Gets the absolute path to the directory where the generated Java files for the parser will be stored.
protected abstract FilegetSourceDirectory()
Gets the absolute path to the directory where the grammar files are located.
protected abstract intgetStaleMillis()
Gets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.
protected abstract FilegetTimestampDirectory()
Gets the absolute path to the directory where the processed input files will be stored for later detection of stale sources.
protected abstract voidprocessGrammar(GrammarInfo grammarInfo)
Passes the specified grammar file through the tool.

Method Detail

addCompileSourceRoot

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

createTimestamp

protected void createTimestamp(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.

execute

public void execute()
Execute the tool.

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

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.

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.

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.

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.

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.

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.

processGrammar

protected abstract void processGrammar(GrammarInfo grammarInfo)
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.

Copyright © 2005-2010 Codehaus. All Rights Reserved.