uk.ac.ic.doc.automed.wrappers
Class CSVWrapper

java.lang.Object
  extended by uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
      extended by uk.ac.ic.doc.automed.wrappers.CSVWrapper
All Implemented Interfaces:
CacheUser

public class CSVWrapper
extends AutoMedWrapper

Author:
Andrew Charles Smith - acs203 This class provides methods to wrap a CSV file from a lego NXT brick

Field Summary
protected static long baseDateTime
           
protected  Model csv
           
protected static int dateTimeElementPos
           
protected static java.lang.String driver
           
static java.lang.String driverString
           
protected  Construct element
           
protected  java.lang.String fileName
           
protected  Construct rootElement
           
protected static long timeGap
           
 
Fields inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
am, awf, debug, emptyKeyProtection, emptyKeys, optionKeyProtection, optionKeys, optionSet, password, protocol, s, url, username
 
Constructor Summary
CSVWrapper()
          Creates a new, empty instance of XMLSchemaWrapper
CSVWrapper(AccessMethod am, java.lang.String password)
          This constructor is used when querying the schema
 
Method Summary
protected  void connect()
          Check that the CSV file exists
protected  ASG csvQuery(java.lang.String searchNode, boolean rootNode, QueryProcessorConfiguration qpc)
           
 ASG executeIQL(ASG q)
          Execute an IQL query on the datasource.
 ASG executeSourceIQL(ASG q, QueryProcessorConfiguration qpc, int packetNumber)
          This is similar to executeIQL(ASG q) except that it takes a configuration object as an extra argument.
protected  AutoMedWrapperFactory getDefaultWrapperFactory()
          Return the default AutoMedWrapperFactory that is used to generate Schema instances from information in a data sources
static java.lang.String getDriver()
          The name of the driver string that identifies this wrapper
 ResultSetMetadata getMetadata(ASG asg, QueryProcessorConfiguration qpc)
          Extract metadata from an ASG object (result or query)
 java.lang.String getProtocolName()
          The name of the Protocol that this wrapper uses
 
Methods inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
atDebugLevel, cacheWrapper, costIQL, deleteIQL, executeIQL, executeIQLIncrementally, executeLocalQuery, getAccessMethod, getAutoMedPeerInstance, getAutoMedWrapper, getAutoMedWrapper, getAutoMedWrapperFactory, getDrivers, getOption, getOptionKeyProtection, getOptionKeys, getProtocol, getQueryParser, getRange, getSchema, getSchema, getURL, getUserName, insertIQL, newAutoMedSchema, newAutoMedWrapper, newAutoMedWrapper, newAutoMedWrapper, newAutoMedWrapperInstance, registerWrapper, selectNewAutoMedWrapper, selectNewAutoMedWrapper, setDebugLevel, setOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

driverString

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

dateTimeElementPos

protected static final int dateTimeElementPos
See Also:
Constant Field Values

timeGap

protected static final long timeGap
See Also:
Constant Field Values

baseDateTime

protected static final long baseDateTime

driver

protected static java.lang.String driver

csv

protected Model csv

rootElement

protected Construct rootElement

element

protected Construct element

fileName

protected java.lang.String fileName
Constructor Detail

CSVWrapper

public CSVWrapper()
Creates a new, empty instance of XMLSchemaWrapper


CSVWrapper

public CSVWrapper(AccessMethod am,
                  java.lang.String password)
           throws DataSourceException,
                  NotFoundException
This constructor is used when querying the schema

Throws:
DataSourceException
NotFoundException
Method Detail

connect

protected void connect()
                throws DataSourceException
Check that the CSV file exists

Specified by:
connect in class AutoMedWrapper
Throws:
DataSourceException - if unable to connect to the data source

executeSourceIQL

public ASG executeSourceIQL(ASG q,
                            QueryProcessorConfiguration qpc,
                            int packetNumber)
                     throws DataSourceException,
                            NotFoundException
This is similar to executeIQL(ASG q) except that it takes a configuration object as an extra argument.
Subclasses must override this method to provide a more specific way of executing query over the source. If not, this method behaves just like the executeIQL(ASG q} method.

Specified by:
executeSourceIQL in interface CacheUser
Overrides:
executeSourceIQL in class AutoMedWrapper
Throws:
DataSourceException
NotFoundException

executeIQL

public ASG executeIQL(ASG q)
               throws DataSourceException
Description copied from class: AutoMedWrapper
Execute an IQL query on the datasource.

Specified by:
executeIQL in class AutoMedWrapper
Parameters:
q - 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

csvQuery

protected ASG csvQuery(java.lang.String searchNode,
                       boolean rootNode,
                       QueryProcessorConfiguration qpc)
                throws DataSourceException
Throws:
DataSourceException

getMetadata

public ResultSetMetadata getMetadata(ASG asg,
                                     QueryProcessorConfiguration qpc)
                              throws ASGMetadataException
Description copied from class: AutoMedWrapper
Extract metadata from an ASG object (result or query)

Specified by:
getMetadata in interface CacheUser
Overrides:
getMetadata in class AutoMedWrapper
Throws:
ASGMetadataException

getDriver

public static java.lang.String getDriver()
The name of the driver string that identifies this wrapper


getDefaultWrapperFactory

protected AutoMedWrapperFactory getDefaultWrapperFactory()
Description copied from class: AutoMedWrapper
Return the default AutoMedWrapperFactory that is used to generate Schema instances from information in a data sources

Specified by:
getDefaultWrapperFactory in class AutoMedWrapper

getProtocolName

public java.lang.String getProtocolName()
Description copied from class: AutoMedWrapper
The name of the Protocol that this wrapper uses

Specified by:
getProtocolName in class AutoMedWrapper