simple.page
Class Workspace

java.lang.Object
  extended by simple.page.Workspace

public class Workspace
extends java.lang.Object

The Workspace object is used to specify the source and build context for the JSP translation and compilation process. This allows the source files, that is, the JSP sources, and build files to be acquired by the JSP engine. The build files, are the Java or Groovy sources, and the class files compiled. Typically these will be located within a WEB-INF directory in the source root, however, the workspace can be configured to use any directory.

Author:
Niall Gallagher

Constructor Summary
Workspace(Context source)
          Constructor for the Workspace object.
Workspace(Context source, java.lang.String name)
          Constructor for the Workspace object.
Workspace(Context source, java.lang.String name, java.io.File base)
          Constructor for the Workspace object.
Workspace(Context source, java.lang.String name, java.lang.String base)
          Constructor for the Workspace object.
 
Method Summary
 java.io.File getBuildFile(java.lang.String target)
          This acquires a file for the specified build location.
 java.io.File getBuildPath()
          This provides the root path for the build directory.
 java.lang.String getDirectory(java.lang.String target)
          This will acquire the directory as acquired from the JSP source context.
 java.lang.String getName()
          This provides the name of this JSP project workspace.
 java.io.File getSourceFile(java.lang.String target)
          This acquires a file for the specified JSP source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Workspace

public Workspace(Context source)
          throws java.io.IOException
Constructor for the Workspace object. This uses a JSP context root to create a default configuration. With this the translated sources and compiled classes are written to the WEB-INF directory within the context root directory.

Parameters:
source - specifies the location for the JSP sources
Throws:
java.io.IOException

Workspace

public Workspace(Context source,
                 java.lang.String name)
          throws java.io.IOException
Constructor for the Workspace object. This uses a JSP context root to create a default configuration. With this the translated sources and compiled classes are written to the WEB-INF directory within the context root directory.

Parameters:
source - specifies the location for the JSP sources
name - this is the name of this JSP project workspace
Throws:
java.io.IOException

Workspace

public Workspace(Context source,
                 java.lang.String name,
                 java.lang.String base)
          throws java.io.IOException
Constructor for the Workspace object. This uses a JSP context root to create a default configuration. With this constructor the sources are acquired from the provided context and the build files are written, within the context, to the specified directory. This is used to modify the default WEB-INF.

Parameters:
source - this is the location JSP sources are taken from
name - this is the name of this JSP project workspace
base - this is the context to write the build files to
Throws:
java.io.IOException

Workspace

public Workspace(Context source,
                 java.lang.String name,
                 java.io.File base)
          throws java.io.IOException
Constructor for the Workspace object. This uses a JSP context root to create a default configuration. With this constructor the sources are acquired from the provided context and the build files are written to the directory specified. This is used to store the build files out side the JSP context.

Parameters:
source - this is the location JSP sources are taken from
name - this is the name of this JSP project workspace
base - this is the context to write the build files to
Throws:
java.io.IOException
Method Detail

getDirectory

public java.lang.String getDirectory(java.lang.String target)
This will acquire the directory as acquired from the JSP source context. This is used to determine the souce context for any JSP files included recursively. For example "/some/path/File.jsp" will be converted into "/some/path/" by this method.

Parameters:
target - this is the location of the JSP source file
Returns:
this returns the directory the source file resides in

getSourceFile

public java.io.File getSourceFile(java.lang.String target)
This acquires a file for the specified JSP source. This will look in the JSP source context only. The target must be a full and absolute path reference, that is, "../Path" is illegal.

Parameters:
target - this is an absolute URI path to the source
Returns:
this returns the OS file system reference to the file

getBuildFile

public java.io.File getBuildFile(java.lang.String target)
This acquires a file for the specified build location. This will acquire the build file from the build directory used. This must be an absolute path reference, that is "../Path" is illegal.

Parameters:
target - this is an absolute URI path to the build file
Returns:
this returns the OS file system reference to the file

getBuildPath

public java.io.File getBuildPath()
This provides the root path for the build directory. This is used to locate the directory where the Ant compile task is to be executed. All files within this directory are compiled.

Returns:
this returns the root file for the build directory

getName

public java.lang.String getName()
This provides the name of this JSP project workspace. The name provides a unique identity for the workspace, it must be a valid Java package prefix as it is appended to all generated pages sources. For example a workspace name of "example" would translate "/demo/File.jsp" to the class "example.demo.File"

Returns:
this is the name of this JSP project workspace