org.apache.uima.ducc.common.utils.id
Class ADuccId

java.lang.Object
  extended by org.apache.uima.ducc.common.utils.id.ADuccId
All Implemented Interfaces:
Serializable, Comparable, IDuccId

public class ADuccId
extends Object
implements IDuccId

This class provudes a unique identifier to various DUCC objects. It is used to uniquely identify DUCC Jobs, Reservations, Registered Services, Service Instances, Arbitrary Processes, resource shares, and so on. A DuccId consists of two fields, A UUID which is usually hidden, and which is used internally, and a "friendly", numeric id, intended for better consumption by human beings. The DuccId implements its own compareTo(), hashCode() and equals() methods and should be used as a primitive object by all internal DUCC components. When exposing a DuccId to the world, use the "friendly" id.

See Also:
Serialized Form

Constructor Summary
ADuccId(long given)
          Constructor - create a UNIQUE id, presenting a specific "frienly" id as needed.
 
Method Summary
 int compareTo(Object id)
           
 boolean equals(Object obj)
           
 long getFriendly()
          Return the (not unique) "friendly" id.
 String getUnique()
           
 UUID getUUID()
           
 int hashCode()
           
 void setFriendly(long myFriendly)
          Set a friendly id.
 void setUUID(UUID unique)
          Create a DuccId from a given UUID.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ADuccId

public ADuccId(long given)
Constructor - create a UNIQUE id, presenting a specific "frienly" id as needed. The DuccId it produces is unique for all intents and purposes, even if the "friendly" isn't.

Parameters:
given - This is the "friendly" id which may not be unique.
Method Detail

setUUID

public void setUUID(UUID unique)
Create a DuccId from a given UUID. This is used internally to restore a DuccId from some serialized resource.

Parameters:
unique - This is a unique ID which overrides the generated UUID from the constructor. Use with care.

getUUID

public UUID getUUID()

compareTo

public int compareTo(Object id)
Specified by:
compareTo in interface Comparable

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getFriendly

public long getFriendly()
Return the (not unique) "friendly" id.

Specified by:
getFriendly in interface IDuccId
Returns:
THe non-unique friendly id.

setFriendly

public void setFriendly(long myFriendly)
Set a friendly id.

Parameters:
myFriendly - The "friendly" id to associate with the UUID.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getUnique

public String getUnique()


Copyright © 2012–2014 The Apache Software Foundation. All rights reserved.