JXTA

net.jxta.impl.id.binaryID
Class ModuleSpecBinaryID

java.lang.Object
  extended by net.jxta.id.ID
      extended by net.jxta.platform.ModuleSpecID
          extended by net.jxta.impl.id.binaryID.ModuleSpecBinaryID
All Implemented Interfaces:
Serializable

public final class ModuleSpecBinaryID
extends ModuleSpecID

A ModuleSpecID uniquely identifies a particular network behaviour (wire protocol and choregraphy) that may be embodied by a Jxta Module. There may be any number of implementations of a given SpecID. All such implementations are assumed to be network compatible.

The Specification that corresponds to a given ModuleSpecID may be published in a ModuleSpecAdvertisement. This advertisement is uniquely identified by the ModuleSpecID that it describes.

The various implementations of a given SpecID may be published in ModuleImplAdvertisements. These advertisements are identified by the ModuleSpecID that they implement and a compatibility statement. ModuleImplAdvertisements baring the same SpecID and compatibility statement are theorethicaly interchangeable. However they may be subsequently discriminated by a Description element.

A ModuleSpecID embeds a ModuleClassID which uniquely identifies a base Module class. A base module class defines a local behaviour and one API per compatible JXTA implementation.

A ModuleSpecID therefore uniquely identifies an abstract module, of which an implementation compatible with the local JXTA implementation may be located and instantiated.

In the standard PeerGroup implementation of the java reference implementation the various services are specified as a list of ModuleSpecID, for each of which the group locates and loads an implementation as part of the group's initialization.

Author:
Daniel Brookshier turbogeek@cluck.com
See Also:
PeerGroup, Module, ModuleClassID, ModuleSpecAdvertisement, ModuleImplAdvertisement, ID, Advertisement, Serialized Form

Field Summary
protected  BinaryID baseClassID
           
protected  BinaryID classID
           
protected  BinaryID specID
           
 
Fields inherited from class net.jxta.id.ID
nullID, URIEncodingName, URNNamespace
 
Constructor Summary
protected ModuleSpecBinaryID()
          Constructor.
protected ModuleSpecBinaryID(BinaryID classID, BinaryID baseClassID, BinaryID specID)
          Constructor.
protected ModuleSpecBinaryID(String id)
          Constructor.
 
Method Summary
 boolean equals(Object target)
          
 ModuleClassID getBaseClass()
          Return a ModuleClassID of the same base class but with the role portion set to zero. aka "the base class".
 BinaryID getBaseClassID()
          Getter for property baseClassID.
 BinaryID getClassID()
          Getter for property classID.
 String getIDFormat()
          Returns a string identifier which indicates which ID format is used by this ID instance.
 BinaryID getSpecID()
          Getter for property specID.
 Object getUniqueValue()
          Returns an object containing the unique value of the ID.
 int hashCode()
          
 boolean isOfSameBaseClass(ModuleClassID classId)
          Returns true if this ModuleSpecID is of the same base class than the given class.
 boolean isOfSameBaseClass(ModuleSpecID specId)
          Returns true if this ModuleSpecID is of the same base class than the the given ModuleSpecID.
 
Methods inherited from class net.jxta.platform.ModuleSpecID
create, intern
 
Methods inherited from class net.jxta.id.ID
getURL, toString, toURI
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

classID

protected BinaryID classID

baseClassID

protected BinaryID baseClassID

specID

protected BinaryID specID
Constructor Detail

ModuleSpecBinaryID

protected ModuleSpecBinaryID()
Constructor. Used only internally.

Since:
JXTA 1.0

ModuleSpecBinaryID

protected ModuleSpecBinaryID(String id)
Constructor. Intializes contents from provided ID.

Parameters:
id - the ID data
Since:
JXTA 1.0

ModuleSpecBinaryID

protected ModuleSpecBinaryID(BinaryID classID,
                             BinaryID baseClassID,
                             BinaryID specID)
Constructor. Creates a ModuleSpecID in a given class, with a given class unique id. A BinaryID of a class and another BinaryID are provided.

Parameters:
classID - the class to which this will belong.
baseClassID - the unique id of this spec in that class.
specID - the spec ID
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()
Returns a string identifier which indicates which ID format is used by this ID instance.

Specified by:
getIDFormat in class ID
Returns:
a string identifier which indicates which ID format is used by this ID instance.

getUniqueValue

public Object getUniqueValue()
Returns an object containing the unique value of the ID. This object must provide implementations of toString(), equals() and hashCode() that are canonical and consistent from run-to-run given the same input values. Beyond this nothing should be assumed about the nature of this object. For some implementations the object returned may be this.

Specified by:
getUniqueValue in class ID
Returns:
Object which can provide canonical representations of the ID.

getBaseClass

public ModuleClassID getBaseClass()
Return a ModuleClassID of the same base class but with the role portion set to zero. aka "the base class".

Specified by:
getBaseClass in class ModuleSpecID
Returns:
ModuleClassID the base class.

isOfSameBaseClass

public boolean isOfSameBaseClass(ModuleClassID classId)
Returns true if this ModuleSpecID is of the same base class than the given class. Note: This method is NOT named "isOfClass" because a ModuleClassID may have two portions; one that denotes a class proper, and an optional second one that denotes a "Role". For convenience, we refer the class stripped of its role portion as "the base class" although this is not a totally accurate term. A ModuleSpecID, is of a base class but is not related to any kind of role. So using "isOfClass" could be misleading. Base classes are represented by a class with the role ID set to zero, which happens to be a valid class. This routine may be used for comparison with such a class, of course.

Specified by:
isOfSameBaseClass in class ModuleSpecID
Parameters:
classId - Module class id to compare with
Returns:
boolean true if equals

isOfSameBaseClass

public boolean isOfSameBaseClass(ModuleSpecID specId)
Returns true if this ModuleSpecID is of the same base class than the the given ModuleSpecID.

Specified by:
isOfSameBaseClass in class ModuleSpecID
Parameters:
specId - Module spec id to compare with
Returns:
boolean true if equals

getClassID

public BinaryID getClassID()
Getter for property classID.

Returns:
Value of property classID.

getBaseClassID

public BinaryID getBaseClassID()
Getter for property baseClassID.

Returns:
Value of property baseClassID.

getSpecID

public BinaryID getSpecID()
Getter for property specID.

Returns:
Value of property specID.

JXSE