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
 java.lang.String buildSipXQuery(java.lang.String defaultNamespace, java.lang.String table, java.lang.String serviceUri, boolean includePresPack)
          Used by RlsXdmSipServlet class
 java.lang.String buildUriXQuery(java.lang.String defaultNamespace, java.lang.String table, java.lang.String serviceUri)
          Used by ResourceListConstraintFilter class
 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.lang.String get(com.ibm.xcap.DocumentSelector documentSelector, java.security.Principal principal, boolean isSuperAdminUser, boolean isAnonymousUser)
          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, javax.servlet.sip.SipServletRequest request)
          Retrieves the ETag for a document
 long getETag(java.lang.String documentSelector, XcapServerRequest request)
          Retrieves the ETag for a document
 javax.transaction.UserTransaction getTransaction(XcapServerRequest request)
          Returns the current transaction for this request.
 java.lang.String getXmlDocumentsDirectory(java.lang.String uri)
          Retreives the XML Documents Directory for the configured AUID
 java.lang.String getXmlDocumentsDirectory(XcapServerRequest request)
          Retreives the XML Documents Directory for the configured AUID
 long put(XcapServerRequest request, XcapServerResponse response)
          Puts a document
 long put(XcapServerRequest request, XcapServerResponse response, DatastoreHelper dh, java.sql.Connection con)
          Puts a document
 void rollbackTransaction(XcapServerRequest request)
          Rolls back the transaction associated with the Datastore
 com.ibm.xcap.DocumentSelector transformGlobalIndexDocumentSelector(com.ibm.xcap.DocumentSelector documentSelector)
          Transforms a DocumentSelector for a global/index file to a DocumentSelector for an individual file
 com.ibm.xcap.DocumentSelector transformNodeAttribute(com.ibm.xcap.DocumentSelector documentSelector)
          Transforms the nodeAttribute of a DocumentSelector to match the format for
 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

get

java.lang.String get(com.ibm.xcap.DocumentSelector documentSelector,
                     java.security.Principal principal,
                     boolean isSuperAdminUser,
                     boolean isAnonymousUser)
                     throws XcapException,
                            XdmsException,
                            java.net.MalformedURLException
Retrieves a document

Parameters:
documentSelector - DocumentSelector
Returns:
The document as a String
Throws:
XcapException - error retrieving the document from the database
XdmsException
java.net.MalformedURLException

transformGlobalIndexDocumentSelector

com.ibm.xcap.DocumentSelector transformGlobalIndexDocumentSelector(com.ibm.xcap.DocumentSelector documentSelector)
                                                                   throws LocalConstraintFailureException,
                                                                          XcapException,
                                                                          java.net.MalformedURLException
Transforms a DocumentSelector for a global/index file to a DocumentSelector for an individual file

Parameters:
documentSelector - DocumentSelector
Returns:
Transformed documentSelector
Throws:
LocalConstraintFailureException, - XcapException, MalformedURLException
LocalConstraintFailureException
XcapException
java.net.MalformedURLException

transformNodeAttribute

com.ibm.xcap.DocumentSelector transformNodeAttribute(com.ibm.xcap.DocumentSelector documentSelector)
                                                     throws java.net.MalformedURLException,
                                                            XcapException
Transforms the nodeAttribute of a DocumentSelector to match the format for

Parameters:
documentSelector - DocumentSelector
Returns:
Transformed documentSelector
Throws:
XcapException, - MalformedURLException
java.net.MalformedURLException
XcapException

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

put

long put(XcapServerRequest request,
         XcapServerResponse response,
         DatastoreHelper dh,
         java.sql.Connection con)
         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,
             XcapServerRequest request)
             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

getETag

long getETag(java.lang.String documentSelector,
             javax.servlet.sip.SipServletRequest request)
             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

buildSipXQuery

java.lang.String buildSipXQuery(java.lang.String defaultNamespace,
                                java.lang.String table,
                                java.lang.String serviceUri,
                                boolean includePresPack)
                                throws java.net.MalformedURLException
Used by RlsXdmSipServlet class

Parameters:
defaultNamespace -
table -
serviceUri -
Returns:
Throws:
java.net.MalformedURLException

buildUriXQuery

java.lang.String buildUriXQuery(java.lang.String defaultNamespace,
                                java.lang.String table,
                                java.lang.String serviceUri)
                                throws java.net.MalformedURLException
Used by ResourceListConstraintFilter class

Parameters:
defaultNamespace -
table -
serviceUri -
Returns:
Throws:
java.net.MalformedURLException

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

getXmlDocumentsDirectory

java.lang.String getXmlDocumentsDirectory(java.lang.String uri)
                                          throws XdmsException,
                                                 java.net.MalformedURLException
Retreives the XML Documents Directory for the configured AUID

Parameters:
uri - String
Throws:
XdmsException - Error retrieving the directory for the configured AUID
java.net.MalformedURLException