org.ispheres.server.core
Class ISphereId

java.lang.Object
  extended by org.ispheres.server.core.ISphereId

public final class ISphereId
extends java.lang.Object

Methods for generating and checking iSphere unique identifiers (ids). An id is made up of two parts: - The first 7 characters is the time the iSphere was first started in seconds, displayed in base 36. - The final 7 characters is a CRC32 hash of the hostname the iSphere is on in base 36. This makes a unique id of 14 characters length. This was originally a longer id - however Ian Johnson requested a much smaller string.

Author:
Owen Jones

Method Summary
static java.lang.String generateUniqueId(long startupTime, java.lang.String hostname)
          Generate a unique identifier, this is generated from a concatination of the time in milliseconds (POSIX time) and a hash of the local ip address.
static boolean isValidUniqueId(java.lang.String id)
          Return true if the unique id is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

generateUniqueId

public static java.lang.String generateUniqueId(long startupTime,
                                                java.lang.String hostname)
Generate a unique identifier, this is generated from a concatination of the time in milliseconds (POSIX time) and a hash of the local ip address. A collision could still occur if two ips result in the same hash, and both are generated at the exact same time.

Parameters:
startupTime - The time the iSphere was first started as a long.
hostname - The name of the host.
Returns:
a String to use as an (almost) unique identifier.

isValidUniqueId

public static boolean isValidUniqueId(java.lang.String id)
Return true if the unique id is valid.

Parameters:
id - The unique id to check.
Returns:
true If the unique id is valid.


Copyright © 2004-2005 The Archaeological Computing Laboratory, University of Sydney. All Rights Reserved.