org.apache.turbine.util.db
Class UUIdGenerator

java.lang.Object
  extended byorg.apache.turbine.util.db.UUIdGenerator

Deprecated. Use the Unique ID Service

public class UUIdGenerator
extends java.lang.Object

This class generates universally unique id's in the form of a String. The id has three parts. The first is supposed to be location dependent. The preferred location parameter is an ethernet (MAC) address, but an IP can be used as well. if none is supplied a Math.random generated number will be used. This part of the key will be 48 bits in length. The second part of the key is time related and will be the lower 48 bits of the long used to signify the time since Jan. 1, 1970. This will cause key rollover in the year 6429. The preceding 12 bytes are Base64 encoded with the characters / and * replaced by _ (underscore) and - (dash). Resulting in 16 characters. Finally a counter is used to hand out 4095 keys in between each timestamp. The resulting id is a String of 18 characters including: a-z,A-Z,0-9, and the previously mentioned - and _.

Note this class does not save any state information, so it is important that time only moves forward to keep the integrity of the ids. We might want to consider saving some state info.

To specify the MAC/Ethernet address, add a uuid.address= property to the TurbineResources.properties file.

Version:
$Id: UUIdGenerator.java 264152 2005-08-29 14:50:22Z henning $
Author:
John D. McNally, Henning P. Schmiedehausen

Constructor Summary
UUIdGenerator()
          Deprecated. Constructor
 
Method Summary
 java.lang.String getId()
          Deprecated. Gets the id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UUIdGenerator

public UUIdGenerator()
              throws TurbineException
Deprecated. 
Constructor

Method Detail

getId

public java.lang.String getId()
                       throws java.lang.Exception
Deprecated. 
Gets the id

Returns:
the 18 character id
Throws:
java.lang.Exception


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.