net.sf.xaj
Interface XmlDb

All Known Implementing Classes:
AbstractDiscoverableXmlDb, ReplicatingXmlDb, XmlDbWebRemoteService

public interface XmlDb

API for an XQuery based service.

Version:
$Revision: 73 $ $Date: 2008-05-14 15:45:39 +1200 (Wed, 14 May 2008) $
Author:
matt

Nested Class Summary
static interface XmlDb.BatchTaskResult
          A Future for the List of Serializable XmlResource IDs processed in the batch process.
static interface XmlDb.SearchResultsMetadata
          Metadata about SearchResults.
static class XmlDb.State
          A state.
static interface XmlDb.XQuerySearchCriteria
          XQuery search criteria.
static interface XmlDb.XQuerySearchResults
          Search results object.
 
Method Summary
 void close()
          Dispose of any open resources and close the database.
 boolean delete(java.io.Serializable id)
          Delete an XML resource based on its ID.
 java.lang.Integer deleteByXQuery(XmlDb.XQuerySearchCriteria criteria)
          Delete a set of XML resources that match the results of an XQuery.
 XmlDb.XQuerySearchResults executeXQuery(XmlDb.XQuerySearchCriteria criteria)
          Execute an XQuery program and return the results.
 XmlResource get(java.io.Serializable id)
          Get an XML resource based on its ID.
 XmlDb.State getState()
          Get the State of the XmlDb.
 XmlDb.BatchTaskResult processBatch(java.lang.Iterable<XmlResource> resources, XmlDbBatchHandler handler)
          Process a set of XmlResource objects.
 java.io.Serializable storeXml(XmlResource resource)
          Store an XML resource in the DB.
 

Method Detail

storeXml

java.io.Serializable storeXml(XmlResource resource)
Store an XML resource in the DB.

Parameters:
resource - the resource to store
Returns:
the stored ID of the resource

get

XmlResource get(java.io.Serializable id)
Get an XML resource based on its ID.

Parameters:
id - the ID of the resource to get
Returns:
the XmlResource, or null if not found

deleteByXQuery

java.lang.Integer deleteByXQuery(XmlDb.XQuerySearchCriteria criteria)
Delete a set of XML resources that match the results of an XQuery.

Parameters:
criteria - the XQuery criteria
Returns:
the number of documents deleted

delete

boolean delete(java.io.Serializable id)
Delete an XML resource based on its ID.

Parameters:
id - the ID of the resource to delete
Returns:
true if the document was deleted

processBatch

XmlDb.BatchTaskResult processBatch(java.lang.Iterable<XmlResource> resources,
                                   XmlDbBatchHandler handler)
Process a set of XmlResource objects.

Parameters:
resources - the resources to process
handler - the handler for each XmlResource
Returns:
a unique transaction ID

executeXQuery

XmlDb.XQuerySearchResults executeXQuery(XmlDb.XQuerySearchCriteria criteria)
Execute an XQuery program and return the results.

Note that some implementations might have requirements as to how this list is garbage collected or treated once finished. Users of this API should call List.clear() when finished using the returned List instance so that the implementation can free any required resources.

Parameters:
criteria - the XQuery search criteria to execute
Returns:
the results

close

void close()
Dispose of any open resources and close the database.

Once this method is called, the XmlDb instance is not expected to be used again and does not need to execute other methods successfully if called.

This method should be allowed to be called even if it has been called previously on the same instance.


getState

XmlDb.State getState()
Get the State of the XmlDb.

Returns:
State