com.resilientedge.jockey.peerbridge
Class LoopbackPeer

java.lang.Object
  |
  +--com.resilientedge.jockey.peerbridge.LoopbackPeer
All Implemented Interfaces:
java.lang.Comparable, PBPeer

public class LoopbackPeer
extends java.lang.Object
implements PBPeer

Represents a peer on the network

Version:
$Revision: 1.1.1.1 $
Author:
John Gardner

Field Summary
protected static int nextPeerId_
           
protected static int NO_PEER_ID
           
 
Constructor Summary
LoopbackPeer()
           
 
Method Summary
 int compareTo(java.lang.Object other)
          Returns zero if the other network is the same as this network.
protected static LoopbackPeer createNewPeer()
          Create a new peer.
 boolean equals(java.lang.Object other)
          Indicates whether some other object is "equal to" this peer.
 PBPeer fromPeerToken(PeerToken token)
          Return a reference to a peer implementation, translated from a client side token.
protected static java.lang.String getNextPeerId()
          Return an Id for the next created peer.
protected  java.lang.String getPeerId()
          Return the peer id.
protected  boolean isLocal()
          Return the peer id.
protected  void setPeerId(java.lang.String id)
          Set the id for this peer.
 PeerToken toPeerToken()
          Return a copy of this object translated to a client side token.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_PEER_ID

protected static final int NO_PEER_ID

nextPeerId_

protected static int nextPeerId_
Constructor Detail

LoopbackPeer

public LoopbackPeer()
Method Detail

toPeerToken

public PeerToken toPeerToken()
Return a copy of this object translated to a client side token.
Specified by:
toPeerToken in interface PBPeer
Returns:
a PI PeerToken

fromPeerToken

public PBPeer fromPeerToken(PeerToken token)
Return a reference to a peer implementation, translated from a client side token. This must return an identical instance to the one that created the token; this implies a registry of peers and some sort of reference counting, or at least a way to reconstruct the peer from the token.
Specified by:
fromPeerToken in interface PBPeer
Returns:
a PI PeerToken

compareTo

public int compareTo(java.lang.Object other)
Returns zero if the other network is the same as this network.
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - network to compare
Returns:
a positive or negative integer, or zero

equals

public boolean equals(java.lang.Object other)
Indicates whether some other object is "equal to" this peer.
Overrides:
equals in class java.lang.Object
Parameters:
other - object to compare
Returns:
true if equal

createNewPeer

protected static LoopbackPeer createNewPeer()
Create a new peer.
Returns:
the new peer

isLocal

protected boolean isLocal()
Return the peer id.
Returns:
peer id

getPeerId

protected java.lang.String getPeerId()
Return the peer id.
Returns:
peer id

setPeerId

protected void setPeerId(java.lang.String id)
Set the id for this peer.
Parameters:
id - the peer id

getNextPeerId

protected static java.lang.String getNextPeerId()
Return an Id for the next created peer.
Returns:
The Instance value


Copyright © 2001 Resilient Edge, Inc. All Rights Reserved.