|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.turbine.util.db.UUIdGenerator
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.
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 |
public UUIdGenerator() throws TurbineException
Method Detail |
public java.lang.String getId() throws java.lang.Exception
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |