com.ibm.xdms.function
Interface Datastore

All Superinterfaces:
Function

public interface Datastore
extends Function

Interface for interacting with a backend data store.


Field Summary
static java.lang.String ATTR_REQUEST_PATCH_OPS
          Request attribute to store the Patch Operations Request Attribute
static java.lang.String ATTR_REQUEST_UPDATED_DOC
          Request attribute to store the updated document from a Node Selector PUT or DELETE
static java.lang.String ATTR_USER_TRANSACTION
          Request attribute to store the datastore's UserTransaction object
static java.lang.String COPYRIGHT
           
static java.lang.String PATCH_OPS_ADD
          Patch Operations Add Value
static java.lang.String PATCH_OPS_REMOVE
          Patch Operations Remove Value
static java.lang.String PATCH_OPS_REPLACE
          Path Operations Replace Value
 
Method Summary
 void commitTransaction(XcapServerRequest request)
          Commits the transaction associated with the Datastore
 long delete(XcapServerRequest request, XcapServerResponse response)
          Deletes a document
 java.lang.String get(com.ibm.xcap.DocumentSelector documentSelector)
          Retrieves a document
 java.util.Map<java.lang.String,java.lang.String> get(java.util.List<java.lang.String> documentSelectors, java.lang.String baseXPath, java.util.List<java.lang.String> additionalXPaths)
          Retrieves a Map of xml fragments based on a list of document selectors and associated XPath statements
 java.util.Map<java.lang.String,java.lang.String> get(java.util.List<java.lang.String> documentSelectors, java.lang.String baseXPath, java.util.List<java.lang.String> additionalXPaths, java.util.Map<java.lang.String,java.lang.String> additionalNamespaces, java.lang.String returnXPath)
          Retrieves a Map of xml fragments based on a list of document selectors and associated XPath statements
 java.lang.String get(XcapServerRequest request, XcapServerResponse response)
          Retrieves a document
 long getETag(java.lang.String documentSelector)
          Retrieves the ETag for a document
 javax.transaction.UserTransaction getTransaction(XcapServerRequest request)
          Returns the current transaction for this request.
 java.lang.String getXmlDocumentsDirectory(XcapServerRequest request)
          Retreives the XML Documents Directory for the configured AUID
 long put(XcapServerRequest request, XcapServerResponse response)
          Puts a document
 void rollbackTransaction(XcapServerRequest request)
          Rolls back the transaction associated with the Datastore
 java.util.List<java.lang.String> xquery(java.lang.String query, ApplicationUsage appUsage)
          Performs an XQuery
 java.lang.String xquery(XcapServerRequest request, XcapServerResponse response)
          Performs an XQuery based on a search request from a client
 
Methods inherited from interface com.ibm.xdms.function.Function
getApplicationUsage, init
 

Field Detail

COPYRIGHT

static final java.lang.String COPYRIGHT

ATTR_REQUEST_PATCH_OPS

static final java.lang.String ATTR_REQUEST_PATCH_OPS
Request attribute to store the Patch Operations Request Attribute

See Also:
Constant Field Values

PATCH_OPS_ADD

static final java.lang.String PATCH_OPS_ADD
Patch Operations Add Value

See Also:
Constant Field Values

PATCH_OPS_REMOVE

static final java.lang.String PATCH_OPS_REMOVE
Patch Operations Remove Value

See Also:
Constant Field Values

PATCH_OPS_REPLACE

static final java.lang.String PATCH_OPS_REPLACE
Path Operations Replace Value

See Also:
Constant Field Values

ATTR_REQUEST_UPDATED_DOC

static final java.lang.String ATTR_REQUEST_UPDATED_DOC
Request attribute to store the updated document from a Node Selector PUT or DELETE

See Also:
Constant Field Values

ATTR_USER_TRANSACTION

static final java.lang.String ATTR_USER_TRANSACTION
Request attribute to store the datastore's UserTransaction object

See Also:
Constant Field Values
Method Detail

get

java.lang.String get(XcapServerRequest request,
                     XcapServerResponse response)
                     throws XdmsException
Retrieves a document

Parameters:
request - XcapServerRequest
response - XcapServerResponse, if it is not null, then this method will set the document, status code, and ETag
Returns:
The document as a String
Throws:
XcapException - error retrieving the document from the database
XdmsException

get

java.lang.String get(com.ibm.xcap.DocumentSelector documentSelector)
                     throws XcapException
Retrieves a document

Parameters:
documentSelector - DocumentSelector
Returns:
The document as a String
Throws:
XcapException - error retrieving the document from the database

delete

long delete(XcapServerRequest request,
            XcapServerResponse response)
            throws CannotDeleteException,
                   XcapException
Deletes a document

Parameters:
request - XcapServerRequest
response - XcapServerResponse, if it is not null, then this method will set the status code and ETag
Returns:
ETag of the deleted document, -1 if the document still exists
Throws:
CannotDeleteException - document could not be deleted
XcapException

put

long put(XcapServerRequest request,
         XcapServerResponse response)
         throws CannotInsertException,
                XcapException
Puts a document

Parameters:
request - XcapServerRequest
response - XcapServerResponse, if it is not null, then this method will set the status code and ETag
Returns:
ETag for the document
Throws:
CannotInsertException - if the document could not be inserted
XcapException

getETag

long getETag(java.lang.String documentSelector)
             throws XcapException
Retrieves the ETag for a document

Parameters:
documentSelector - Document Selector
Returns:
ETag of the document, -1 if the document was not found
Throws:
XcapException - error retrieving the document from the database

xquery

java.util.List<java.lang.String> xquery(java.lang.String query,
                                        ApplicationUsage appUsage)
                                        throws XcapException
Performs an XQuery

Parameters:
query - XQuery string
appUsage - Application Usage
Returns:
List of results
Throws:
XcapException - error retrieving the document from the database

xquery

java.lang.String xquery(XcapServerRequest request,
                        XcapServerResponse response)
                        throws XdmsException
Performs an XQuery based on a search request from a client

Parameters:
request - XcapServerRequest
response - XcapServerResponse
Returns:
The search result document as a String
Throws:
XdmsException

get

java.util.Map<java.lang.String,java.lang.String> get(java.util.List<java.lang.String> documentSelectors,
                                                     java.lang.String baseXPath,
                                                     java.util.List<java.lang.String> additionalXPaths)
                                                     throws XcapException
Retrieves a Map of xml fragments based on a list of document selectors and associated XPath statements

Parameters:
documentSelectors - Document Selectors to look for
baseXPath - Base XPath statement to use in the document
additionalXPaths - XPath statements which will be applied on top of the baseXPath statement
Returns:
Map keyed by documentSelectors which contains list of found XML fragments
Throws:
XcapException - Error interacting with the database

get

java.util.Map<java.lang.String,java.lang.String> get(java.util.List<java.lang.String> documentSelectors,
                                                     java.lang.String baseXPath,
                                                     java.util.List<java.lang.String> additionalXPaths,
                                                     java.util.Map<java.lang.String,java.lang.String> additionalNamespaces,
                                                     java.lang.String returnXPath)
                                                     throws XcapException
Retrieves a Map of xml fragments based on a list of document selectors and associated XPath statements

Parameters:
documentSelectors - Document Selectors to look for
baseXPath - Base XPath statement to use in the document
additionalXPaths - XPath statements which will be applied on top of the baseXPath statement
additionalNamespaces - Map of additional namespace URLs, keyed by their prefixes
returnXPath - return XPath, this is appended to the baseXPath statement
Returns:
Map keyed by documentSelectors which contains list of found XML fragments
Throws:
XcapException - Error interacting with the database

commitTransaction

void commitTransaction(XcapServerRequest request)
                       throws XcapException
Commits the transaction associated with the Datastore

Parameters:
request - XcapServerRequest object
Throws:
XcapException

rollbackTransaction

void rollbackTransaction(XcapServerRequest request)
                         throws XcapException
Rolls back the transaction associated with the Datastore

Parameters:
request - XcapServerRequest object
Throws:
XcapException

getTransaction

javax.transaction.UserTransaction getTransaction(XcapServerRequest request)
                                                 throws XcapException
Returns the current transaction for this request. If one does not exist, this method creates one and places it as an attribute in the request

Parameters:
request - XcapServerRequest
Returns:
The UserTransaction to use
Throws:
XcapException

getXmlDocumentsDirectory

java.lang.String getXmlDocumentsDirectory(XcapServerRequest request)
                                          throws XdmsException
Retreives the XML Documents Directory for the configured AUID

Parameters:
request - XcapServerRequest
Throws:
XdmsException - Error retrieving the directory for the configured AUID