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

Constructor Index

 o SubjectImp(String, WhiteBoardImp)
Constructor.

Method Index

 o getDirectory()
Return name and subscriber list of this Subject as a tree structure.
 o getValue()
Return current value of this Subject.
 o name()
Return name of this Subject.
 o setValue(Object)
Publish data to this Subject.
 o subscribe(String)
 o subscribe(SubscriberInt)
Subscribe to this Subject.
 o unsubscribe(String)
Unsubscribe to this Subject.

Constructors

 o SubjectImp
 public SubjectImp(String name,
                   WhiteBoardImp wb) throws RemoteException
Constructor.

Parameters:
name - the Subject's name.

Methods

 o getDirectory
 public TreeNode getDirectory()
Return name and subscriber list of this Subject as a tree structure.

 o name
 public String name() throws RemoteException
Return name of this Subject.

 o getValue
 public Object getValue() throws RemoteException
Return current value of this Subject.

 o subscribe
 public Object subscribe(SubscriberInt s) throws RemoteException
Subscribe to this Subject. Returns the current Subject value.

Parameters:
s - the Subscriber object
 o subscribe
 public Object subscribe(String s) throws RemoteException
 o unsubscribe
 public boolean unsubscribe(String sname) throws RemoteException
Unsubscribe to this Subject. Return true if successful.

Parameters:
sn - the Subscriber's name
 o 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