Project JXTA

net.jxta.id
Interface IDFactory.Instantiator

Enclosing class:
IDFactory

public static interface IDFactory.Instantiator

Interface for instantiators of IDs


Method Summary
 ID fromURL(java.net.URL source)
          Construct a new ID instance from a JXTA ID contained in a URI.
 java.lang.String getSupportedIDFormat()
          Returns the ID format value associated with this ID format
 CodatID newCodatID(PeerGroupID groupID)
          Creates a new CodatID Instance.
 CodatID newCodatID(PeerGroupID groupID, java.io.InputStream in)
          Creates a new CodatID Instance.
 ModuleClassID newModuleClassID()
          Creates a new ModuleClassID Instance.
 ModuleClassID newModuleClassID(ModuleClassID baseClass)
          Creates a new ModuleClassID Instance.
 ModuleSpecID newModuleSpecID(ModuleClassID baseClass)
          Creates a new ModuleClassID Instance.
 PeerGroupID newPeerGroupID()
          Creates a new PeerGroupID Instance.
 PeerID newPeerID(PeerGroupID groupID)
          Creates a new PeerID Instance.
 PipeID newPipeID(PeerGroupID groupID)
          Creates a new PeerGroupID Instance.
 PipeID newPipeID(PeerGroupID groupID, byte[] seed)
          Creates a new PipeID Instance.
 

Method Detail

getSupportedIDFormat

public java.lang.String getSupportedIDFormat()
Returns the ID format value associated with this ID format
Returns:
String containing the ID format value for this format.

fromURL

public ID fromURL(java.net.URL source)
           throws java.net.MalformedURLException,
                  java.net.UnknownServiceException
Construct a new ID instance from a JXTA ID contained in a URI.
Parameters:
source - URI which will be decoded to create a new ID instance.
Returns:
ID containing the new ID instance initialized from the URI.
Throws:
java.net.UnknownServiceException - Is thrown if the URI provided is of a format unrecognized by this JXTA implementation.
java.net.MalformedURLException - Is thrown if the URI provided is not a valid, recognized JXTA URI.
Since:
JXTA 1.0
See Also:
ID, URL

newCodatID

public CodatID newCodatID(PeerGroupID groupID)
Creates a new CodatID Instance. A new random Codata ID is created for the provided Peer Group. This type of CodatID can be used as a canonical reference for dynamic content.
Parameters:
groupID - the group to which this content will belong.
Returns:
the newly created ID.
Since:
JXTA 1.0
See Also:
CodatID

newCodatID

public CodatID newCodatID(PeerGroupID groupID,
                          java.io.InputStream in)
                   throws java.io.IOException
Creates a new CodatID Instance. A new random Codata ID is created for the provided Peer Group and contains a hash value for the Codat data. This type of Codat ID is most appropriate for static content. By including a hash value this form of Codat ID provides greater assurance of the canonical property of IDs. It also allows the document content returned when this ID is used to be verified to ensure it has not been altered.
Parameters:
groupID - The group to which this ID will belong.
in - The InputStream from which the content hash is calculated. The stream is read until EOF and then closed.
Returns:
the newly created ID.
Throws:
java.io.IOException - I/O Error reading document
Since:
JXTA 1.0
See Also:
CodatID

newPeerID

public PeerID newPeerID(PeerGroupID groupID)
Creates a new PeerID Instance. A new random peer id will be generated. The PeerID will be a member of the provided group.
Parameters:
groupID - the group to which this PeerID will belong.
Returns:
the newly created ID.
Since:
JXTA 1.0
See Also:
PeerID

newPeerGroupID

public PeerGroupID newPeerGroupID()
Creates a new PeerGroupID Instance. A new random peer group id will be generated.
Returns:
the newly created ID.
Since:
JXTA 1.0
See Also:
PeerGroupID

newPipeID

public PipeID newPipeID(PeerGroupID groupID)
Creates a new PeerGroupID Instance. A new random peer group id will be generated.
Parameters:
groupID - the group to which this Pipe ID will belong.
Returns:
the newly created ID.
Since:
JXTA 1.0
See Also:
PeerGroupID

newPipeID

public PipeID newPipeID(PeerGroupID groupID,
                        byte[] seed)
Creates a new PipeID Instance. A new pipe id will be generated with the provided seed information. The Pipe ID will be a member of the provided group. The seed information should be at least four bytes in length, though longer values are better. This varient of Pipe ID allows you to create "Well-known" pipes within the context of diverse groups. This can be useful for common services that need to do discovery without advertisements or for network organization services. Because of the potential for ID collisions and the difficulties with maintaining common service interfaces this form of Pipe ID should be used sparingly.
Parameters:
groupID - the group to which this Pipe ID will belong.
seed - The seed information which will be used in creating the pipeID.
Returns:
the newly created ID.
Since:
JXTA 1.0
See Also:
PipeID

newModuleClassID

public ModuleClassID newModuleClassID()
Creates a new ModuleClassID Instance. A new random Module Class Id will be generated with a zero value role identifier. This form of Module Class Id is appropriate for cases where the module does not need to be distinguished from other instances of the same Module.
Returns:
the newly created ID.
Since:
JXTA 1.0
See Also:
ModuleClassID

newModuleClassID

public ModuleClassID newModuleClassID(ModuleClassID baseClass)
Creates a new ModuleClassID Instance. A new random Module Class Id will be generated with a a random value role identifier and a base class of the provided Module Class ID. This form of Module Class Id is appropriate for cases where it is necessary to distinguish instances of the same service interface.
Parameters:
baseClass - The module class ID which will be used as a base class for this new role value instance.
Returns:
the newly created ID.
Since:
JXTA 1.0
See Also:
ModuleClassID

newModuleSpecID

public ModuleSpecID newModuleSpecID(ModuleClassID baseClass)
Creates a new ModuleClassID Instance. A new random Module Spec Id will be generated.
Parameters:
baseClass - The module class ID which will be used as a base class for this new Spec ID.
Returns:
the newly created ID.
Since:
JXTA 1.0
See Also:
ModuleSpecID

Project JXTA