com.resilientedge.jockey.peerbridge
Class LoopbackPeerGroup

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

public class LoopbackPeerGroup
extends java.lang.Object
implements PBPeerGroup

A definition of a group within a network that performs the join, leave, create and delete.

Version:
$Revision: 1.1.1.1 $
Author:
John Gardner

Field Summary
protected static int nextGroupId_
           
protected static int WORLD_GROUP_ID
           
 
Constructor Summary
protected LoopbackPeerGroup(LoopbackNetManager manager, int id)
          Constructor.
 
Method Summary
 int compareTo(java.lang.Object other)
          Returns zero if the other peer group is the same as this group.
 void createGroup(PBPeerGroup newGroup)
          Create a new group as a subgroup.
 void destroyGroup(PBPeerGroup newGroup)
          Destroy a subgroup.
 boolean equals(java.lang.Object other)
          Indicates whether some other object is "equal to" this peer.
 PBPeerGroup fromPeerGroupToken(PeerGroupToken token)
          Return a reference to a peer group implementation, translated from a client side token.
 PBDirectory getDirectory()
          Return a reference to a directory which can browse this group
protected  int getGroupId()
          Return the group id.
 PBMessenger getMessenger()
          Return a reference to a messenger capable of exchanging messages with peers in this peer group.
protected static int getNextGroupId()
          Return an Id for the next created group.
static LoopbackPeerGroup getWorldGroup(LoopbackNetManager manager)
          Returns a reference to the default group that contains all peer entities.
 void join()
          Join the group.
 void leave()
          Leave the group.
 PeerGroupToken toPeerGroupToken()
          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

WORLD_GROUP_ID

protected static final int WORLD_GROUP_ID

nextGroupId_

protected static int nextGroupId_
Constructor Detail

LoopbackPeerGroup

protected LoopbackPeerGroup(LoopbackNetManager manager,
                            int id)
Constructor.
Method Detail

getMessenger

public PBMessenger getMessenger()
Return a reference to a messenger capable of exchanging messages with peers in this peer group.
Specified by:
getMessenger in interface PBPeerGroup
Returns:
messenger

getDirectory

public PBDirectory getDirectory()
Return a reference to a directory which can browse this group
Specified by:
getDirectory in interface PBPeerGroup
Returns:
directory

join

public void join()
          throws PBSecurityViolationException
Join the group.
Specified by:
join in interface PBPeerGroup
Throws:
PBSecurityViolationException - Description of Exception

leave

public void leave()
Leave the group.
Specified by:
leave in interface PBPeerGroup

createGroup

public void createGroup(PBPeerGroup newGroup)
                 throws PBSecurityViolationException
Create a new group as a subgroup.
Specified by:
createGroup in interface PBPeerGroup
Parameters:
newGroup - Description of Parameter
Throws:
PBSecurityViolationException - Description of Exception

destroyGroup

public void destroyGroup(PBPeerGroup newGroup)
                  throws PBSecurityViolationException
Destroy a subgroup.
Specified by:
destroyGroup in interface PBPeerGroup
Parameters:
newGroup - Description of Parameter
Throws:
PBSecurityViolationException - Description of Exception

toPeerGroupToken

public PeerGroupToken toPeerGroupToken()
Return a copy of this object translated to a client side token.
Specified by:
toPeerGroupToken in interface PBPeerGroup
Returns:
a PI PeerGroupToken

fromPeerGroupToken

public PBPeerGroup fromPeerGroupToken(PeerGroupToken token)
Return a reference to a peer group 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 peergroups and some sort of reference counting, or at least a way to reconstruct the group from the token.
Specified by:
fromPeerGroupToken in interface PBPeerGroup
Returns:
a PI PeerGroupToken

getWorldGroup

public static LoopbackPeerGroup getWorldGroup(LoopbackNetManager manager)
Returns a reference to the default group that contains all peer entities.
Returns:
the 'world' group

compareTo

public int compareTo(java.lang.Object other)
Returns zero if the other peer group is the same as this group.
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - group 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

getGroupId

protected int getGroupId()
Return the group id.
Returns:
group id

getNextGroupId

protected static int getNextGroupId()
Return an Id for the next created group.
Returns:
The Instance value


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