Project JXTA

net.jxta.protocol
Class PeerAdvertisement

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

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

This type of advertisement is used in two different fashions: One is generated when instantiating a group on a peer and contains all the parameters that services need to publish. It is then published within the the group. The other is generated by configuration menus and serves to pass to all services their optional user-driven configuration. Some of which may be published as part of the above process. A configuration PeerAdvertisement is not itself published.


Constructor Summary
PeerAdvertisement()
           
 
Method Summary
 java.lang.Object clone()
          Make a safe clone of this PeerAdvertisement.
static java.lang.String getAdvertisementType()
          returns the advertisement type
 java.lang.String getDebugLevel()
          returns the debugLevel
 java.lang.String getDescription()
          returns the description
 ID getID()
          Returns a unique ID for that peer X group intersection.
 java.lang.String getName()
          returns the name of the peer.
 PeerGroupID getPeerGroupID()
          Returns the id of the peergroup this peer advertisement is for.
 PeerID getPeerID()
          Returns the id of the peer.
 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 setDebugLevel(java.lang.String debugLevel)
          sets the debugLevel
 void setDescription(java.lang.String description)
          sets the description
 void setName(java.lang.String name)
          sets the name of the peer.
 void setPeerGroupID(PeerGroupID gid)
          Returns the id of the peergroup this peer advertisement is for.
 void setPeerID(PeerID pid)
          Sets the id of the peer.
 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

PeerAdvertisement

public PeerAdvertisement()
Method Detail

clone

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

getAdvertisementType

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

getName

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

setName

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

getPeerID

public PeerID getPeerID()
Returns the id of the peer.
Returns:
PeerID the peer id
Since:
JXTA 1.0

setPeerID

public void setPeerID(PeerID pid)
Sets the id of the peer.
Parameters:
id - The id of the peer.
Since:
JXTA 1.0

getPeerGroupID

public PeerGroupID getPeerGroupID()
Returns the id of the peergroup this peer advertisement is for.
Returns:
PeerGroupID the peergroup id
Since:
JXTA 1.0

setPeerGroupID

public void setPeerGroupID(PeerGroupID gid)
Returns the id of the peergroup this peer advertisement is for.
Parameters:
gid - The id of the peer.
Since:
JXTA 1.0

getID

public ID getID()
Returns a unique ID for that peer X group intersection. This is for indexing purposes only. We return a composite ID that represents this peer is this group rather than in the platform, which is what the regular peerId shows. May-be one day we'll want to name a peer differently in each group, exactly in this way. In the meantime we still need it to uniquely identify this adv.
Overrides:
getID in class Advertisement
Returns:
ID the composite ID
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

getDebugLevel

public java.lang.String getDebugLevel()
returns the debugLevel
Returns:
String the debugLevel
Since:
JXTA 1.0

setDebugLevel

public void setDebugLevel(java.lang.String debugLevel)
sets the debugLevel
Parameters:
description - the debugLevel
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