Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.cantaloop.cgimlet.lang.java
Class JCompiler  view JCompiler download JCompiler.java

java.lang.Object
  extended byorg.cantaloop.cgimlet.lang.java.JCompiler
All Implemented Interfaces:
org.cantaloop.cgimlet.lang.CodeCompiler

public class JCompiler
extends java.lang.Object
implements org.cantaloop.cgimlet.lang.CodeCompiler


Field Summary
private  java.util.List m_classpath
           
private  boolean m_forceToolsJar
           
private  org.cantaloop.tools.logging.Logger m_logger
           
private  java.io.File m_targetDir
           
private  boolean m_useToolsJar
           
 
Constructor Summary
JCompiler()
           
 
Method Summary
 void addToClasspath(java.io.File f)
          Addes the given file to the classpath.
private  void callJavac(java.lang.String[] args)
           
 void clearClasspath()
          Removes all entries of the classpath.
 void compile(java.io.File inputFile)
          Compiles the given file.
 void compile(java.util.List inputFiles)
          Compiles the given list of files.
 java.util.List getClasspath()
          Returns a (read-only) list with all entries of the classpath.
 org.cantaloop.tools.logging.Logger getLogger()
          Returns the logger.
private  java.lang.String getStringFromStream(java.io.InputStream in)
           
 java.io.File getTargetDir()
          Returns the target directory of this compiler.
private  void log(java.lang.String msg)
           
 void setForceToolsJar(boolean b)
          Specify if the compiler should try to invoke javac in an external process if tools.jar could not be found.
 void setLogger(org.cantaloop.tools.logging.Logger l)
          Sets the logger that should be used to log the messages of the compiler
 void setTargetDir(java.io.File targetDir)
          Sets the directory under which the compiled files should be placed.
 void setUseToolsJar(boolean b)
          Specifies if the compiler should try to use the javac compiler directly (that is, without starting another virtual machine).
private  void warn(java.lang.String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_logger

private org.cantaloop.tools.logging.Logger m_logger

m_classpath

private java.util.List m_classpath

m_targetDir

private java.io.File m_targetDir

m_useToolsJar

private boolean m_useToolsJar

m_forceToolsJar

private boolean m_forceToolsJar
Constructor Detail

JCompiler

public JCompiler()
Method Detail

log

private void log(java.lang.String msg)

warn

private void warn(java.lang.String msg)

setLogger

public void setLogger(org.cantaloop.tools.logging.Logger l)
Description copied from interface: org.cantaloop.cgimlet.lang.CodeCompiler
Sets the logger that should be used to log the messages of the compiler

Specified by:
setLogger in interface org.cantaloop.cgimlet.lang.CodeCompiler

getLogger

public org.cantaloop.tools.logging.Logger getLogger()
Description copied from interface: org.cantaloop.cgimlet.lang.CodeCompiler
Returns the logger.

Specified by:
getLogger in interface org.cantaloop.cgimlet.lang.CodeCompiler

setTargetDir

public void setTargetDir(java.io.File targetDir)
Description copied from interface: org.cantaloop.cgimlet.lang.CodeCompiler
Sets the directory under which the compiled files should be placed.

Specified by:
setTargetDir in interface org.cantaloop.cgimlet.lang.CodeCompiler

getTargetDir

public java.io.File getTargetDir()
Description copied from interface: org.cantaloop.cgimlet.lang.CodeCompiler
Returns the target directory of this compiler.

Specified by:
getTargetDir in interface org.cantaloop.cgimlet.lang.CodeCompiler

addToClasspath

public void addToClasspath(java.io.File f)
Addes the given file to the classpath. used for this compilation process.


clearClasspath

public void clearClasspath()
Removes all entries of the classpath.


getClasspath

public java.util.List getClasspath()
Returns a (read-only) list with all entries of the classpath.


setUseToolsJar

public void setUseToolsJar(boolean b)
Specifies if the compiler should try to use the javac compiler directly (that is, without starting another virtual machine). If the library tools.jar cannot be found, javac is invoked in a separate process. You should enable this option as it results in a faster compilation. The default value of this option is true.

Note: This method is mainly for testing purpose.


setForceToolsJar

public void setForceToolsJar(boolean b)
Specify if the compiler should try to invoke javac in an external process if tools.jar could not be found. This option is set to false by default.

Note: This method is mainly for testing purpose.


compile

public void compile(java.io.File inputFile)
Description copied from interface: org.cantaloop.cgimlet.lang.CodeCompiler
Compiles the given file.

Specified by:
compile in interface org.cantaloop.cgimlet.lang.CodeCompiler

compile

public void compile(java.util.List inputFiles)
Description copied from interface: org.cantaloop.cgimlet.lang.CodeCompiler
Compiles the given list of files.

Specified by:
compile in interface org.cantaloop.cgimlet.lang.CodeCompiler

callJavac

private void callJavac(java.lang.String[] args)

getStringFromStream

private java.lang.String getStringFromStream(java.io.InputStream in)
                                      throws java.io.IOException