uk.co.lakesidetech.springxmldb.dao
Class AbstractXMLDBDao

java.lang.Object
  extended byuk.co.lakesidetech.springxmldb.dao.AbstractXMLDBDao
Direct Known Subclasses:
BaseCollectionManageXMLDBDao, BaseResourceManageXMLDBDao, BaseXPathXMLDBDao, BaseXQueryXMLDBDao, BaseXUpdateXMLDBDao, ExistDatabaseManageXMLDBDao, ExistXQueryXMLDBDao

public abstract class AbstractXMLDBDao
extends java.lang.Object

A abstract Dao object for accessing XML databases. This class provides base functionality for creating daos which access XML databases mainly through the XML:DB apis.

http://xmldb-org.sourceforge.net/xapi/api/index.html

Author:
Stuart Eccles

Field Summary
protected  XMLDBDataSource dataSource
          the database source for the xml database
static java.lang.String RESOURCETYPE_XMLRESOURCE
           
protected static java.lang.String XPATHQUERYSERVICE_NAME
           
protected static java.lang.String XPATHQUERYSERVICE_VERSION
           
protected static java.lang.String XUPDATEQUERYSERVICE_NAME
           
protected static java.lang.String XUPDATEQUERYSERVICE_VERSION
           
 
Constructor Summary
AbstractXMLDBDao()
           
 
Method Summary
 XMLDBDataSource getDataSource()
           
 java.util.Map getNameSpaces()
           
protected  org.xmldb.api.modules.XPathQueryService getXPathQueryServiceFromCollection(org.xmldb.api.base.Collection collection)
          Returns a configured XPathQueryService from a given collection
protected  org.xmldb.api.modules.XUpdateQueryService getXUpdateServiceFromCollection(org.xmldb.api.base.Collection collection)
          Returns a configured XUpdateQueryService from a given collection
protected  java.util.Map processResourceSetToDocuments(org.xmldb.api.base.ResourceSet resultSet)
          Processes a resource set of XML:DB resources (providing only they are XML type) to a Map of XML DOM documents keyed on the id of the document.
protected  java.util.Map processResourceSetToStrings(org.xmldb.api.base.ResourceSet resultSet)
           
 void setDataSource(XMLDBDataSource dataSource)
           
 void setNameSpaces(java.util.Map map)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCETYPE_XMLRESOURCE

public static final java.lang.String RESOURCETYPE_XMLRESOURCE
See Also:
Constant Field Values

XUPDATEQUERYSERVICE_NAME

protected static final java.lang.String XUPDATEQUERYSERVICE_NAME
See Also:
Constant Field Values

XUPDATEQUERYSERVICE_VERSION

protected static final java.lang.String XUPDATEQUERYSERVICE_VERSION
See Also:
Constant Field Values

XPATHQUERYSERVICE_VERSION

protected static final java.lang.String XPATHQUERYSERVICE_VERSION
See Also:
Constant Field Values

XPATHQUERYSERVICE_NAME

protected static final java.lang.String XPATHQUERYSERVICE_NAME
See Also:
Constant Field Values

dataSource

protected XMLDBDataSource dataSource
the database source for the xml database

Constructor Detail

AbstractXMLDBDao

public AbstractXMLDBDao()
Method Detail

getXPathQueryServiceFromCollection

protected org.xmldb.api.modules.XPathQueryService getXPathQueryServiceFromCollection(org.xmldb.api.base.Collection collection)
                                                                              throws org.xmldb.api.base.XMLDBException
Returns a configured XPathQueryService from a given collection

Parameters:
collection - The XML:DB collection
Returns:
a XPathQueryService for that collection configured with namespace support
Throws:
org.xmldb.api.base.XMLDBException - If the collection cannot provide that service

getXUpdateServiceFromCollection

protected org.xmldb.api.modules.XUpdateQueryService getXUpdateServiceFromCollection(org.xmldb.api.base.Collection collection)
                                                                             throws org.xmldb.api.base.XMLDBException
Returns a configured XUpdateQueryService from a given collection

Parameters:
collection - The XML:DB collection
Returns:
a XUpdateQueryService for that collection configured with namespace support
Throws:
org.xmldb.api.base.XMLDBException - If the collection cannot provide that service

processResourceSetToDocuments

protected java.util.Map processResourceSetToDocuments(org.xmldb.api.base.ResourceSet resultSet)
                                               throws XMLDBDataAccessException
Processes a resource set of XML:DB resources (providing only they are XML type) to a Map of XML DOM documents keyed on the id of the document. Does not work on mixed type (binary) resources but this is rare occurance anyway and should be processed seperaly

Parameters:
resultSet - The XML:DB ResourceSet
Returns:
runtime exception XMLDBDataAccessException
Throws:
XMLDBDataAccessException

processResourceSetToStrings

protected java.util.Map processResourceSetToStrings(org.xmldb.api.base.ResourceSet resultSet)
                                             throws XMLDBDataAccessException
Throws:
XMLDBDataAccessException

getNameSpaces

public java.util.Map getNameSpaces()
Returns:

setNameSpaces

public void setNameSpaces(java.util.Map map)
Parameters:
map -

getDataSource

public XMLDBDataSource getDataSource()
Returns:
Returns the dataSource.

setDataSource

public void setDataSource(XMLDBDataSource dataSource)
Parameters:
dataSource - The dataSource to set.