|
|||||||||||
?PREV CLASS? ?NEXT CLASS | FRAMES ? ?NO FRAMES ? ? | ||||||||||
SUMMARY:?NESTED?|?FIELD?|?CONSTR?|?METHOD | DETAIL:?FIELD?|?CONSTR?|?METHOD |
java.lang.Object | +--java.util.Observable | +--uk.org.ogsadai.engine.ProcessingStatus
An Observable
class encapsulating the state of processing of OGSA-DAI entities, such as Request
or Activity
objects.
Instances of this class are implemented as Observable
wrappers around a ProcessingStatus
field. Observer
implementations can be registered and they will each be updated every time the status is changed using the setXYZ
methods.
Each instance of this class is regarded as being "owned" by the object for which it acts as status. This "owner" object, which may not be 'null', is made known to the instance at construction time. A reference to the owner object is then subsequently passed to observers as the second argument of their update()
method.
A rich set of predicates is provided to establish:
The present implementation uses synchronised methods for thread-safety.
Field Summary | |
private static?java.lang.String |
COPYRIGHT_NOTICE ??????????Copyright statement |
private ?java.lang.Object |
mOwner ??????????Object whose status is provided by this instance. |
private ?ProcessingState |
mState ??????????Current state. |
Fields inherited from class java.util.Observable |
|
Constructor Summary | |
ProcessingStatus(java.lang.Object?owner) ??????????Constructs an instance of this class using a given owner object. |
|
ProcessingStatus(java.lang.Object?owner, ProcessingState?initialState) ??????????Constructs an instance of this class using a given owner object and initial state. |
Method Summary | |
?void |
copyState(ProcessingStatus?status) ??????????Copies the state of the specified ProcessingStatus object to that of this ProcessingStatus object. |
?boolean |
isActive() ??????????Indicates whether the owner object is being initialised or processed. |
?boolean |
isCompleted() ??????????Indicates whether processing has completed on the owner object. |
?boolean |
isError() ??????????Indicates whether the owner object has stopped processing due to errors. |
?boolean |
isInitialising() ??????????Indicates whether initialisation is being carried out on the object for which this instance acts as status. |
?boolean |
isLive() ??????????Indicates whether the owner object is still processing or pending initialisation. |
?boolean |
isProcessing() ??????????Indicates whether initialisation is complete and processing has commenced. |
?boolean |
isStopped() ??????????Indicates whether all processing has stopped on the owner object. |
?boolean |
isTerminated() ??????????Indicates whether the processing of the owner object has been externally terminated. |
?boolean |
isTimedOut() ??????????Indicates whether processing of the owner object has timed out. |
?boolean |
isUnstarted() ??????????Indicates whether the owner object remains uninitialised. |
?void |
setCompleted() ??????????Updates the status to reflect that the onwer object has completed processing. |
?void |
setError() ??????????Updates the status to reflect that the initialisation or processing of the onwer object has yielded errors. |
?void |
setInitialising() ??????????Updates the status to reflect that the onwer object is being initialised. |
?void |
setProcessing() ??????????Updates the status to reflect that the onwer object is being actively processed. |
private ?void |
setState(ProcessingState?nextState) ??????????Effects an internal change of state. |
?void |
setTerminated() ??????????Updates the status to reflect that the onwer object has been terminated. |
?void |
setTimedOut() ??????????Updates the status to reflect that the onwer object has been timed out. |
?java.lang.String |
toString() ??????????Provides a textual rendition of the current state. |
Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private ProcessingState mState
private java.lang.Object mOwner
Constructor Detail |
public ProcessingStatus(java.lang.Object?owner, ProcessingState?initialState) throws java.lang.IllegalArgumentException
owner
- the object for which the new instance acts as statusinitialState
- the state with which to initialise the new instancejava.lang.IllegalArgumentException
- if either of the two parameters is null
public ProcessingStatus(java.lang.Object?owner) throws java.lang.IllegalArgumentException
ProcessingState.UNSTARTED
.
owner
- the object for which the new instance acts as statusjava.lang.IllegalArgumentException
- if the supplied argument is null
Method Detail |
private void setState(ProcessingState?nextState)
nextState
- the target state to which a transition is made.public boolean isStopped()
true
if processing has stopped, either normally or as a result of errors, termination or timing out; false
otherwise.public boolean isLive()
true
if processing is as yet unstarted or ongoing; false
otherwise.public boolean isActive()
true
if processing is ongoing (i.e., the processing entity is initialising or being processed); false
otherwise.public final boolean isCompleted()
true
if and only if the current state is ProcessingState.COMPLETED
.public final boolean isError()
true
if and only if the current state is ProcessingState.ERROR
.public final boolean isTimedOut()
true
if and only if the current state is ProcessingState.TIMEDOUT
.public final boolean isUnstarted()
true
if and only if the current state is ProcessingState.UNSTARTED
.public final boolean isInitialising()
true
if and only if the current state is ProcessingState.INITIALISING
.public final boolean isProcessing()
true
if and only if the current state is ProcessingState.PROCESSING
.public final boolean isTerminated()
true
if and only if the current state is ProcessingState.TERMINATED
.public void setInitialising() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the current status indicates that initialisation has already commenced or completed.public void setProcessing() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the current status indicates that processing has already commenced or completed.public void setCompleted() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the current status indicates that processing has already completed, either normally or otherwise.public void setError() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the current status indicates that the owner object is already inactive.public void setTerminated() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the current status indicates that all activity on the owner object has already stopped, either normally or otherwise.public void setTimedOut()
java.lang.IllegalStateException
- if the current status indicates that all activity on the owner object has already stopped, either normally or otherwise.public java.lang.String toString()
toString
in class java.lang.Object
String
object encoding the current state, e.g., "INITIALISING" or "TIMEDOUT".ProcessingState
public void copyState(ProcessingStatus?status)
ProcessingStatus
object to that of this ProcessingStatus
object.
status
- the status to copy
|
|||||||||||
?PREV CLASS? ?NEXT CLASS | FRAMES ? ?NO FRAMES ? ? | ||||||||||
SUMMARY:?NESTED?|?FIELD?|?CONSTR?|?METHOD | DETAIL:?FIELD?|?CONSTR?|?METHOD |