org.apache.tools.ant.taskdefs.optional.metamata

Class MParse


public class MParse
extends AbstractMetamataTask

Simple Metamata MParse task. Based on the original written by Thomas Haas. This version was written for Metamata 2.0 available at http://www.metamata.com
To do:
make a subclass of AbstractMetaMataTask

Field Summary

Fields inherited from class org.apache.tools.ant.taskdefs.optional.metamata.AbstractMetamataTask

classPath, cmdl, fileSets, includedFiles, metamataHome, optionsFile, sourcePath

Fields inherited from class org.apache.tools.ant.Task

description, location, target, taskName, taskType, wrapper

Fields inherited from class org.apache.tools.ant.ProjectComponent

project

Constructor Summary

MParse()
Sole constructor.

Method Summary

protected void
_execute(ExecuteStreamHandler handler)
execute the process with a specific handler
protected void
checkOptions()
validate options set and resolve files and paths
protected void
cleanUp()
clean up all the mess that we did with temporary objects
protected ExecuteStreamHandler
createStreamHandler()
return the default stream handler for this task
void
execute()
execute the command line
protected void
generateOptionsFile(File tofile, String[] options)
write all options to a file with one option / line
protected File[]
getMetamataLibs()
return an array of files containing the path to the needed libraries to run metamata.
protected Vector
getOptions()
return all options of the command line as string elements
void
setCleanup(boolean value)
Remove the intermediate Sun JavaCC file ; optional, default false.
void
setDebugparser(boolean flag)
set parser debug mode; optional, default false
void
setDebugscanner(boolean flag)
set scanner debug mode; optional, default false
void
setTarget(File target)
The .jj file to process; required.
protected void
setUp()
check the options and build the command line
void
setVerbose(boolean flag)
set verbose mode

Methods inherited from class org.apache.tools.ant.taskdefs.optional.metamata.AbstractMetamataTask

addAllVector, addFileSet, checkOptions, cleanUp, createClasspath, createJvmarg, createSourcepath, createStreamHandler, createTmpFile, execute, execute0, generateOptionsFile, getFileMapping, getMetamataJar, getOptions, scanSources, scanSources, setHome, setMaxmemory, setMetamatahome, setUp

Methods inherited from class org.apache.tools.ant.Task

execute, getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

Methods inherited from class org.apache.tools.ant.ProjectComponent

getProject, log, log, setProject

Constructor Details

MParse

public MParse()
Sole constructor.

Method Details

_execute

protected void _execute(ExecuteStreamHandler handler)
            throws BuildException
execute the process with a specific handler

checkOptions

protected void checkOptions()
            throws BuildException
validate options set and resolve files and paths
Overrides:
checkOptions in interface AbstractMetamataTask
Throws:
BuildException - thrown if an option has an incorrect state.

cleanUp

protected void cleanUp()
clean up all the mess that we did with temporary objects
Overrides:
cleanUp in interface AbstractMetamataTask

createStreamHandler

protected ExecuteStreamHandler createStreamHandler()
return the default stream handler for this task
Overrides:
createStreamHandler in interface AbstractMetamataTask

execute

public void execute()
            throws BuildException
execute the command line
Overrides:
execute in interface AbstractMetamataTask

generateOptionsFile

protected void generateOptionsFile(File tofile,
                                   String[] options)
            throws BuildException
write all options to a file with one option / line
Parameters:
tofile - the file to write the options to.
options - the array of options element to write to the file.
Throws:
BuildException - thrown if there is a problem while writing to the file.

getMetamataLibs

protected File[] getMetamataLibs()
return an array of files containing the path to the needed libraries to run metamata. The file are not checked for existence. You should do this yourself if needed or simply let the forked process do it for you.
Returns:
array of jars/zips needed to run metamata.

getOptions

protected Vector getOptions()
return all options of the command line as string elements
Overrides:
getOptions in interface AbstractMetamataTask
Returns:
an array of options corresponding to the setted options.

setCleanup

public void setCleanup(boolean value)
Remove the intermediate Sun JavaCC file ; optional, default false.

setDebugparser

public void setDebugparser(boolean flag)
set parser debug mode; optional, default false

setDebugscanner

public void setDebugscanner(boolean flag)
set scanner debug mode; optional, default false

setTarget

public void setTarget(File target)
The .jj file to process; required.

setUp

protected void setUp()
            throws BuildException
check the options and build the command line
Overrides:
setUp in interface AbstractMetamataTask

setVerbose

public void setVerbose(boolean flag)
set verbose mode

Copyright B) 2000-2008 Apache Software Foundation. All Rights Reserved.