Qizx/open API

net.axyana.qizxopen.xquery
Class XQueryBasicEngine

java.lang.Object
  extended bynet.axyana.qizxopen.xquery.XQueryBasicEngine
All Implemented Interfaces:
java.rmi.Remote, XQueryServer

public class XQueryBasicEngine
extends java.lang.Object
implements XQueryServer

An implementation of a XQuery system.

In standalone applications, this is the first object to create in order to obtain a XQueryConnection, which is the primary interface for XQuery applications.

An XQuery Engine manages several categories of resources. These resources are shared by the connections created from it:


Field Summary
static Namespace EXTENSIONS_NS
          Namespace of extension functions.
static java.lang.String EXTENSIONS_URI
          Namespace URI of extension functions.
static net.axyana.qizxopen.xquery.impl.PredefinedModule PREDEFINED_MODULE
          Shared predefined module with extensions.
 
Constructor Summary
XQueryBasicEngine()
          Creates an Engine equipped with a DocumentManager, a XQuery Module Manager, and a Library Engine, all these objects using the current directory as base location.
 
Method Summary
 void authorizeClass(java.lang.String className)
          Allow a Java class to be used as extension (more precisely, its public methods can be called as extension functions).
 XQueryConnection getConnection(java.util.Properties properties)
          Opens a new connection without access to an XML Library.
 XQueryConnection getConnection(java.lang.String libraryPath, java.util.Properties properties)
          Opens a new connection to a particular XML Library.
 XQueryDataSource getDataSource(java.lang.String libraryPath)
          Creates a XQueryDataSource
 DocumentManager getDocumentManager()
          Returns the DocumentManager currently in use.
 XQModuleManager getModuleManager()
          Returns the DocumentManager currently in use.
 XQMetadata getProductInfo()
          Returns an object describing the XQuery Engine (Similar to XQMetaData in the XQJ specification).
 boolean isServer()
          Returns true if startAsServer() was used.
static XQueryServer remoteConnection(java.lang.String uri)
          Convenience method for connecting to a remote XQuery server.
 void setDocumentManager(DocumentManager value)
          Changes the DocumentManager used.
 void setModuleManager(XQModuleManager value)
          Changes the ModuleManager used.
 void shutdown(int gracePeriod, boolean forceExit)
          Releases all resources, closes all active connections.
 void startAsServer(int port)
          Makes the server accessible for Java RMI remote connections.
 void startup()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTENSIONS_URI

public static java.lang.String EXTENSIONS_URI
Namespace URI of extension functions.


EXTENSIONS_NS

public static Namespace EXTENSIONS_NS
Namespace of extension functions.


PREDEFINED_MODULE

public static net.axyana.qizxopen.xquery.impl.PredefinedModule PREDEFINED_MODULE
Shared predefined module with extensions.

Constructor Detail

XQueryBasicEngine

public XQueryBasicEngine()
                  throws java.io.IOException
Creates an Engine equipped with a DocumentManager, a XQuery Module Manager, and a Library Engine, all these objects using the current directory as base location.

Further configuration must be performed by retrieving these objects and configuring them individually.

Method Detail

remoteConnection

public static XQueryServer remoteConnection(java.lang.String uri)
                                     throws XQueryException
Convenience method for connecting to a remote XQuery server.

Parameters:
uri - URI or name of a XQuest server. It can be a simple name or an URI of the form //remote_host[:registry_port]/name.
Returns:
a handle to a XQuestServer
Throws:
XQueryException

startAsServer

public void startAsServer(int port)
                   throws XQueryException,
                          java.rmi.RemoteException
Makes the server accessible for Java RMI remote connections.

Parameters:
port - a specific port, or generally 0 if the port is managed by the RMI registry.
Throws:
XQueryException
java.rmi.RemoteException

isServer

public boolean isServer()
Returns true if startAsServer() was used.


startup

public void startup()
             throws XQueryException
Throws:
XQueryException

getDocumentManager

public DocumentManager getDocumentManager()
Returns the DocumentManager currently in use.


setDocumentManager

public void setDocumentManager(DocumentManager value)
Changes the DocumentManager used. Should not be done after opening connections.


getModuleManager

public XQModuleManager getModuleManager()
Returns the DocumentManager currently in use.


setModuleManager

public void setModuleManager(XQModuleManager value)
Changes the ModuleManager used.


authorizeClass

public void authorizeClass(java.lang.String className)
Allow a Java class to be used as extension (more precisely, its public methods can be called as extension functions).

Caution: This is a security feature. Using this method enforces an explicit control: all classes to be used as extensions must then be explicitly declared. By default, any accessible class can be used.

Parameters:
className - fully qualified name of Java class, for example
java.io.File

getConnection

public XQueryConnection getConnection(java.util.Properties properties)
                               throws XQueryException,
                                      java.rmi.RemoteException
Description copied from interface: XQueryServer
Opens a new connection without access to an XML Library.

Access to XML Libraries is still possible provided that there is a XMLLibraryServer and access rights are granted.

Specified by:
getConnection in interface XQueryServer
Parameters:
properties - a set of named properties for authentification and configuration purpose. May be null if no authentification enforced.
Throws:
XQueryException
java.rmi.RemoteException

getConnection

public XQueryConnection getConnection(java.lang.String libraryPath,
                                      java.util.Properties properties)
                               throws XQueryException,
                                      java.rmi.RemoteException
Opens a new connection to a particular XML Library.

This Library becomes the default one. Access to other Libraries controlled by the same XMLLibraryEngine is possible if access rights are granted.

Specified by:
getConnection in interface XQueryServer
Throws:
XQueryException
java.rmi.RemoteException

shutdown

public void shutdown(int gracePeriod,
                     boolean forceExit)
              throws java.rmi.RemoteException
Releases all resources, closes all active connections.

Parameters:
gracePeriod - time in milliseconds allowed for connections to commit pending transactions.
forceExit - if true, force a System exit (in fact, call the overriddable method exitHook() of the engine.
Throws:
java.rmi.RemoteException

getProductInfo

public XQMetadata getProductInfo()
Returns an object describing the XQuery Engine (Similar to XQMetaData in the XQJ specification).

Specified by:
getProductInfo in interface XQueryServer

getDataSource

public XQueryDataSource getDataSource(java.lang.String libraryPath)
                               throws XQueryException
Description copied from interface: XQueryServer
Creates a XQueryDataSource

Specified by:
getDataSource in interface XQueryServer
Throws:
XQueryException

© 2005 Axyana Software