public class IDFactory extends Object implements IIDFactory
| Modifier and Type | Field and Description |
|---|---|
protected static IIDFactory |
instance |
static String |
SECURITY_PROPERTY |
| Modifier and Type | Method and Description |
|---|---|
Namespace |
addNamespace(Namespace namespace)
Add the given Namespace to our table of available Namespaces
|
static Namespace |
addNamespace0(Namespace namespace) |
protected static void |
checkPermission(NamespacePermission namespacepermission) |
boolean |
containsNamespace(Namespace namespace)
Check whether table contains given Namespace instance
|
static boolean |
containsNamespace0(Namespace n) |
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,
Object[] args)
Make a new identity.
|
ID |
createID(Namespace namespace,
String uri)
Make a new identity instance from a namespace and String.
|
ID |
createID(String namespaceName,
Object[] args)
Make a new identity.
|
ID |
createID(String namespace,
String uri)
Make a new identity instance from a namespaceName and idValue.
|
ID |
createLongID(long l)
Make a an ID from a long
|
ID |
createStringID(String idstring)
Make a an ID from a String
|
ID |
createURIID(String uri)
Create a URIID from String.
|
ID |
createURIID(URI uri)
Create a URIID from URI.
|
ID |
createUuID()
Create a random UuID
|
ID |
createUuID(String uuid)
Create a UuID from String
|
ID |
createUuID(URI uuidURI)
Create a UuID from URI.
|
ID |
createUuID(UUID uuid)
Create a UuID from UUID
|
static IIDFactory |
getDefault() |
Namespace |
getNamespace(Namespace namespace)
Get the given Namespace instance from table
|
protected static Namespace |
getNamespace0(Namespace n) |
protected static Namespace |
getNamespace0(String name) |
Namespace |
getNamespaceByName(String name)
Get a Namespace instance by its string name.
|
List<Namespace> |
getNamespaces()
Get a list of the current Namespace instances exposed by this factory.
|
protected static void |
logAndThrow(String s,
Throwable t) |
Namespace |
removeNamespace(Namespace n)
Remove the given Namespace from our table of available Namespaces
|
static Namespace |
removeNamespace0(Namespace n) |
public static final String SECURITY_PROPERTY
protected static IIDFactory instance
public static IIDFactory getDefault()
public Namespace addNamespace(Namespace namespace) throws SecurityException
IIDFactoryaddNamespace in interface IIDFactorynamespace - the Namespace to addSecurityException - thrown if caller does not have appropriate
NamespacePermission for given namespaceprotected static final void checkPermission(NamespacePermission namespacepermission) throws SecurityException
SecurityExceptionpublic boolean containsNamespace(Namespace namespace) throws SecurityException
IIDFactorycontainsNamespace in interface IIDFactorynamespace - the Namespace to look forSecurityException - thrown if caller does not have appropriate
NamespacePermission for given namespacepublic List<Namespace> getNamespaces()
IIDFactorygetNamespaces in interface IIDFactorypublic static final boolean containsNamespace0(Namespace n)
public Namespace getNamespace(Namespace namespace) throws SecurityException
IIDFactorygetNamespace in interface IIDFactorynamespace - the Namespace to look forSecurityException - thrown if caller does not have appropriate
NamespacePermission for given namespacepublic Namespace getNamespaceByName(String name) throws SecurityException
IIDFactorygetNamespaceByName in interface IIDFactoryname - the name to use for lookupSecurityException - thrown if caller does not have appropriate
NamespacePermission for given namespacepublic ID createGUID() throws IDCreateException
IIDFactorycreateGUID in interface IIDFactoryIDCreateException - if ID cannot be constructedpublic ID createGUID(int length) throws IDCreateException
IIDFactorycreateGUID in interface IIDFactorylength - the byte-length of data used to create a GUIDIDCreateException - if ID cannot be constructedprotected static void logAndThrow(String s, Throwable t) throws IDCreateException
IDCreateExceptionpublic ID createID(Namespace n, Object[] args) throws IDCreateException
IIDFactorycreateID in interface IIDFactoryn - the Namespace to which the ID will belongargs - an Object [] of the parameters for the ID instance constructorIDCreateException - thrown if class for instantiator or instance can't be
loaded, if something goes wrong during instance
constructionpublic ID createID(String namespaceName, Object[] args) throws IDCreateException
IIDFactorycreateID in interface IIDFactorynamespaceName - the name of the Namespace to which the ID will belongargs - an Object [] of the parameters for the ID instance constructorIDCreateException - thrown if class for instantiator or ID instance can't be
loaded, if something goes wrong during instance
constructionpublic ID createID(Namespace namespace, String uri) throws IDCreateException
IIDFactorycreateID in interface IIDFactorynamespace - the namespace to use to create the IDuri - the String uri to use to create the IDIDCreateException - thrown if class for instantiator or ID instance can't be
loaded, if something goes wrong during instance
constructionpublic ID createID(String namespace, String uri) throws IDCreateException
IIDFactoryIIDFactory.getNamespaceByName(String), and then the result is passed into
IIDFactory.createID(Namespace,String).createID in interface IIDFactorynamespace - the name of the namespace that should be used to create the IDuri - the String value to use to create the IDIDCreateException - thrown if class for instantiator or ID instance can't be
loaded, if something goes wrong during instance
constructionpublic ID createStringID(String idstring) throws IDCreateException
IIDFactorycreateStringID in interface IIDFactoryidstring - 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.IDCreateException - thrown if class for instantiator or ID instance can't be
loaded, if something goes wrong during instance constructionpublic ID createLongID(long l) throws IDCreateException
IIDFactorycreateLongID in interface IIDFactoryl - 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.IDCreateException - thrown if class for instantiator or ID instance can't be
loaded, if something goes wrong during instance constructionpublic Namespace removeNamespace(Namespace n) throws SecurityException
IIDFactoryremoveNamespace in interface IIDFactoryn - the Namespace to removeSecurityException - thrown if caller does not have appropriate
NamespacePermission for given namespacepublic ID createUuID(String uuid) throws IDCreateException
IIDFactorycreateUuID in interface IIDFactoryuuid - the String to use. Must be in UUID format as returned from
UUID.toString(). Must not be null.IDCreateExceptionpublic ID createUuID(UUID uuid) throws IDCreateException
IIDFactorycreateUuID in interface IIDFactoryuuid - the UUID to use. Must not be null.IDCreateExceptionpublic ID createUuID(URI uuidURI) throws IDCreateException
IIDFactorycreateUuID in interface IIDFactoryuuidURI - the URI. Must not be null and must be in valid uuid syntax
form as specified by rfc4122 see
http://tools.ietf.org/html/rfc4122. Example:
'uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'IDCreateExceptionpublic ID createURIID(URI uri) throws IDCreateException
IIDFactorycreateURIID in interface IIDFactoryuri - the URI to use for the URIID. Must not be null.IDCreateExceptionpublic ID createURIID(String uri) throws IDCreateException
IIDFactorycreateURIID in interface IIDFactoryuri - the String to use for the URIID. Must not be null, and must be
valid URI format as per URI.toString().IDCreateExceptionpublic ID createUuID() throws IDCreateException
IIDFactorycreateUuID in interface IIDFactoryIDCreateExceptionCopyright © 2004–2020 Eclipse Foundation. All rights reserved.