uk.org.ogsadai.engine
Class ProcessingStatusObserver

java.lang.Object
  |
  +--uk.org.ogsadai.engine.ProcessingStatusObserver
All Implemented Interfaces:
java.util.Observer

public class ProcessingStatusObserver
extends java.lang.Object
implements java.util.Observer

This is an Observer that can be registered with a ProcessingStatus then used to wait until the status changes to a finished state. A finished status is one in which the ProcessingStatus.isFinished() method returns true.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  boolean mInitialising
          Indicates whether or not the status being observed has been set to initialising.
private  boolean mProcessing
          Indicates whether or not the status being observed has been set to processing.
private  boolean mWaiting
          Indicates whether or not to continue waiting until the status being observed is set to a terminal state (completed, timed out or error).
 
Constructor Summary
ProcessingStatusObserver()
           
 
Method Summary
 void reset()
          Resets the ProcessingStatusObserver ready for the waitForCompletion,waitForInitialisation and waitForProcessing methods to be used again.
 void update(java.util.Observable status, java.lang.Object owner)
          Called by the Engine whenever the request status changes.
 void waitForCompletion()
          Blocks until the ObservableStatus is updated to a status that indicates a finished state or the processing thread is interupted.
 void waitForInitialisation()
          Blocks until the ProcessingStatus is updated to a status that indicates initialisation has commenced, or until the processing thread is interupted.
 void waitForProcessing()
          Blocks until the ProcessingStatus is updated to a status that indicates processing has commenced, or until the processing thread is interupted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

mWaiting

private boolean mWaiting
Indicates whether or not to continue waiting until the status being observed is set to a terminal state (completed, timed out or error).


mInitialising

private boolean mInitialising
Indicates whether or not the status being observed has been set to initialising.


mProcessing

private boolean mProcessing
Indicates whether or not the status being observed has been set to processing.

Constructor Detail

ProcessingStatusObserver

public ProcessingStatusObserver()
Method Detail

update

public void update(java.util.Observable status,
                   java.lang.Object owner)
Called by the Engine whenever the request status changes.

Specified by:
update in interface java.util.Observer
Parameters:
status - An Object reference to the ProcessingStatus object that has been updated.
owner - An Object reference to the object for which status acts status.

reset

public void reset()
Resets the ProcessingStatusObserver ready for the waitForCompletion,waitForInitialisation and waitForProcessing methods to be used again.


waitForCompletion

public void waitForCompletion()
Blocks until the ObservableStatus is updated to a status that indicates a finished state or the processing thread is interupted. After this method has returned, the reset method should be invoked before any of waitForInitialisation, waitForProcessing and waitForCompletion are used again.


waitForInitialisation

public void waitForInitialisation()
Blocks until the ProcessingStatus is updated to a status that indicates initialisation has commenced, or until the processing thread is interupted. After this method has returned, the reset method should be invoked before any of waitForInitialisation, waitForProcessing and waitForCompletion are used again.


waitForProcessing

public void waitForProcessing()
Blocks until the ProcessingStatus is updated to a status that indicates processing has commenced, or until the processing thread is interupted. After this method has returned, the reset method should be invoked before any of waitForInitialisation, waitForProcessing and waitForCompletion are used again.