Project JXTA

net.jxta.ext.rdvpeergroup
Class RdvPeerGroup

java.lang.Object
  extended bynet.jxta.peergroup.LightWeightPeerGroup
      extended bynet.jxta.ext.rdvpeergroup.RdvPeerGroup
All Implemented Interfaces:
EventListener, Module, PeerGroup, PeerViewListener, RendezvousListener, Service

public class RdvPeerGroup
extends LightWeightPeerGroup
implements PeerViewListener, RendezvousListener

RdvPeerGroup is an LightWeighttPeerGroup that uses all the parent PeerGroup's services except for the RendezVous Service which is instantiaded by RdvPeerGroup. RdvPeerGroup allows a set of peers to run as rdv peers (control peers) within the RdvPeerGroup, other peers to be edge peers (primary peers), and other peers to simply keep track of running rdv peers (guest peers).


Nested Class Summary
 
Nested classes inherited from class net.jxta.peergroup.PeerGroup
PeerGroup.GlobalRegistry
 
Field Summary
 
Fields inherited from interface net.jxta.peergroup.PeerGroup
accessClassID, allPurposePeerGroupSpecID, applicationClassID, Both, DEFAULT_EXPIRATION, DEFAULT_LIFETIME, discoveryClassID, endpointClassID, FromParent, globalRegistry, Here, httpProtoClassID, membershipClassID, peerGroupClassID, peerinfoClassID, pipeClassID, proxyClassID, refAccessSpecID, refDiscoverySpecID, refEndpointSpecID, refHttpProtoSpecID, refMembershipSpecID, refNetPeerGroupSpecID, refPeerinfoSpecID, refPipeSpecID, refPlatformSpecID, refProxySpecID, refRelayProtoSpecID, refRendezvousSpecID, refResolverSpecID, refRouterProtoSpecID, refShellSpecID, refStartNetPeerGroupSpecID, refTcpProtoSpecID, refTlsProtoSpecID, relayProtoClassID, rendezvousClassID, resolverClassID, routerProtoClassID, tcpProtoClassID, tlsProtoClassID, WK_ID_PREFIX
 
Fields inherited from interface net.jxta.platform.Module
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_OK
 
Constructor Summary
RdvPeerGroup(PeerGroupAdvertisement adv, PeerGroup parentPeerGroup)
          Constructor All classes that extend RdvPeerGroup must invoke this constructor.
 
Method Summary
 Enumeration getControlPeers()
          Get an Enumeration of the PeerIDs of the control peers of this RdvPeerGroup.
 RendezVousService getRendezVousService()
           
 void init(PeerGroup group, ID assignedID, Advertisement implAdv)
          
 boolean isRendezvous()
          
 boolean joinAsControlPeer(RendezvousListener listener)
          Joins the RdvPeerGroup as a control peer (rdv peer).
 boolean joinAsGuestPeer(RendezvousListener listener)
          Joins the RdvPeerGroup as a guest peer (PeerView only).
 boolean joinAsPrimaryPeer(RendezvousListener listener)
          Joins the RdvPeerGroup as a primary peer (edge peer).
 void leave()
          Leaves (quit) the RdvPeerGroup
 void peerViewEvent(PeerViewEvent event)
          peerViewEvent the peerview event
 void rendezvousEvent(RendezvousEvent event)
          Called when an event occurs for the Rendezvous service
 int startApp(String[] args)
          
 void stopApp()
          
 void unref()
           
 
Methods inherited from class net.jxta.peergroup.LightWeightPeerGroup
compatible, getAccessService, getAllPurposePeerGroupImplAdvertisement, getConfigAdvertisement, getDiscoveryService, getEndpointService, getHomeThreadGroup, getImplAdvertisement, getInterface, getLoader, getMembershipService, getParentGroup, getPeerAdvertisement, getPeerGroupAdvertisement, getPeerGroupID, getPeerGroupName, getPeerID, getPeerInfoService, getPeerName, getPipeService, getResolverService, getRoleMap, getWeakInterface, loadModule, loadModule, lookupService, lookupService, newGroup, newGroup, newGroup, publishGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RdvPeerGroup

public RdvPeerGroup(PeerGroupAdvertisement adv,
                    PeerGroup parentPeerGroup)
Constructor All classes that extend RdvPeerGroup must invoke this constructor. Note that this constructor does not join the PeerGroup.

Parameters:
adv - PeerGroupAdvertisement of the RdvPeerGroup
Method Detail

joinAsPrimaryPeer

public boolean joinAsPrimaryPeer(RendezvousListener listener)
                          throws IOException
Joins the RdvPeerGroup as a primary peer (edge peer).

Parameters:
listener - optional listener allowing the application to be asynchronously notified of the state of the connection.
Returns:
boolean true is returned when joining was authorized. False otherwise.
Throws:
IOException

joinAsControlPeer

public boolean joinAsControlPeer(RendezvousListener listener)
                          throws IOException
Joins the RdvPeerGroup as a control peer (rdv peer).

Parameters:
listener - optional listener allowing the application to be asynchronously notified of the state of the connection.
Returns:
boolean true is returned when joining was authorized. False otherwise.
Throws:
IOException

joinAsGuestPeer

public boolean joinAsGuestPeer(RendezvousListener listener)
                        throws IOException
Joins the RdvPeerGroup as a guest peer (PeerView only).

Parameters:
listener - optional listener allowing the application to be asynchronously notified of the state of the connection.
Returns:
boolean true is returned when joining was authorized. False otherwise.
Throws:
IOException

leave

public void leave()
Leaves (quit) the RdvPeerGroup


getControlPeers

public Enumeration getControlPeers()
Get an Enumeration of the PeerIDs of the control peers of this RdvPeerGroup. Note that the result may be null if the RdvPeerGroup is not yet connected.

Returns:
Enumeration of PeerID of the control peers.

rendezvousEvent

public void rendezvousEvent(RendezvousEvent event)
Called when an event occurs for the Rendezvous service

Specified by:
rendezvousEvent in interface RendezvousListener
Parameters:
event - the rendezvous event

peerViewEvent

public void peerViewEvent(PeerViewEvent event)
peerViewEvent the peerview event

Specified by:
peerViewEvent in interface PeerViewListener

init

public void init(PeerGroup group,
                 ID assignedID,
                 Advertisement implAdv)

Specified by:
init in interface Module

startApp

public int startApp(String[] args)

Specified by:
startApp in interface Module

stopApp

public void stopApp()

Specified by:
stopApp in interface Module

isRendezvous

public boolean isRendezvous()

Specified by:
isRendezvous in interface PeerGroup

getRendezVousService

public RendezVousService getRendezVousService()
Specified by:
getRendezVousService in interface PeerGroup

unref

public void unref()
Specified by:
unref in interface PeerGroup

JXTA J2SE