TPTP 4.1.0 Platform Project
Public API Specification

org.eclipse.hyades.loaders.util
Class Guid

java.lang.Object
  extended byorg.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:

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
 

Constructor Detail

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
         +--------------------------...-----+
       
      
     
    
   
  
 

Method Detail

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.

TPTP 4.1.0 Platform Project
Public API Specification