uk.org.ogsadai.client.toolkit.properties
Class RequestStatus

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.properties.RequestStatus

public final class RequestStatus
extends java.lang.Object

The status of a request.

Author:
The OGSA-DAI Project Team.

Field Summary
static RequestStatus COMPLETED
          The request has completed.
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
static RequestStatus ERROR
          The request resulted in an error.
static RequestStatus INITIALISING
          The request is initialising.
private  java.lang.String mText
          The string representation of the status.
static RequestStatus PROCESSING
          The request is being processed.
static RequestStatus TERMINATED
          The request has terminated.
static RequestStatus TIMEDOUT
          The request has timed out.
static RequestStatus UNSTARTED
          The request has yet to be started.
 
Constructor Summary
private RequestStatus(java.lang.String text)
          Private constructor.
 
Method Summary
static RequestStatus createFromProperty(Property property)
          Creates a RequestStatus object from a property holding a value representing the request status.
static RequestStatus createFromResponse(org.w3c.dom.Document response)
          Creates a RequestStatus object by extracting the status from the given response document.
 boolean isFinished()
          Returns flag indicating whether the status indicates a finished state, where a finished state equals RequestStatus.COMPLETE, RequestStatus.ERROR, RequestStatus.TIMEDOUT or RequestStatus.TERMINATED.
 boolean isStopped()
          Returns flag indicating whether the status indicates a stopped state, where a stopped state equals RequestStatus.ERROR or RequestStatus.TERMINATED or RequestStatus.TIMEDOUT.
 boolean isUnfinished()
          Returns flag indicating whether the status indicates an incomplete state, where an incomplete state equals RequestStatus.UNSTARTED, RequestStatus.INITIALISING or RequestStatus.PROCESSING.
 boolean isUnstarted()
          Returns flag indicating whether the status indicates an unstarted state, where an unstarted state equals RequestStatus.UNSTARTED.
 java.lang.String toString()
          Gets the status in a displayable string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

UNSTARTED

public static final RequestStatus UNSTARTED
The request has yet to be started.


INITIALISING

public static final RequestStatus INITIALISING
The request is initialising.


PROCESSING

public static final RequestStatus PROCESSING
The request is being processed.


COMPLETED

public static final RequestStatus COMPLETED
The request has completed.


ERROR

public static final RequestStatus ERROR
The request resulted in an error.


TERMINATED

public static final RequestStatus TERMINATED
The request has terminated.


TIMEDOUT

public static final RequestStatus TIMEDOUT
The request has timed out.


mText

private final java.lang.String mText
The string representation of the status.

Constructor Detail

RequestStatus

private RequestStatus(java.lang.String text)
Private constructor. Prevents users creating their own status objects.

Parameters:
text - The name of the status.
Method Detail

toString

public java.lang.String toString()
Gets the status in a displayable string.

Overrides:
toString in class java.lang.Object
Returns:
the status as a string.

isStopped

public boolean isStopped()
Returns flag indicating whether the status indicates a stopped state, where a stopped state equals RequestStatus.ERROR or RequestStatus.TERMINATED or RequestStatus.TIMEDOUT.

Returns:
true if stopped, false otherwise.

isFinished

public boolean isFinished()
Returns flag indicating whether the status indicates a finished state, where a finished state equals RequestStatus.COMPLETE, RequestStatus.ERROR, RequestStatus.TIMEDOUT or RequestStatus.TERMINATED.

Returns:
true if finished, false otherwise.

isUnfinished

public boolean isUnfinished()
Returns flag indicating whether the status indicates an incomplete state, where an incomplete state equals RequestStatus.UNSTARTED, RequestStatus.INITIALISING or RequestStatus.PROCESSING.

Returns:
true if incomplete, false otherwise.

isUnstarted

public boolean isUnstarted()
Returns flag indicating whether the status indicates an unstarted state, where an unstarted state equals RequestStatus.UNSTARTED.

Returns:
true if unstarted, false otherwise.

createFromProperty

public static RequestStatus createFromProperty(Property property)
                                        throws DataFormatException
Creates a RequestStatus object from a property holding a value representing the request status.

The property's getValue method is assumed to return an org.w3c.dom.Element representing the request status as provided by a data service resource.

Parameters:
property - Property holding request status from data service resource.
Returns:
the RequestStatus object corresponding to the request status in the property.
Throws:
DataFormatException - If the value of the property cannot be parsed into a request status.

createFromResponse

public static RequestStatus createFromResponse(org.w3c.dom.Document response)
                                        throws DataFormatException
Creates a RequestStatus object by extracting the status from the given response document.

Parameters:
response - Response document.
Returns:
RequestStatus object corresponding to the status in the given response document.
Throws:
DataFormatException - If the response document cannot be parsed to access the request status.