JXTA

net.jxta.impl.protocol
Class GroupConfig

java.lang.Object
  extended by net.jxta.document.Advertisement
      extended by net.jxta.document.ExtendableAdvertisement
          extended by net.jxta.protocol.ConfigParams
              extended by net.jxta.impl.protocol.GroupConfig
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
PlatformConfig

public class GroupConfig
extends ConfigParams
implements Cloneable

Configuration container for any Peer Group.


Nested Class Summary
static class GroupConfig.Instantiator
          Instantiator for GroupConfig
 
Field Summary
 
Fields inherited from class net.jxta.protocol.ConfigParams
modCount
 
Constructor Summary
GroupConfig()
          Use the Instantiator through the factory
GroupConfig(XMLElement doc)
          Use the Instantiator through the factory
 
Method Summary
 GroupConfig clone()
          Make a safe clone of this GroupConfig.
static String getAdvertisementType()
          returns the advertisement type
 String getAdvType()
          Returns the identifying type of this Advertisement.
 StructuredDocument getDocument(MimeMediaType encodeAs)
          Write this advertisement into a document of the requested type.
 ID getID()
          Returns an ID which identifies this Advertisement as uniquely as possible.
 String[] getIndexFields()
          Returns the element names on which this advertisement should be indexed.
 
Methods inherited from class net.jxta.protocol.ConfigParams
addDocumentElements, equals, getBaseAdvType, getModCount, getServiceParam, getServiceParamsEntrySet, getSvcConfigAdvertisement, handleElement, incModCount, isSvcEnabled, putServiceParam, removeServiceParam, removeSvcConfigAdvertisement, setSvcConfigAdvertisement, setSvcConfigAdvertisement
 
Methods inherited from class net.jxta.document.ExtendableAdvertisement
handleAttribute
 
Methods inherited from class net.jxta.document.Advertisement
toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GroupConfig

GroupConfig()
Use the Instantiator through the factory


GroupConfig

GroupConfig(XMLElement doc)
Use the Instantiator through the factory

Parameters:
root - the element
Method Detail

clone

public GroupConfig clone()
Make a safe clone of this GroupConfig.

Overrides:
clone in class ConfigParams
Returns:
Object an object of class GroupConfig that is a deep-enough copy of this one.

getAdvertisementType

public static String getAdvertisementType()
returns the advertisement type

Returns:
string type

getAdvType

public String getAdvType()
Returns the identifying type of this Advertisement. Unlike Advertisement.getAdvertisementType() this method will return the correct runtime type of an Advertisement object.

This implementation is provided for existing advertisements which do not provide their own implementation. In most cases you should provide your own implementation for efficiency reasons.

Overrides:
getAdvType in class Advertisement
Returns:
The identifying type of this Advertisement.

getDocument

public StructuredDocument getDocument(MimeMediaType encodeAs)
Write this advertisement into a document of the requested type. Two standard document forms are defined. "text/plain" encodes the document in a "pretty-print" format for human viewing and "text/xml" which provides an XML format.

We don't have any content to add, just build the document instance and return it to implementations that actually do something with it.

Overrides:
getDocument in class ExtendableAdvertisement
Parameters:
encodeAs - MimeMediaType format representation requested.
Returns:
The Advertisement represented as a Document of the requested MIME Media Type.

getIndexFields

public String[] getIndexFields()
Returns the element names on which this advertisement should be indexed.

Specified by:
getIndexFields in class Advertisement
Returns:
The element names on which this advertisement should be indexed.

getID

public ID getID()
Returns an ID which identifies this Advertisement as uniquely as possible. This ID is typically used as the primary key for indexing of the Advertisement within databases.

Each advertisement sub-class must choose an appropriate implementation which returns canonical and relatively unique ID values for it's instances. Since this ID is commonly used for indexing, the IDs returned must be as unique as possible to avoid collisions. The value for the ID returned can either be:

  • An ID which is already part of the advertisement definition and is relatively unique between advertisements instances. For example, the Peer Advertisement returns the Peer ID.
  • A static CodatID which is generated via some canonical process which will produce the same value each time and different values for different advertisements of the same type.
  • ID.nullID for advertisement types which are not readily indexed.

For Advertisement types which normally return non-ID.nullID values no ID should be returned when asked to generate an ID while the Advertisement is an inconsistent state (example: uninitialized index fields). Instead IllegalStateException should be thrown.

Specified by:
getID in class Advertisement
Returns:
An ID that relatively uniquely identifies this advertisement or ID.nullID if this advertisement is of a type that is not normally indexed.

JXSE