org.eclipse.ecf.core.identity
Interface IIDFactory

All Known Implementing Classes:
IDFactory

public interface IIDFactory

Contract for IDFactory


Method Summary
 Namespace addNamespace(Namespace n)
          Add the given Namespace to our table of available Namespaces
 boolean containsNamespace(Namespace n)
          Check whether table contains given Namespace instance
 ID createGUID()
          Make a GUID using SHA-1 hash algorithm and a default of 16bits of data length.
 ID createGUID(int length)
          Make a GUID using SHA-1 hash algorithm and a default of 16bits of data length.
 ID createID(Namespace n, java.lang.Object[] args)
          Make a new identity.
 ID createID(Namespace namespace, java.lang.String uri)
          Make a new identity instance from a namespace and String.
 ID createID(java.lang.String namespaceName, java.lang.Object[] args)
          Make a new identity.
 ID createID(java.lang.String namespaceName, java.lang.String idValue)
          Make a new identity instance from a namespaceName and idValue.
 ID createLongID(long l)
          Make a an ID from a long
 ID createStringID(java.lang.String idString)
          Make a an ID from a String
 Namespace getNamespace(Namespace n)
          Get the given Namespace instance from table
 Namespace getNamespaceByName(java.lang.String name)
          Get a Namespace instance by its string name.
 java.util.List getNamespaces()
          Get a list of the current Namespace instances exposed by this factory.
 Namespace removeNamespace(Namespace n)
          Remove the given Namespace from our table of available Namespaces
 

Method Detail

addNamespace

Namespace addNamespace(Namespace n)
                       throws java.lang.SecurityException
Add the given Namespace to our table of available Namespaces

Parameters:
n - the Namespace to add
Returns:
Namespace the namespace already in table (null if Namespace not previously in table)
Throws:
java.lang.SecurityException - thrown if caller does not have appropriate NamespacePermission for given namespace

containsNamespace

boolean containsNamespace(Namespace n)
                          throws java.lang.SecurityException
Check whether table contains given Namespace instance

Parameters:
n - the Namespace to look for
Returns:
true if table does contain given Namespace, false otherwise
Throws:
java.lang.SecurityException - thrown if caller does not have appropriate NamespacePermission for given namespace

getNamespaces

java.util.List getNamespaces()
                             throws java.lang.SecurityException
Get a list of the current Namespace instances exposed by this factory.

Returns:
List of Namespace instances
Throws:
java.lang.SecurityException - thrown if caller does not have appropriate NamespacePermission for given namespace

getNamespace

Namespace getNamespace(Namespace n)
                       throws java.lang.SecurityException
Get the given Namespace instance from table

Parameters:
n - the Namespace to look for
Returns:
Namespace
Throws:
java.lang.SecurityException - thrown if caller does not have appropriate NamespacePermission for given namespace

getNamespaceByName

Namespace getNamespaceByName(java.lang.String name)
                             throws java.lang.SecurityException
Get a Namespace instance by its string name.

Parameters:
name - the name to use for lookup
Returns:
Namespace instance. Null if not found.
Throws:
java.lang.SecurityException - thrown if caller does not have appropriate NamespacePermission for given namespace

createGUID

ID createGUID()
              throws IDCreateException
Make a GUID using SHA-1 hash algorithm and a default of 16bits of data length. The value is Base64 encoded to allow for easy display.

Returns:
new ID instance
Throws:
IDCreateException - if ID cannot be constructed

createGUID

ID createGUID(int length)
              throws IDCreateException
Make a GUID using SHA-1 hash algorithm and a default of 16bits of data length. The value is Base64 encoded to allow for easy display.

Parameters:
length - the byte-length of data used to create a GUID
Returns:
new ID instance
Throws:
IDCreateException - if ID cannot be constructed

createID

ID createID(Namespace n,
            java.lang.Object[] args)
            throws IDCreateException
Make a new identity. Given a Namespace, and an array of instance constructor parameters, return a new instance of an ID belonging to the given Namespace

Parameters:
n - the Namespace to which the ID will belong
args - an Object [] of the parameters for the ID instance constructor
Throws:
IDCreateException - thrown if class for instantiator or instance can't be loaded, if something goes wrong during instance construction

createID

ID createID(java.lang.String namespaceName,
            java.lang.Object[] args)
            throws IDCreateException
Make a new identity. Given a Namespace name, and an array of instance constructor parameters, return a new instance of an ID belonging to the given Namespace

Parameters:
namespaceName - the name of the Namespace to which the ID will belong
args - an Object [] of the parameters for the ID instance constructor
Throws:
IDCreateException - thrown if class for instantiator or ID instance can't be loaded, if something goes wrong during instance construction

createID

ID createID(Namespace namespace,
            java.lang.String uri)
            throws IDCreateException
Make a new identity instance from a namespace and String.

Parameters:
namespace - the namespace to use to create the ID
uri - the String uri to use to create the ID
Throws:
IDCreateException - thrown if class for instantiator or ID instance can't be loaded, if something goes wrong during instance construction

createID

ID createID(java.lang.String namespaceName,
            java.lang.String idValue)
            throws IDCreateException
Make a new identity instance from a namespaceName and idValue. The namespaceName is first used to lookup the namespace with getNamespaceByName(String), and then the result is passed into createID(Namespace,String).

Parameters:
namespaceName - the name of the namespace that should be used to create the ID
idValue - the String value to use to create the ID
Throws:
IDCreateException - thrown if class for instantiator or ID instance can't be loaded, if something goes wrong during instance construction

createStringID

ID createStringID(java.lang.String idString)
                  throws IDCreateException
Make a an ID from a String

Parameters:
idString - the String to use as this ID's unique value. Note: It is incumbent upon the caller of this method to be sure that the given string allows the resulting ID to satisfy the ID contract for global uniqueness within the associated Namespace.
Returns:
valid ID instance
Throws:
IDCreateException - thrown if class for instantiator or ID instance can't be loaded, if something goes wrong during instance construction

createLongID

ID createLongID(long l)
                throws IDCreateException
Make a an ID from a long

Parameters:
l - the long to use as this ID's unique value. Note: It is incumbent upon the caller of this method to be sure that the given long allows the resulting ID to satisfy the ID contract for global uniqueness within the associated Namespace.
Returns:
valid ID instance
Throws:
IDCreateException - thrown if class for instantiator or ID instance can't be loaded, if something goes wrong during instance construction

removeNamespace

Namespace removeNamespace(Namespace n)
                          throws java.lang.SecurityException
Remove the given Namespace from our table of available Namespaces

Parameters:
n - the Namespace to remove
Returns:
Namespace the namespace already in table (null if Namespace not previously in table)
Throws:
java.lang.SecurityException - thrown if caller does not have appropriate NamespacePermission for given namespace