Project JXTA

net.jxta.peergroup
Class PeerGroupFactory

java.lang.Object
  extended bynet.jxta.peergroup.PeerGroupFactory

public final class PeerGroupFactory
extends Object

A factory for instantiating the JXTA core peer groups and application peer peer groups.

JXTA comes with two peergroup implementations:

Platform
Implements the world peer group. Every peer starts by instantiating this peer group and then other peer groups are instantiated as needed.

The world peer group provides the minimum core services needed to find and instantiate other groups on a peer. Platform has the privilege of assigning a new ID to the peer, if it does not already have one. The World peer group's ID is invariant.

StdPeergroup
this is currently used to implement all other kinds of peer groups. The first such peer group that it is instantiated after starting is known as The Net Peer Group. When the Platform starts it may optionaly search for The Net Peer Group on the local network and, if found, instantiate it. Otherwise a default built-in configuration of The Net Peer Group is instantiated.

A non-default configuration of The Net Peer Group may be set-up by the administrator in charge of the network domain inside which the peer is starting. The Net Peer Group is discovered via the DiscoveryService protocol. Many such groups may be configured by an administrator.

StdPeergroup may also be used to implement User-defined peer groups--Users can create new peer groups which use their own set of customized services.

See Also:
PeerGroup

Field Summary
static Class DEFAULT_CONFIGURATOR
          Constant for specifying the default configurator.
static Class NULL_CONFIGURATOR
          Constant for specifying no configurator.
 
Method Summary
static Class getConfiguratorClass()
          Get the configurator class for the platform.
static PeerGroup newNetPeerGroup()
          Instantiates the platform peergroup and then instantiates the net peer group.
static PeerGroup newNetPeerGroup(PeerGroup ppg)
          Instantiates the net peer group using the provided platform peer group.
static PeerGroup newPeerGroup()
          Static Method to create a new peer group instance.
static PeerGroup newPlatform()
          Instantiates the Platform Peer Group.
static void setConfiguratorClass(Class c)
          Set the configurator class for the platform.
static void setNetPGDesc(String desc)
          Static Method to initialize the net peer group description.
static void setNetPGID(PeerGroupID id)
          Static Method to initialize the net peer group ID.
static void setNetPGName(String name)
          Static Method to initialize the net peer group name.
static void setPlatformClass(Class c)
          Static Method to initialize the Platform peer group class
static void setStdPeerGroupClass(Class c)
          Static Method to initialize the std peer group class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_CONFIGURATOR

public static final Class NULL_CONFIGURATOR
Constant for specifying no configurator.


DEFAULT_CONFIGURATOR

public static final Class DEFAULT_CONFIGURATOR
Constant for specifying the default configurator.

Method Detail

setPlatformClass

public static void setPlatformClass(Class c)
Static Method to initialize the Platform peer group class

Parameters:
c - The Class which will be instantiated for the World Peer Group

setStdPeerGroupClass

public static void setStdPeerGroupClass(Class c)
Static Method to initialize the std peer group class

Parameters:
c - Class to use for for general peer group creation.

setNetPGDesc

public static void setNetPGDesc(String desc)
Static Method to initialize the net peer group description.

Parameters:
desc - The description to use for the net peer group.
Since:
JXTA 2.1.1

setNetPGName

public static void setNetPGName(String name)
Static Method to initialize the net peer group name.

Parameters:
name - The name to use for the net peer group.
Since:
JXTA 2.1.1

setNetPGID

public static void setNetPGID(PeerGroupID id)
Static Method to initialize the net peer group ID.

Parameters:
id - The id to use for the net peer group.
Since:
JXTA 2.1.1

getConfiguratorClass

public static Class getConfiguratorClass()
Get the configurator class for the platform.

Returns:
Class configurator class
Since:
JXTA 2.2

setConfiguratorClass

public static void setConfiguratorClass(Class c)
Set the configurator class for the platform.

Parameters:
c - Class to use as a configurator.
Since:
JXTA 2.2

newPeerGroup

public static PeerGroup newPeerGroup()
Static Method to create a new peer group instance.

After beeing created the init method needs to be called, and the startApp() method may be called, at the invoker's discretion.

Returns:
PeerGroup instance of a new PeerGroup

newPlatform

public static PeerGroup newPlatform()
Instantiates the Platform Peer Group.

The Module.init(PeerGroup,ID,Advertisement) method is called automatically. The Module.startApp(String[]) method is left for the invoker to call if appropriate.

Invoking this method amounts to creating an instance of JXTA.

Since JXTA stores its persistent state in the local filesystem relative to the initial current directory, it is unadvisable to start more than one instance with the same current directory.

Returns:
PeerGroup instance of a new Platform

newNetPeerGroup

public static PeerGroup newNetPeerGroup(PeerGroup ppg)
                                 throws PeerGroupException
Instantiates the net peer group using the provided platform peer group.

Parameters:
ppg - The platform group.
Returns:
PeerGroup The default netPeerGroup
Throws:
PeerGroupException

newNetPeerGroup

public static PeerGroup newNetPeerGroup()
                                 throws PeerGroupException
Instantiates the platform peergroup and then instantiates the net peer group. This simplifies the method by which applications can start JXTA.

Returns:
The newly instantiated net peer group.
Throws:
PeerGroupException

JXTA J2SE