org.eclipse.hyades.loaders.util
Class Guid
java.lang.Object
org.eclipse.hyades.loaders.util.Guid
- public final class Guid
- extends java.lang.Object
Abstract from IETF Specification
(http://ftp.ics.uci.edu/pub/ietf/webdav/uuid-guid/draft-leach-uuids-guids-01.txt):
This specification defines the format of UUIDs (Universally Unique
IDentifier), also known as GUIDs (Globally Unique IDentifier). A UUID is 128
bits long, and if generated according to the one of the mechanisms in this
document, is either guaranteed to be different from all other UUIDs/GUIDs
generated until 3400 A.D. or extremely likely to be different (depending on
the mechanism chosen). UUIDs were originally used in the Network Computing
System (NCS) [1] and later in the Open Software Foundation's (OSF)
Distributed Computing Environment [2].
This specification is derived from the latter specification with the kind
permission of the OSF.
References:
- Lisa Zahn, et. al., Network Computing Architecture, Prentice Hall,
Englewood Cliffs, NJ, 1990
- DCE: Remote Procedure Call, Open Group CAE Specification C309 ISBN
1-85912-041-5 28cm. 674p. pbk. 1,655g. 8/94
- R. Rivest, RFC 1321, "The MD5 Message-Digest Algorithm", 04/16/1992.
- NIST FIPS PUB 180-1, "Secure Hash Standard," National Institute of
Standards and Technology, U.S. Department of Commerce, DRAFT, May 31, 1994.
Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital
Equipment Corporation, Maynard, Mass.
Copyright (c) 1998 Microsoft.
To anyone who acknowledges that this file is provided "AS IS" without any
express or implied warranty: permission to use, copy, modify, and distribute
this file for any purpose is hereby granted without fee, provided that the
above copyright notices and this notice appears in all source code copies,
and that none of the names of Open Software Foundation, Inc., Hewlett-Packard
Company, or Digital Equipment Corporation be used in advertising or publicity
pertaining to distribution of the software without specific, written prior
permission. Neither Open Software Foundation, Inc., Hewlett-Packard Company,
Microsoft, nor Digital Equipment Corporation makes any representations about
the suitability of this software for any purpose.
This class requires creating and deleting locking file (e.g. /guid.lock) to ensure the atomic generation of unique time stamps
between several JVM processes on the same system. Users with Java Security
enabled and without the required explicitly granted
java.io.FilePermission s (e.g. read, create and delete) are
not guaranteed to receive unique GUIDs between several JVM processes on the
same system.
GUIDs are 128 bits in length. As such, the hexadecimal string representation
of the 128 bit Guid (e.g. see toString()) is
32 characters long.
The hexadecimal string representation of GUIDs generated with this class are
compliant with XML Schema ID primitive datatype
(http://www.w3.org/TR/2000/CR-xmlschema-2-20001024/#ID). As such, the most
significant hexadecimal character is guaranteed to be a non-numeric
character.
- Since:
- 1.0
|
Constructor Summary |
Guid()
No-argument constructor
|
|
Method Summary |
static java.lang.String |
generate()
Static convenience API for generating a new GUID. |
java.lang.String |
toString()
Returns the hexadecimal string representation of the 128 bit
Guid object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Guid
public Guid()
- No-argument constructor
Creates a variant #1 style identifier and returns the instance.
The adjusted time stamp is split into three fields, and the clockSeq is
split into two fields.
|<------------------------- 32 bits -------------------------->|
+--------------------------------------------------------------+
| low 32 bits of time | 0-3 .time_low
+-------------------------------+-------------------------------
| mid 16 bits of time | 4-5 .time_mid
+-------+-----------------------+
| vers. | hi 12 bits of time | 6-7 .time_hi_and_version
+-------+-------+---------------+
|Res| clkSeqHi | 8 .clock_seq_hi_and_reserved
+---------------+
| clkSeqLow | 9 .clock_seq_low
+---------------+----------...-----+
| node ID | 8-16 .node
+--------------------------...-----+
toString
public java.lang.String toString()
- Returns the hexadecimal string representation of the 128 bit
Guid object.
The toString method will take the binary data in each of
the internal components of the Guid object, covert each
byte to its hexadecimal character equivalent, and return the string.
- Returns:
- The hexadecimal string representation of the 128 bit
Guid, which is 32 characters long.
generate
public static java.lang.String generate()
- Static convenience API for generating a new GUID.
This API is equivalent to calling new Guid().toString().
The API returns the hexadecimal string representation of a new
Guid object.
This API will create a new Guid object, take the binary
data in each of the internal components of the Guid
object, covert each byte to its hexadecimal character equivalent and
return the string.
- Returns:
- The hexadecimal string representation of a new
Guid
object, which is 32 characters long.