uk.ac.bbk.dcs.automed.xml.wrappers
Class SAXWrapper

java.lang.Object
  extended by uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
      extended by uk.ac.bbk.dcs.automed.xml.wrappers.XMLWrapper
          extended by uk.ac.bbk.dcs.automed.xml.wrappers.SAXWrapper

public class SAXWrapper
extends XMLWrapper

A lower level wrapper that conforms to the XMLWrapper class. The SAXWrapper class uses SAX and DOM. The SAXWrapper creates a copy of the XML data source locally in order to query it. The SAXWrapper holds the schema in memory using DOM.

Author:
Lucas Zamboulis

Field Summary
 
Fields inherited from class uk.ac.bbk.dcs.automed.xml.wrappers.XMLWrapper
logger, resultList, schemaDoc, schemaUIDDoc
 
Fields inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
am, awf, debug, driver, emptyKeyProtection, emptyKeys, optionKeyProtection, optionKeys, password, s, url, username
 
Constructor Summary
SAXWrapper(AccessMethod am, java.lang.String password)
           
 
Method Summary
protected  ASG compositeQuery(ASG query)
           
protected  ASG elementAttributeQuery(java.lang.String searchNode1, java.lang.String searchNode2)
           
protected  ASG elementElementQuery(java.lang.String elem1CID, java.lang.String elem2CID, int order)
          Nodes are compared based on elementName:count, not their whole UID
protected  ASG elementPCDataQuery(java.lang.String searchNode, int order)
           
protected  ASG elementQuery(java.lang.String elemCID)
           
protected  AutoMedWrapperFactory getDefaultWrapperFactory()
          Returns a new instance of the default wrapper factory for this wrapper
 java.lang.String getProtocolName()
          The name of the Protocolin the repository used to represent JDBC connections.
 QueryParser getQueryParser(ASG query)
          Return a parser that will accept queries for the wrapper.
protected  ASG textQuery()
           
 
Methods inherited from class uk.ac.bbk.dcs.automed.xml.wrappers.XMLWrapper
assignCIDs, connect, elementElementQuery, elementPCDataQuery, executeIQL, executeLocalQuery, executeXMLQuery, getSchemaDoc, getSchemaName, getSchemaUIDDoc, getSODefinition, getURI, getXMLDSS, initialiseWrapper, newAutoMedWrapper, selectNewAutoMedWrapper, xpathForAttributeQuery, xpathForElementQuery, xpathForTextQuery
 
Methods inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
atDebugLevel, cacheWrapper, deleteIQL, executeIQL, getAccessMethod, getAutoMedWrapper, getAutoMedWrapper, getAutoMedWrapperFactory, getDrivers, getOption, getOptionKeyProtection, getOptionKeys, getProtocol, getQueryCache, getQueryCache, getSchema, getSchema, getSODefinition, insertIQL, newAutoMedSchema, newAutoMedWrapper, newAutoMedWrapper, registerWrapper, selectNewAutoMedWrapper, setDebugLevel, setOption, updateCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXWrapper

public SAXWrapper(AccessMethod am,
                  java.lang.String password)
           throws DataSourceException,
                  java.io.IOException,
                  org.xml.sax.SAXException,
                  IntegrityException
Throws:
DataSourceException
java.io.IOException
org.xml.sax.SAXException
IntegrityException
Method Detail

getQueryParser

public QueryParser getQueryParser(ASG query)
Description copied from class: AutoMedWrapper
Return a parser that will accept queries for the wrapper. The default parser is Schemes, which accepts only single schemes, with no other IQL operators supported. The SimpleComp parser will allow simple list comprehensions to be passed to the wrapper.

Overrides:
getQueryParser in class AutoMedWrapper

textQuery

protected final ASG textQuery()
                       throws TranslationException,
                              NotFoundException
Specified by:
textQuery in class XMLWrapper
Returns:
all PCData and CData nodes
Throws:
TranslationException
NotFoundException

elementQuery

protected final ASG elementQuery(java.lang.String elemCID)
                          throws TranslationException,
                                 NotFoundException
Specified by:
elementQuery in class XMLWrapper
Parameters:
elemCID - the tag of the element (not its UID)
Returns:
ASG with the result elements
Throws:
NotFoundException
XMLException
TranslationException

elementAttributeQuery

protected final ASG elementAttributeQuery(java.lang.String searchNode1,
                                          java.lang.String searchNode2)
                                   throws TranslationException,
                                          NotFoundException
Specified by:
elementAttributeQuery in class XMLWrapper
Throws:
TranslationException
NotFoundException

elementElementQuery

protected final ASG elementElementQuery(java.lang.String elem1CID,
                                        java.lang.String elem2CID,
                                        int order)
                                 throws TranslationException
Nodes are compared based on elementName:count, not their whole UID

Specified by:
elementElementQuery in class XMLWrapper
Parameters:
elem1CID - parent element
elem2CID - child element
order - the order of the child element in its parent's nodelist, including PCData nodes. If -1 then order is unimportant
Returns:
Throws:
XMLException
TranslationException

elementPCDataQuery

protected final ASG elementPCDataQuery(java.lang.String searchNode,
                                       int order)
                                throws TranslationException
Specified by:
elementPCDataQuery in class XMLWrapper
Throws:
TranslationException

compositeQuery

protected ASG compositeQuery(ASG query)
                      throws TranslationException
Specified by:
compositeQuery in class XMLWrapper
Throws:
TranslationException

getProtocolName

public java.lang.String getProtocolName()
The name of the Protocolin the repository used to represent JDBC connections.

Specified by:
getProtocolName in class AutoMedWrapper

getDefaultWrapperFactory

protected final AutoMedWrapperFactory getDefaultWrapperFactory()
Returns a new instance of the default wrapper factory for this wrapper

Specified by:
getDefaultWrapperFactory in class AutoMedWrapper