All Packages Class Hierarchy This Package Previous Next Index
Class weblab.net.SubjectImp
java.lang.Object
|
+----java.rmi.server.RemoteObject
|
+----java.rmi.server.RemoteServer
|
+----java.rmi.server.UnicastRemoteObject
|
+----weblab.net.SubjectImp
- public class SubjectImp
- extends UnicastRemoteObject
- implements Subject
SubjectImp is a data container class.
It maintains a list of subscribers and notifies them when its value is updated.
- See Also:
- Subject
-
SubjectImp(String, WhiteBoardImp)
- Constructor.
-
getDirectory()
- Return name and subscriber list of this Subject as a tree structure.
-
getValue()
- Return current value of this Subject.
-
name()
- Return name of this Subject.
-
setValue(Object)
- Publish data to this Subject.
-
subscribe(String)
-
-
subscribe(SubscriberInt)
- Subscribe to this Subject.
-
unsubscribe(String)
- Unsubscribe to this Subject.
SubjectImp
public SubjectImp(String name,
WhiteBoardImp wb) throws RemoteException
- Constructor.
- Parameters:
- name - the Subject's name.
getDirectory
public TreeNode getDirectory()
- Return name and subscriber list of this Subject as a tree structure.
name
public String name() throws RemoteException
- Return name of this Subject.
getValue
public Object getValue() throws RemoteException
- Return current value of this Subject.
subscribe
public Object subscribe(SubscriberInt s) throws RemoteException
- Subscribe to this Subject. Returns the current Subject value.
- Parameters:
- s - the Subscriber object
subscribe
public Object subscribe(String s) throws RemoteException
unsubscribe
public boolean unsubscribe(String sname) throws RemoteException
- Unsubscribe to this Subject. Return true if successful.
- Parameters:
- sn - the Subscriber's name
setValue
public boolean setValue(Object value) throws RemoteException
- Publish data to this Subject. Return true if successful.
All register subcribers will be notified. If a subscriber's
network connection is broken, it is automatically removed from
subscriber list of this Subject.
- Parameters:
- value - the Object to publish.
All Packages Class Hierarchy This Package Previous Next Index