01: /*
02: * HostAvailabilityListener.java
03: *
04: * Created on July 25, 2002, 11:47 AM
05: */
06:
07: package com.sun.portal.util;
08:
09: import java.util.Observable;
10: import java.util.Observer;
11:
12: /*
13: * Listener class to be implemented by Observers who are intrested in the host
14: * availability event
15: *
16: * @author Rajesh T
17: *
18: * @version 1.0
19: */
20:
21: public abstract class HostAvailabilityListener implements Observer {
22:
23: /*
24: * get the update event from the Obervable and propagate it to the listeners
25: */
26:
27: public final void update(Observable ob, Object arg) {
28: hostAvailabilityChanged(((HostAvailabilityEvent) arg));
29: }
30:
31: /*
32: * registers an observer to the observable - uses the mediator
33: */
34:
35: public final void addHostAvailabilityListener(
36: HostAvailabilityListener hal) {
37: HostAvailabilityMediator.getHostAvailabilityMediator()
38: .addHostAvailabilityListener(hal);
39: }
40:
41: /*
42: * unregisters an observer from the observable - uses the mediator
43: */
44:
45: public final void removeHostAvailabilityListener(
46: HostAvailabilityListener hal) {
47: HostAvailabilityMediator.getHostAvailabilityMediator()
48: .removeHostAvailabilityListener(hal);
49: }
50:
51: /*
52: * method to be implemented by the observers, propagated from
53: * update(Observable,Object) to registered sub classes
54: */
55:
56: public abstract void hostAvailabilityChanged(
57: HostAvailabilityEvent hae);
58: }
|