org.sakaiproject.util.courier
Class ObservingCourier

java.lang.Object
  extended byorg.sakaiproject.util.courier.ObservingCourier
All Implemented Interfaces:
Observer
Direct Known Subclasses:
EventObservingCourier

public abstract class ObservingCourier
extends Object
implements Observer

ObservingCourier is an observer which uses the courier service to notify when things change.

Version:
$Revision: 632 $
Author:
University of Michigan, Sakai Software Development Team

Field Summary
protected  CourierService m_courierService
          Constructor discovered injected CourierService.
protected  String m_deliveryId
          The key identifying the Portal PageSession.
protected  String m_elementId
          The key identifying the element on the Portal Page.
protected  boolean m_enabled
          The enabled state.
protected  String m_location
          The location (id not ref).
 
Constructor Summary
ObservingCourier(String location, String elementId)
          Construct.
 
Method Summary
protected  boolean check(Object arg)
          Check to see if we want to process or ignore this update.
 void disable()
           
 void enable()
           
 String getDeliveryId()
           
 String getElementId()
           
 boolean getEnabled()
           
 String getLocation()
          Access the location this observer is observing.
 void justDelivered()
          Accept notification that the portal element has just been delivered.
 void setDeliveryId(String id)
           
 void setElementId(String id)
           
 void update(Observable o, Object arg)
          This method is called whenever the observed object is changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_courierService

protected CourierService m_courierService
Constructor discovered injected CourierService.


m_location

protected String m_location
The location (id not ref).


m_deliveryId

protected String m_deliveryId
The key identifying the Portal PageSession.


m_elementId

protected String m_elementId
The key identifying the element on the Portal Page.


m_enabled

protected boolean m_enabled
The enabled state.

Constructor Detail

ObservingCourier

public ObservingCourier(String location,
                        String elementId)
Construct.

Parameters:
location - The key identifying the client window to which this courier delivers updates.
elementId - The key identifying the element on the Portal Page that would need a courier delivered message when things change.
Method Detail

getDeliveryId

public String getDeliveryId()

setDeliveryId

public void setDeliveryId(String id)

getElementId

public String getElementId()

setElementId

public void setElementId(String id)

getEnabled

public boolean getEnabled()

enable

public void enable()

disable

public void disable()

justDelivered

public void justDelivered()
Accept notification that the portal element has just been delivered. If there are pending requests to deliver, they can be cleared.


check

protected boolean check(Object arg)
Check to see if we want to process or ignore this update.

Parameters:
arg - The arg from the update.
Returns:
true to continue, false to quit.

getLocation

public String getLocation()
Access the location this observer is observing.

Returns:
the location this observer is observing.

update

public void update(Observable o,
                   Object arg)
This method is called whenever the observed object is changed. An application calls an Observable object's notifyObservers method to have all the object's observers notified of the change. default implementation is to cause the courier service to deliver to the interface controlled by my controller. Extensions can override.

Specified by:
update in interface Observer
Parameters:
o - the observable object.
arg - an argument passed to the notifyObservers method.