Arch4J 1.1

org.arch4j.persistence.domainmapper
Class JugTimeBasedUuidGenerator

java.lang.Object
  |
  +--org.arch4j.persistence.domainmapper.JugTimeBasedUuidGenerator
All Implemented Interfaces:
IdentifierGenerator

public class JugTimeBasedUuidGenerator
extends Object
implements IdentifierGenerator

This class implements the IdentifierGenerator interface to provide a time-based UUID generator. The actual implementation is delegated to a third-party library, the open-source Java UUID Generator (JUG). The returned UUID string is 36 characters long; for example, c383402e-98a8-4535-8b80-3a0216d78f80

A property named identifier.generator.ethernet.address is consulted to get the ethernet address to use in the generator. It should be specified as a standard MAC address string (like 00:B0:D0:56:E9:30). If the property is not found, a randomly-generated dummy ethernet address is used by the JUG library.

Version:
$Revision: 1.2 $
Author:
$Author: rgreinke $

Constructor Summary
JugTimeBasedUuidGenerator()
           
 
Method Summary
 Serializable generate()
          Generate a new unique identifier.
protected  org.doomdark.uuid.UUID getUUID()
          Try to get an ethernet address from the property file to pass to JUG.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JugTimeBasedUuidGenerator

public JugTimeBasedUuidGenerator()
Method Detail

generate

public Serializable generate()
Generate a new unique identifier.

Specified by:
generate in interface IdentifierGenerator
Returns:
A Serializable unique identifier.

getUUID

protected org.doomdark.uuid.UUID getUUID()
Try to get an ethernet address from the property file to pass to JUG. Otherwise, let JUG generate a dummy address for it's own use.

Returns:
A time-based UUID.
Throws:
EnvironmentalException - if there is any problem creating an ethernet address from the property.

Arch4J 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.