simple.page.compile
Class Compiler

java.lang.Object
  extended by simple.page.compile.Compiler

public class Compiler
extends java.lang.Object

The Compiler object is used to compile a translated source. This is provided the source specification for the page, which contains the class name, the runtime language, and location. This should be subclassed to support a specific language, the current languages supported are Java and Groovy.

Author:
Niall Gallagher
See Also:
GroovyCompiler, JavaCompiler

Field Summary
protected  simple.page.compile.CompilerFactory factory
          This is used to create a compiler for the specified source.
protected  simple.page.compile.CompilerLoader loader
          This is used to load the class files from the workspace.
protected  java.io.File root
          This is the build directory for the provided workspace.
 
Constructor Summary
Compiler(Workspace project)
          Constructor for the Compiler object.
 
Method Summary
 java.lang.Class compile(Source source)
          This will compile an load the specified source specificaiton.
 java.lang.Class compile(Source source, Path path)
          This will compile an load the specified source specificaiton.
 java.lang.Class load(Source source)
          This is used to load the compiled class from the project build directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected simple.page.compile.CompilerFactory factory
This is used to create a compiler for the specified source.


loader

protected simple.page.compile.CompilerLoader loader
This is used to load the class files from the workspace.


root

protected java.io.File root
This is the build directory for the provided workspace.

Constructor Detail

Compiler

public Compiler(Workspace project)
         throws java.io.IOException
Constructor for the Compiler object. This is used to create a compiler that compiles classes into the workspace build directory. This will delegate the compilation process to a subclass implementation, which can handle a specific language.

Parameters:
project - this is the project that defines the layout
Throws:
java.io.IOException
Method Detail

load

public java.lang.Class load(Source source)
                     throws java.lang.Exception
This is used to load the compiled class from the project build directory. If the JSP has not been translated and compiled this will throw an exception. If however, the source JSP was previously translated and compiled this will return the class.

Parameters:
source - this contains the details need to load the class
Returns:
returns the class definition for the compiled class
Throws:
java.lang.Exception

compile

public java.lang.Class compile(Source source)
                        throws java.lang.Exception
This will compile an load the specified source specificaiton. The provided Source object must contain the class name, the source location and the runtime language to be used. This method will delegate the compilation procedure to a class that implements this method for a specific language type.

Parameters:
source - this contains the details for the source file
Returns:
returns the class definition for the compiled class
Throws:
java.lang.Exception

compile

public java.lang.Class compile(Source source,
                               Path path)
                        throws java.lang.Exception
This will compile an load the specified source specificaiton. The provided Source object must contain the class name, the source location and the runtime language to be used. This method will delegate the compilation procedure to a class that implements this method for a specific language type.

Parameters:
source - this contains the details for the source file
path - this is the full classpath for the compiler
Returns:
returns the class definition for the compiled class
Throws:
java.lang.Exception