org.codehaus.activemq.util
Class IdGenerator

java.lang.Object
  extended byorg.codehaus.activemq.util.IdGenerator

public class IdGenerator
extends Object

Generator for globally unique Strings

Version:
$Revision: 1.1 $

Constructor Summary
IdGenerator()
          Construct an IdGenerator
 
Method Summary
static int compare(String id1, String id2)
          Does a proper compare on the ids
 String generateId()
          Generate a unqiue id
static long getCountFromId(String id)
          From a generated id - return the generator count
static String getHostName()
          As we have to find the hostname as a side-affect of generating a unique stub, we allow it's easy retrevial here
 String getSeed()
           
static String getSeedFromId(String id)
          From a generated id - return the seed (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdGenerator

public IdGenerator()
Construct an IdGenerator

Method Detail

getHostName

public static String getHostName()
As we have to find the hostname as a side-affect of generating a unique stub, we allow it's easy retrevial here

Returns:
the local host name

generateId

public String generateId()
Generate a unqiue id

Returns:
a unique id

getSeed

public String getSeed()
Returns:
the unique seed used by this generator

getSeedFromId

public static String getSeedFromId(String id)
From a generated id - return the seed (i.e. minus the count)

Parameters:
id - the generated identifer
Returns:

getCountFromId

public static long getCountFromId(String id)
From a generated id - return the generator count

Parameters:
id -
Returns:
the count

compare

public static int compare(String id1,
                          String id2)
Does a proper compare on the ids

Parameters:
id1 -
id2 -
Returns:


Copyright © 2004 Protique, Ltd.. All Rights Reserved.