com.xml_project.morganaxproc
Class XProcCompiler

java.lang.Object
  extended by com.xml_project.morganaxproc.XProcCompiler

public final class XProcCompiler
extends java.lang.Object

An XProcCompiler is used to compile an XProc pipeline to an executable form, i.e. transform an XProcSource object into an XProcPipeline object.

An XProcCompiler object can be obtained by calling XProcEngine.newCompiler.

The compiler may be used to compile multiple XProc pipelines. Changes to the configuration do not apply to XProc pipelines already compiled.


Nested Class Summary
static class XProcCompiler.CompilationModes
          An enumeration of the possible compilation modes of an XProcCompiler
 class XProcCompiler.XProcCompilerException
           An Exception thrown when a compilation error has occurred calling compile
 
Field Summary
static java.lang.String EXTERNAL_STEPS_NAME
          A constant holding the step name used for external port bindings.
static boolean PIPELINE_MODE
          A constant used to flag compilation of p:pipeline as opposed to p:declare-step.
static java.lang.String XML_NAMESPACE
          A constant holding the namespace uri for xml
static java.lang.String XPROC_ERROR_NAMESPACE
          A constant holding the namespace uri for xproc errors.
static java.lang.String XPROC_NAMESPACE
          A constant holding the namespace uri for xproc.
static java.lang.String XPROC_STEP_NAMESPACE
          A constant holding the namespace uri for xproc steps.
 
Method Summary
 XProcPipeline compile(XProcSource pipelineSource)
           Compiles the XProc pipeline delivered as an XProcSource, i.e. transforms it into an XProcPipeline object which can be executed.
 XProcLibrary compileLibrary(XProcSource librarySource)
           Compiles an XProc library delivered as an XProcSource, i.e. transforms it into an XProcLibrary object, from which the steps in the library can be called.
 XProcConfiguration getConfiguration()
           Returns the XProcConfiguration currently used.
 XProcEngine getEngine()
           Returns the XProcEngine used to generate this XProcCompiler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XPROC_NAMESPACE

public static final java.lang.String XPROC_NAMESPACE
A constant holding the namespace uri for xproc.

See Also:
Constant Field Values

XPROC_STEP_NAMESPACE

public static final java.lang.String XPROC_STEP_NAMESPACE
A constant holding the namespace uri for xproc steps.

See Also:
Constant Field Values

XPROC_ERROR_NAMESPACE

public static final java.lang.String XPROC_ERROR_NAMESPACE
A constant holding the namespace uri for xproc errors.

See Also:
Constant Field Values

XML_NAMESPACE

public static final java.lang.String XML_NAMESPACE
A constant holding the namespace uri for xml

See Also:
Constant Field Values

EXTERNAL_STEPS_NAME

public static final java.lang.String EXTERNAL_STEPS_NAME
A constant holding the step name used for external port bindings.

See Also:
Constant Field Values

PIPELINE_MODE

public static final boolean PIPELINE_MODE
A constant used to flag compilation of p:pipeline as opposed to p:declare-step.

See Also:
Constant Field Values
Method Detail

getEngine

public XProcEngine getEngine()

Returns the XProcEngine used to generate this XProcCompiler.

Please mind that the XProcConfiguration object hold by XProcEngine might have changed since generation of the compiler.

Returns:
the XProcEngine used to generate this XProcCompiler.

compile

public XProcPipeline compile(XProcSource pipelineSource)
                      throws XProcCompiler.XProcCompilerException,
                             java.io.IOException,
                             XProcFilesystem.UnsupportedXMLVersionException,
                             XProcSecurityException

Compiles the XProc pipeline delivered as an XProcSource, i.e. transforms it into an XProcPipeline object which can be executed. The setting of "PipelineFolderURI" in XProcConfiguration is used to make relative uri's in XProcSource absolute.

Parameters:
pipelineSource - the XProc pipeline to be compiled.
Returns:
the executable form of the XProc pipeline.
Throws:
XProcCompiler.XProcCompilerException - if there is a compilation error.
java.io.IOException - if the XProc pipeline can not be obtained.
XProcFilesystem.UnsupportedXMLVersionException - if the XProc pipeline uses an XML version not supported.
XProcSecurityException - if running this pipeline is not allowed by the current settings of XProcSecurityManager

compileLibrary

public XProcLibrary compileLibrary(XProcSource librarySource)
                            throws XProcCompiler.XProcCompilerException,
                                   java.io.IOException,
                                   XProcFilesystem.UnsupportedXMLVersionException,
                                   XProcSecurityException

Compiles an XProc library delivered as an XProcSource, i.e. transforms it into an XProcLibrary object, from which the steps in the library can be called. The setting of "PipelineFolderURI" in XProcConfiguration is used to make relative uri's in XProcSource absolute.

Parameters:
librarySource - the XProc library to be compiled
Returns:
an XProcLibrary representing the compiled library.
Throws:
XProcCompiler.XProcCompilerException - if there is a compilation error.
java.io.IOException - if the XProc library can not be obtained.
XProcFilesystem.UnsupportedXMLVersionException - if the XProc library uses an XML version not supported.
XProcSecurityException - if running this library is not allowed by the current settings of XProcSecurityManager

getConfiguration

public XProcConfiguration getConfiguration()

Returns the XProcConfiguration currently used.

Returns:
the XProcConfiguration currently used.