org.gcube.contentmanagement.layerindependent.servicehelper
Class UUIDUtils

java.lang.Object
  extended by org.gcube.contentmanagement.layerindependent.servicehelper.UUIDUtils

public class UUIDUtils
extends java.lang.Object

Note: Java.utils.uuid provides a class which can parse an uuid and extract the information therein.


Constructor Summary
UUIDUtils()
           
 
Method Summary
static java.lang.String getLocationFromUUID(java.lang.String hexadecimalUUIDRepresentation)
          Transforms a uuid into a path (intended for use with a filesystem) Since the generation of uuids is timebased, the number of files into a directory depends on the objects creation rate.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UUIDUtils

public UUIDUtils()
Method Detail

getLocationFromUUID

public static java.lang.String getLocationFromUUID(java.lang.String hexadecimalUUIDRepresentation)
Transforms a uuid into a path (intended for use with a filesystem) Since the generation of uuids is timebased, the number of files into a directory depends on the objects creation rate. This transformation is chosen so that (empirically) the leaf directories contain at most circa 5000 files (in case of fast creation rates) and they contain a sufficient number of $ files even in case of slow object creation (to avoid creating as many directories as files). The topmost directories instead are guaranteed to contain at most 256 entries, as their identifiers are limited to 2 hexadecimal digits. In principle, since the invariant part is actually variant, also the root directory part should be split in segments so to ensure that the root directory is not overcrowded. However, this would bring to an unnecessary nesting of directories. The event of a restart is rather unlikely: even with five restarts per day it will take approximately 3 years to get to 5500 sub-directories in the root directory. If an additional directory with a 3 variant digits name is created, thus limiting he root to 4096 directories, each of these directories would probably contain at most a few dozen files even with regular restarts for several years.