Qizx/Open v0.4

net.xfra.qizxopen.xquery
Class ModuleManager

java.lang.Object
  |
  +--net.xfra.qizxopen.xquery.ModuleManager
All Implemented Interfaces:
javax.xml.transform.ErrorListener

public class ModuleManager
extends java.lang.Object
implements javax.xml.transform.ErrorListener

Compiles and caches XQuery modules on behalf of a XQueryProcessor.

This is a simple implementation that assumes that all modules URIs can be resolved using the same base location (any URL supported by Java). If the physical location ("at") is not specified in the "import module" declaration, then the module URI is used as follows: periods are replaced by '/' and the extension '.xqm' is appended. For example if the base URL is http://myserver.net/xqmodules, the declaration import module mod1 = "myapp.module1" will resolve the module location as http://myserver.net/xqmodules/myapp/module1.xqm

Ensures that a module is loaded only once for the same query (i.e. two indirect references to a module from the same query must yield the same object).

Can be shared by several XQueryProcessors in a multithreaded context.


Constructor Summary
ModuleManager(java.lang.String baseURI)
          Builds a Module Manager with a base location for resolution of module URIs.
ModuleManager(java.net.URL baseURL)
          Builds a Module Manager with a base location for resolution of module URIs.
 
Method Summary
 void error(javax.xml.transform.TransformerException exception)
           
 void fatalError(javax.xml.transform.TransformerException exception)
           
 javax.xml.transform.TransformerFactory getXSLTFactory()
          Gets the TransformerFactory used for XSLT transformations.
 net.xfra.qizxopen.xquery.impl.Module loadModule(net.xfra.qizxopen.xquery.impl.Module predefinedModule, java.lang.String uri, java.lang.String location, Log log)
          [Undocumented: used internally by the parser.]
 java.net.URL resolveModuleLocation(java.lang.String uri, java.lang.String location)
          Overridable method for resolving a module name and location to an actual URL.
 void setXSLTFactory(javax.xml.transform.TransformerFactory value)
          Sets the TransformerFactory used for XSLT transformations.
 void unloadAllModules()
          Unloads all modules.
 void warning(javax.xml.transform.TransformerException exception)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleManager

public ModuleManager(java.net.URL baseURL)
              throws java.io.IOException
Builds a Module Manager with a base location for resolution of module URIs.


ModuleManager

public ModuleManager(java.lang.String baseURI)
              throws java.io.IOException
Builds a Module Manager with a base location for resolution of module URIs.

Method Detail

resolveModuleLocation

public java.net.URL resolveModuleLocation(java.lang.String uri,
                                          java.lang.String location)
                                   throws java.io.IOException
Overridable method for resolving a module name and location to an actual URL.

java.io.IOException

unloadAllModules

public void unloadAllModules()
Unloads all modules. Main Queries can still refer safely to the modules.

Note: Due to possible dependencies between modules, it would be very difficult to unload a module selectively.


loadModule

public net.xfra.qizxopen.xquery.impl.Module loadModule(net.xfra.qizxopen.xquery.impl.Module predefinedModule,
                                                       java.lang.String uri,
                                                       java.lang.String location,
                                                       Log log)
                                                throws java.io.IOException,
                                                       XQueryException
[Undocumented: used internally by the parser.]

java.io.IOException
XQueryException

setXSLTFactory

public void setXSLTFactory(javax.xml.transform.TransformerFactory value)
Sets the TransformerFactory used for XSLT transformations.


getXSLTFactory

public javax.xml.transform.TransformerFactory getXSLTFactory()
Gets the TransformerFactory used for XSLT transformations. Useful for configuring the default factory.


error

public void error(javax.xml.transform.TransformerException exception)
           throws javax.xml.transform.TransformerException
Specified by:
error in interface javax.xml.transform.ErrorListener
javax.xml.transform.TransformerException

fatalError

public void fatalError(javax.xml.transform.TransformerException exception)
                throws javax.xml.transform.TransformerException
Specified by:
fatalError in interface javax.xml.transform.ErrorListener
javax.xml.transform.TransformerException

warning

public void warning(javax.xml.transform.TransformerException exception)
Specified by:
warning in interface javax.xml.transform.ErrorListener

 Copyright Xavier FRANC 2003-2004