JXTA

net.jxta.peergroup
Class NetPeerGroupFactory

java.lang.Object
  extended by net.jxta.peergroup.NetPeerGroupFactory

public final class NetPeerGroupFactory
extends Object

A factory for instantiating a Network Peer Group instances. The Network Peer Group is the base peer group for applications and services within the JXTA network. Most applications and services will instantiate their own peer groups using the Network Peer Group as a base.

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

Since:
JXTA JSE 2.4
See Also:
PeerGroup, WorldPeerGroupFactory

Constructor Summary
NetPeerGroupFactory()
          Instantiates the Net Peer Group using the ConfigParams found in the directory specified by the JXTA_HOME system property or the ".jxta/" directory if JXTA_HOME is not defined.
NetPeerGroupFactory(ConfigParams config, URI storeHome)
          Constructs a Net Peer Group and the World Peer Group using the configuration specified by the provided ConfigParams and using the specified storeHome location for persistence.
NetPeerGroupFactory(ConfigParams config, URI storeHome, ID id, String name, XMLElement desc)
          Deprecated. With the addition of support for PeerGroupConfigAdv this constructor is being deprecated as the precedence of settings is ambiguous.
NetPeerGroupFactory(PeerGroup parentGroup)
          Constructs a Net Peer Group using the specified parent peer group.
NetPeerGroupFactory(PeerGroup parentGroup, ConfigParams config, ModuleImplAdvertisement moduleImplAdv)
          Constructs a Net Peer Group instance using the specified parent peer group (normally the World Peer Group).
NetPeerGroupFactory(PeerGroup parentGroup, ConfigParams config, URI storeHome)
          Constructs a Net Peer Group and the World Peer Group using the configuration specified by the provided ConfigParams and using the specified storeHome location for persistence.
NetPeerGroupFactory(PeerGroup parentGroup, ID id, String name, XMLElement desc)
          Deprecated. With the addition of support for PeerGroupConfigAdv this constructor is being deprecated as the precedence of settings is ambiguous.
NetPeerGroupFactory(PeerGroup parentGroup, ID id, String name, XMLElement desc, ModuleImplAdvertisement moduleImplAdv)
          Deprecated. With the addition of support for PeerGroupConfigAdv this constructor is being deprecated as the precedence of settings is ambiguous.
 
Method Summary
 PeerGroup getInterface()
          Returns a strong (reference counted) interface object for the Net Peer Group instance.
 PeerGroup getWeakInterface()
          Returns a weak (non-reference counted) interface object for the Net Peer Group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetPeerGroupFactory

public NetPeerGroupFactory()
                    throws PeerGroupException
Instantiates the Net Peer Group using the ConfigParams found in the directory specified by the JXTA_HOME system property or the ".jxta/" directory if JXTA_HOME is not defined.

This constructor is provided primarily for backwards compatibility. Though not deprecated this method should be considered as sample code only and the other constructors should be used whenever possible.

Throws:
PeerGroupException - Thrown for problems constructing the Net Peer Group.

NetPeerGroupFactory

public NetPeerGroupFactory(PeerGroup parentGroup)
                    throws PeerGroupException
Constructs a Net Peer Group using the specified parent peer group. This is the preferred constructor for constructing a Net Peer Group using the default configuration. The resulting Net Peer Group instance will use the default ID, Name and Description.

Parameters:
parentGroup - The Peer Group which will be the parent of the newly created net peer group. This should normally be the World Peer Group.
Throws:
PeerGroupException - Thrown for problems constructing the Net Peer Group.

NetPeerGroupFactory

public NetPeerGroupFactory(ConfigParams config,
                           URI storeHome)
                    throws PeerGroupException
Constructs a Net Peer Group and the World Peer Group using the configuration specified by the provided ConfigParams and using the specified storeHome location for persistence. The resulting Net Peer Group instance will use the default ID, Name and Description.

Parameters:
config - The configuration to use for the newly created World Peer Group and Net Peer Groups.
storeHome - The optional location that the World Peer Group, the Net Peer Group and its' services should use for storing persistent and transient information. May be null if the World Peer Group is not provided a persistent store (though this not currently supported).
Throws:
PeerGroupException - Thrown for problems constructing the Net Peer Group.

NetPeerGroupFactory

public NetPeerGroupFactory(PeerGroup parentGroup,
                           ConfigParams config,
                           URI storeHome)
                    throws PeerGroupException
Constructs a Net Peer Group and the World Peer Group using the configuration specified by the provided ConfigParams and using the specified storeHome location for persistence. The resulting Net Peer Group instance will use the group information provided in the

This constructor is provided in anticipation of other improvements to the peer group instantiation process. Currently it has some unreasonable limitations which keep it from being very useful. In a future release it will be improved.

Parameters:
config - The configuration to use for the newly created World Peer Group and Net Peer Groups.
storeHome - The optional location that the World Peer Group, the Net Peer Group and its' services should use for storing persistent and transient information. May be null if the World Peer Group is not provided a persistent store (though this not currently supported).
parentGroup - the parent peer group
Throws:
PeerGroupException - Thrown for problems constructing the Net Peer Group.

NetPeerGroupFactory

@Deprecated
public NetPeerGroupFactory(ConfigParams config,
                                      URI storeHome,
                                      ID id,
                                      String name,
                                      XMLElement desc)
                    throws PeerGroupException
Deprecated. With the addition of support for PeerGroupConfigAdv this constructor is being deprecated as the precedence of settings is ambiguous.

Constructs a Net Peer Group and the World Peer Group using the configuration specified by the provided ConfigParams and using the specified storeHome location for persistence.

Parameters:
config - The configuration to use for the newly created World Peer Group and Net Peer Groups.
storeHome - The optional location that the World Peer Group, the Net Peer Group and its' services should use for storing persistent and transient information. May be null if the World Peer Group is not provided a persistent store (though this not currently supported).
id - The PeerGroupID which will be used for the new Net Peer Group instance.
name - The name which will be used for the new Net Peer Group instance.
desc - The description which will be used for the new Net Peer Group instance. You can construct an XMLDocument from a String via :

     XMLDocument asDoc = StructuredDocumentFactory.newStructuredDocument( MimeMediaType.XMLUTF8, "desc", asString );
 
Throws:
PeerGroupException - Thrown for problems constructing the Net Peer Group.

NetPeerGroupFactory

@Deprecated
public NetPeerGroupFactory(PeerGroup parentGroup,
                                      ID id,
                                      String name,
                                      XMLElement desc)
                    throws PeerGroupException
Deprecated. With the addition of support for PeerGroupConfigAdv this constructor is being deprecated as the precedence of settings is ambiguous.

Constructs a Net Peer Group instance using the specified parent peer group (normally the World Peer Group). This is the preferred constructor for constructing a private Net Peer Group.

Parameters:
parentGroup - The Peer Group which will be the parent of the newly created net peer group. This should normally be the World Peer Group.
id - The PeerGroupID which will be used for the new Net Peer Group instance.
name - The name which will be used for the new Net Peer Group instance.
desc - The description which will be used for the new Net Peer Group instance. You can construct an XMLDocument from a String via :

     XMLDocument asDoc = StructuredDocumentFactory.newStructuredDocument( MimeMediaType.XMLUTF8, "desc", asString );
 
Throws:
PeerGroupException - Thrown for problems constructing the Net Peer Group.

NetPeerGroupFactory

@Deprecated
public NetPeerGroupFactory(PeerGroup parentGroup,
                                      ID id,
                                      String name,
                                      XMLElement desc,
                                      ModuleImplAdvertisement moduleImplAdv)
                    throws PeerGroupException
Deprecated. With the addition of support for PeerGroupConfigAdv this constructor is being deprecated as the precedence of settings is ambiguous.

Constructs a Net Peer Group instance using the specified parent peer group (normally the World Peer Group). This is the preferred constructor for constructing a private Net Peer Group with a specific implementation.

Parameters:
parentGroup - The Peer Group which will be the parent of the newly created net peer group. This should normally be the World Peer
id - The PeerGroupID which will be used for the new Net Peer Group instance.
name - The name which will be used for the new Net Peer Group instance.
desc - The description which will be used for the new Net Peer Group instance. You can construct an XMLDocument from a String via :

     XMLDocument asDoc = StructuredDocumentFactory.newStructuredDocument( MimeMediaType.XMLUTF8, "desc", asString );
 
moduleImplAdv - The Module Impl Advertisement for the new Net Peer Group instance.
Throws:
PeerGroupException - Thrown for problems constructing the Net Peer Group.

NetPeerGroupFactory

public NetPeerGroupFactory(PeerGroup parentGroup,
                           ConfigParams config,
                           ModuleImplAdvertisement moduleImplAdv)
                    throws PeerGroupException
Constructs a Net Peer Group instance using the specified parent peer group (normally the World Peer Group). This is the preferred constructor for constructing a Net Peer Group with a specific implementation.

Parameters:
parentGroup - The Peer Group which will be the parent of the newly created net peer group. This should normally be the World Peer Group.
config - The configuration parameters for the newly created Net Peer Group instance.
moduleImplAdv - The Module Impl Advertisement for the new Net Peer Group instance.
Throws:
PeerGroupException - Thrown for problems constructing the Net Peer Group.
Method Detail

getInterface

public PeerGroup getInterface()
Returns a strong (reference counted) interface object for the Net Peer Group instance. This reference should be explicitly unreferenced when it is no longer needed.

Returns:
A strong (reference counted) interface object for the Net Peer Group.
See Also:
PeerGroup.unref()

getWeakInterface

public PeerGroup getWeakInterface()
Returns a weak (non-reference counted) interface object for the Net Peer Group.

Returns:
A weak (non-reference counted) interface object for the Net Peer Group.
See Also:
PeerGroup.getWeakInterface()

JXSE