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

java.lang.Object
  |
  +--uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
        |
        +--uk.ac.ic.doc.automed.wrappers.YattaWrapper

public class YattaWrapper
extends AutoMedWrapper

A YATTA wrapper for semistructured data source.

Author:
Sasivimol Kittivoravitkul (sk297@doc.ic.ac.uk)

Field Summary
 
Fields inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
am, awf, debug, driver, password, protocol, s, url, username
 
Constructor Summary
YattaWrapper(AccessMethod am, java.lang.String password)
           
 
Method Summary
protected  void connect()
          Connect to a semistructured textfile --- i.e.
 ASG executeIQL(ASG q)
          Execute an IQL query on the datasource.
 AutoMedResult executeLocalQuery(AutoMedQuery q)
          Execute a query in the datasource's native query language, and obtain a result in an AutoMedResult class
 YattaQueryResult executeYattaQuery(YattaQuery q)
           
protected  java.util.Vector getDatafromYattaData(java.util.Vector orderedschemes)
           
protected  AutoMedWrapperFactory getDefaultWrapperFactory()
          Returns a new instance of the default wrapper factory for this wrapper
static java.lang.String getDriver()
          The name of the driver string that identifies this wrapper
 java.lang.String getProtocolName()
          The name of the Protocol in the repository used to represent flat files with a YATTA schema.
 SSDFormat getSSDFormat()
           
 java.lang.String getSSDSource()
           
 Schema getWrapperSchema()
           
 SchemaObject getYattaRootNode(Schema sc)
           
static AutoMedWrapper newAutoMedWrapper(java.lang.String username, java.lang.String password, java.lang.String driver, java.lang.String url, java.lang.String schemaName, AutoMedWrapperFactory awf)
          Create an AutoMed Schema containing SchemaObjects that represent a database, in such a form that queries on that schema can be mapped by executeQuery in the query lanuage of the database.
protected  void readMetaData()
           
 
Methods inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
atDebugLevel, cacheWrapper, deleteIQL, getAccessMethod, getAutoMedWrapper, getAutoMedWrapper, getAutoMedWrapperFactory, getOption, getOptionKeys, getProtocol, getSchema, getSchema, insertIQL, newAutoMedSchema, newAutoMedWrapper, newAutoMedWrapper, registerWrapper, selectNewAutoMedWrapper, selectNewAutoMedWrapper, setDebugLevel, setOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YattaWrapper

public YattaWrapper(AccessMethod am,
                    java.lang.String password)
             throws DataSourceException
Method Detail

getDriver

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


newAutoMedWrapper

public static AutoMedWrapper newAutoMedWrapper(java.lang.String username,
                                               java.lang.String password,
                                               java.lang.String driver,
                                               java.lang.String url,
                                               java.lang.String schemaName,
                                               AutoMedWrapperFactory awf)
                                        throws IntegrityException,
                                               DataSourceException
Create an AutoMed Schema containing SchemaObjects that represent a database, in such a form that queries on that schema can be mapped by executeQuery in the query lanuage of the database. This should be called once per database, so as to configure the repository. Subsequent uses of the database should call the constructor for YattaWrapper with the AccessMethod of the YattaWrapper returned here.

Parameters:
schemaName - is the name of the Schema to create in the repository to represent the data source. If this is left null then a connection is established to the data source, and the Schema may be created later using AutoMedWrapper.getSchema(String)
awf - is an YattaWrapperFactory instance configured to model the source schema in the desired manner. This may be left null, in which case an YattaWrapperFactory with default settings will be created.
IntegrityException
DataSourceException

connect

protected void connect()
                throws DataSourceException
Connect to a semistructured textfile --- i.e. file open!

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

readMetaData

protected void readMetaData()
                     throws AutoMedException,
                            java.sql.SQLException,
                            java.io.IOException
AutoMedException
java.sql.SQLException
java.io.IOException

getWrapperSchema

public Schema getWrapperSchema()

getSSDFormat

public SSDFormat getSSDFormat()

getSSDSource

public java.lang.String getSSDSource()

getYattaRootNode

public SchemaObject getYattaRootNode(Schema sc)

executeLocalQuery

public AutoMedResult executeLocalQuery(AutoMedQuery q)
                                throws DataSourceException
Description copied from class: AutoMedWrapper
Execute a query in the datasource's native query language, and obtain a result in an AutoMedResult class

Overrides:
executeLocalQuery in class AutoMedWrapper
DataSourceException

executeYattaQuery

public YattaQueryResult executeYattaQuery(YattaQuery q)
                                   throws DataSourceException
DataSourceException

getDatafromYattaData

protected java.util.Vector getDatafromYattaData(java.util.Vector orderedschemes)

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
DataSourceException

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 flat files with a YATTA schema.

Specified by:
getProtocolName in class AutoMedWrapper