Package org.eclipse.ecf.core.identity
Class GUID
java.lang.Object
org.eclipse.ecf.core.identity.BaseID
org.eclipse.ecf.core.identity.StringID
org.eclipse.ecf.core.identity.GUID
- All Implemented Interfaces:
Serializable
,Comparable
,Principal
,org.eclipse.core.runtime.IAdaptable
,ID
Globally unique ID implementation class. Uses
SecureRandom
to create a unique number of given byte
length. Default byte length for secure number is 20 bytes. Default algorithm
used for creating a SecureRandom instance is SHA1PRNG.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.ecf.core.identity.StringID
StringID.StringIDNamespace
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
protected static SecureRandom
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static SecureRandom
Get SecureRandom instance for creation of random number.protected static void
initializeRandom
(String algo, String provider) toString()
Methods inherited from class org.eclipse.ecf.core.identity.StringID
compareTo, equals, getName, getNamespace, hashCode, namespaceCompareTo, namespaceEquals, namespaceGetName, namespaceHashCode, setEmptyNamespace, toExternalForm
Methods inherited from class org.eclipse.ecf.core.identity.BaseID
getAdapter, namespaceToExternalForm
-
Field Details
-
SR_DEFAULT_ALGO
-
SR_DEFAULT_PROVIDER
-
DEFAULT_BYTE_LENGTH
public static final int DEFAULT_BYTE_LENGTH- See Also:
-
random
-
-
Constructor Details
-
GUID
public GUID()- Since:
- 3.9
-
GUID
Protected constructor for factory-based construction- Parameters:
n
- the Namespace this identity will belong toprovider
- the name of the algorithm to use. SeeSecureRandom
byteLength
- the length of the target number (in bytes)- Throws:
IDCreateException
-
GUID
-
GUID
- Throws:
IDCreateException
-
GUID
- Throws:
IDCreateException
-
-
Method Details
-
getRandom
Get SecureRandom instance for creation of random number.- Parameters:
algo
- the String algorithm specification (e.g. "SHA1PRNG") for creation of the SecureRandom instanceprovider
- the provider of the implementation of the given algorighm (e.g. "SUN")- Returns:
- SecureRandom
- Throws:
Exception
- thrown if SecureRandom instance cannot be created/accessed
-
initializeRandom
- Throws:
Exception
-
toString
-