uk.org.ogsadai.engine
Class StatusObserver

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

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

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

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  boolean mWaiting
          Indicates whether or not to continue waiting.
 
Constructor Summary
StatusObserver()
           
 
Method Summary
 void reset()
          Resets the StatusObserver ready for the waitForCompletion method to be used again.
 void update(java.util.Observable observable, java.lang.Object status)
          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.
 
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.

Constructor Detail

StatusObserver

public StatusObserver()
Method Detail

update

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

Specified by:
update in interface java.util.Observer
Parameters:
observable - An Object reference to the ObservableStatus object that has been updated.
status - An Object reference to the Status object indicating the new status of the ObservableStatus.

reset

public void reset()
Resets the StatusObserver ready for the waitForCompletion method 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 waitForCompletion is used again.