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

java.lang.Object
  extended by uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
      extended by uk.ac.ic.doc.automed.wrappers.P2PWrapper
All Implemented Interfaces:
CacheUser
Direct Known Subclasses:
P2PDHTWrapper

public class P2PWrapper
extends AutoMedWrapper

Use the AutoMed P2P package to access other AutoMed repositories (called peers) that contain a common schema. This schema is called a public schema, which any peer is free to store in its own repository and provide pathways to its datasources.

Author:
Peter McBrien (pjm@doc.ic.ac.uk)

Field Summary
static java.lang.String driverString
           
private static java.lang.String protocolName
           
 
Fields inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
am, awf, debug, driver, emptyKeyProtection, emptyKeys, optionKeyProtection, optionKeys, optionSet, password, protocol, s, url, username
 
Constructor Summary
P2PWrapper()
           
P2PWrapper(AccessMethod am, java.lang.String password)
           
 
Method Summary
protected  void connect()
          In a P2P network, communication is not guarenteed, and hence this method returning with an Exception does not ensure that all peers are contactable.
 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
 java.lang.String getProtocolName()
          The name of the Protocol that this wrapper uses.
 QueryParser getQueryParser(ASG query)
          Return a parser that will accept queries for the wrapper.
static void main(java.lang.String[] args)
           
private static java.lang.String removeSchemaName(java.lang.String queryItem)
          Remove an individual schema name from each query item
private static java.lang.String removeSchemaNames(java.lang.String query)
           
 
Methods inherited from class uk.ac.ic.doc.automed.wrappers.AutoMedWrapper
atDebugLevel, cacheWrapper, costIQL, deleteIQL, executeIQL, executeIQLIncrementally, executeLocalQuery, getAccessMethod, getAutoMedPeerInstance, getAutoMedWrapper, getAutoMedWrapper, getAutoMedWrapperFactory, getDrivers, getMetadata, getOption, getOptionKeyProtection, getOptionKeys, getProtocol, 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

protocolName

private static final java.lang.String protocolName
See Also:
Constant Field Values

driverString

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

P2PWrapper

public P2PWrapper()

P2PWrapper

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

connect

protected void connect()
                throws DataSourceException
In a P2P network, communication is not guarenteed, and hence this method returning with an Exception does not ensure that all peers are contactable.

Specified by:
connect in class AutoMedWrapper
Throws:
DataSourceException - if unable to connect one of the peers

getProtocolName

public java.lang.String getProtocolName()
The name of the Protocol that this wrapper uses. For this wrapper it will always be "p2p"

Specified by:
getProtocolName in class AutoMedWrapper

removeSchemaNames

private static java.lang.String removeSchemaNames(java.lang.String query)

removeSchemaName

private static java.lang.String removeSchemaName(java.lang.String queryItem)
Remove an individual schema name from each query item


executeIQL

public ASG executeIQL(ASG q)
               throws DataSourceException,
                      NotFoundException
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
NotFoundException

executeSourceIQL

public ASG executeSourceIQL(ASG q,
                            QueryProcessorConfiguration qpc,
                            int packetNumber)
                     throws DataSourceException,
                            NotFoundException
Description copied from class: AutoMedWrapper
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

getDefaultWrapperFactory

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

Specified by:
getDefaultWrapperFactory in class AutoMedWrapper

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

main

public static void main(java.lang.String[] args)