Project JXTA

net.jxta.protocol
Class PeerGroupAdvertisement

java.lang.Object
  |
  +--net.jxta.document.Advertisement
        |
        +--net.jxta.protocol.PeerGroupAdvertisement
All Implemented Interfaces:
java.lang.Cloneable

public abstract class PeerGroupAdvertisement
extends Advertisement
implements java.lang.Cloneable

Describes a peer group and references additional information required for instantiating it. The PeerGroup method newGroup performs the task of instantiating a PeerGroup given its advertisement (provided the required subsequent documents can actually be found).

See Also:
ModuleSpecID, ModuleImplAdvertisement, PeerGroup

Constructor Summary
PeerGroupAdvertisement()
           
 
Method Summary
 java.lang.Object clone()
          Clone this PeerGroupAdvertisement
static java.lang.String getAdvertisementType()
          returns the advertisement type
 java.lang.String getDescription()
          returns the description
 ID getID()
          Returns a unique ID for indexing purposes.
 ModuleSpecID getModuleSpecID()
          Returns the id of the group spec that this uses.
 java.lang.String getName()
          returns the name of the group.
 PeerGroupID getPeerGroupID()
          Returns the id of the group.
 StructuredDocument getServiceParam(ID key)
          Returns the parameter element that matches the given key from the service parameters table.
 java.util.Hashtable getServiceParams()
          Returns the sets of parameters for all services.
 void putServiceParam(ID key, Element param)
          Puts a service parameter in the service parameters table under the given key.
 StructuredDocument removeServiceParam(ID key)
          Removes and returns the parameter element that matches the given key from the service parameters table.
 void setDescription(java.lang.String description)
          sets the description
 void setModuleSpecID(ModuleSpecID sid)
          Sets the id of the group spec that this uses.
 void setName(java.lang.String name)
          sets the name of the group.
 void setPeerGroupID(PeerGroupID gid)
          Sets the id of the group.
 void setServiceParams(java.util.Hashtable params)
          sets the sets of parameters for all services.
 
Methods inherited from class net.jxta.document.Advertisement
getDocument
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeerGroupAdvertisement

public PeerGroupAdvertisement()
Method Detail

getAdvertisementType

public static java.lang.String getAdvertisementType()
returns the advertisement type
Returns:
string type
Since:
JXTA 1.0

clone

public java.lang.Object clone()
Clone this PeerGroupAdvertisement
Overrides:
clone in class Advertisement
Returns:
Object an object of class PeerGroupAdvertisement that is a deep-enough copy of this one.

getName

public java.lang.String getName()
returns the name of the group.
Returns:
String name of the group.
Since:
JXTA 1.0

setName

public void setName(java.lang.String name)
sets the name of the group.
Parameters:
name - name of the group.
Since:
JXTA 1.0

getModuleSpecID

public ModuleSpecID getModuleSpecID()
Returns the id of the group spec that this uses.
Returns:
ID the spec id
Since:
JXTA 1.0

setModuleSpecID

public void setModuleSpecID(ModuleSpecID sid)
Sets the id of the group spec that this uses.
Parameters:
id - The id of the spec
Since:
JXTA 1.0

getPeerGroupID

public PeerGroupID getPeerGroupID()
Returns the id of the group.
Returns:
ID the group id
Since:
JXTA 1.0

setPeerGroupID

public void setPeerGroupID(PeerGroupID gid)
Sets the id of the group.
Parameters:
id - The id of the group.
Since:
JXTA 1.0

getID

public ID getID()
Returns a unique ID for indexing purposes. We use the id of the group as a plain ID.
Overrides:
getID in class Advertisement
Returns:
ID a unique id for that advertisement.
Since:
JXTA 1.0

getDescription

public java.lang.String getDescription()
returns the description
Returns:
String the description
Since:
JXTA 1.0

setDescription

public void setDescription(java.lang.String description)
sets the description
Parameters:
description - the description
Since:
JXTA 1.0

setServiceParams

public void setServiceParams(java.util.Hashtable params)
sets the sets of parameters for all services. This method first makes a deep copy, in order to protect the active information from uncontrolled sharing. This quite an expensive operation. If only a few of the parameters need to be added, it is wise to use putServiceParam() instead.
Parameters:
params - The whole set of parameters.
Since:
JXTA 1.0

getServiceParams

public java.util.Hashtable getServiceParams()
Returns the sets of parameters for all services. This method returns a deep copy, in order to protect the real information from uncontrolled sharing while keeping it shared as long as it is safe. This quite an expensive operation. If only a few parameters need to be accessed, it is wise to use getServiceParam() instead.
Parameters:
params - The whole set of parameters.
Since:
JXTA 1.0

putServiceParam

public void putServiceParam(ID key,
                            Element param)
Puts a service parameter in the service parameters table under the given key. The key is of a subclass of ID; usually a ModuleClassID. This method makes a deep copy of the given element into an independent document.
Parameters:
key - The key.
param - The parameter, as an element. What is stored is a copy as a standalone StructuredDocument which type is the element's name.
Since:
JXTA 1.0

getServiceParam

public StructuredDocument getServiceParam(ID key)
Returns the parameter element that matches the given key from the service parameters table. The key is of a subclass of ID; usually a ModuleClassID.
Parameters:
key - The key.
Returns:
StructuredDocument The matching parameter document or null if none matched. The document type id "Param".
Since:
JXTA 1.0

removeServiceParam

public StructuredDocument removeServiceParam(ID key)
Removes and returns the parameter element that matches the given key from the service parameters table. The key is of a subclass of ID; usually a ModuleClassID.
Parameters:
key - The key.
Returns:
Element the removed parameter element or null if not found. This is actually a StructureDocument of type "Param".
Since:
JXTA 1.0

Project JXTA