Class AbstractCompiler

java.lang.Object
org.apache.axis.components.compiler.AbstractCompiler
All Implemented Interfaces:
Compiler
Direct Known Subclasses:
Javac, Jikes

public abstract class AbstractCompiler extends Object implements Compiler
This class implements the functionality common to all Java compilers.
Since:
2.0
Author:
Davanum Srinivas, Stefano Mazzocchi
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
    The classpath to be used for compilation
    protected String
    The name of the directory to contain the resulting object program file
    protected String
    The encoding of the source program or null to use the platform's default encoding
    protected InputStream
    The input stream to output compilation errors
    protected ArrayList
    The source program filenames
    protected String
    The name of the directory containing the source program file
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    Return the list of errors generated by this compilation
    protected abstract List
    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
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.axis.components.compiler.Compiler

    compile
  • Field Details

    • fileList

      protected ArrayList fileList
      The source program filenames
    • srcDir

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

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

      protected String classpath
      The classpath to be used for compilation
    • 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
  • Constructor Details

    • AbstractCompiler

      public AbstractCompiler()
  • 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
    • 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
    • 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
    • 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
    • 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
    • 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
      Throws:
      IOException - If an error occurs during message collection
    • parseStream

      protected abstract 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
      Throws:
      IOException - If an error occurs during message collection
    • 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
    • toStringArray

      protected String[] toStringArray(List arguments)
      Copy arguments to a string array
      Parameters:
      arguments - The compiler arguments
      Returns:
      A string array containing compilation arguments