org.apache.commons.id.uuid
Class VersionOneGenerator

java.lang.Object
  extended by org.apache.commons.id.uuid.VersionOneGenerator
All Implemented Interfaces:
IdentifierGenerator, Constants

public final class VersionOneGenerator
extends java.lang.Object
implements IdentifierGenerator, Constants

Class is responsible for generating version 1 UUID's per RFC 4122. This class attempts to locate the machine's node identifier first by attempting to loading the properties file UUID.properties from the system classpath. If the UUID.properties file does not exist then the generator will create a node identifier from random information as defined in the RFC 4122: A Universally Unique IDentifier (UUID) URN Namespace.

Version:
$Revision: 480488 $ $Date: 2006-11-29 08:57:26 +0000 (Wed, 29 Nov 2006) $
Author:
Commons-Id team

Field Summary
 
Fields inherited from interface org.apache.commons.id.uuid.Constants
CLOCK_SEQ_HI_AND_RESERVED_BYTE_8, FORMAT_POSITION1, FORMAT_POSITION2, FORMAT_POSITION3, FORMAT_POSITION4, MD5_ENCODING, SHA1_ENCODING, TIME_HI_AND_VERSION_BYTE_6, TIME_HI_BYTE_LEN, TIME_HI_START_POS, TIME_HI_TS_POS, TIME_LOW_BYTE_LEN, TIME_LOW_START_POS, TIME_LOW_TS_POS, TIME_MID_BYTE_LEN, TIME_MID_START_POS, TIME_MID_TS_POS, TOKEN_LENGTHS, TOKENS_IN_UUID, URN_PREFIX, UUID_BIT_LENGTH, UUID_BYTE_LENGTH, UUID_FORMATTED_LENGTH, UUID_UNFORMATTED_LENGTH, VARIANT_FUTURE, VARIANT_IETF_DRAFT, VARIANT_MS, VARIANT_NCS_COMPAT, VERSION_FIVE, VERSION_FOUR, VERSION_ONE, VERSION_THREE, VERSION_TWO, WRONG_VAR_VER_MSG
 
Method Summary
static VersionOneGenerator getInstance()
          Returns the singleton instance of the version one UUID generator.
 java.lang.Object nextIdentifier()
          Gets the next identifier in the sequence.
 UUID nextUUID()
          Returns a new version 1 UUID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static VersionOneGenerator getInstance()

Returns the singleton instance of the version one UUID generator.

Returns:
the singleton instance of the version one UUID generator.

nextIdentifier

public java.lang.Object nextIdentifier()
Description copied from interface: IdentifierGenerator
Gets the next identifier in the sequence.

Specified by:
nextIdentifier in interface IdentifierGenerator
Returns:
the next identifier in sequence
See Also:
IdentifierGenerator.nextIdentifier()

nextUUID

public UUID nextUUID()

Returns a new version 1 UUID. The method acts upons static variables and so should be sychronized.

Returns:
Returns a new version 1 UUID.


Copyright 2003-2008 The Apache Software Foundation. All Rights Reserved.