Berkeley DB XML
version 2.3.10

com.sleepycat.dbxml
Class XmlResolver

java.lang.Object
  extended by com.sleepycat.dbxml.XmlResolver

public class XmlResolver
extends Object

Provides an unimplemented base class that is used for file resolution policy. Implementations of this class are used for URI resolution, or for public and system ids resolution. XmlResolver implementations are identified for use using XmlManager.registerResolver(com.sleepycat.dbxml.XmlResolver).

The XmlResolver class allows applications to provide named access to application-specific objects, such as documents, collections of documents, DTDs, and XML schema. Berkeley DB XML can resolve references to names within a container, or a file system; applications can create XmlResolver instances that can resolve entities in other locations.

For an example of an XmlResolver implementation, see the Berkeley DB XML distribution file test/cpp/util/TestResolver.cpp.

If an application uses multiple threads, custom implementations of XmlResolver must be free threaded, and allow multiple, simultaneous calls for resolution.


Constructor Summary
XmlResolver()
           
 
Method Summary
 void delete()
          Free the native resources associated with this object.
 boolean resolveCollection(XmlTransaction txn, XmlManager mgr, String uri, XmlResults result)
          When implemented, should resolve a URI to an XmlResults.
 boolean resolveDocument(XmlTransaction txn, XmlManager mgr, String uri, XmlValue result)
          When implemented, should resolve a URI to an XmlValue.
 XmlInputStream resolveEntity(XmlTransaction txn, XmlManager mgr, String systemId, String publicId)
          When implemented, should resolve a System ID and Public ID to a new XmlInputStream.
 XmlInputStream resolveModule(XmlTransaction txn, XmlManager mgr, String moduleLocation, String namespace)
          When implemented, should resolve a module location and namespace to a new XmlInputStream.
 boolean resolveModuleLocation(XmlTransaction txn, XmlManager mgr, String nameSpace, XmlResults result)
          When implemented, should resolve a module namespace to list of strings that are locations for the files that comprise the module.
 XmlInputStream resolveSchema(XmlTransaction txn, XmlManager mgr, String schemaLocation, String nameSpace)
          When implemented, should resolve schema location and namespace information to a new XmlInputStream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlResolver

public XmlResolver()
Method Detail

delete

public void delete()
Free the native resources associated with this object.


resolveCollection

public boolean resolveCollection(XmlTransaction txn,
                                 XmlManager mgr,
                                 String uri,
                                 XmlResults result)
                          throws XmlException
When implemented, should resolve a URI to an XmlResults. If the URI cannot be resolved by this resolver, this method should return false. Otherwise, it should return true.

Parameters:
txn - If a transaction is in force, a pointer to the XmlTransaction object; otherwise, null.
mgr - The XmlManager object associated with the operation.
uri - The URI to resolve.
result - The XmlResults object in which the results of the resolution are to be placed.
Throws:
XmlException

resolveDocument

public boolean resolveDocument(XmlTransaction txn,
                               XmlManager mgr,
                               String uri,
                               XmlValue result)
                        throws XmlException
When implemented, should resolve a URI to an XmlValue. If the URI cannot be resolved by this resolver, this method should return false. Otherwise, it should return true.

Parameters:
txn - If a transaction is in force, a pointer to the XmlTransaction object; otherwise, null.
mgr - The XmlManager object associated with the operation.
uri - The URI to resolve.
result - The XmlValue object in which the results of the resolution are to be placed.
Throws:
XmlException

resolveEntity

public XmlInputStream resolveEntity(XmlTransaction txn,
                                    XmlManager mgr,
                                    String systemId,
                                    String publicId)
                             throws XmlException
When implemented, should resolve a System ID and Public ID to a new XmlInputStream. If the IDs cannot be resolved by this resolver, this method should return null. The XmlInputStream object will be deleted by the caller.

Parameters:
txn - If a transaction is in force, a pointer to the XmlTransaction object; otherwise, null.
mgr - The XmlManager object associated with the operation.
systemId - The System ID to resolve.
publicId - The Public ID to resolve.
Returns:
A stream containing the results of the resolution.
Throws:
XmlException

resolveSchema

public XmlInputStream resolveSchema(XmlTransaction txn,
                                    XmlManager mgr,
                                    String schemaLocation,
                                    String nameSpace)
                             throws XmlException
When implemented, should resolve schema location and namespace information to a new XmlInputStream. If this information cannot be resolved by this resolver, this method should return null. The XmlInputStream object will be deleted by the caller.

Parameters:
txn - If a transaction is in force, a pointer to the XmlTransaction object; otherwise, null.
mgr - The XmlManager object associated with the operation.
schemaLocation - The location where the schema resides.
nameSpace - The namespace used by the schema.
Returns:
A stream containing the results of the resolution.
Throws:
XmlException

resolveModule

public XmlInputStream resolveModule(XmlTransaction txn,
                                    XmlManager mgr,
                                    String moduleLocation,
                                    String namespace)
                             throws XmlException
When implemented, should resolve a module location and namespace to a new XmlInputStream. If the location and namespace cannot be resolved by this resolver, this method should return null. The XmlInputStream object will be deleted by the caller.

Parameters:
txn - If a transaction is in force, a pointer to the XmlTransaction object; otherwise, null.
mgr - The XmlManager object associated with the operation.
moduleLocation - The location of the module to resolve.
namespace - The namespace of the module to resolve.
Returns:
A stream containing the results of the resolution.
Throws:
XmlException

resolveModuleLocation

public boolean resolveModuleLocation(XmlTransaction txn,
                                     XmlManager mgr,
                                     String nameSpace,
                                     XmlResults result)
                              throws XmlException
When implemented, should resolve a module namespace to list of strings that are locations for the files that comprise the module. The strings are returned as XmlValue objects in an XmlResults object. If the module namespace cannot be resolved by this resolver, this method should return false. Otherwise, it should return true.

Parameters:
txn - If a transaction is in force, a pointer to the XmlTransaction object; otherwise, null.
mgr - The XmlManager object associated with the operation.
nameSpace - The module namespace to resolve.
result - The XmlResults object in which the results of the resolution are to be placed.
Throws:
XmlException

Berkeley DB XML
version 2.3.10

Copyright 1996,2007 Oracle. All rights reserved.