public class XmlManager
extends java.lang.Object
The class is implemented using a handle-body idiom. When a handle is copied both handles maintain a reference to the same body.
This object is free threaded, and can be safely shared among threads in an application.
| Modifier and Type | Field and Description | 
|---|---|
| static int | CATEGORY_ALLAll messages. | 
| static int | CATEGORY_CONTAINERContainer messages. | 
| static int | CATEGORY_DICTIONARYDictionary messages. | 
| static int | CATEGORY_INDEXERIndexer messages. | 
| static int | CATEGORY_MANAGERManager messages. | 
| static int | CATEGORY_NODESTORENode storage messages. | 
| static int | CATEGORY_NONENo message category. | 
| static int | CATEGORY_OPTIMIZEROptimizer messages. | 
| static int | CATEGORY_QUERYQuery processor messages. | 
| static int | LEVEL_ALLEnable all debug levels. | 
| static int | LEVEL_DEBUGEnable program execution tracing messages. | 
| static int | LEVEL_ERROREnable fatal error messages. | 
| static int | LEVEL_INFOEnable informational messages. | 
| static int | LEVEL_NONEDisable logging. | 
| static int | LEVEL_WARNINGEnable warning messages. | 
| static java.lang.String | metaDataName_nameThe "name" of the XmlDocument name metadata item | 
| static java.lang.String | metaDataName_rootThe "name" of the root metadata item | 
| static java.lang.String | metaDataNamespace_prefixThe prefix for the built-in BDB XML metadata namespace. | 
| static java.lang.String | metaDataNamespace_uriThe URI for the built-in BDB XML metadata namespace. | 
| Constructor and Description | 
|---|
| XmlManager()Constructor that uses a private internal database environment. | 
| XmlManager(Environment dbenv,
          XmlManagerConfig config)Constructor that uses the provided  Environmentfor the
underlying environment. | 
| XmlManager(XmlManagerConfig config)Constructor that uses a private internal database environment. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | close()Close the XmlManager instance. | 
| void | compactContainer(java.lang.String name,
                XmlUpdateContext uc)Compacts the content of the container. | 
| void | compactContainer(XmlTransaction txn,
                java.lang.String name,
                XmlUpdateContext uc)Compacts the content of the container in the context of a transaction. | 
| XmlContainer | createContainer(java.lang.String name)Creates and opens a container, returning a handle to an
 XmlContainerobject. | 
| XmlContainer | createContainer(java.lang.String name,
               XmlContainerConfig config)Creates a container, returning a handle to an  XmlContainerobject. | 
| XmlContainer | createContainer(XmlTransaction txn,
               java.lang.String name)Creates and opens a container in the context of a transaction, returning a handle to an
 XmlContainerobject. | 
| XmlContainer | createContainer(XmlTransaction txn,
               java.lang.String name,
               XmlContainerConfig config)Creates a container in the scope of a transaction, returning a handle to an  XmlContainerobject. | 
| XmlDocument | createDocument()Instantiate a  XmlDocumentobject. | 
| XmlIndexLookup | createIndexLookup(XmlContainer container,
                 java.lang.String uri,
                 java.lang.String name,
                 java.lang.String index)Returns a  XmlIndexLookupobject that can be executed to perform
and index lookup on a container. | 
| XmlIndexLookup | createIndexLookup(XmlContainer container,
                 java.lang.String uri,
                 java.lang.String name,
                 java.lang.String index,
                 XmlValue value)Returns a  XmlIndexLookupobject that can be executed to perform
and index lookup on a container. | 
| XmlIndexLookup | createIndexLookup(XmlContainer container,
                 java.lang.String uri,
                 java.lang.String name,
                 java.lang.String index,
                 XmlValue value,
                 int op)Returns a  XmlIndexLookupobject that can be executed to perform
and index lookup on a container. | 
| XmlInputStream | createInputStream(java.io.InputStream is)Returns a  XmlInputStreamthat wraps aInputStream. | 
| XmlInputStream | createLocalFileInputStream(java.lang.String filename)Returns a  XmlInputStreamto the filefilename. | 
| XmlInputStream | createMemBufInputStream(java.lang.String buffer,
                       int bufLen,
                       boolean copyBuf)Returns a  XmlInputStreamfor the bufferbuffer. | 
| XmlQueryContext | createQueryContext()Creates a new  XmlQueryContext. | 
| XmlQueryContext | createQueryContext(int rt)Creates a new  XmlQueryContext. | 
| XmlQueryContext | createQueryContext(int rt,
                  int et)Creates a new  XmlQueryContext. | 
| XmlResults | createResults()Instantiates an new, empty  XmlResultsobject. | 
| XmlInputStream | createStdInInputStream()Returns an  XmlInputStreamto the console. | 
| XmlTransaction | createTransaction()Creates a new  XmlTransactionobject by callingEnvironment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig). | 
| XmlTransaction | createTransaction(Transaction toUse)Creates a new  XmlTransactionobject by adopting the provided transaction handle. | 
| XmlTransaction | createTransaction(Transaction parent,
                 TransactionConfig config)Creates a new  XmlTransactionobject by callingEnvironment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)with the supplied parent transaction. | 
| XmlUpdateContext | createUpdateContext()Instantiates a new, default,  XmlUpdateContextobject. | 
| XmlInputStream | createURLInputStream(java.lang.String baseId,
                    java.lang.String systemId)Creates an input stream to the identified URL. | 
| XmlInputStream | createURLInputStream(java.lang.String baseId,
                    java.lang.String systemId,
                    java.lang.String publicId)Creates an input stream to the identified URL. | 
| void | delete()Close the XmlManager instance. | 
| void | dumpContainer(java.lang.String name,
             java.lang.String filename)Dumps the contents of the specified container to the specified output
file. | 
| int | existsContainer(java.lang.String name)See if a container exists. | 
| static int | get_version_major()Returns the DB XML release's major version number. | 
| static int | get_version_minor()Returns the DB XML release's minor version number. | 
| static int | get_version_patch()Returns the DB XML release's patch version number. | 
| static java.lang.String | get_version_string()Returns the DB XML release's version as a string. | 
| java.lang.String | getCompression()Returns the name of the default compression algorithm. | 
| XmlContainerConfig | getDefaultContainerConfig()Gets the default configuration object used for containers opened and created by this
XmlManager object. | 
| int | getDefaultContainerType()Returns the default type used for containers opened and created by this
XmlManager object. | 
| int | getDefaultPageSize()Gets the size of the pages used to store documents in the database. | 
| int | getDefaultSequenceIncrement()Returns the integer increment to be used when pre-allocating document ids for new documents created by  XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument). | 
| Environment | getEnvironment()Returns a handle to the underlying database environment. | 
| java.lang.String | getHome()Returns the home directory for the underlying database environment. | 
| int | getImplicitTimezone()Gets the implicit timezone to be used for XQuery expressions,
     in offset in minutes from GMT. | 
| XmlManagerConfig | getManagerConfig()Gets the configuration object for this XmlManager instance. | 
| void | loadContainer(java.lang.String name,
             java.lang.String filename,
             XmlUpdateContext uc)Loads data from the specified file into the container. | 
| XmlContainer | openContainer(java.lang.String name)Opens a container, returning a handle to an  XmlContainerobject. | 
| XmlContainer | openContainer(java.lang.String name,
             XmlContainerConfig config)Opens a container, returning a handle to an  XmlContainerobject. | 
| XmlContainer | openContainer(XmlTransaction txn,
             java.lang.String name)Opens a container in the context of a transaction, returning a handle to an  XmlContainerobject. | 
| XmlContainer | openContainer(XmlTransaction txn,
             java.lang.String name,
             XmlContainerConfig config)Opens a container, returning a handle to an  XmlContainerobject. | 
| XmlQueryExpression | prepare(java.lang.String query,
       XmlQueryContext context)Compile an XQuery expression into an  XmlQueryExpressionobject. | 
| XmlQueryExpression | prepare(XmlTransaction txn,
       java.lang.String query,
       XmlQueryContext context)Compile an XQuery expression into an  XmlQueryExpressionobject. | 
| XmlResults | query(java.lang.String query,
     XmlQueryContext context)Executes a query in the context of the XmlManager object. | 
| XmlResults | query(java.lang.String query,
     XmlQueryContext context,
     XmlDocumentConfig config)Executes a query in the context of the XmlManager object. | 
| XmlResults | query(XmlTransaction txn,
     java.lang.String query,
     XmlQueryContext context)Executes a query in the context of the XmlManager object. | 
| XmlResults | query(XmlTransaction txn,
     java.lang.String query,
     XmlQueryContext context,
     XmlDocumentConfig config)Executes a query in the context of the XmlManager object. | 
| void | registerCompression(java.lang.String name,
                   XmlCompression compression)Identifies by name an  XmlCompressionobject to be used for compression. | 
| void | registerResolver(XmlResolver resolver)Identifies an  XmlResolverobject to be used for file resolution. | 
| void | reindexContainer(java.lang.String name,
                XmlContainerConfig config)Reindex a container. | 
| void | reindexContainer(java.lang.String name,
                XmlUpdateContext context,
                XmlContainerConfig config)Reindex a container. | 
| void | reindexContainer(XmlTransaction txn,
                java.lang.String name,
                XmlContainerConfig config)Reindex a container. | 
| void | reindexContainer(XmlTransaction txn,
                java.lang.String name,
                XmlUpdateContext context,
                XmlContainerConfig config)Reindex a container. | 
| void | removeContainer(java.lang.String name)Removes the underlying file for the container from the file system. | 
| void | removeContainer(XmlTransaction txn,
               java.lang.String name)Removes the underlying file for the container from the file system in the context of a transaction. | 
| void | renameContainer(java.lang.String oldName,
               java.lang.String newName)Renames the container's underlying file. | 
| void | renameContainer(XmlTransaction txn,
               java.lang.String oldName,
               java.lang.String newName)Renames the container's underlying file in the context of a transaction. | 
| void | setCompression(java.lang.String name)Sets the name of the default compression algorithm used by containers. | 
| void | setDefaultContainerConfig(XmlContainerConfig config)Sets the default configuration object used for containers opened and created by this
XmlManager object. | 
| void | setDefaultContainerType(int type)Sets the default type used for containers opened and created by this
XmlManager object. | 
| void | setDefaultPageSize(int pageSize)Sets the size of the pages
used to store documents in the database. | 
| void | setDefaultSequenceIncrement(int incr)
Sets the integer increment to be used when pre-allocating document ids for new documents created by  XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument). | 
| void | setImplicitTimezone(int tz)Sets the implicit timezone to be used for XQuery expressions | 
| static void | setLogCategory(int category,
              boolean enabled)Enable or disable a category of log messages. | 
| static void | setLogLevel(int level,
           boolean enabled)Enable or disable log messages of a given level of importance. | 
| void | truncateContainer(java.lang.String name,
                 XmlUpdateContext uc)Truncates the content of the container. | 
| void | truncateContainer(XmlTransaction txn,
                 java.lang.String name,
                 XmlUpdateContext uc)Truncates the content of the container in the context of a transaction. | 
| void | upgradeContainer(java.lang.String name,
                XmlUpdateContext context)Upgrades the container from a previous version of Berkeley DB XML, or Berkeley DB, to
the current version. | 
| void | verifyContainer(java.lang.String name,
               java.lang.String filename)Checks that the container data files are not corrupt, and optionally
writes the salvaged container data to the specified output stream. | 
| void | verifyContainer(java.lang.String name,
               java.lang.String filename,
               VerifyConfig config)Checks that the container data files are not corrupt, and optionally
writes the salvaged container data to the specified output stream. | 
public static final int LEVEL_NONE
public static final int LEVEL_DEBUG
public static final int LEVEL_INFO
public static final int LEVEL_WARNING
public static final int LEVEL_ERROR
public static final int LEVEL_ALL
public static final int CATEGORY_NONE
public static final int CATEGORY_INDEXER
public static final int CATEGORY_QUERY
public static final int CATEGORY_OPTIMIZER
public static final int CATEGORY_DICTIONARY
public static final int CATEGORY_CONTAINER
public static final int CATEGORY_NODESTORE
public static final int CATEGORY_MANAGER
public static final int CATEGORY_ALL
public static final java.lang.String metaDataNamespace_uri
public static final java.lang.String metaDataNamespace_prefix
public static final java.lang.String metaDataName_name
public static final java.lang.String metaDataName_root
public XmlManager()
           throws XmlException
Note that for this form of the constructor, the environment home is
located in either the current working directory, or in the directory
identified by the DB_HOME environment variable.
XmlExceptionpublic XmlManager(XmlManagerConfig config) throws XmlException
Note that for this form of the constructor, the environment home is
located in either the current working directory, or in the directory
identified by the DB_HOME environment variable.
config - The configuration settings for this XmlManager instance.XmlExceptionpublic XmlManager(Environment dbenv, XmlManagerConfig config) throws XmlException
Environment for the
underlying environment.  The Berkeley DB subsystems initiated by this
environment (for example, transactions, logging, the memory pool), are
the subsystems that are available to Berkeley DB XML when operations are
performed using this manager object.dbenv - The environment handle to use for the underlying database environment. The
handle provided here must be opened.config - The configuration settings for this XmlManager instance.XmlExceptionpublic void delete()
Environment
     was adopted, that is closed, as well.  This method also
     frees the native resources.public void close()
           throws XmlException
delete().XmlExceptionpublic void compactContainer(java.lang.String name,
                             XmlUpdateContext uc)
                      throws XmlException
Database.compact(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.CompactConfig)
The container must be closed; the system throws an exception if the container is open.
name - The name of the container to be compacted.uc - Update context for the operation.XmlExceptionpublic void compactContainer(XmlTransaction txn, java.lang.String name, XmlUpdateContext uc) throws XmlException
Database.compact(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.CompactConfig)
The container must be closed; the system throws an exception if the container is open.
txn - If the operation is to be transaction-protected, the txn
parameter is an XmlTransaction handle returned from
createTransaction().name - The name of the container to be compacted.uc - Update context for the operation.XmlExceptionpublic XmlContainer createContainer(java.lang.String name) throws XmlException
XmlContainer object. If the container already exists at the time
this method is called, an exception is thrown.  The
container is set up to use node-level storage unless
setDefaultContainerType(int) has been called.
Use openContainer(java.lang.String) to open a container that has
already been created.
Containers always remain open until the last handle referencing the container is destroyed.
name - The container's name. The container is created relative to the
underlying environment's home directory (see XmlManager for more
information) unless an absolute path is used for the name; in that case
the container is created in the location identified by the path.
The name provided here must be unique for the environment or an exception is thrown.
XmlExceptionpublic XmlContainer createContainer(XmlTransaction txn, java.lang.String name) throws XmlException
XmlContainer object. If the container already exists at the time
this method is called, an exception is thrown.  The
container is set up to use node-level storage unless
setDefaultContainerType(int) has been called.
Use openContainer(java.lang.String) to open a container that has
already been created.
Containers always remain open until the last handle referencing the container is destroyed.
txn - The transaction handle to use for this container creation.name - The container's name. The container is created relative to the
underlying environment's home directory (see XmlManager for more
information) unless an absolute path is used for the name; in that case
the container is created in the location identified by the path.
The name provided here must be unique for the environment or an exception is thrown.
XmlExceptionpublic XmlContainer createContainer(java.lang.String name, XmlContainerConfig config) throws XmlException
XmlContainer object.name - The container's name. The container is created relative to the
underlying environment's home directory (see XmlManager for more
information) unless an absolute path is used for the name; in that case
the container is created in the location identified by the path.
The name provided here must be unique for the environment or an exception is thrown.
config - The configuration settings for the containerXmlExceptionpublic XmlContainer createContainer(XmlTransaction txn, java.lang.String name, XmlContainerConfig config) throws XmlException
XmlContainer object.txn - The transaction handle to use for this container creation.name - The container's name. The container is created relative to the
underlying environment's home directory (see XmlManager for more
information) unless an absolute path is used for the name; in that case
the container is created in the location identified by the path.
The name provided here must be unique for the environment or an exception is thrown.
config - The configuration settings for the containerXmlExceptionpublic XmlDocument createDocument() throws XmlException
XmlDocument object.XmlExceptionpublic XmlIndexLookup createIndexLookup(XmlContainer container, java.lang.String uri, java.lang.String name, java.lang.String index, XmlValue value, int op) throws XmlException
XmlIndexLookup object that can be executed to perform
and index lookup on a container.
The constructed object can be further configured, and used with the 
XmlIndexLookup.execute(com.sleepycat.dbxml.XmlQueryContext) method to perform the lookup operation.
container - The target container for the lookup operationuri - The namespace of the node to be used.  The default namespace is 
selected by passing a null string.name - The name of the element or attribute node to be used.index - Identifies the index to be used for the lookup operation.
The value supplied here must be a valid index. See 
XmlIndexSpecification.addIndex(java.lang.String,java.lang.String,java.lang.String) 
for a description of valid index specifications, with the exceptions that
only one index can be specified, and substring indexes are not supported.value - The value to be used as the single value for an equality or 
inequality lookup, or as the lower bound of a range lookup.  An empty value is
specified using a null object.op - The comparison operation to be performed.  See XmlIndexLookup for valid operations.XmlExceptionpublic XmlIndexLookup createIndexLookup(XmlContainer container, java.lang.String uri, java.lang.String name, java.lang.String index, XmlValue value) throws XmlException
XmlIndexLookup object that can be executed to perform
and index lookup on a container.
The constructed object can be further configured, and used with the 
XmlIndexLookup.execute(com.sleepycat.dbxml.XmlQueryContext) method to perform the lookup operation.
container - The target container for the lookup operationuri - The namespace of the node to be used.  The default namespace is 
selected by passing a null string.name - The name of the element or attribute node to be used.index - Identifies the index to be used for the lookup operation.
The value supplied here must be a valid index. See 
XmlIndexSpecification.addIndex(java.lang.String,java.lang.String,java.lang.String) 
for a description of valid index specifications, with the exceptions that
only one index can be specified, and substring indexes are not supported.value - The value to be used as the single value for an equality or 
inequality lookup, or as the lower bound of a range lookup.  An empty value is
specified using a null object.XmlExceptionpublic XmlIndexLookup createIndexLookup(XmlContainer container, java.lang.String uri, java.lang.String name, java.lang.String index) throws XmlException
XmlIndexLookup object that can be executed to perform
and index lookup on a container.
The constructed object can be further configured, and used with the 
XmlIndexLookup.execute(com.sleepycat.dbxml.XmlQueryContext) method to perform the lookup operation.
container - The target container for the lookup operationuri - The namespace of the node to be used.  The default namespace is 
selected by passing a null string.name - The name of the element or attribute node to be used.index - Identifies the index to be used for the lookup operation.
The value supplied here must be a valid index. See 
XmlIndexSpecification.addIndex(java.lang.String,java.lang.String,java.lang.String) 
for a description of valid index specifications, with the exceptions that
only one index can be specified, and substring indexes are not supported.XmlExceptionpublic XmlInputStream createLocalFileInputStream(java.lang.String filename) throws XmlException
XmlInputStream to the file filename.
Use this input stream with XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument) or
XmlDocument.setContentAsXmlInputStream(com.sleepycat.dbxml.XmlInputStream).
The input stream must be passed to one of these methods, or the underlying memory will leak. It cannot be deleted from Java code. Note that there is no attempt to ensure that the file referenced contains well-formed or valid XML. Exceptions may be thrown at the time that this input stream is actually read if the stream does not contain well-formed, or valid XML.
filename - The file to which you want an input stream formed.XmlExceptionpublic XmlInputStream createMemBufInputStream(java.lang.String buffer, int bufLen, boolean copyBuf) throws XmlException
XmlInputStream for the buffer buffer.
Use this input stream with XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument) or
XmlDocument.setContentAsXmlInputStream(com.sleepycat.dbxml.XmlInputStream).
The input stream must be passed to one of these methods, or the underlying memory will leak. It cannot be deleted from Java code. Note that there is no attempt to ensure that the file referenced contains well-formed or valid XML. Exceptions may be thrown at the time that this input stream is actually read if the stream does not contain well-formed, or valid XML.
buffer - The buffer from which you want an input stream formed.bufLen - The number of bytes in buffer.  Do not include any trailing null.copyBuf - Must be true to indicate that the buffer should be copied.XmlExceptionpublic XmlInputStream createInputStream(java.io.InputStream is) throws XmlException
XmlInputStream that wraps a InputStream.
Use this input stream with XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument) or
XmlDocument.setContentAsXmlInputStream(com.sleepycat.dbxml.XmlInputStream).
The input stream must be passed to one of these methods, or the underlying memory may leak. It cannot be deleted from Java code. Note that there is no attempt to ensure that the file referenced contains well-formed or valid XML. Exceptions may be thrown at the time that this input stream is actually read if the stream does not contain well-formed, or valid XML.
is - a java.io.InputStream from which the XmlInputStream should be created.XmlExceptionpublic XmlQueryContext createQueryContext(int rt, int et) throws XmlException
XmlQueryContext.rt - Specifies return type.  Must be XmlQueryContext.LiveValueset - The evaluation type must be specified as either: XmlQueryContext.Eager or XmlQueryContext.Lazy.XmlExceptionpublic XmlQueryContext createQueryContext() throws XmlException
XmlQueryContext.XmlExceptionpublic XmlQueryContext createQueryContext(int rt) throws XmlException
XmlQueryContext.rt - Specifies return type.  Must be XmlQueryContext.LiveValuesXmlExceptionpublic XmlResults createResults() throws XmlException
XmlResults object. You can then use
XmlResults.add(com.sleepycat.dbxml.XmlValue) to add XmlValue objects to this result
set.XmlExceptionpublic XmlInputStream createStdInInputStream() throws XmlException
XmlInputStream to the console.  Use this input stream
with XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument) or
XmlDocument.setContentAsXmlInputStream(com.sleepycat.dbxml.XmlInputStream).
If the input stream is passed to either of these methods, it will be adopted, and deleted. If it is not passed, it is the responsibility of the user to delete the object.
Use this input stream with XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument) or
XmlDocument.setContentAsXmlInputStream(com.sleepycat.dbxml.XmlInputStream).
XmlExceptionpublic XmlTransaction createTransaction() throws XmlException
XmlTransaction object by calling Environment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig).
If transactions were not initialized when this XmlManager object was opened then this method throws an exception.
XmlExceptionpublic XmlTransaction createTransaction(Transaction toUse) throws XmlException
XmlTransaction object by adopting the provided transaction handle.
If transactions were not initialized when this XmlManager object was opened then this method throws an exception.
toUse - A transaction handle to adopt.  If the returned XmlTransaction is not committed or aborted, the state of the underlying transaction is left unchanged. This allows a transaction to be controlled external to its XmlTransaction object.XmlExceptionpublic XmlTransaction createTransaction(Transaction parent, TransactionConfig config) throws XmlException
XmlTransaction object by calling Environment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig) with the supplied parent transaction.
If transactions were not initialized when this XmlManager object was opened then this method throws an exception.
parent - The parent transaction passed to Environment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig).config - The transaction configuration passed to Environment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig).XmlExceptionpublic XmlUpdateContext createUpdateContext() throws XmlException
XmlUpdateContext object. This
object is used for XmlContainer operations
that add, delete, and modify documents, and documents in containers.XmlExceptionpublic XmlInputStream createURLInputStream(java.lang.String baseId, java.lang.String systemId, java.lang.String publicId) throws XmlException
XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument)
or XmlDocument.setContentAsXmlInputStream(com.sleepycat.dbxml.XmlInputStream).
If the input stream is passed to either of these methods, it will be adopted, and deleted. If it is not passed, it is the responsibility of the user to delete the object. Note that there is no attempt to ensure that the URI referenced contains well-formed or valid XML. Exceptions may be thrown at the time that this input stream is actually read if the stream does not contain well-formed, or valid XML.
baseId - The base ID to use for this URL.systemId - The system ID to use for this URL.publicId - The public ID to use for this URL.XmlExceptionpublic XmlInputStream createURLInputStream(java.lang.String baseId, java.lang.String systemId) throws XmlException
XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument)
or XmlDocument.setContentAsXmlInputStream(com.sleepycat.dbxml.XmlInputStream).
If the input stream is passed to either of these methods, it will be adopted, and deleted. If it is not passed, it is the responsibility of the user to delete the object. Note that there is no attempt to ensure that the URI referenced contains well-formed or valid XML. Exceptions may be thrown at the time that this input stream is actually read if the stream does not contain well-formed, or valid XML.
baseId - The base ID to use for this URL.systemId - The system ID to use for this URL.XmlExceptionpublic void dumpContainer(java.lang.String name,
                          java.lang.String filename)
                   throws XmlException
loadContainer(java.lang.String, java.lang.String, com.sleepycat.dbxml.XmlUpdateContext).
The container must be closed; the system throws an exception if the container is open.
The container must be have been opened at least once; the system throws an exception if the underlying files have not yet been created.
name - The name of the container to dump.filename - The filename to which the container is to be dumped.XmlExceptionpublic int existsContainer(java.lang.String name)
                    throws XmlException
Returns 0 if the file named either does not exist or is not a container. Returns the format version if it is a valid container.
name - The name of the container.XmlExceptionpublic void setDefaultContainerConfig(XmlContainerConfig config) throws XmlException
createContainer(java.lang.String) or
openContainer(java.lang.String) is used that takes an XmlContainerConfig argument,
the settings provided using this method are ignored.config - The configuration object to use for container creation.XmlExceptionpublic XmlContainerConfig getDefaultContainerConfig() throws XmlException
XmlExceptionpublic void setCompression(java.lang.String name)
registerCompression(java.lang.String, com.sleepycat.dbxml.XmlCompression).name - The name of the compression algorithm.public java.lang.String getCompression()
public void setDefaultPageSize(int pageSize)
                        throws XmlException
This method will only affect containers created after it is set. It has no effect on existing containers.
pageSize - The page size in bytes.XmlExceptionpublic int getDefaultPageSize()
                       throws XmlException
XmlExceptionpublic void setDefaultContainerType(int type)
                             throws XmlException
createContainer(java.lang.String) or
openContainer(java.lang.String) is used that is provided with a type via XmlContainerConfig.setNodeContainer(boolean), the settings provided using this method are ignored.type - The type of container to create.  One of:
XmlContainer.NodeContainer or XmlContainer.WholedocContainer.XmlExceptionpublic int getDefaultContainerType()
                            throws XmlException
XmlContainer.NodeContainer or XmlContainer.WholedocContainer.XmlExceptionpublic int getImplicitTimezone()
                        throws XmlException
XmlExceptionpublic void setImplicitTimezone(int tz)
                         throws XmlException
tz - The offset in minutes from GMT.XmlExceptionpublic void setDefaultSequenceIncrement(int incr)
                                 throws XmlException
Sets the integer increment to be used when pre-allocating document ids for new documents created by XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument).
incr - The integer increment to use.XmlExceptionpublic int getDefaultSequenceIncrement()
                                throws XmlException
XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument).XmlExceptionpublic Environment getEnvironment() throws XmlException
XmlExceptionpublic java.lang.String getHome()
                         throws XmlException
XmlContainer files are placed relative to this directory unless
an absolute path is used for the container name.XmlExceptionpublic XmlManagerConfig getManagerConfig() throws XmlException
XmlExceptionpublic static int get_version_major()
public static int get_version_minor()
public static int get_version_patch()
public static java.lang.String get_version_string()
public void loadContainer(java.lang.String name,
                          java.lang.String filename,
                          XmlUpdateContext uc)
                   throws XmlException
The specified input stream should contain data as created by
dumpContainer(java.lang.String, java.lang.String).
The container must be closed; the system throws an exception if the container is open.
The container must be have been opened at least once; the system throws an exception if the underlying files have not yet been created.
name - The name of the container to load.filename - The filename from which the container is to be loaded.XmlExceptionpublic XmlContainer openContainer(java.lang.String name) throws XmlException
XmlContainer object.
Use createContainer(java.lang.String) to create and open a new container.
Containers always remain open until the last handle referencing the container is destroyed.
name - The container's name. The container is opened relative to the
underlying environment's home directory (see XmlManager for more
information) unless an absolute path is used for the name; in that case
the container is opened in the location identified by the path.
The name provided here must be unique for the environment or an exception is thrown.
XmlExceptionpublic XmlContainer openContainer(XmlTransaction txn, java.lang.String name) throws XmlException
XmlContainer object.
Use createContainer(java.lang.String) to create and open a new container.
Containers always remain open until the last handle referencing the container is destroyed.
txn - The transaction handle to use for this container creation.name - The container's name. The container is opened relative to the
underlying environment's home directory (see XmlManager for more
information) unless an absolute path is used for the name; in that case
the container is opened in the location identified by the path.
The name provided here must be unique for the environment or an exception is thrown.
XmlExceptionpublic XmlContainer openContainer(java.lang.String name, XmlContainerConfig config) throws XmlException
XmlContainer object.
Containers always remain open until the last handle referencing the container is destroyed.
name - The container's name. The container is opened relative to the
underlying environment's home directory (see XmlManager for more
information) unless an absolute path is used for the name; in that case
the container is opened in the location identified by the path.
The name provided here must be unique for the environment or an exception is thrown.
config - The configuration settings for the containerXmlExceptionpublic XmlContainer openContainer(XmlTransaction txn, java.lang.String name, XmlContainerConfig config) throws XmlException
XmlContainer object.
Containers always remain open until the last handle referencing the container is destroyed.
txn - The transaction handle to use for this container creation.name - The container's name. The container is opened relative to the
underlying environment's home directory (see XmlManager for more
information) unless an absolute path is used for the name; in that case
the container is opened in the location identified by the path.
The name provided here must be unique for the environment or an exception is thrown.
config - The configuration settings for the containerXmlExceptionpublic XmlQueryExpression prepare(java.lang.String query, XmlQueryContext context) throws XmlException
XmlQueryExpression object.
You can then run the XQuery expression repeatedly using
XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext).
Use this method to compile and evaluate XQuery expressions against your
XmlContainer and XmlDocument objects any time you want to evaluate the expression more than once.
Note that the scope of the query provided here can be restricted using one of the XQuery navigational functions. For example:
"collection('mycontainer.dbxml')/foo"or:
"doc('dbxml:/mycontainer.dbxml/mydoc.xml')/foo/@attr1='bar'"
The scope of a query can also be controlled by passing an appropriate
contextItem object to XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext).
query - The XQuery query string to compile.context - The XmlQueryContext to use for this query.XmlExceptionpublic XmlQueryExpression prepare(XmlTransaction txn, java.lang.String query, XmlQueryContext context) throws XmlException
XmlQueryExpression object.
You can then run the XQuery expression repeatedly using
XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext).
Use this method to compile and evaluate XQuery expressions against your
XmlContainer and XmlDocument objects any time you want to evaluate the expression more than once.
Note that the scope of the query provided here can be restricted using one of the XQuery navigational functions. For example:
"collection('mycontainer.dbxml')/foo"or:
"doc('dbxml:/mycontainer.dbxml/mydoc.xml')/foo/@attr1='bar'"
The scope of a query can also be controlled by passing an appropriate
contextItem object to XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext).
txn - If the operation is to be transaction-protected, the txn
parameter is an XmlTransaction handle returned from
createTransaction().query - The XQuery query string to compile.context - The XmlQueryContext to use for this query.XmlExceptionpublic XmlResults query(java.lang.String query, XmlQueryContext context, XmlDocumentConfig config) throws XmlException
prepare(java.lang.String, com.sleepycat.dbxml.XmlQueryContext) and then
XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext) on the prepared query.
The scope of the query can be restricted using one of the XQuery navigational functions. For example:
"collection('mycontainer.dbxml')/foo"or:
"doc('dbxml:/mycontainer.dbxml/mydoc.xml')/foo/@attr1='bar'"
The scope of a query can also be controlled by passing an appropriate
contextItem object to XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext).
Note that this method is suitable for performing one-off queries. If you
want to execute a query more than once, you should use
prepare(java.lang.String, com.sleepycat.dbxml.XmlQueryContext) to compile the expression, and then use
XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext) to run it.
This method returns an XmlResults object. You then iterate over
the results set contained in that object using XmlResults.next()
and XmlResults.previous().
For more information on querying containers and documents, see the Berkeley DB XML Getting Started Guide.
query - The XQuery query string.context - The XmlQueryContext to use for this query.config - Configuration settings for this operationXmlExceptionpublic XmlResults query(XmlTransaction txn, java.lang.String query, XmlQueryContext context, XmlDocumentConfig config) throws XmlException
prepare(java.lang.String, com.sleepycat.dbxml.XmlQueryContext) and then
XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext) on the prepared query.
The scope of the query can be restricted using one of the XQuery navigational functions. For example:
"collection('mycontainer.dbxml')/foo"or:
"doc('dbxml:/mycontainer.dbxml/mydoc.xml')/foo/@attr1='bar'"
The scope of a query can also be controlled by passing an appropriate
contextItem object to XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext).
Note that this method is suitable for performing one-off queries. If you
want to execute a query more than once, you should use
prepare(java.lang.String, com.sleepycat.dbxml.XmlQueryContext) to compile the expression, and then use
XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext) to run it.
This method returns an XmlResults object. You then iterate over
the results set contained in that object using XmlResults.next()
and XmlResults.previous().
For more information on querying containers and documents, see the Berkeley DB XML Getting Started Guide.
txn - If the operation is to be transaction-protected, the txn
parameter is an XmlTransaction handle returned from
createTransaction().query - The XQuery query string.context - The XmlQueryContext to use for this query.config - Configuration settings for this operationXmlExceptionpublic XmlResults query(java.lang.String query, XmlQueryContext context) throws XmlException
prepare(java.lang.String, com.sleepycat.dbxml.XmlQueryContext) and then
XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext) on the prepared query.
The scope of the query can be restricted using one of the XQuery navigational functions. For example:
"collection('mycontainer.dbxml')/foo"or:
"doc('dbxml:/mycontainer.dbxml/mydoc.xml')/foo/@attr1='bar'"
The scope of a query can also be controlled by passing an appropriate
contextItem object to XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext).
Note that this method is suitable for performing one-off queries. If you
want to execute a query more than once, you should use
prepare(java.lang.String, com.sleepycat.dbxml.XmlQueryContext) to compile the expression, and then use
XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext) to run it.
This method returns an XmlResults object. You then iterate over
the results set contained in that object using XmlResults.next()
and XmlResults.previous().
For more information on querying containers and documents, see the Berkeley DB XML Getting Started Guide.
query - The XQuery query string.context - The XmlQueryContext to use for this query.XmlExceptionpublic XmlResults query(XmlTransaction txn, java.lang.String query, XmlQueryContext context) throws XmlException
prepare(java.lang.String, com.sleepycat.dbxml.XmlQueryContext) and then
XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext) on the prepared query.
The scope of the query can be restricted using one of the XQuery navigational functions. For example:
"collection('mycontainer.dbxml')/foo"or:
"doc('dbxml:/mycontainer.dbxml/mydoc.xml')/foo/@attr1='bar'"
The scope of a query can also be controlled by passing an appropriate
contextItem object to XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext).
Note that this method is suitable for performing one-off queries. If you
want to execute a query more than once, you should use
prepare(java.lang.String, com.sleepycat.dbxml.XmlQueryContext) to compile the expression, and then use
XmlQueryExpression.execute(com.sleepycat.dbxml.XmlQueryContext) to run it.
This method returns an XmlResults object. You then iterate over
the results set contained in that object using XmlResults.next()
and XmlResults.previous().
For more information on querying containers and documents, see the Berkeley DB XML Getting Started Guide.
txn - If the operation is to be transaction-protected, the txn
parameter is an XmlTransaction handle returned from
createTransaction().query - The XQuery query string.context - The XmlQueryContext to use for this query.XmlExceptionpublic void registerCompression(java.lang.String name,
                                XmlCompression compression)
                         throws XmlException
XmlCompression object to be used for compression.
This object is used to compress document data before it is stored in the database and to decompress it after it is retrieved from the database.  The registered compression will be used for data in any container that is created using an XmlContainerConfig object that has the compression name set as the registered name.  When a container is created with user defined compression whenever it is opened again the user defined compression must be registered under the same name or the attempt to open the container will fail.name - The name used to identify the compression object.compression - A user implemented class that inherits from XmlCompression.XmlExceptionpublic void registerResolver(XmlResolver resolver) throws XmlException
XmlResolver object to be used for file resolution.
This object is used by the internal XML document parser to
locate data based on URIs, or public and system ids.  Custom
XmlResolver objects can be created by applications to provide a
mechanism to name and retrieve collections, documents, and XML entities
external to Berkeley DB XML.resolver - The XmlResolver instance to be used for file resolution.XmlExceptionpublic void reindexContainer(java.lang.String name,
                             XmlContainerConfig config)
                      throws XmlException
Remove indexes and reindex the container, to change the indexing mode between node-level and document-level indexes.
The container should be backed up before using this method. This method may take a very long time, depending on the size of the container, and should not be used casually.
name - The name of the container to reindexconfig - XmlContainerConfig.  For document indexes, pass null, for
node indexes, use new XmlContainerConfig().setIndexNodes(true).
See XmlContainerConfig.XmlExceptionpublic void reindexContainer(java.lang.String name,
                             XmlUpdateContext context,
                             XmlContainerConfig config)
                      throws XmlException
Remove indexes and reindex the container, to change the indexing mode between node-level and document-level indexes.
The container should be backed up before using this method. This method may take a very long time, depending on the size of the container, and should not be used casually.
name - The name of the container to reindexcontext - The update context for the opeartionconfig - XmlContainerConfig.  For document indexes, pass null, for
node indexes, use new XmlContainerConfig().setIndexNodes(true).
See XmlContainerConfig.XmlExceptionpublic void reindexContainer(XmlTransaction txn, java.lang.String name, XmlContainerConfig config) throws XmlException
Remove indexes and reindex the container, to change the indexing mode between node-level and document-level indexes.
txn - If the operation is to be transaction-protected, the txn
parameter is an XmlTransaction handle returned from
createTransaction().name - The name of the container to reindexconfig - XmlContainerConfig.  For document indexes, pass null, for
node indexes, use new XmlContainerConfig().setIndexNodes(true).
See XmlContainerConfig.XmlExceptionpublic void reindexContainer(XmlTransaction txn, java.lang.String name, XmlUpdateContext context, XmlContainerConfig config) throws XmlException
Remove indexes and reindex the container, to change the indexing mode between node-level and document-level indexes.
txn - If the operation is to be transaction-protected, the txn
parameter is an XmlTransaction handle returned from
createTransaction().name - The name of the container to reindexcontext - The update context for the opeartionconfig - XmlContainerConfig.  For document indexes, pass null, for
node indexes, use new XmlContainerConfig().setIndexNodes(true).
See XmlContainerConfig.XmlExceptionpublic void removeContainer(java.lang.String name)
                     throws XmlException
The container must be closed; the system throws an exception if the container is open.
The container must have been opened at least once; the system throws an exception if the underlying file has not yet been created.
name - The name of the container to be removed.XmlExceptionpublic void removeContainer(XmlTransaction txn, java.lang.String name) throws XmlException
The container must be closed; the system throws an exception if the container is open.
The container must have been opened at least once; the system throws an exception if the underlying file has not yet been created.
txn - If the operation is to be transaction-protected, the txn
parameter is an XmlTransaction handle returned from
createTransaction().name - The name of the container to be removed.XmlExceptionpublic void renameContainer(java.lang.String oldName,
                            java.lang.String newName)
                     throws XmlException
The container must be closed; the system throws an exception if the container is open.
The container must have been opened at least once; the system throws an exception if the underlying file has not yet been created.
oldName - The name of the container whose name you want to change.newName - The new container name.XmlExceptionpublic void renameContainer(XmlTransaction txn, java.lang.String oldName, java.lang.String newName) throws XmlException
The container must be closed; the system throws an exception if the container is open.
The container must have been opened at least once; the system throws an exception if the underlying file has not yet been created.
txn - If the operation is to be transaction-protected, the txn
parameter is an XmlTransaction handle returned fromoldName - The name of the container whose name you want to change.newName - The new container name.XmlExceptionpublic static void setLogCategory(int category,
                                  boolean enabled)
                           throws XmlException
     Berkeley DB XML can be configured to generate a stream of messages to help
application debugging. The messages are categorized by subsystem, and
by importance. The messages are sent to the output stream that is
configured in the Berkeley DB environment associated with the XmlManager
generating the message. The output is sent to System.err if no
environment is associated with the XmlManager.
category - The log category to enable or disable.  One of:
CATEGORY_INDEXER,
CATEGORY_QUERY,
CATEGORY_OPTIMIZER,
CATEGORY_DICTIONARY, 
CATEGORY_CONTAINER,
CATEGORY_NODESTORE, 
CATEGORY_MANAGER, or
CATEGORY_ALLenabled - Whether to enable or disable the category.XmlExceptionpublic static void setLogLevel(int level,
                               boolean enabled)
                        throws XmlException
     Berkeley DB XML can be configured to generate a stream of messages to help
application debugging. The messages are categorized by subsystem, and
by importance. The messages are sent to the output stream that is
configured in the Berkeley DB environment associated with the XmlManager
generating the message. The output is sent to System.err if no
environment is associated with the XmlManager.
level - The log level to enable or disable.  One of:
LEVEL_DEBUG,
LEVEL_INFO,
LEVEL_WARNING,
LEVEL_ERROR, or
LEVEL_ALL.enabled - Whether to enable or disable the importance level.XmlExceptionpublic void truncateContainer(java.lang.String name,
                              XmlUpdateContext uc)
                       throws XmlException
Database.truncate(com.sleepycat.db.Transaction, boolean)
The container must be closed; the system throws an exception if the container is open.
name - The name of the container to be truncated.uc - The update context for the operation.XmlExceptionpublic void truncateContainer(XmlTransaction txn, java.lang.String name, XmlUpdateContext uc) throws XmlException
Database.truncate(com.sleepycat.db.Transaction, boolean)
The container must be closed; the system throws an exception if the container is open.
txn - If the operation is to be transaction-protected, the txn
parameter is an XmlTransaction handle returned from
createTransaction().name - The name of the container to be truncated.uc - The update context for the operation.XmlExceptionpublic void upgradeContainer(java.lang.String name,
                             XmlUpdateContext context)
                      throws XmlException
Database.upgrade(java.lang.String, com.sleepycat.db.DatabaseConfig) method, and then the Berkeley DB XML container is upgraded. If no upgrade is needed, then no changes are made.
Container upgrades are done in place and are destructive. For example, if pages need to be allocated and no disk space is available, the container may be left corrupted. Backups should be made before containers are upgraded. See Upgrading databases for more information.
The container must be closed; the system throws an exception if the container is open.
name - The name of the container to be upgraded.context - The XmlUpdateContext object to be used for this operation.XmlExceptionpublic void verifyContainer(java.lang.String name,
                            java.lang.String filename)
                     throws XmlException
The container must be closed; the system throws an exception if the container is open.
The container must have been opened at least once; the system throws an exception if the underlying files have not yet been created.
name - The name of the container to be verified.filename - The name of the file into which salvaged container data is to be dumped.XmlExceptionpublic void verifyContainer(java.lang.String name,
                            java.lang.String filename,
                            VerifyConfig config)
                     throws XmlException
The container must be closed; the system throws an exception if the container is open.
The container must have been opened at least once; the system throws an exception if the underlying files have not yet been created.
name - The name of the container to be verified.filename - The name of the file into which salvaged container data is to be dumped.config - The configuration settings for this operation.XmlExceptionCopyright (c) 2004,2014 Oracle. All rights reserved.