drm.agentbase
Class StaticRequest

java.lang.Object
  |
  +--drm.agentbase.StaticRequest
All Implemented Interfaces:
IRequest

public class StaticRequest
extends java.lang.Object
implements IRequest

A convinience class to return requests that are actually not assyncronous to conform to the interface.


Fields inherited from interface drm.agentbase.IRequest
DONE, ERROR, WAITING
 
Constructor Summary
StaticRequest(int s, java.lang.Throwable t)
          Constructs a constant request.
StaticRequest(int s, java.lang.Throwable t, java.util.Map m)
          Constructs a constant request.
 
Method Summary
 java.lang.Object getInfo(java.lang.String q)
          Implementations can use this function to return additional information about the request.
 long getStartTime()
          Returns the starting date in the format returned by System.currentTimeMillis()
 int getStatus()
          Returns the status.
 java.lang.Throwable getThrowable()
          If the status is ERROR and the problem was catching a throwable object then returns the corresponding throwable object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticRequest

public StaticRequest(int s,
                     java.lang.Throwable t,
                     java.util.Map m)
Constructs a constant request. It will always return status s and throwable t. The map m is used to simulate getInfo(String): getInfo always returns the object this map maps the given string to.

StaticRequest

public StaticRequest(int s,
                     java.lang.Throwable t)
Constructs a constant request. It will always return status s and throwable t. getInfo will always return null.
Method Detail

getStatus

public int getStatus()
Description copied from interface: IRequest
Returns the status. Either WAITING, DONE or ERROR.
Specified by:
getStatus in interface IRequest

getThrowable

public java.lang.Throwable getThrowable()
Description copied from interface: IRequest
If the status is ERROR and the problem was catching a throwable object then returns the corresponding throwable object. If the status is not ERROR or the error was not due to a Throwable then returns null.
Specified by:
getThrowable in interface IRequest

getStartTime

public long getStartTime()
Description copied from interface: IRequest
Returns the starting date in the format returned by System.currentTimeMillis()
Specified by:
getStartTime in interface IRequest

getInfo

public java.lang.Object getInfo(java.lang.String q)
Description copied from interface: IRequest
Implementations can use this function to return additional information about the request.
Specified by:
getInfo in interface IRequest
Following copied from interface: drm.agentbase.IRequest
Parameters:
q - the string id of the requested information
Returns:
the requested info or null if query is not known