Somewhat abstract framework to be used for other metama 2.0 tasks.
This should include, audit, metrics, cover and mparse.
For more information, visit the website at
www.metamata.com
classPath
protected Path classPath
The user classpath to be provided. It matches the -classpath of the
command line. The classpath must includes both the .class and the
.java files for accurate audit.
fileSets
protected Vector fileSets
the set of files to be audited
includedFiles
protected Hashtable includedFiles
metamataHome
protected File metamataHome
Metamata home directory. It will be passed as a metamata.home property
and should normally matches the environment property META_HOME
set by the Metamata installer.
optionsFile
protected File optionsFile
the options file where are stored the command line options
sourcePath
protected Path sourcePath
the path to the source file
addAllVector
protected static final void addAllVector(Vector dest,
Enumeration files)
convenient method for JDK 1.1. Will copy all elements from src to dest
addFileSet
public void addFileSet(FileSet fs)
The java files or directory to audit.
Whatever the filter is, only the files that end
with .java will be included for processing.
Note that the base directory used for the fileset
MUST be the root of the source files otherwise package names
deduced from the file path will be incorrect.
checkOptions
protected void checkOptions()
throws BuildException
validate options set
cleanUp
protected void cleanUp()
clean up all the mess that we did with temporary objects
createClasspath
public Path createClasspath()
Sets the class path (also source path unless one explicitly set).
Overrides METAPATH/CLASSPATH environment variables.
createJvmarg
public Commandline.Argument createJvmarg()
Additional optional parameters to pass to the JVM.
You can avoid using the
<jvmarg>
by adding these empty
entries to
metamata.properties
located at
${metamata.home}/bin
metamata.classpath=
metamata.sourcepath=
metamata.baseclasspath=
createSourcepath
public Path createSourcepath()
Sets the source path.
Overrides the SOURCEPATH environment variable.
createStreamHandler
protected ExecuteStreamHandler createStreamHandler()
create a stream handler that will be used to get the output since
metamata tools do not report with convenient files such as XML.
createTmpFile
protected final File createTmpFile()
execute
public void execute()
throws BuildException
execute the command line
- execute in interface Task
generateOptionsFile
protected void generateOptionsFile(File tofile,
Vector options)
throws BuildException
getFileMapping
protected Hashtable getFileMapping()
getMetamataJar
protected final File getMetamataJar(File home)
return the location of the jar file used to run
getOptions
protected Vector getOptions()
return all options of the command line as string elements
scanSources
protected Hashtable scanSources(Hashtable map)
- the list of .java files (as their absolute path) that should
be audited.
scanSources
protected Hashtable scanSources(Hashtable mapping,
String[] entries)
setHome
public void setHome(File value)
the metamata.home property to run all tasks.
setMaxmemory
public void setMaxmemory(String max)
Set the maximum memory for the JVM; optional.
-mx or -Xmx depending on VM version
setMetamatahome
public void setMetamatahome(File value)
The home directory containing the Metamata distribution; required
setUp
protected void setUp()
throws BuildException
check the options and build the command line