Project JXTA

net.jxta.impl.id.binaryID
Class PeerGroupBinaryID

java.lang.Object
  extended by net.jxta.id.ID
      extended by net.jxta.peergroup.PeerGroupID
          extended by net.jxta.impl.id.binaryID.PeerGroupBinaryID
All Implemented Interfaces:
Serializable

public final class PeerGroupBinaryID
extends PeerGroupID

This class implements a PeerGroup ID. Each peer group is assigned a unique peer id.BinaryID id are used to implement peer group id. Because this id is built with BinaryID, pulling the parent group requires a little work. The parent group is the first id, with the second following, seperated by a dash '-' character.

Author:
Daniel Brookshier turbogeek@cluck.com
See Also:
ID, IDFactory, net.jxta.impl.id.BinaryID.BinaryID, net.jxta.impl.id.BinaryID.BinaryIDFactory, PeerGroupID, Serialized Form

Field Summary
protected  String id
          This is the id string used in the XML of the id.
 
Fields inherited from class net.jxta.peergroup.PeerGroupID
defaultNetPeerGroupID, worldPeerGroupID
 
Fields inherited from class net.jxta.id.ID
nullID, URIEncodingName, URNNamespace
 
Constructor Summary
  PeerGroupBinaryID()
          Constructor for creating a new PeerGroupID.
  PeerGroupBinaryID(BinaryID id)
          Constructor.
  PeerGroupBinaryID(byte[] data, boolean lengthIncluded)
          Constructor for creating a new PeerGroupID with a unique ID and a parent.
  PeerGroupBinaryID(PeerGroupID parent, byte[] data, boolean lengthIncluded)
          Constructor for creating a new PeerGroupID with a unique ID and a parent.
protected PeerGroupBinaryID(String id)
          Creates a ID from a string.
 
Method Summary
 boolean equals(Object target)
          
protected  String getID()
          returns the coded ID without the binaryid tag.
 String getIDFormat()
          
 PeerGroupID getParentPeerGroupID()
          
 ID getPeerGroupID()
          
 Object getUniqueValue()
          
 URL getURL()
          
 int hashCode()
          
 
Methods inherited from class net.jxta.id.ID
clone, create, toString, toURI
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected String id
This is the id string used in the XML of the id. The format is TX0..Xn where T is the type and X0 through Xn are the base64 encoded id.

Constructor Detail

PeerGroupBinaryID

public PeerGroupBinaryID(PeerGroupID parent,
                         byte[] data,
                         boolean lengthIncluded)
Constructor for creating a new PeerGroupID with a unique ID and a parent.

Note that only the ID for the parent is obtained and not the parent and the grandparent.

Parameters:
parent - Parent peer group.
data - data byte array to be used as the id.
lengthIncluded - If true, the first byte in the data array is the length of the remaining bytes.

PeerGroupBinaryID

protected PeerGroupBinaryID(String id)
Creates a ID from a string. Note that the ID is not currently validated.

Parameters:
id - Value of ID.

PeerGroupBinaryID

public PeerGroupBinaryID(byte[] data,
                         boolean lengthIncluded)
Constructor for creating a new PeerGroupID with a unique ID and a parent.

Parameters:
data - DOCUMENT ME!
lengthIncluded - DOCUMENT ME!

PeerGroupBinaryID

public PeerGroupBinaryID()
Constructor for creating a new PeerGroupID. Note that this creates an invalid ID but is required for serialization.


PeerGroupBinaryID

public PeerGroupBinaryID(BinaryID id)
Constructor. Intializes contents from provided ID. This PeerGroupID has no parent.

Parameters:
id - the ID data
Method Detail

equals

public boolean equals(Object target)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

getIDFormat

public String getIDFormat()

Specified by:
getIDFormat in class ID

getUniqueValue

public Object getUniqueValue()

Specified by:
getUniqueValue in class ID

getURL

public URL getURL()

Specified by:
getURL in class ID

getPeerGroupID

public ID getPeerGroupID()


getParentPeerGroupID

public PeerGroupID getParentPeerGroupID()

Specified by:
getParentPeerGroupID in class PeerGroupID

getID

protected String getID()
returns the coded ID without the binaryid tag.

Returns:
The coded ID without the binaryid tag.

JXTA J2SE