org.apache.axis.components.compiler

Class AbstractCompiler

Implemented Interfaces:
Compiler
Known Direct Subclasses:
Javac, Jikes

public abstract class AbstractCompiler
extends java.lang.Object
implements Compiler

This class implements the functionality common to all Java compilers.

Authors:
Davanum Srinivas
Stefano Mazzocchi

Since:
2.0

Field Summary

protected String
classpath
The classpath to be used for compilation
protected String
destDir
The name of the directory to contain the resulting object program file
protected String
encoding
The encoding of the source program or null to use the platform's default encoding
protected InputStream
errors
The input stream to output compilation errors
protected ArrayList
fileList
The source program filenames
protected String
srcDir
The name of the directory containing the source program file

Method Summary

void
addFile(String file)
Add the name of the file containing the source program to the file list
protected List
fillArguments(List arguments)
Fill the arguments taken by the Java compiler
List
getErrors()
Return the list of errors generated by this compilation
protected List
parseStream(BufferedReader errors)
Parse the compiler error stream to produce a list of CompilerErrors
void
setClasspath(String classpath)
Set the classpath to be used for this compilation
void
setDestination(String destDir)
Set the name of the directory to contain the resulting object program file
void
setEncoding(String encoding)
Set the encoding of the input source file or null to use the platform's default encoding
void
setSource(String srcDir)
Set the name of the directory containing the source program file
protected String[]
toStringArray(List arguments)
Copy arguments to a string array

Field Details

classpath

protected String classpath
The classpath to be used for compilation


destDir

protected String destDir
The name of the directory to contain the resulting object program file


encoding

protected String encoding
The encoding of the source program or null to use the platform's default encoding


errors

protected InputStream errors
The input stream to output compilation errors


fileList

protected ArrayList fileList
The source program filenames


srcDir

protected String srcDir
The name of the directory containing the source program file

Method Details

addFile

public void addFile(String file)
Add the name of the file containing the source program to the file list
Specified by:
addFile in interface Compiler

Parameters:
file - The name of the file containing the source program


fillArguments

protected List fillArguments(List arguments)
Fill the arguments taken by the Java compiler

Parameters:
arguments - The list of compilation arguments

Returns:
The prepared list of compilation arguments


getErrors

public List getErrors()
            throws IOException
Return the list of errors generated by this compilation
Specified by:
getErrors in interface Compiler

Returns:
The list of errors generated by this compilation


parseStream

protected List parseStream(BufferedReader errors)
            throws IOException
Parse the compiler error stream to produce a list of CompilerErrors

Parameters:
errors - The error stream

Returns:
The list of compiler error messages


setClasspath

public void setClasspath(String classpath)
Set the classpath to be used for this compilation
Specified by:
setClasspath in interface Compiler

Parameters:
classpath - The classpath to be used for this compilation


setDestination

public void setDestination(String destDir)
Set the name of the directory to contain the resulting object program file
Specified by:
setDestination in interface Compiler

Parameters:
destDir - The name of the directory to contain the resulting object program file


setEncoding

public void setEncoding(String encoding)
Set the encoding of the input source file or null to use the platform's default encoding
Specified by:
setEncoding in interface Compiler

Parameters:
encoding - The encoding of the input source file or null to use the platform's default encoding


setSource

public void setSource(String srcDir)
Set the name of the directory containing the source program file
Specified by:
setSource in interface Compiler

Parameters:
srcDir - The name of the directory containing the source program file


toStringArray

protected String[] toStringArray(List arguments)
Copy arguments to a string array

Parameters:
arguments - The compiler arguments

Returns:
A string array containing compilation arguments


Copyright B) 2005 Apache Web Services Project. All Rights Reserved.