|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.doomdark.uuid.UUIDGenerator
public final class UUIDGenerator
UUIDGenerator is the class that contains factory methods for generating UUIDs using one of the three specified 'standard' UUID generation methods: (see draft-leach-uuids-guids-01.txt for details)
generateTimeBasedUUID() function.
| Method Summary | |
|---|---|
UUID |
generateNameBasedUUID(UUID nameSpaceUUID,
java.lang.String name)
Method similar to the previous one; the difference being that a shared MD5 digest instance will be used. |
UUID |
generateNameBasedUUID(UUID nameSpaceUUID,
java.lang.String name,
java.security.MessageDigest digest)
Method for generating name-based UUIDs, using the standard name-based generation method described in the UUID specs, and the caller supplied hashing method. |
UUID |
generateRandomBasedUUID()
Method for generating (pseudo-)random based UUIDs, using the default (shared) SecureRandom object. |
UUID |
generateRandomBasedUUID(java.security.SecureRandom randomGenerator)
Method for generating (pseudo-)random based UUIDs, using the specified SecureRandom object. |
UUID |
generateTagURIBasedUUID(TagURI name)
Method for generating UUIDs using tag URIs. |
UUID |
generateTagURIBasedUUID(TagURI name,
java.security.MessageDigest hasher)
Method for generating UUIDs using tag URIs. |
UUID |
generateTimeBasedUUID()
Method for generating time based UUIDs. |
UUID |
generateTimeBasedUUID(EthernetAddress addr)
Method for generating time based UUIDs. |
EthernetAddress |
getDummyAddress()
Method that returns a randomly generated dummy ethernet address. |
java.security.MessageDigest |
getHashAlgorithm()
|
static UUIDGenerator |
getInstance()
Method used for accessing the singleton generator instance. |
java.security.SecureRandom |
getRandomNumberGenerator()
Method for getting the shared random number generator used for generating the UUIDs. |
static void |
main(java.lang.String[] args)
A simple test harness is added to make (automated) testing of the class easier. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static UUIDGenerator getInstance()
public EthernetAddress getDummyAddress()
public java.security.SecureRandom getRandomNumberGenerator()
public java.security.MessageDigest getHashAlgorithm()
public UUID generateRandomBasedUUID()
public UUID generateRandomBasedUUID(java.security.SecureRandom randomGenerator)
randomGenerator - SecureRandom to use for getting the
random number from which UUID will be composed.
public UUID generateTimeBasedUUID()
hwAddress - Hardware address (802.1) to use for generating
spatially unique part of UUID. If system has more than one NIC,
any address is usable. If no NIC is available (or its address
not accessible; often the case with java apps), a randomly
generated broadcast address is acceptable. If so, use the
alternative method that takes no arguments.
public UUID generateTimeBasedUUID(EthernetAddress addr)
hwAddress - Hardware address (802.1) to use for generating
spatially unique part of UUID. If system has more than one NIC,
any address is usable. If no NIC is available (or its address
not accessible; often the case with java apps), a randomly
generated broadcast address is acceptable. If so, use the
alternative method that takes no arguments.
public UUID generateNameBasedUUID(UUID nameSpaceUUID,
java.lang.String name,
java.security.MessageDigest digest)
nameSpaceUUID - UUID of the namespace, as defined by the
spec. UUID has 4 pre-defined "standard" name space strings
that can be passed to UUID constructor (see example below).
Note that this argument is optional; if no namespace is needed
(for example when name includes namespace prefix), null may be
passed.name - Name to base the UUID on; for example,
IP-name ("www.w3c.org") of the system for UUID.NAMESPACE_DNS,
URL ("http://www.w3c.org/index.html") for UUID.NAMESPACE_URL
and so on.hash - Instance of MessageDigest to use for hashing the name
value. hash.reset() will be called before calculating the has
value, to make sure digest state is not random and UUID will
not be randomised.
UUID uuid = gen.generateNameBasedUUID(
new UUID(UUID.NAMESPACE_DNS, "www.w3c.org"));
public UUID generateNameBasedUUID(UUID nameSpaceUUID,
java.lang.String name)
public UUID generateTagURIBasedUUID(TagURI name)
name - tag URI to base UUID on.
public UUID generateTagURIBasedUUID(TagURI name,
java.security.MessageDigest hasher)
name - tag URI to base UUID on.hasher - Hashing algorithm to use. Note that the caller has to
make sure that it's thread-safe to use 'hasher', either by never
calling this method from multiple threads, or by explicitly sync'ing
the calls.public static void main(java.lang.String[] args)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||