Project JXTA

net.jxta.impl.peergroup
Class GenericPeerGroup

java.lang.Object
  |
  +--net.jxta.impl.peergroup.GenericPeerGroup
Direct Known Subclasses:
Platform, StdPeerGroup

public class GenericPeerGroup
extends java.lang.Object
implements RefPeerGroup


Field Summary
protected  boolean debugStatus
           
static JxtaLoader loader
           
 
Constructor Summary
GenericPeerGroup()
           
 
Method Summary
protected  void addService(net.jxta.service.Service service)
          Adds a service to the set.
protected  void checkServices()
          check that all required services are there.
 net.jxta.protocol.PeerGroupAdvertisement getAdvertisement()
          Ask this group its group advertisement
 net.jxta.platform.Application getApp()
          Returns the main application for that group.
 boolean getDebug()
          Returns the debug status.
 net.jxta.discovery.Discovery getDiscovery()
           
 Endpoint getEndpoint()
          Get this group's Endpoint manager.
 net.jxta.peergroup.PeerGroupID getID()
          Ask a group its group id.
 net.jxta.membership.Membership getMembership()
           
 RefPeerGroup getParentGroup()
          Get this group's parent group.
 net.jxta.protocol.PeerGroupAdvertisement getPeerAdvertisement()
          Ask this group its peer advertisement (somewhat backwds compat.)
 net.jxta.peer.PeerID getPeerID()
          Ask a group its peerId.
 net.jxta.peer.PeerInfo getPeerInfo()
           
 java.lang.String getPeerName()
          Ask a group the name of the Peer it is running on.
 net.jxta.pipe.Pipe getPipe()
           
 net.jxta.rendezvous.RendezVous getRendezVous()
           
 net.jxta.resolver.Resolver getResolver()
           
 void init(net.jxta.peergroup.PeerGroup homeGroup, net.jxta.document.Advertisement baseAdv)
           
protected  void initNetworkGroup()
           
 boolean isRendezvous()
          Returns the whether the group is s Rendezvous.
 net.jxta.service.Service lookupService(java.lang.String name)
          Call a service by name.
protected  void removeService(net.jxta.service.Service service)
          Ask a group to unregister and unload a service FIXME: The finalize() seems like a good thing to do, resourcewise, however, if something was still using it, it'll break it.
 void setEndpoint(Endpoint endp)
          Set this group's Endpoint manager.
 int startApp(java.lang.String[] arg)
          Start the peergroup.
 void stopApp()
          Stops the group and all its services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loader

public static final JxtaLoader loader

debugStatus

protected boolean debugStatus
Constructor Detail

GenericPeerGroup

public GenericPeerGroup()
Method Detail

initNetworkGroup

protected void initNetworkGroup()

addService

protected void addService(net.jxta.service.Service service)
Adds a service to the set. removes any pre-existing one with the name name.

lookupService

public net.jxta.service.Service lookupService(java.lang.String name)
                                       throws net.jxta.exception.ServiceNotFoundException
Call a service by name.
Parameters:
name - the service name
Returns:
Service, the Service registered by that name

checkServices

protected void checkServices()
                      throws net.jxta.exception.ServiceNotFoundException
check that all required services are there.

removeService

protected void removeService(net.jxta.service.Service service)
                      throws net.jxta.exception.ServiceNotFoundException,
                             net.jxta.exception.ViolationException
Ask a group to unregister and unload a service FIXME: The finalize() seems like a good thing to do, resourcewise, however, if something was still using it, it'll break it.
Parameters:
service - handle to the service to be removed

getParentGroup

public RefPeerGroup getParentGroup()
Get this group's parent group.
Specified by:
getParentGroup in interface RefPeerGroup
Tags copied from interface: RefPeerGroup
Returns:
PeerGroup the parent group.

getEndpoint

public Endpoint getEndpoint()
Get this group's Endpoint manager. That one should probably never be given to applications, but then some part of the endpoint API might be proxied by the PeerGroup itself, such as "addProtocol", but that's for later.
Specified by:
getEndpoint in interface RefPeerGroup
Tags copied from interface: RefPeerGroup
Returns:
Endpoint the endpoint object.

init

public void init(net.jxta.peergroup.PeerGroup homeGroup,
                 net.jxta.document.Advertisement baseAdv)

setEndpoint

public void setEndpoint(Endpoint endp)
Set this group's Endpoint manager. Separate from init(), because building the endpoint may require the rest to have been set first.

getApp

public net.jxta.platform.Application getApp()
Returns the main application for that group.
Returns:
Application the main application for that group.

startApp

public int startApp(java.lang.String[] arg)
Start the peergroup. In practice, it means starting its main application. The group does not care for start args, and does not come-up with args to pass to its main app. So, until we decide on something more usefull, the args of the group's startApp are passed-on to the group's main app. NB: both the apps init and startApp methods are invoked.
Returns:
int Status.

stopApp

public void stopApp()
Stops the group and all its services.

getPeerName

public java.lang.String getPeerName()
Ask a group the name of the Peer it is running on.

getPeerID

public net.jxta.peer.PeerID getPeerID()
Ask a group its peerId.

getID

public net.jxta.peergroup.PeerGroupID getID()
Ask a group its group id.
Returns:
PeerGroupId this Group's ID

getAdvertisement

public net.jxta.protocol.PeerGroupAdvertisement getAdvertisement()
Ask this group its group advertisement
Returns:
Advertisement this Group's advertisement

getPeerAdvertisement

public net.jxta.protocol.PeerGroupAdvertisement getPeerAdvertisement()
Ask this group its peer advertisement (somewhat backwds compat.)
Returns:
Advertisement this Group's advertisement

getDebug

public boolean getDebug()
Returns the debug status.

isRendezvous

public boolean isRendezvous()
Returns the whether the group is s Rendezvous.

getResolver

public net.jxta.resolver.Resolver getResolver()
Returns:
Resolver an object implementing the Resolver service for this group.

getDiscovery

public net.jxta.discovery.Discovery getDiscovery()
Returns:
Discovery an object implementing the Discovery service for this group.

getPeerInfo

public net.jxta.peer.PeerInfo getPeerInfo()
Returns:
PeerInfo an object implementing the PeerInfo service for this group.

getMembership

public net.jxta.membership.Membership getMembership()
Returns:
Membership an object implementing the Membership service for this group.

getPipe

public net.jxta.pipe.Pipe getPipe()
Returns:
Pipe an object implementing the Pipe service for this group.

getRendezVous

public net.jxta.rendezvous.RendezVous getRendezVous()
Returns:
RendezVous an object implementing the RendezVous service for this group.

Project JXTA