edu.cmu.aura.service
Class SimpleService

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

public abstract class SimpleService
extends java.lang.Object
implements PrimitiveService

Overview

SimpleService is the base class that most service implementations will want to extend. It takes care listening for incoming service calls, deserializing them, and dispatching them to the service. As well as sending back the result to the client. This class also provides many error checking and other query processing routines.

Subclasses class must implement at least the query() method. Default implementations for functions other than query are included; they simply throw a FunctionNotSupportedException, so subclasses that wish to really support any of the post methods must implement these as well.

The rest of this description discusses sample ways in which this class may be used. Note that the steps below are not the only ways in which this class may be used, but merely some possible ways that it may be used. You may ignore features that you do not wish to use.

Using SimpleServices query processing and error checking.

A large amount of support is provided for error checking and processing incoming queries. You will generally want to use either the processQuery() family of calls for general queries, and the processSimpleEqualityQuery() family of calls for simple equality queries. These calls will perform error checking and return a query object corresponding to the type of query being processed.

For error checking and query processing to work you must set the following fields (usually done in your constructor): serviceName, attribNames, and allowedExpressionAttribs. The following checks are made by the processQuery and processSimpleEqualityQuery families of methods: Ensure that the serviceNames parameter is either null or contains a single entry matching the name of this service as specified in the field serviceName. Ensure that the sAttribs parameter is either null or contains only attributes specified in the attribNames field. If it's null, the query object generated will contain an sAttribs member that specifies all attributes (i.e. it handles the null wildcard so you can assume that all attributes are explicitly specified). Ensures that all attributes specified in the expression are listed in allowedExpressionAttribs.

Simple equality processing performs the additional steps: Ensure that the expression is actually a simple equality query. Ensure that the correct expression attribute name is specified. Ensure that the expression attribute value is of the correct type.

Note that using the processQuery() and processSimpleEqualityQuery() methods are not required. Also, they are not the only methods provided for error checking. You can also use specialized methods contained in this class as well as the ExpressionUtil and ReqUtil classes. However, processQuery()/processSimpleEqualityQuery() and friends are probably the easiest to use.

Using PostQueryWorker routines to enable posted queries.

The PostQueryWorker series of calls provides a simplistic method of implementing posted queries. Note that currently this mechanism only supports simple equality queries. (Also, note that no corresponding mechanism is currently provided for triggers.) Subclasses that desire to use this mechanism should call enablePostQuery() to start a Gatherer and perform other initialization.

Next classes that desire to use this mechanism should divide query processing (incoming query() calls) into two halves: the first half would call processSimpleEqualityQuery() and the second half would be an implementation of the method computeQueryResult(). The reason for this is that PostQueryWorkers will use the computeQueryResult() method to compute the query result for posted queries.

When an incoming postQuery() call is received, a SimpleEqualityPostedQuery() object should be created probably by using processSimpleEqualityPostedQuery(). Next addPQWorker() should be called to begin execution of this posted query. removePQWorker() can be called to remove the posted query.

See Also:
ExpressionUtil, ReqUtil, Gatherer, PostQueryWorker

Field Summary
protected  java.lang.String[] allowedExpressionAttribs
          Attribute names that are allowed to appear in expressions.
protected  java.lang.String[] attribNames
          Attribute names that this service supports.
protected  edu.cmu.aura.gather.Gatherer gatherer
          This gatherer is intended to work on postQueryWorkers.
protected  int nextQueryId
          Next query id.
protected static int NO_BOUNDS_REQ
          Used by the processQuery series of calls to indicate that the process query has no requirements on attributes.
protected  boolean postCondTriggerAllowed
          Indicates whether or not postCondTrigger is allowed
protected  boolean postModTriggerAllowed
          Indicates whether or not postModTrigger is allowed
protected  boolean postQueryAllowed
          Indicates whether or not postQuery is allowed.
protected  java.util.HashMap pqWorkers
          HashMap for PostQueryWorkers.
protected  PrimitiveServiceSkel pServiceSkel
          Accepts incoming requests from the skelServer and passes them to this class
protected  java.lang.Object queryIdSynch
          Mutex for generating new query IDs
protected  java.lang.String serviceName
          Name of this service.
protected  edu.cmu.aura.service.rpc.SkelServer skelServer
          SkelServer used to accept incoming requests
 
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
SimpleService(java.lang.String serviceName, int port)
          Creates a service with a given name listening on a specified port.
 
Method Summary
protected  int addPQWorker(SimpleEqualityPostedQuery postedQuery)
          Adds a new PostedQueryWorker.
protected  void checkExpressionAttribs(ExpressionNode expression)
          Ensure that an expression uses only attributes specified in the field allowedAttribs.
protected  void checkSAttribs(java.util.ArrayList sAttribs)
          Ensure that a list of selected attributes refers only to attributes specified in the field attribNames.
protected  void checkServiceNames(java.util.ArrayList serviceNames)
          Ensures that a list of service names refers only to this service.
 QueryResult computeQueryResult(SimpleEqualityQuery query)
          computeQueryResult is implemented by subclasses of SimpleQuery that intend to use PostQueryWorker.
protected  void enablePostQuery(long updateLeadTime, int gatherThreads)
          Enables the PostQueryWorker method of performing postQueries.
protected  int getNewQueryId()
          Threadsafe routine for generating a new unique queryID.
protected  boolean isPQWorkerQuery(int queryID)
           
 int postCondTrigger(java.util.ArrayList selectedAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, ExpressionNode triggerExpression, edu.cmu.aura.service.rpc.RemoteReference queryClient)
          Post a conditional trigger.
 int postModTrigger(java.util.ArrayList selectedAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, java.util.ArrayList triggerAttribs, java.util.ArrayList triggerDeltas, edu.cmu.aura.service.rpc.RemoteReference queryClient)
          Post a mod trigger.
 int postQuery(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, edu.cmu.aura.service.rpc.RemoteReference queryClientRef)
          Post a query.
protected  CondTrigger processCondTrigger(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, ExpressionNode triggerExpression, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs)
          Error check a cond trigger and if everything is OK return a CondTrigger object representing the given query.
protected  CondTrigger processCondTrigger(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, ExpressionNode triggerExpression, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs, long[] intervalBounds, long[] updateTimeBounds)
          Error check a cond trigger and if everything is OK return a CondTrigger object representing the given query.
protected  ModTrigger processModTrigger(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, java.util.ArrayList triggerAttribs, java.util.ArrayList triggerDeltas, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs)
          Error check a mod trigger and if everything is OK return a ModTrigger object representing the given query.
protected  ModTrigger processModTrigger(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, java.util.ArrayList triggerAttribs, java.util.ArrayList triggerDeltas, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs, long[] intervalBounds, long[] updateTimeBounds)
          Error check a mod trigger and if everything is OK return a ModTrigger object representing the given query.
protected  PostedQuery processPostedQuery(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs)
          Error check a posted query and if everything is OK return a PostedQuery object representing the given query.
protected  PostedQuery processPostedQuery(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs, long[] intervalBounds, long[] updateTimeBounds)
          Error check a posted query and if everything is OK return a PostedQuery object representing the given query.
protected  Query processQuery(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, java.lang.String[] reqAllowedAttribs, int allowedReqs)
          Error check a query and if everything is OK return a Query object representing the given query.
protected  Query processQuery(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, java.lang.String[] reqAllowedAttribs, int allowedReqs, long[] intervalBounds, long[] updateTimeBounds)
          Error check a query and if everything is OK return a Query object representing the given query.
protected  SimpleEqualityCondTrigger processSimpleEqualityCondTrigger(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, ExpressionNode triggerExpression, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs)
          Error check a simple equality cond trigger and if everything is OK return a SimpleEqualityCondTrigger object representing the given query.
protected  SimpleEqualityCondTrigger processSimpleEqualityCondTrigger(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, ExpressionNode triggerExpression, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs, java.lang.String keyAttrib, java.lang.Class keyAttribClass)
          Error check a simple equality cond trigger and if everything is OK return a SimpleEqualityCondTrigger object representing the given query.
protected  SimpleEqualityModTrigger processSimpleEqualityModTrigger(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, java.util.ArrayList triggerAttribs, java.util.ArrayList triggerDeltas, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs)
          Error check a simple equality mod trigger and if everything is OK return a SimpleEqualityModTrigger object representing the given query.
protected  SimpleEqualityModTrigger processSimpleEqualityModTrigger(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, java.util.ArrayList triggerAttribs, java.util.ArrayList triggerDeltas, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs, java.lang.String keyAttrib, java.lang.Class keyAttribClass)
          Error check a simple equality mod trigger and if everything is OK return a SimpleEqualityModTrigger object representing the given query.
protected  SimpleEqualityPostedQuery processSimpleEqualityPostedQuery(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs)
          Error check a simple equality posted query and if everything is OK return a SimpleEqualityPostedQuery object representing the given query.
protected  SimpleEqualityPostedQuery processSimpleEqualityPostedQuery(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, long execInterval, edu.cmu.aura.service.rpc.RemoteReference queryClientRef, java.lang.String[] reqAllowedAttribs, int allowedReqs, java.lang.String keyAttrib, java.lang.Class keyAttribClass)
          Error check a simple equality posted query and if everything is OK return a SimpleEqualityPostedQuery object representing the given query.
protected  SimpleEqualityQuery processSimpleEqualityQuery(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, java.lang.String[] reqAllowedAttribs, int allowedReqs)
          Error check a simple equality query and if everything is OK return a SimpleEqualityQuery object representing the given query.
protected  SimpleEqualityQuery processSimpleEqualityQuery(java.util.ArrayList sAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit, java.lang.String[] reqAllowedAttribs, int allowedReqs, java.lang.String keyAttrib, java.lang.Class keyAttribClass)
          Error check a simple equality query and if everything is OK return a SimpleEqualityQuery object representing the given query.
abstract  QueryResult query(java.util.ArrayList selectedAttribs, java.util.ArrayList serviceNames, ExpressionNode expression, java.util.ArrayList attribReqs, long timeLimit)
          Query this service.
protected  void removePQWorker(int queryId)
          Removes the PostQueryWorker corresponding to the query with the given ID.
 void removeQuery(java.lang.String serviceName, int queryId)
          Removes a posted query.
 void removeTrigger(java.lang.String serviceName, int queryID)
          Remove a trigger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serviceName

protected java.lang.String serviceName
Name of this service. Incoming requests must either specify this name or specify the default (null)


pServiceSkel

protected PrimitiveServiceSkel pServiceSkel
Accepts incoming requests from the skelServer and passes them to this class


skelServer

protected edu.cmu.aura.service.rpc.SkelServer skelServer
SkelServer used to accept incoming requests


attribNames

protected java.lang.String[] attribNames
Attribute names that this service supports. Used by error checking to ensure that only valid attrib names are selected.


allowedExpressionAttribs

protected java.lang.String[] allowedExpressionAttribs
Attribute names that are allowed to appear in expressions. Used by error checking to ensure that only the specified attributes appear in expressions. Subset of attribNames.


postQueryAllowed

protected boolean postQueryAllowed
Indicates whether or not postQuery is allowed. If you are using the PostQueryWorker than you should set this by calling enablePostQuery().


postCondTriggerAllowed

protected boolean postCondTriggerAllowed
Indicates whether or not postCondTrigger is allowed


postModTriggerAllowed

protected boolean postModTriggerAllowed
Indicates whether or not postModTrigger is allowed


gatherer

protected edu.cmu.aura.gather.Gatherer gatherer
This gatherer is intended to work on postQueryWorkers.


queryIdSynch

protected java.lang.Object queryIdSynch
Mutex for generating new query IDs


nextQueryId

protected int nextQueryId
Next query id. Should only be accessed by getNewQueryID()


pqWorkers

protected java.util.HashMap pqWorkers
HashMap for PostQueryWorkers. Maps query id to the worker


NO_BOUNDS_REQ

protected static final int NO_BOUNDS_REQ
Used by the processQuery series of calls to indicate that the process query has no requirements on attributes. The value of this constant is -1.

See Also:
Constant Field Values
Constructor Detail

SimpleService

public SimpleService(java.lang.String serviceName,
                     int port)
              throws java.lang.Exception
Creates a service with a given name listening on a specified port.

Parameters:
serviceName - the name of this service
port - the port number to listen on
Method Detail

getNewQueryId

protected int getNewQueryId()
Threadsafe routine for generating a new unique queryID. Currently simply wraps around. // FUTURE - worry about wrap.


enablePostQuery

protected void enablePostQuery(long updateLeadTime,
                               int gatherThreads)
Enables the PostQueryWorker method of performing postQueries.

Parameters:
updateLeadTime - leadTime for updates (usually 0)
gatherThreads - numberOfThreads to use for working on posted queries

addPQWorker

protected int addPQWorker(SimpleEqualityPostedQuery postedQuery)
Adds a new PostedQueryWorker. This will repeatedly execute the given query.

Parameters:
postedQuery - the query to post
Returns:
a unique id for this query

removePQWorker

protected void removePQWorker(int queryId)
                       throws ServiceException
Removes the PostQueryWorker corresponding to the query with the given ID.

Parameters:
queryId - id of the PostQueryWorker/query to remove
ServiceException

isPQWorkerQuery

protected boolean isPQWorkerQuery(int queryID)

query

public abstract QueryResult query(java.util.ArrayList selectedAttribs,
                                  java.util.ArrayList serviceNames,
                                  ExpressionNode expression,
                                  java.util.ArrayList attribReqs,
                                  long timeLimit)
                           throws ServiceException
Query this service. See PrimitiveService.query() for information on how clients use this call.

Specified by:
query in interface PrimitiveService
Parameters:
selectedAttribs - attribsutes to select. ALL_ATTRIBS indicates that all attributes are to be selected.
serviceNames - names of services to retrieve attributes from. DEFAULT_SERVICE may be used if there is only one service listening on a given port.
expression - expression selecting which entities or relations in the service should be returned. SELECT_ALL indicates all entities are to be selected.
attribReqs - requirements on dynamic attributes. NO_REQS indicates there are no requirements in effect.
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. NO_TIME_LIMIT indicates that the client has no hard limit on how long the query should take; though a client will likely still desire reasonably fast execution.
Returns:
the QueryResult of the query.
ServiceException

postQuery

public int postQuery(java.util.ArrayList sAttribs,
                     java.util.ArrayList serviceNames,
                     ExpressionNode expression,
                     java.util.ArrayList attribReqs,
                     long timeLimit,
                     long execInterval,
                     edu.cmu.aura.service.rpc.RemoteReference queryClientRef)
              throws ServiceException
Post a query. See PrimitiveService.postQuery() for information on how clients use this call.

Specified by:
postQuery in interface PrimitiveService
Parameters:
sAttribs - attribsutes to select. ALL_ATTRIBS indicates that all attributes are to be selected.
serviceNames - names of services to retrieve attributes from. DEFAULT_SERVICE may be used if there is only one service listening on a given port.
expression - expression selecting which entities or relations in the service should be returned. SELECT_ALL indicates all entities are to be selected.
attribReqs - requirements on dynamic attributes. NO_REQS indicates there are no requirements in effect.
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. NO_TIME_LIMIT indicates that the client has no hard limit on how long the query should take; though a client will likely still desire reasonably fast execution.
execInterval - interval at which to execute the query. DEFAULT_EXEC_INTERVAL may be specified if they service is to select the interval at which the query should execute.
queryClientRef - the client that should be informed when this query executes.
Returns:
the id of the posted query.
ServiceException

removeQuery

public void removeQuery(java.lang.String serviceName,
                        int queryId)
                 throws ServiceException
Removes a posted query. The default implementation of this routine performs error checking then calls removePQWorker(queryID)

Specified by:
removeQuery in interface PrimitiveService
Parameters:
serviceName - name of the service to remove the query from.
queryId - the ID of the query to remove.
ServiceException

postCondTrigger

public int postCondTrigger(java.util.ArrayList selectedAttribs,
                           java.util.ArrayList serviceNames,
                           ExpressionNode expression,
                           java.util.ArrayList attribReqs,
                           long timeLimit,
                           long execInterval,
                           ExpressionNode triggerExpression,
                           edu.cmu.aura.service.rpc.RemoteReference queryClient)
                    throws java.rmi.RemoteException,
                           ServiceException
Post a conditional trigger. See PrimitiveService.postCondTrigger() for information on how clients use this call.

Specified by:
postCondTrigger in interface PrimitiveService
Parameters:
selectedAttribs - attribsutes to select. ALL_ATTRIBS indicates that all attributes are to be selected.
serviceNames - names of services to retrieve attributes from. DEFAULT_SERVICE may be used if there is only one service listening on a given port.
expression - expression selecting which entities or relations in the service should be returned. SELECT_ALL indicates all entities are to be selected.
attribReqs - requirements on dynamic attributes. NO_REQS indicates there are no requirements in effect.
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. NO_TIME_LIMIT indicates that the client has no hard limit on how long the processing should take; though a client will likely still desire reasonably fast execution.
execInterval - interval at which to check the trigger.
triggerExpression - condition indicating when to fire the trigger.
queryClient - the client that should be informed when this trigger executes.
Returns:
the id of the posted trigger.
java.rmi.RemoteException
ServiceException

postModTrigger

public int postModTrigger(java.util.ArrayList selectedAttribs,
                          java.util.ArrayList serviceNames,
                          ExpressionNode expression,
                          java.util.ArrayList attribReqs,
                          long timeLimit,
                          long execInterval,
                          java.util.ArrayList triggerAttribs,
                          java.util.ArrayList triggerDeltas,
                          edu.cmu.aura.service.rpc.RemoteReference queryClient)
                   throws java.rmi.RemoteException,
                          ServiceException
Post a mod trigger. See PrimitiveService.postMOdTrigger() for information on how clients use this call.

Specified by:
postModTrigger in interface PrimitiveService
Parameters:
selectedAttribs - attribsutes to select. ALL_ATTRIBS indicates that all attributes are to be selected.
serviceNames - names of services to retrieve attributes from. DEFAULT_SERVICE may be used if there is only one service listening on a given port.
expression - expression selecting which entities or relations in the service should be returned. SELECT_ALL indicates all entities are to be selected.
attribReqs - requirements on dynamic attributes. NO_REQS indicates there are no requirements in effect.
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. NO_TIME_LIMIT indicates that the client has no hard limit on how long the processing should take; though a client will likely still desire reasonably fast execution.
execInterval - interval at which to check the trigger.
triggerAttribs - attributes to watch for changes.
triggerDeltas - amount of change that will cause the trigger to fire for the corresponding attribute.
queryClient - the client that should be informed when this trigger executes.
Returns:
the id of the posted trigger.
java.rmi.RemoteException
ServiceException

removeTrigger

public void removeTrigger(java.lang.String serviceName,
                          int queryID)
                   throws java.rmi.RemoteException,
                          ServiceException
Remove a trigger. The default implementation of this routine does nothing.

Specified by:
removeTrigger in interface PrimitiveService
Parameters:
serviceName - name of the service to remove the query from.
queryID - the ID of the query to remove.
java.rmi.RemoteException
ServiceException

computeQueryResult

public QueryResult computeQueryResult(SimpleEqualityQuery query)
                               throws ServiceException
computeQueryResult is implemented by subclasses of SimpleQuery that intend to use PostQueryWorker. PostQueryWorker will call this procedure to do back half of query processing. That is, retrieve a pre-processed query and compute the results.

ServiceException

processQuery

protected Query processQuery(java.util.ArrayList sAttribs,
                             java.util.ArrayList serviceNames,
                             ExpressionNode expression,
                             java.util.ArrayList attribReqs,
                             long timeLimit,
                             java.lang.String[] reqAllowedAttribs,
                             int allowedReqs)
                      throws ServiceException
Error check a query and if everything is OK return a Query object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a Query object representing this query
ServiceException

processQuery

protected Query processQuery(java.util.ArrayList sAttribs,
                             java.util.ArrayList serviceNames,
                             ExpressionNode expression,
                             java.util.ArrayList attribReqs,
                             long timeLimit,
                             java.lang.String[] reqAllowedAttribs,
                             int allowedReqs,
                             long[] intervalBounds,
                             long[] updateTimeBounds)
                      throws ServiceException
Error check a query and if everything is OK return a Query object representing the given query. Also return the maximum interval bounds and maximum update time bounds of the requirements. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
intervalBounds - used to return the maximum interval bounds of requirements
updateTimeBounds - used to return the maximum updateTimeBounds of requirements
Returns:
a Query object representing this query
ServiceException

processPostedQuery

protected PostedQuery processPostedQuery(java.util.ArrayList sAttribs,
                                         java.util.ArrayList serviceNames,
                                         ExpressionNode expression,
                                         java.util.ArrayList attribReqs,
                                         long timeLimit,
                                         long execInterval,
                                         edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                         java.lang.String[] reqAllowedAttribs,
                                         int allowedReqs)
                                  throws ServiceException
Error check a posted query and if everything is OK return a PostedQuery object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a PostedQuery object representing this query
ServiceException

processPostedQuery

protected PostedQuery processPostedQuery(java.util.ArrayList sAttribs,
                                         java.util.ArrayList serviceNames,
                                         ExpressionNode expression,
                                         java.util.ArrayList attribReqs,
                                         long timeLimit,
                                         long execInterval,
                                         edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                         java.lang.String[] reqAllowedAttribs,
                                         int allowedReqs,
                                         long[] intervalBounds,
                                         long[] updateTimeBounds)
                                  throws ServiceException
Error check a posted query and if everything is OK return a PostedQuery object representing the given query. Also return the maximum interval bounds and maximum update time bounds of the requirements. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
intervalBounds - used to return the maximum interval bounds of requirements
updateTimeBounds - used to return the maximum updateTimeBounds of requirements
Returns:
a PostedQuery object representing this query
ServiceException

processModTrigger

protected ModTrigger processModTrigger(java.util.ArrayList sAttribs,
                                       java.util.ArrayList serviceNames,
                                       ExpressionNode expression,
                                       java.util.ArrayList attribReqs,
                                       long timeLimit,
                                       long execInterval,
                                       java.util.ArrayList triggerAttribs,
                                       java.util.ArrayList triggerDeltas,
                                       edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                       java.lang.String[] reqAllowedAttribs,
                                       int allowedReqs)
                                throws ServiceException
Error check a mod trigger and if everything is OK return a ModTrigger object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a ModTrigger object representing this query
ServiceException

processModTrigger

protected ModTrigger processModTrigger(java.util.ArrayList sAttribs,
                                       java.util.ArrayList serviceNames,
                                       ExpressionNode expression,
                                       java.util.ArrayList attribReqs,
                                       long timeLimit,
                                       long execInterval,
                                       java.util.ArrayList triggerAttribs,
                                       java.util.ArrayList triggerDeltas,
                                       edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                       java.lang.String[] reqAllowedAttribs,
                                       int allowedReqs,
                                       long[] intervalBounds,
                                       long[] updateTimeBounds)
                                throws ServiceException
Error check a mod trigger and if everything is OK return a ModTrigger object representing the given query. Also return the maximum interval bounds and maximum update time bounds of the requirements. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
intervalBounds - used to return the maximum interval bounds of requirements
updateTimeBounds - used to return the maximum updateTimeBounds of requirements
Returns:
a ModTrigger object representing this query
ServiceException

processCondTrigger

protected CondTrigger processCondTrigger(java.util.ArrayList sAttribs,
                                         java.util.ArrayList serviceNames,
                                         ExpressionNode expression,
                                         java.util.ArrayList attribReqs,
                                         long timeLimit,
                                         long execInterval,
                                         ExpressionNode triggerExpression,
                                         edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                         java.lang.String[] reqAllowedAttribs,
                                         int allowedReqs)
                                  throws ServiceException
Error check a cond trigger and if everything is OK return a CondTrigger object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a CondTrigger object representing this query
ServiceException

processCondTrigger

protected CondTrigger processCondTrigger(java.util.ArrayList sAttribs,
                                         java.util.ArrayList serviceNames,
                                         ExpressionNode expression,
                                         java.util.ArrayList attribReqs,
                                         long timeLimit,
                                         long execInterval,
                                         ExpressionNode triggerExpression,
                                         edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                         java.lang.String[] reqAllowedAttribs,
                                         int allowedReqs,
                                         long[] intervalBounds,
                                         long[] updateTimeBounds)
                                  throws ServiceException
Error check a cond trigger and if everything is OK return a CondTrigger object representing the given query. Also return the maximum interval bounds and maximum update time bounds of the requirements. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
intervalBounds - used to return the maximum interval bounds of requirements
updateTimeBounds - used to return the maximum updateTimeBounds of requirements
Returns:
a CondTrigger object representing this query
ServiceException

processSimpleEqualityQuery

protected SimpleEqualityQuery processSimpleEqualityQuery(java.util.ArrayList sAttribs,
                                                         java.util.ArrayList serviceNames,
                                                         ExpressionNode expression,
                                                         java.util.ArrayList attribReqs,
                                                         long timeLimit,
                                                         java.lang.String[] reqAllowedAttribs,
                                                         int allowedReqs)
                                                  throws ServiceException
Error check a simple equality query and if everything is OK return a SimpleEqualityQuery object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. This version of this method does not perform key value extraction. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a Query object representing this query
ServiceException

processSimpleEqualityQuery

protected SimpleEqualityQuery processSimpleEqualityQuery(java.util.ArrayList sAttribs,
                                                         java.util.ArrayList serviceNames,
                                                         ExpressionNode expression,
                                                         java.util.ArrayList attribReqs,
                                                         long timeLimit,
                                                         java.lang.String[] reqAllowedAttribs,
                                                         int allowedReqs,
                                                         java.lang.String keyAttrib,
                                                         java.lang.Class keyAttribClass)
                                                  throws ServiceException
Error check a simple equality query and if everything is OK return a SimpleEqualityQuery object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. The key attribute name and class passed in will be used to error check the query and extract the key value specified by the user. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a Query object representing this query
ServiceException

processSimpleEqualityPostedQuery

protected SimpleEqualityPostedQuery processSimpleEqualityPostedQuery(java.util.ArrayList sAttribs,
                                                                     java.util.ArrayList serviceNames,
                                                                     ExpressionNode expression,
                                                                     java.util.ArrayList attribReqs,
                                                                     long timeLimit,
                                                                     long execInterval,
                                                                     edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                                                     java.lang.String[] reqAllowedAttribs,
                                                                     int allowedReqs)
                                                              throws ServiceException
Error check a simple equality posted query and if everything is OK return a SimpleEqualityPostedQuery object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. This version of this method does not perform key value extraction. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a Query object representing this query
ServiceException

processSimpleEqualityPostedQuery

protected SimpleEqualityPostedQuery processSimpleEqualityPostedQuery(java.util.ArrayList sAttribs,
                                                                     java.util.ArrayList serviceNames,
                                                                     ExpressionNode expression,
                                                                     java.util.ArrayList attribReqs,
                                                                     long timeLimit,
                                                                     long execInterval,
                                                                     edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                                                     java.lang.String[] reqAllowedAttribs,
                                                                     int allowedReqs,
                                                                     java.lang.String keyAttrib,
                                                                     java.lang.Class keyAttribClass)
                                                              throws ServiceException
Error check a simple equality posted query and if everything is OK return a SimpleEqualityPostedQuery object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. The key attribute name and class passed in will be used to error check the query and extract the key value specified by the user. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a Query object representing this query
ServiceException

processSimpleEqualityModTrigger

protected SimpleEqualityModTrigger processSimpleEqualityModTrigger(java.util.ArrayList sAttribs,
                                                                   java.util.ArrayList serviceNames,
                                                                   ExpressionNode expression,
                                                                   java.util.ArrayList attribReqs,
                                                                   long timeLimit,
                                                                   long execInterval,
                                                                   java.util.ArrayList triggerAttribs,
                                                                   java.util.ArrayList triggerDeltas,
                                                                   edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                                                   java.lang.String[] reqAllowedAttribs,
                                                                   int allowedReqs)
                                                            throws ServiceException
Error check a simple equality mod trigger and if everything is OK return a SimpleEqualityModTrigger object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. This version of this method does not perform key value extraction. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a Query object representing this query
ServiceException

processSimpleEqualityModTrigger

protected SimpleEqualityModTrigger processSimpleEqualityModTrigger(java.util.ArrayList sAttribs,
                                                                   java.util.ArrayList serviceNames,
                                                                   ExpressionNode expression,
                                                                   java.util.ArrayList attribReqs,
                                                                   long timeLimit,
                                                                   long execInterval,
                                                                   java.util.ArrayList triggerAttribs,
                                                                   java.util.ArrayList triggerDeltas,
                                                                   edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                                                   java.lang.String[] reqAllowedAttribs,
                                                                   int allowedReqs,
                                                                   java.lang.String keyAttrib,
                                                                   java.lang.Class keyAttribClass)
                                                            throws ServiceException
Error check a simple equality mod trigger and if everything is OK return a SimpleEqualityModTrigger object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. The key attribute name and class passed in will be used to error check the query and extract the key value specified by the user. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a Query object representing this query
ServiceException

processSimpleEqualityCondTrigger

protected SimpleEqualityCondTrigger processSimpleEqualityCondTrigger(java.util.ArrayList sAttribs,
                                                                     java.util.ArrayList serviceNames,
                                                                     ExpressionNode expression,
                                                                     java.util.ArrayList attribReqs,
                                                                     long timeLimit,
                                                                     long execInterval,
                                                                     ExpressionNode triggerExpression,
                                                                     edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                                                     java.lang.String[] reqAllowedAttribs,
                                                                     int allowedReqs)
                                                              throws ServiceException
Error check a simple equality cond trigger and if everything is OK return a SimpleEqualityCondTrigger object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. This version of this method does not perform key value extraction. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a Query object representing this query
ServiceException

processSimpleEqualityCondTrigger

protected SimpleEqualityCondTrigger processSimpleEqualityCondTrigger(java.util.ArrayList sAttribs,
                                                                     java.util.ArrayList serviceNames,
                                                                     ExpressionNode expression,
                                                                     java.util.ArrayList attribReqs,
                                                                     long timeLimit,
                                                                     long execInterval,
                                                                     ExpressionNode triggerExpression,
                                                                     edu.cmu.aura.service.rpc.RemoteReference queryClientRef,
                                                                     java.lang.String[] reqAllowedAttribs,
                                                                     int allowedReqs,
                                                                     java.lang.String keyAttrib,
                                                                     java.lang.Class keyAttribClass)
                                                              throws ServiceException
Error check a simple equality cond trigger and if everything is OK return a SimpleEqualityCondTrigger object representing the given query. Error checking must be set up as described in the class documentation. You must pass in the regular query parameters, the names of attributes allowed to have requirements as well as the requirements allowed. The key attribute name and class passed in will be used to error check the query and extract the key value specified by the user. See PrimitiveService.query() for information on query parameters.

Parameters:
reqAllowedAttribs - the names of attributes that are allowed to have requirements
allowedReqs - allowed requirements. See ReqUtil for allowed values.
Returns:
a Query object representing this query
ServiceException

checkServiceNames

protected void checkServiceNames(java.util.ArrayList serviceNames)
                          throws RequestException
Ensures that a list of service names refers only to this service. In other words the list must either be null, or have a single element that is equal to the value of the field serviceName. A RequestException is thrown if the list is invalid.

Parameters:
serviceNames - list of serviceNames to check
RequestException

checkSAttribs

protected void checkSAttribs(java.util.ArrayList sAttribs)
                      throws RequestException
Ensure that a list of selected attributes refers only to attributes specified in the field attribNames.

Parameters:
sAttribs - list of selected attributes to check
RequestException

checkExpressionAttribs

protected void checkExpressionAttribs(ExpressionNode expression)
                               throws RequestException
Ensure that an expression uses only attributes specified in the field allowedAttribs. Throws a RequestException if a disallowed attribute is found.

Parameters:
expression - expression to check
RequestException