edu.cmu.aura.service.dbw
Class WrapperService

java.lang.Object
  |
  +--edu.cmu.aura.service.SimpleService
        |
        +--edu.cmu.aura.service.dbw.WrapperService
All Implemented Interfaces:
PrimitiveService, java.rmi.Remote

public class WrapperService
extends SimpleService

A simple service to provide access to an SQL database via the primitive service API. This allows services to be written without the need to write any code.

To use this class you must provide it four things: 1 - a name for this service, 2 - a port to provide this service on, 3 - the jdbc URL to contact the database on, 4 - the class name of the jdbc driver.

This class currently performs no real error checking and returns all attributes as static attributes. Future versions should provide the ability to support dynamic attributes, attribute requirements, time limits, etc..


Field Summary
 
Fields inherited from interface edu.cmu.aura.service.PrimitiveService
ALL_ATTRIBS, ANY_CHANGE, DEFAULT_EXEC_INTERVAL, DEFAULT_SERVICE, DEFAULT_SERVICE_NAME, NO_REQS, NO_TIME_LIMIT, RELATION_ATTRIB, SELECT_ALL
 
Constructor Summary
WrapperService(java.lang.String serviceName, int port, java.lang.String dbURL, java.lang.String jdbcDriver)
          Creates the WrapperService.
 
Method Summary
static void main(java.lang.String[] args)
          Accept command line parameters and run the test.
 QueryResult query(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit)
          Handle incoming queries from clients by passing them to the SQL database.
 
Methods inherited from class edu.cmu.aura.service.SimpleService
computeQueryResult, postCondTrigger, postModTrigger, postQuery, removeQuery, removeTrigger
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrapperService

public WrapperService(java.lang.String serviceName,
                      int port,
                      java.lang.String dbURL,
                      java.lang.String jdbcDriver)
               throws java.lang.Exception
Creates the WrapperService.

Parameters:
serviceName - the name of the service to provide
port - port on which to listen for requests
dbURL - the jdbc URL on which to contact the database
jdbcDriver - the class name of the jdbc driver
Method Detail

query

public QueryResult query(java.util.ArrayList sAttribs,
                         java.util.ArrayList serviceNames,
                         ExpressionNode expression,
                         java.util.ArrayList attribReqs,
                         long timeLimit)
                  throws ServiceException
Handle incoming queries from clients by passing them to the SQL database.

Specified by:
query in interface PrimitiveService
Specified by:
query in class SimpleService
Parameters:
sAttribs - the attribs to select.
serviceNames - names of services to retrieve attributes from.
expression - expression selecting which entities or relations in the service should be returned.
attribReqs - requirements on dynamic attributes.
timeLimit - this is used by clients to inform the service on when they need the results by. This may also be viewed as a suggestion on how hard to work to retrieve the results.
Returns:
the QueryResult of the query.
ServiceException

main

public static void main(java.lang.String[] args)
Accept command line parameters and run the test.

Parameters:
args - command line parameters