|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jasig.portal.utils.GuidGenerator
public class GuidGenerator
Creates a Global/Universal Unique ID, per DCE RPC specification. Requires seed of MAC address/node identifier (12-digit hex string) for uniqueness. Specification found at the OpenGroup.Org web site.
Field Summary | |
---|---|
private static short |
CLOCKMOD
CLOCKMOD constitutes the net value range for the clock counter per RFC. |
private static java.lang.String |
clockSeq
clockSeq holds the static clock sequence string used in fourth element of Guid per RFC. |
private static long |
lastMilliTime
lastMilliTime holds the static last millisecond time requested in order to provide determination if nanoCounter needs to be adjusted. |
private java.lang.String |
macbase
macbase holds the instance initialization string denoting fifth element of Guid per RFC |
private static long |
nanoCounter
nanoCounter holds static iteration value for unique nanosecond value when two Guid values requested within clock resolution (one millisecond). |
private static short |
NANOS
NANOS is the conversion from millisecond timer to 100 nanoseconds per RFC. |
private static java.util.Random |
random
|
private java.lang.String |
timebase
timebase holds the instance string denoting elements one thru four of Guid per RFC |
Constructor Summary | |
---|---|
GuidGenerator()
GuidGenerator() - default constructor |
|
GuidGenerator(java.lang.String newMAC)
GuidGenerator(String) - seeded constructor |
Method Summary | |
---|---|
private static void |
bytesToHex(byte[] bytes,
java.lang.StringBuffer buffer)
Returns the hexidecimal representation of byte values in the array. |
(package private) static java.lang.String |
getClockSeq()
getClockSeq returns the RFC clock sequence string |
(package private) static long |
getLastTime()
getLastTime accesses lastMilliTime for return |
(package private) static long |
getMilliTime()
getMilliTime accesses the system clock |
(package private) static long |
getNano()
|
java.lang.String |
getNewGuid()
getNewGuid calls set to generate a new GUID |
private void |
initGuid(java.lang.String newMAC)
getNano atomically increments and returns nanoCounter |
static void |
main(java.lang.String[] args)
main is the unit testing interface that creates a new Guid instance and prints result of getNewGuid to System.out |
(package private) static void |
nanoBump()
nanoBump increments nanoCounter |
(package private) static void |
nanoReset()
nanoReset zeroes nanoCounter |
void |
set()
set is where all the work is done |
(package private) static void |
setClockSeq()
setClockSeq sets the RFC clock sequence string |
(package private) static void |
setLastTime(long lastTime)
setLastTime sets the new value of lastMilliTime |
java.lang.String |
toString()
toString returns the current values as a single string per RFC |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final short CLOCKMOD
setClockSeq()
,
Constant Field Valuesprivate static final short NANOS
getMilliTime()
,
Constant Field Valuesprivate static long nanoCounter
getNano()
,
nanoBump()
,
nanoReset()
,
set()
private static java.lang.String clockSeq
setClockSeq()
private static long lastMilliTime
getLastTime()
,
setLastTime(long)
,
set()
private java.lang.String macbase
GuidGenerator(String)
,
toString()
private java.lang.String timebase
GuidGenerator(String)
,
set()
private static java.util.Random random
Constructor Detail |
---|
public GuidGenerator()
java.net.UnknownHostException
public GuidGenerator(java.lang.String newMAC) throws java.lang.IllegalArgumentException
newMAC
- as the seed value for fifth element of string GUID
java.lang.IllegalArgumentException
Method Detail |
---|
private static final void bytesToHex(byte[] bytes, java.lang.StringBuffer buffer)
private void initGuid(java.lang.String newMAC) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
static long getNano()
static void nanoBump()
static void nanoReset()
static long getLastTime()
static void setLastTime(long lastTime)
lastTime
- the value to which to set lastMilliTimeset()
static long getMilliTime()
static java.lang.String getClockSeq()
static void setClockSeq()
GuidGenerator(String)
public java.lang.String getNewGuid()
public java.lang.String toString()
toString
in class java.lang.Object
public void set()
public static void main(java.lang.String[] args)
args
- array for input arguments
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |