edu.emory.mathcs.rmix
Class ObjGUID

java.lang.Object
  extended byedu.emory.mathcs.rmix.ObjGUID

public class ObjGUID
extends java.lang.Object

Represents globally unique object identifier. The identifier consists of three 64-bit elements: host ID, Virtual Machine ID, and object ID. Host ID is derived from the host IP address using SHA algorithm. Virtual Machine ID is calculated out of the current time in milliseconds and either the value of the PID system property or a random number if the PID property is not set. Object ID is a sequence-generated 64-bit value. If the rmix.server.randomIDs property is set to true, the GUID contains additional, fourth 64-bit component being a secure random number generated using a default system source of randomness.

Version:
1.0
Author:
Dawid Kurzyniec

Field Summary
static ObjGUID LOCAL_VM
           
static ObjGUID LOCALHOST
           
static ObjGUID NULL
           
static ObjGUID UNKNOWN
           
 
Constructor Summary
ObjGUID()
          Creates a new ObjGUID.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
static ObjGUID fromString(java.lang.String guid)
          Reconstructs the ObjGUID from the string representation.
 long getHostID()
           
 long getObjID()
           
 long getVMID()
           
 int hashCode()
           
 boolean isAtLocalHost()
          Checks if the guid has been created on the local host (that is, the host on which this check is performed).
 boolean isAtLocalVM()
          Checks if the guid has been created on the local Virtual Machine (that is, the VM on which this check is performed).
static ObjGUID read(java.io.DataInput in)
          Reads a new ObjGUID from the data input stream.
 java.lang.String toString()
          Returns the string representation of this ObjGUID.
 void write(java.io.DataOutput out)
          Writes the value of this ObjGUID to the data output stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL

public static final ObjGUID NULL

UNKNOWN

public static final ObjGUID UNKNOWN

LOCALHOST

public static final ObjGUID LOCALHOST

LOCAL_VM

public static final ObjGUID LOCAL_VM
Constructor Detail

ObjGUID

public ObjGUID()
Creates a new ObjGUID.

Method Detail

getHostID

public long getHostID()

getVMID

public long getVMID()

getObjID

public long getObjID()

isAtLocalHost

public boolean isAtLocalHost()
Checks if the guid has been created on the local host (that is, the host on which this check is performed).

Returns:
true if the guid has been created on the local host, false otherwise.

isAtLocalVM

public boolean isAtLocalVM()
Checks if the guid has been created on the local Virtual Machine (that is, the VM on which this check is performed).

Returns:
true if the guid has been created on the local Virtual Machine, false otherwise.

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

toString

public java.lang.String toString()
Returns the string representation of this ObjGUID. The string representation maintain uniqueness properties, and can be converted back to the object representation using fromString.

Returns:
the string representation of this ObjGUID.
See Also:
fromString(java.lang.String)

fromString

public static ObjGUID fromString(java.lang.String guid)
Reconstructs the ObjGUID from the string representation.

Parameters:
guid - the string representation.
Returns:
the ObjGUID reconstructed from guid
See Also:
toString()

write

public void write(java.io.DataOutput out)
           throws java.io.IOException
Writes the value of this ObjGUID to the data output stream.

Parameters:
out - the output stream.
Throws:
java.io.IOException - if write fails.

read

public static ObjGUID read(java.io.DataInput in)
                    throws java.io.IOException
Reads a new ObjGUID from the data input stream.

Parameters:
in - the input stream.
Returns:
the newly read ObjGUID.
Throws:
java.io.IOException - if read fails.