Qizx fe-4.4p2 API

com.qizx.api
Class XQuerySessionManager

java.lang.Object
  extended by com.qizx.api.XQuerySessionManager

public class XQuerySessionManager
extends Object

Manager of simple XQuery sessions without access to a XML Library.

Provides a cache of Modules and a cache of transient documents, shared among the sessions created on this manager. This cache avoids reparsing XML documents if different sessions access it. It can detect a change on documents stored in the file-system and reload the document.


Constructor Summary
XQuerySessionManager(ModuleResolver moduleResolver, int transientDocumentCacheSize)
          Creates a session manager.
XQuerySessionManager(URL moduleBaseURI)
          Creates a session manager with a default Module Resolver and a default cache for parsed documents.
 
Method Summary
static void bind(XQuerySession session, String prefix, Class classe)
           
 boolean configure(Configuration.Property property, Object value)
          Configures a XQuerySessionManager with a Property.
 void configure(Map<Configuration.Property,Object> setup)
          (Internal use)
 void configure(Properties properties)
          Configures a XQuerySessionManager with a set of properties.
 XQuerySession createSession()
          Creates a new XQuery session.
 XQuerySession findSession(int id)
          Finds a session by its public identifier.
 Map<Configuration.Property,Object> getConfiguration()
          Gets the current configuration properties of the Session Manager.
 com.qizx.xdm.DocumentPool getDocumentCache()
          For internal use.
 FullTextFactory getFullTextFactory()
           
 com.qizx.xquery.ModuleManager getModuleManager()
          For internal use.
 ModuleResolver getModuleResolver()
          Returns the current Resolver of XQuery modules.
 long getTransientDocumentCacheSize()
          Gets the current maximum memory size for the document cache.
 List<XQuerySession> listSessions()
           
 void setDocumentCache(com.qizx.xdm.DocumentPool documentCache)
          For internal use.
 void setFullTextFactory(FullTextFactory factory)
           
 void setModuleResolver(ModuleResolver resolver)
          Defines a resolver of XQuery modules.
 long setTransientDocumentCacheSize(long size)
          Sets the maximum memory size for the document cache.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XQuerySessionManager

public XQuerySessionManager(URL moduleBaseURI)
Creates a session manager with a default Module Resolver and a default cache for parsed documents.

Attention: this method does not inherit setup from Configuration. It is likely to be deprecated in the future.

Parameters:
moduleBaseURI - base URI for the default Module Resolver

XQuerySessionManager

public XQuerySessionManager(ModuleResolver moduleResolver,
                            int transientDocumentCacheSize)
Creates a session manager.

Attention: this method does not inherit setup from Configuration. It is likely to be deprecated in the future.

Parameters:
moduleResolver - resolver used for modules
transientDocumentCacheSize - size in bytes of the document cache
Method Detail

getConfiguration

public Map<Configuration.Property,Object> getConfiguration()
Gets the current configuration properties of the Session Manager.

Returns:
a mapping of configuration Property descriptors to values.

configure

public void configure(Properties properties)
               throws QizxException
Configures a XQuerySessionManager with a set of properties.

Parameters:
properties - a set of properties. Recognized properties are:
  • "TRANSIENT_DOCUMENT_CACHE_SIZE": the value must represent an integer number of bytes. This is equivalent to calling setTransientDocumentCacheSize.
  • "CONTENT_IMPORTERS": a comma-separated list of classes that can be used for importing miscellaneous content formats into an XML Library. These classes must implement ContentImporter.
Throws:
QizxException -

When one or several invalid property values are specified. An invalid value does not prevent valid properties to be taken into account.

Since:
4.2

configure

public void configure(Map<Configuration.Property,Object> setup)
               throws Exception
(Internal use)

Throws:
Exception

configure

public boolean configure(Configuration.Property property,
                         Object value)
                  throws Exception
Configures a XQuerySessionManager with a Property.

Parameters:
property - a Property. Recognized properties are:
value - see each Property
Returns:
true if Property is recognized.
Throws:
Exception

createSession

public XQuerySession createSession()
Creates a new XQuery session.

Returns:
a new XQuery session using the resources of this session manager

listSessions

public List<XQuerySession> listSessions()

findSession

public XQuerySession findSession(int id)
Finds a session by its public identifier.

Parameters:
id - a public identifier returned by XQuerySession.getIdentifier().
Returns:
a session, or null if not found.
Since:
4.4

getModuleManager

public com.qizx.xquery.ModuleManager getModuleManager()
For internal use.


setTransientDocumentCacheSize

public long setTransientDocumentCacheSize(long size)
Sets the maximum memory size for the document cache. The document cache stores transient documents which are parsed in memory.

Parameters:
size - maximum memory size in bytes. Decreasing this size will flush the cache accordingly.
Returns:
the former maximum memory size in bytes

getTransientDocumentCacheSize

public long getTransientDocumentCacheSize()
Gets the current maximum memory size for the document cache.

Returns:
a size in bytes

getDocumentCache

public com.qizx.xdm.DocumentPool getDocumentCache()
For internal use.


setDocumentCache

public void setDocumentCache(com.qizx.xdm.DocumentPool documentCache)
For internal use.


setModuleResolver

public void setModuleResolver(ModuleResolver resolver)
Defines a resolver of XQuery modules.

Parameters:
resolver - a module resolver

getModuleResolver

public ModuleResolver getModuleResolver()
Returns the current Resolver of XQuery modules.

Returns:
the current module resolver

getFullTextFactory

public FullTextFactory getFullTextFactory()

setFullTextFactory

public void setFullTextFactory(FullTextFactory factory)

bind

public static void bind(XQuerySession session,
                        String prefix,
                        Class classe)

© 2010 Axyana Software