Class UUIDGenerator

java.lang.Object
org.archive.uid.UUIDGenerator
All Implemented Interfaces:
RecordIDGenerator

public class UUIDGenerator extends Object implements RecordIDGenerator
Generates UUIDs, using java.util.UUID, formatted as URNs from the UUID namespace [See RFC4122]. Here is an examples of the type of ID it makes: urn:uuid:0161811f-5da6-4c6e-9808-a2fab97114cf. Always makes a new identifier even when passed qualifiers.
Version:
$Revision$ $Date$
Author:
stack
See Also:
  • Constructor Details

    • UUIDGenerator

      public UUIDGenerator()
  • Method Details

    • qualifyRecordID

      public URI qualifyRecordID(URI recordId, Map<String,String> qualifiers)
      Description copied from interface: RecordIDGenerator
      Append (or if already present, update) qualifiers to passed recordId. Use with caution. Guard against turning up a result that already exists. Use when writing a group of records inside a single transaction. How qualifiers are appended/updated varies with URI scheme. Its allowed that an invocation of this method does nought but call RecordIDGenerator.getRecordID(), returning a new URI unrelated to the passed recordId and passed qualifier.
      Specified by:
      qualifyRecordID in interface RecordIDGenerator
      Parameters:
      recordId - URI to append qualifier to.
      qualifiers - Map of qualifier values keyed by qualifier name.
      Returns:
      New URI based off passed uri and passed qualifier.
    • getRecordID

      public URI getRecordID()
      Specified by:
      getRecordID in interface RecordIDGenerator
      Returns:
      A URI that can serve as a record-id.
    • getQualifiedRecordID

      public URI getQualifiedRecordID(String key, String value)
      Specified by:
      getQualifiedRecordID in interface RecordIDGenerator
      Parameters:
      key - Name of qualifier
      value - Value of qualifier
      Returns:
      A URI qualified with passed qualifiers that can serve as a record-id, or, a new, unique record-id without qualifiers (if qualifiers not easily implemented using passed URI scheme).
    • getQualifiedRecordID

      public URI getQualifiedRecordID(Map<String,String> qualifiers)
      Specified by:
      getQualifiedRecordID in interface RecordIDGenerator
      Parameters:
      qualifiers - Qualifiers to add.
      Returns:
      A URI qualified with passed qualifiers that can serve as a record-id, or, a new, unique record-id without qualifiers (if qualifiers not easily implemented using passed URI scheme).