|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.xml_project.morganaxproc.XProcConfiguration
public class XProcConfiguration
This class holds the configuration settings used during compilation and running
of an XProc pipeline. See the documentation for MorganaXProc
for
the meaning and the use of the different configuration settings.
To obtain a new XProcConfiguration
use
newConfiguration()
, newConfiguration(nu.xom.Element)
or newConfiguration(String uri)
.
In any case the values of the configuration settings in an XProcConfiguration
object are the result of a cascading initialization. First the default settings as described in
the documentation are attached to the settings in the XProcConfiguration
. Second,
XProcConfiguration
tries to open a file with the name specified
in DEFAULT_CONFIGURATION_FILE
from the same location as MorganaXProc.jar
. If
such a file is found, the configuration settings are overwritten by the values found in the file. Third,
if you use the newConfiguration
methods with a parameter, the configuration settings
are overwritten with the values found in the Element
or the document designated by
the uri.
Nested Class Summary | |
---|---|
static class |
XProcConfiguration.LogStyle
The possible values for logging. |
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_CONFIGURATION_FILE
The name of the default configuration file used. |
static java.lang.String |
EXTENSION_FOLDER
The name of the folder with MorganaXProc will look for extensions. |
static java.util.HashMap<java.lang.String,java.lang.String> |
KNOWN_CONNECTORS
This HashMap hold the java package names for the known connectors for xslt and xquery |
Method Summary | |
---|---|
void |
addExtensionLibrary(java.lang.String javaName)
This method tells MorganaXProc to use some piece of Java
code to extend the build-in functionality. |
void |
addXPathFunctions(FunctionPackage aPackage)
Adds a user written XPath extension functions from a FunctionPackage to the XPath context. |
boolean |
appendDebugInfoStream()
Returns the current value for AppendDebugInfoStream |
XProcConfiguration |
copy()
Creates a new XProcConfiguration object which is a verbatim copy
of the existing. |
java.util.List<XPathFunction> |
getAllXPathFunctions()
Returns a list of all currently known user written XPath extension functions coming either from addXPathFunction or addExtensionLibrary . |
java.net.URI |
getCompilerInfoStreamURI()
Returns the CompileInfoStreamURI currently used. |
nu.xom.Document |
getConfigurationDocument()
Returns the current configuration (incl. default settings) as document. |
java.lang.String |
getCurrentLanguage()
Returns the current language used in XProc as defined for p:system-property('p:language'). |
java.net.URI |
getDebugInfoStreamURI()
Returns the DebugInfoStreamURI currently used. |
static nu.xom.Document |
getDefaultConfigurationDocument()
Returns the default (factory) configuration as document. |
float |
getDefaultXPathVersion()
Returns the currently used default version of XPath. |
java.net.URI |
getDependencyMapURI()
Returns the URI to write dependency map to. |
java.net.URI |
getDocumentBaseURI()
Returns the documentBaseURI used. |
com.xml_project.morganaxproc.morganapkg.MorganaPKG |
getEXPathPackagingSystem()
Returns the EXPathPackagingSystem associated with this configuration. |
java.lang.String[] |
getExtensionLibraries()
Returns the Java class or package names of the extension libraries set for
this XProcConfiguration . |
java.lang.String |
getExtensionWrapper(java.lang.String extension)
Returns a string with the Java class name of the extension wrapper set
for the given extension. |
XProcFilesystem |
getFileSystem()
Returns the XProcFileSystem currently used. |
java.lang.Object |
getFOConnector()
Return the FOPConnector used in this configuration. |
java.lang.String |
getHTMLParserClass()
Returns the Java class name of the HTMLParserClass. |
java.lang.String |
getLogFileName()
Returns the LogFileName used. |
java.net.URI |
getLogPathURI()
Returns the LogPathURI used or null, if no uri can be found. |
XProcConfiguration.LogStyle |
getLogStyle()
Returns the current LogStyle . |
java.io.PrintStream |
getMessageStream()
Return the stream for system informations such as copyright notices. |
java.lang.String |
getMimeWrapper(java.lang.String mime)
Returns a string with the Java class name of the mime wrapper set
for the given mime. |
java.net.URI |
getPipelineFolderURI()
Returns the pipelineFolderURI used. |
java.lang.String |
getPKGRepository()
Returns the repository to use for EXPath.org's packaging system |
java.net.URI |
getPortDumperURI()
Returns the value of the uri used for port dumping. |
XProcSecurityManager |
getSecurityManager()
Returns the currently used XProcSecurityManager . |
boolean |
getSilentMode()
Returns current setting for silent mode |
boolean |
getStrictExternalBinding()
Returns true if strict external binding is used with this configuration,
otherwise false . |
java.lang.String |
getXMLCatalogFiles()
Returns the catalog files currently used for XML catalog. |
com.xml_project.morganaxproc.xmlcatalog.XMLCatalogInterface |
getXMLCatalogInterface()
Returns the current used interface to resolve uris from an XMLCatalog system. |
java.lang.Object |
getXQueryConnector()
Returns the XQueryConnector used in this configuration. |
java.lang.Object |
getXSLTConnector()
Returns the XSLTConnector used in this configuration. |
FOConnector |
makeFOPConnection(java.io.PrintWriter infoWriter)
Returns a new FOPConnector form the settings in this configuration. |
XQueryConnector |
makeXQueryConnector(java.io.PrintWriter infoWriter)
Returns a new XQueryConnector from the settings of this configuration. |
XSLTConnector |
makeXSLTConnector(java.io.PrintWriter infoWriter)
Returns a new XSLTConnector from the settings in this configuration. |
static XProcConfiguration |
newConfiguration()
Creates a new XProcConfiguration with the default settings and possibly overwritten by the values found in the default configuration file. |
static XProcConfiguration |
newConfiguration(nu.xom.Element prefs)
Creates a new XProcConfiguration with the default setting, the settings from the default configuration file (if found) and the settings from the xom element. |
static XProcConfiguration |
newConfiguration(java.lang.String uri)
Creates a new XProcConfiguration with the default settings, the settings from the default configuration file (if found) and the settings found in the xml document at the specified uri. |
static XProcConfiguration |
newConfiguration(java.lang.String[] cliTokens)
Creates a new XProcConfiguration with the default settings, the settings from the default configuration file (if found) and the settings in the cliSettings strings. |
void |
removeExtensionLibrary(java.lang.String javaName)
Removes a piece of Java previously set with addExtensionLibrary
from the list of used extensions. |
void |
removeXPathFunctions(FunctionPackage aPackage)
Removes a user written XPath extension function in a FunctionPackage from the XPath context. |
void |
setCompilerInfoStreamURI(java.net.URI aCompilerStreamURI)
Sets the CompileInfoStreamURI to be used. |
void |
setConfiguration(nu.xom.Element prefs)
Overwrites the setting in the XProcConfiguration with the value
found in the prefs element. |
void |
setConfiguration(java.lang.String uri)
Overwrites the settings in the XProcConfiguration with the values
found in the xml document at the given uri. |
void |
setConfiguration(java.lang.String[] cliSettings)
Overwrites the setting in the XProcConfiguration with the values
found in the cliSettings strings. |
void |
setDebugInfoStreamAppend(boolean append)
Controls whether a new debugInfoStream is appended to an existing stream or a new is created. |
void |
setDebugInfoStreamURI(java.net.URI debugStream)
Sets the debugInfoStreamURI to be used. |
void |
setDefaultXPathVersion(float f)
Sets the default XPath version used by MorganaXProc. |
void |
setDependencyMapURI(java.net.URI uri)
Sets the URI to write dependency map to. |
void |
setDocumentBaseURI(java.net.URI uri)
Sets the documentBaseURI to be used. |
void |
setExtensionWrapper(java.lang.String extension,
java.lang.String javaClass)
Add a ExtensionWrapper for the given extension by the given Java class name. |
void |
setFileSystem(java.lang.String className)
Sets the Java class name of the XProcFileSystem
to be used. |
void |
setFileSystem(XProcFilesystem fileSystem)
Sets the XProcFileSystem to be used. |
void |
setFOConnector(FOConnector newConnector)
Sets the FO processor to use with this Configuration. |
void |
setFOConnector(java.lang.String newConnector)
Sets the FO processor to use with this Configuration. |
void |
setHTMLParserClass(java.lang.String parserClass)
Sets the Java class name of the HTMLParser class to be used. |
void |
setLogFileName(java.lang.String name)
Set the LogFileName to be used. |
void |
setLogPathURI(java.net.URI uri)
Sets the LogPathURI used. |
void |
setLogStyle(XProcConfiguration.LogStyle s)
Sets the logStyle for this configuration. |
void |
setMessageStream(java.io.PrintStream stream)
Sets the stream where system informations such as copyright are written to |
void |
setMimeWrapper(java.lang.String mime,
java.lang.String javaClass)
Adds a MimeWrapper for the given mime by the given Java class name. |
void |
setPipelineFolderURI(java.net.URI uri)
Sets the pipelineFolderURI to be used. |
void |
setPKGRepository(java.lang.String value)
Sets the path for the repository for EXPath.org's packaging system. |
void |
setPortDumperURI(java.net.URI uri)
Sets the uri for the port dumper. |
void |
setSecurityManager(java.lang.String className)
Sets the XProcSecurityManager to be used by giving its
Java class name. |
void |
setSecurityManager(XProcSecurityManager newManager)
Sets the XProcSecurityManager to be used. |
void |
setSilentMode(boolean mode)
Switches silent mode (less outputs on console) on or off |
void |
setStrictExternalBinding(boolean v)
Sets the value strict external binding |
void |
setXMLCatalogFiles(java.lang.String files)
Sets the catalog files to be used for xml catalog (a ";" separated list). |
void |
setXQueryConnector(java.lang.String newConnector)
Set the XQuery processor to use with this Configuration. |
void |
setXQueryConnector(XQueryConnector newConnector)
Sets the XQueryConnector to use in this configuration. |
void |
setXSLTConnector(java.lang.String newConnector)
Set the XSLT processor to use with this Configuration. |
void |
setXSLTConnector(XSLTConnector newConnector)
Sets the XSLTConnector to use in this configuration. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_CONFIGURATION_FILE
MorganaXProc.jar
, the configuration settings are overwritten with the
values found in this file.
public static final java.lang.String EXTENSION_FOLDER
MorganaXProc
will look for extensions. See the
documentation for details.
public static final java.util.HashMap<java.lang.String,java.lang.String> KNOWN_CONNECTORS
Method Detail |
---|
public static final XProcConfiguration newConfiguration()
Creates a new XProcConfiguration with the default settings and possibly overwritten by the values found in the default configuration file.
public static final XProcConfiguration newConfiguration(java.lang.String uri) throws java.io.IOException, XProcSecurityException, java.net.URISyntaxException, XProcInterfaceException
Creates a new XProcConfiguration with the default settings, the settings from the default configuration file (if found) and the settings found in the xml document at the specified uri.
uri
- the uri of the xml document with the configuration or null to get default settings
java.io.IOException
- if there is ANY exception occurred in reading or parsing the configuration document.
XProcSecurityException
- if any security setting cannot be obeyed.
java.net.URISyntaxException
- if an URISyntaxException occurs with any uri settings IN the configuration
XProcInterfaceException
public static final XProcConfiguration newConfiguration(java.lang.String[] cliTokens) throws java.io.IOException, XProcSecurityException, XProcInterfaceException
Creates a new XProcConfiguration with the default settings, the settings from the
default configuration file (if found) and the settings in the cliSettings
strings.
Only tokens starting with "-mox:" are taken into account. See documentation for details.
cliTokens
- an array with configuration settings. (may be empty or null)
java.io.IOException
- if there is ANY exception occurred in reading or parsing the configuration document.
XProcSecurityException
- if any security setting cannot be obeyed.
XProcInterfaceException
- if any value is not allowed for a given optionpublic static final XProcConfiguration newConfiguration(nu.xom.Element prefs) throws java.io.IOException, XProcSecurityException, XProcInterfaceException
Creates a new XProcConfiguration with the default setting, the settings from the default configuration file (if found) and the settings from the xom element.
prefs
- a xom element in MorganaXProc's namespace and the local name config
java.io.IOException
- if there is ANY exception occurred in reading or parsing the configuration document.
XProcSecurityException
- if any security setting cannot be obeyed.
XProcInterfaceException
- if any value is not allowed for a given optionpublic XProcConfiguration copy()
Creates a new XProcConfiguration
object which is a verbatim copy
of the existing. Any change to either the new or the existing object will NOT affect
the other one.
XProcConfiguration
public static final nu.xom.Document getDefaultConfigurationDocument()
Returns the default (factory) configuration as document. See documentation for details.
public void setDefaultXPathVersion(float f)
Sets the default XPath version used by MorganaXProc. This is used, when no @xpath-version is found.
f
- the version to use. Must be a supported version.public float getDefaultXPathVersion()
Returns the currently used default version of XPath.
public nu.xom.Document getConfigurationDocument()
Returns the current configuration (incl. default settings) as document.
public void setConfiguration(java.lang.String uri) throws java.io.IOException, XProcSecurityException, java.net.URISyntaxException, XProcInterfaceException
Overwrites the settings in the XProcConfiguration
with the values
found in the xml document at the given uri.
uri
- the uri of the document.
java.io.IOException
- if there is ANY exception occurred in reading or parsing the configuration document.
XProcSecurityException
- if any security setting cannot be obeyed.
java.net.URISyntaxException
- if there is a syntax exception with any uri used in the configuration.
XProcInterfaceException
public void setConfiguration(java.lang.String[] cliSettings) throws java.io.IOException, java.net.URISyntaxException, XProcSecurityException, XProcInterfaceException
Overwrites the setting in the XProcConfiguration
with the values
found in the cliSettings
strings. Only tokens starting with "-mox:" are
taken into account. See documentation for details.
cliSettings
- the settings (or null).
java.io.IOException
- if there is ANY exception occurred in reading or parsing the configuration document.
java.net.URISyntaxException
- if there is a syntax exception with any uri used in the configuration.
XProcSecurityException
- if any security setting cannot be obeyed.
XProcInterfaceException
- if any value is not allowed for a given optionpublic void setConfiguration(nu.xom.Element prefs) throws java.io.IOException, java.net.URISyntaxException, XProcSecurityException, XProcInterfaceException
Overwrites the setting in the XProcConfiguration
with the value
found in the prefs
element.
prefs
- an element with the name config
in MorganaXProc's namespace.
java.io.IOException
- if there is ANY exception occurred in reading or parsing the configuration document.
java.net.URISyntaxException
- if there is a syntax exception with any uri used in the configuration.
XProcSecurityException
- if any security setting cannot be obeyed.
XProcInterfaceException
- if any value is not allowed for a given optionpublic void addXPathFunctions(FunctionPackage aPackage) throws XProcInterfaceException
aPackage
- the package to add (may be null).
XProcInterfaceException
- if any function is in any XProc namespace or functions
namespace uri does not conform to package's namespace uri.public void removeXPathFunctions(FunctionPackage aPackage)
aPackage
- the package to remove (may be null).public java.util.List<XPathFunction> getAllXPathFunctions() throws java.io.IOException, XPathException
addXPathFunction
or addExtensionLibrary
.
XPathException
java.io.IOException
public com.xml_project.morganaxproc.xmlcatalog.XMLCatalogInterface getXMLCatalogInterface()
public com.xml_project.morganaxproc.morganapkg.MorganaPKG getEXPathPackagingSystem() throws com.xml_project.morganaxproc.morganapkg.MorganaPKGException, java.io.IOException, XProcSecurityException
EXPathPackagingSystem
associated with this configuration.
null
if none is found.
XProcSecurityException
java.io.IOException
com.xml_project.morganaxproc.morganapkg.MorganaPKGException
public java.lang.String[] getExtensionLibraries()
Java
class or package names of the extension libraries set for
this XProcConfiguration
.
public XQueryConnector makeXQueryConnector(java.io.PrintWriter infoWriter) throws XQueryConnectorException, XPathException, java.io.IOException
XQueryConnector
from the settings of this configuration.
The current file system is used as ModuleURIResolver
and all
registered XPathFunction
s are installed.
infoWriter
- the PrintWriter
to use or null
.
XQueryConnectorException
XPathException
java.io.IOException
public FOConnector makeFOPConnection(java.io.PrintWriter infoWriter) throws com.xml_project.morganaxproc.core.XProcRuntimeException
FOPConnector
form the settings in this configuration.
infoWriter
- the PrintWriter
to use or null
.
com.xml_project.morganaxproc.core.XProcRuntimeException
public XSLTConnector makeXSLTConnector(java.io.PrintWriter infoWriter) throws com.xml_project.morganaxproc.core.XProcRuntimeException, XPathException, java.io.IOException
XSLTConnector
from the settings in this configuration.
The current file system is used as ImportURIResolver
and all
registered XPathFunction
s are installed.
infoWriter
- the PrintWriter
to use or null
.
com.xml_project.morganaxproc.core.XProcRuntimeException
XPathException
java.io.IOException
public void addExtensionLibrary(java.lang.String javaName)
MorganaXProc
to use some piece of Java
code to extend the build-in functionality. This can either be done by giving the
name of a Java
class which implements StepPackage
(as a
collection of XProc
step implementations) or the name of a Java
package name which will be looked up by MorganaXProc
for implementations of
BuildInStep
(for XProc
-steps) or for XPathFunction
for additional XPath
functions.
If javaName
is null, an empty string or "null" all previously loaded
extensions are discarded.
javaName
- a Java
class name or a Java
package name.public void removeExtensionLibrary(java.lang.String javaName)
Java
previously set with addExtensionLibrary
from the list of used extensions. Ignored if packageName
is null,
an empty string or if the javaName was not added to the list.
javaName
- a java
package name.public void setXSLTConnector(java.lang.String newConnector)
KNOWN_CONNECTORS
.
Ignored if newConnector
is null, an empty string or "null".
newConnector
- a qualified Java
class name or the name of a registered connector.public void setXSLTConnector(XSLTConnector newConnector)
newConnector
is null.
newConnector
- the new connector to use.public void setXQueryConnector(java.lang.String newConnector)
KNOWN_CONNECTORS
.
Ignored if newConnector
is null, an empty string or "null".
newConnector
- a qualified Java
class name or the name of a registered connector.public void setXQueryConnector(XQueryConnector newConnector)
newConnector
is null.
newConnector
- the new connector to use.public void setFOConnector(FOConnector newConnector)
newConnector
- the FOConnector to use. Ignored if is null.public void setFOConnector(java.lang.String newConnector)
newConnector
- qualified class name. Ignored if is "null", an empty string or null.public java.lang.String getCurrentLanguage()
public java.lang.Object getXSLTConnector()
Java
class name or an instance of
XSLTConnector
.
public java.lang.Object getXQueryConnector()
Java
class name or an instance of
XQueryConnector
.
public java.lang.Object getFOConnector()
Java
class nme or an instance of
FOPConnector
.
public void setSecurityManager(java.lang.String className) throws XProcInterfaceException
XProcSecurityManager
to be used by giving its
Java
class name. Ignored if className
is null
className
- the Java
class name of a XProcSecurityManager
.
java.io.IOException
- if any exception occures while loading the securityManager.
XProcInterfaceException
public XProcSecurityManager getSecurityManager()
XProcSecurityManager
.
public void setSecurityManager(XProcSecurityManager newManager)
XProcSecurityManager
to be used. Ignored if newManager
is null.
newManager
- the XProcSecurityManager
to be used.public boolean getSilentMode()
public void setSilentMode(boolean mode)
mode
- the new modepublic boolean getStrictExternalBinding()
true
if strict external binding is used with this configuration,
otherwise false
.
public void setStrictExternalBinding(boolean v)
v
- the new value.public void setPKGRepository(java.lang.String value)
XProcSecurityManager
associated with this XProcConfiguration
is augmented, so read access to the resources in the repository is granted.
Please mind that this only holds for repository resources in MorganaXProc
.
For a pipeline's access to the resources via "public import URI" you have to
grant access by adding an appropriate rule to the used XProcSecurityManager
.
value
- public java.lang.String getPKGRepository()
public void setPortDumperURI(java.net.URI uri)
uri
- a uri or null.public java.net.URI getPortDumperURI()
public XProcConfiguration.LogStyle getLogStyle()
LogStyle
.
LogStyle
used.public void setLogStyle(XProcConfiguration.LogStyle s)
s
- the new LogStyle
.public void setLogPathURI(java.net.URI uri)
uri
- the uri to use. If value is "null" the user home folder will be used for port dumping.public java.net.URI getLogPathURI()
public java.lang.String getLogFileName()
public void setLogFileName(java.lang.String name)
name
is null or an empty string.
name
- theLogFileName to be used.public XProcFilesystem getFileSystem()
XProcFileSystem
currently used.
XProcFileSystem
currently used.public void setPipelineFolderURI(java.net.URI uri)
uri
- an uri or null, if no pipelineFolderURI should be used.public java.net.URI getPipelineFolderURI()
public void setDocumentBaseURI(java.net.URI uri)
uri
- an uri or null, if no documentBaseURI should be used.public void setDependencyMapURI(java.net.URI uri)
uri
- the uri or null, if no dependency map should be created.public java.net.URI getDocumentBaseURI()
public void setDebugInfoStreamAppend(boolean append)
append
- true, if a new stream should be appended to the
existing stream.public void setDebugInfoStreamURI(java.net.URI debugStream)
debugStream
- an uri or null, if no debugInfoStream should be used.public void setXMLCatalogFiles(java.lang.String files)
files
- the catalog files to be used or "", if no catalog should be used.public void setCompilerInfoStreamURI(java.net.URI aCompilerStreamURI)
aCompilerStreamURI
- an uri or null, if no compilerInfoStream should be used.public java.net.URI getDebugInfoStreamURI()
public boolean appendDebugInfoStream()
public java.lang.String getXMLCatalogFiles()
public java.net.URI getCompilerInfoStreamURI()
public java.net.URI getDependencyMapURI()
public void setFileSystem(XProcFilesystem fileSystem)
XProcFileSystem
to be used. Ignored if null.
fileSystem
- the XProcFileSystem
to be used.public void setFileSystem(java.lang.String className) throws java.io.IOException
Java
class name of the XProcFileSystem
to be used. Ignored if null or an empty string.
className
- the class name of the XProcFileSystem
to be used.
java.io.IOException
- if any error occured while loading the class with the given name.public void setHTMLParserClass(java.lang.String parserClass)
Java
class name of the HTMLParser class to be used.
parserClass
- a Java
class name or null, if no parser should be used.public void setMimeWrapper(java.lang.String mime, java.lang.String javaClass)
Java
class name. Ignored if
mime
is null or an empty string or if javaClass
is null or an
empty string. Any existing association between this mime and a java class is overwritten.
If javaClass.equals("null"), any existing wrapper for this mime is removed.
If mime.equals("null") and javaClass.equals("null") all previously set MimeWrappers are discarded.
mime
- a string with a mime.javaClass
- a string with a Java
class name.public java.lang.String getMimeWrapper(java.lang.String mime)
Java
class name of the mime wrapper set
for the given mime.
mime
- the mime for which the MimeWrapper should be returned.
Java
class name or null, if no wrapper is set for
this mime.public void setExtensionWrapper(java.lang.String extension, java.lang.String javaClass)
Java
class name. Ignored
if extension
is null or an empty string or if javaClass
is null or
an empty string. Any existing associating between this extension and a java class is overwritten.
If javaClass.equals("null"), any existing wrapper for this extension is removed.
If extension.equals("null") and javaClass.equals("null") all previously set MimeWrappers are discarded.
extension
- a string with an extension.javaClass
- a string with a Java
class name.public java.lang.String getHTMLParserClass()
Java
class name of the HTMLParserClass.
Java
class name or null, if no HTMLParserClass is used.public java.lang.String getExtensionWrapper(java.lang.String extension)
Java
class name of the extension wrapper set
for the given extension.
extension
- the extension for which the ExtensionWrapper should be returned.
Java
class name or null, if no wrapper is set for
this extension.public java.io.PrintStream getMessageStream()
public void setMessageStream(java.io.PrintStream stream)
stream
- the stream (null is ignored!)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |