uk.ac.bbk.dcs.automed.hdmstore
Class HdmWrapper

java.lang.Object
  extended by uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
      extended by uk.ac.bbk.dcs.automed.hdmstore.HdmWrapper

public class HdmWrapper
extends AutoMedWrapper

A Wrapper for the HDM data store.

Author:
Dean Williams (dean@dcs.bbk.ac.uk)

Field Summary
 
Fields inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
am, awf, debug, driver, emptyKeyProtection, emptyKeys, optionKeyProtection, optionKeys, password, protocol, s, url, username
 
Constructor Summary
HdmWrapper(AccessMethod am, java.lang.String password)
           
 
Method Summary
protected  void connect()
          Use the connection details held with this wrapper to connect to the data source.
 boolean deleteIQL(ASG q)
          Take the query and attempt to insert each of the values in the list into the database.
 ASG executeIQL(ASG queryASG)
          Takes ASG query and passes it to a LowLevelWrapperHdm for processing.
 AutoMedResult executeLocalQuery(AutoMedQuery arg0)
          This is a stub required as the AutoMedWrapper requires it
protected  AutoMedWrapperFactory getDefaultWrapperFactory()
          Returns a new instance of the default wrapper factory for this wrapper
 java.lang.String getProtocolName()
          The name of the Protocol in the repository used to represent the HDM store.
 void getSODefinition(QuerySubGoal qsg)
          Implement AutoMedWrapper abstract method
 boolean insertIQL(ASG q)
          Take the query and attempt to insert each of the values in the list into the database.
 void setHdmStore(HdmStore pHdmStore)
          Set the HdmStore that this wrapper will use
 void setSchema(java.lang.String schemaName)
          Set the value of the schema that this wrapper is for
 boolean validQuery(ASG q)
          check that the given ASG is a valid query
 
Methods inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
atDebugLevel, cacheWrapper, executeIQL, getAccessMethod, getAutoMedWrapper, getAutoMedWrapper, getAutoMedWrapperFactory, getDrivers, getOption, getOptionKeyProtection, getOptionKeys, getProtocol, getQueryCache, getQueryCache, getQueryParser, getSchema, getSchema, getSODefinition, newAutoMedSchema, newAutoMedWrapper, newAutoMedWrapper, newAutoMedWrapper, registerWrapper, selectNewAutoMedWrapper, selectNewAutoMedWrapper, setDebugLevel, setOption, updateCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HdmWrapper

public HdmWrapper(AccessMethod am,
                  java.lang.String password)
           throws DataSourceException
Throws:
DataSourceException
Method Detail

connect

protected void connect()
Description copied from class: AutoMedWrapper
Use the connection details held with this wrapper to connect to the data source.

Specified by:
connect in class AutoMedWrapper

executeIQL

public ASG executeIQL(ASG queryASG)
               throws DataSourceException
Takes ASG query and passes it to a LowLevelWrapperHdm for processing.

Specified by:
executeIQL in class AutoMedWrapper
Parameters:
queryASG - An IQL query held in an ASG which complies with the limitations of what this wrapper is able to process
Returns:
An ASG containing the results of the query
Throws:
DataSourceException

executeLocalQuery

public AutoMedResult executeLocalQuery(AutoMedQuery arg0)
                                throws DataSourceException
This is a stub required as the AutoMedWrapper requires it

Overrides:
executeLocalQuery in class AutoMedWrapper
Throws:
DataSourceException

setHdmStore

public void setHdmStore(HdmStore pHdmStore)
Set the HdmStore that this wrapper will use


setSchema

public void setSchema(java.lang.String schemaName)
Set the value of the schema that this wrapper is for


insertIQL

public boolean insertIQL(ASG q)
                  throws DataSourceException
Take the query and attempt to insert each of the values in the list into the database. Return true if at the end all the values are present in the database (even if some or all of them were already there). Otherwise return false (even if some inserts suceedded)

Overrides:
insertIQL in class AutoMedWrapper
Parameters:
q - is the ASG representation of an IQL query of the form

sub [t1, ..., tn] s

where:
  • 'sub' is the sub-bag builtin function (this has the same semantics as sub-set if operating on sets, which is what the extents of schemes are)
  • [t1, ..., tn] are the tuples to be inserted/deleted
  • s is the scheme that they will be inserted into/deleted from

The semantics and execution of the insert request will depend on the data source e.g. for a relational database it could be translated into a series of INSERT requests within a single transaction, which may fail or succeeed as a whole (and thus return False or True respectively from the insertIQL method). For a non-transactional repository like the HDM or XML flat files, we may choose to allow partial updates e.g. some of a set of tuples are inserted, while some already exist or violate some constraint or another.

Throws:
DataSourceException

deleteIQL

public boolean deleteIQL(ASG q)
                  throws DataSourceException
Take the query and attempt to insert each of the values in the list into the database. Return true if at the end all the values are present in the database (even if some or all of them were already there). Otherwise return false (even if some inserts suceedded)

Overrides:
deleteIQL in class AutoMedWrapper
Throws:
DataSourceException

validQuery

public boolean validQuery(ASG q)
check that the given ASG is a valid query


getDefaultWrapperFactory

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

Specified by:
getDefaultWrapperFactory in class AutoMedWrapper

getProtocolName

public java.lang.String getProtocolName()
The name of the Protocol in the repository used to represent the HDM store.

Specified by:
getProtocolName in class AutoMedWrapper

getSODefinition

public void getSODefinition(QuerySubGoal qsg)
                     throws DataSourceException
Implement AutoMedWrapper abstract method

Specified by:
getSODefinition in class AutoMedWrapper
Throws:
DataSourceException