nu.staldal.lsp.compiler
Class LSPCompilerHelper

java.lang.Object
  extended by nu.staldal.lsp.compiler.LSPCompilerHelper

public class LSPCompilerHelper
extends java.lang.Object

Wrapper around LSPCompiler to handle reading input files and writing the result to a file.

Instances of this class may be reused, but may not be used from several threads concurrently. Create several instances if multiple threads needs to compile concurrently.

See Also:
LSPCompiler

Constructor Summary
LSPCompilerHelper()
          Create a new LSP compiler.
 
Method Summary
 boolean doCompile(java.lang.String mainPage, boolean force)
          Compiles an LSP file.
static java.lang.String getPageName(java.lang.String sourceFilename)
          Get pageName.
 void setAcceptNull(boolean acceptNull)
          Deprecated. use setAcceptUnbound(boolean) instead
 void setAcceptUnbound(boolean acceptUnbound)
          Set to true to make the compiled page accept unbound values without runtime error.
 void setEncloseFile(java.io.File encloseFile)
          Enclose to use.
 void setHtml(boolean html)
          Set to true to use html as default output type.
 void setSourcePath(java.io.File[] sourcePath)
          Where to look for imported files with relative URL:s (will search the directory where the source file is as well).
 void setStartDir(java.io.File startDir)
          Where to look for files to compile, default is current directory.
 void setTargetDir(java.io.File targetDir)
          Where to place generated files, default is current directory.
 void setXhtml(boolean xhtml)
          Deprecated. XHTML is now default, use setHtml(boolean) to override it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LSPCompilerHelper

public LSPCompilerHelper()
Create a new LSP compiler. The instance may be reused, but may not be used from several threads concurrently. Create several instances if multiple threads needs to compile concurrently.

Method Detail

doCompile

public boolean doCompile(java.lang.String mainPage,
                         boolean force)
                  throws LSPException
Compiles an LSP file. Performs dependency checking and compiles only if nessecary.

Parameters:
mainPage - the main LSP file to compile
force - force compilation, override dependency checking.
Returns:
true if page was compiled, falseotherwise
Throws:
LSPException - with an error message if unsuccessful

getPageName

public static java.lang.String getPageName(java.lang.String sourceFilename)
Get pageName.

Parameters:
sourceFilename - the source filename
Returns:
the page name

setStartDir

public void setStartDir(java.io.File startDir)
Where to look for files to compile, default is current directory.

Parameters:
startDir - the start directory

setSourcePath

public void setSourcePath(java.io.File[] sourcePath)
Where to look for imported files with relative URL:s (will search the directory where the source file is as well).

Parameters:
sourcePath - the source path

setTargetDir

public void setTargetDir(java.io.File targetDir)
Where to place generated files, default is current directory.

Parameters:
targetDir - the target directory

setEncloseFile

public void setEncloseFile(java.io.File encloseFile)
Enclose to use. Set to null to not use any enclose.

Parameters:
encloseFile - the enclose file

setXhtml

@Deprecated
public void setXhtml(boolean xhtml)
Deprecated. XHTML is now default, use setHtml(boolean) to override it.

Set to true to use xhtml as default output type.

Parameters:
xhtml -

setHtml

public void setHtml(boolean html)
Set to true to use html as default output type.

Parameters:
html -

setAcceptNull

@Deprecated
public void setAcceptNull(boolean acceptNull)
Deprecated. use setAcceptUnbound(boolean) instead

Parameters:
acceptNull -

setAcceptUnbound

public void setAcceptUnbound(boolean acceptUnbound)
Set to true to make the compiled page accept unbound values without runtime error.

Parameters:
acceptUnbound -