Methods Summary |
---|
public void | addPeer(jdc.patterns.peer.Peer p)Add a peer to our list.
mPeers.put(p.getIdentity(), p);
|
public boolean | broadcast(Message msg)Broadcast the message to all currently connected peers.
boolean success = true;
Enumeration pEnum = getPeers();
while (pEnum.hasMoreElements()) {
Peer p = (Peer)pEnum.nextElement();
if (!send(msg, p.getIdentity())) {
success = false;
}
}
return success;
|
public abstract boolean | connect(java.util.Properties connProps)Connect to a peer given the connection properties. The requirements
on these properties will depend on the implementation. A socket-based
peer will need to have the host name and port on which the peer is
listening. An RMI-based peer will need the host and registry name of the
remote peer object. The peer will need to initialize the Identity of the
remote based on data gleaned from the connection process.
|
public abstract boolean | connect(java.util.Properties connProps, Identity peerID)Connect to a peer given the connection properties and identity of the
peer. Subclasses can choose to implement this using both arguments, or
ignoring one in favor of the other (connection properties vs. properties
pulled from the remote peer identifier).
|
public Identity | getIdentity()
return mIdentity;
|
public jdc.patterns.peer.Peer | getPeer(Identity i)Get the peer identified by the given identity.
return (Peer)mPeers.get(i);
|
public java.util.Enumeration | getPeers()Get list of Peers
return mPeers.elements();
|
public abstract void | handle(Message m)Handle an incoming message.
|
public abstract boolean | send(Message msg, Identity peer)Send the message to the identified peer.
|
public void | setIdentity(Identity i)
mIdentity = i;
|