org.archive.uid
Class GeneratorFactory
java.lang.Object
org.archive.uid.GeneratorFactory
- All Implemented Interfaces:
- Generator
public class GeneratorFactory
- extends java.lang.Object
- implements Generator
Factory that generates uids.
Singleton. Default implementation is UUIDGenerator
. To
change, specify alternate implementation of Generator
with
SYSTEM_PROPERTY_GENERATOR_KEY
system property.
- Version:
- $Revision: 4417 $ $Date: 2006-08-02 01:12:00 +0000 (Wed, 02 Aug 2006) $
- Author:
- stack
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SYSTEM_PROPERTY_GENERATOR_KEY
public final java.lang.String SYSTEM_PROPERTY_GENERATOR_KEY
getRecordID
public java.net.URI getRecordID()
throws java.net.URISyntaxException
- Specified by:
getRecordID
in interface Generator
- Returns:
- A URI that can serve as a record-id.
- Throws:
java.net.URISyntaxException
getQualifiedRecordID
public java.net.URI getQualifiedRecordID(java.util.Map<java.lang.String,java.lang.String> qualifiers)
throws java.net.URISyntaxException
- Specified by:
getQualifiedRecordID
in interface Generator
- 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).
- Throws:
java.net.URISyntaxException
getQualifiedRecordID
public java.net.URI getQualifiedRecordID(java.lang.String key,
java.lang.String value)
throws java.net.URISyntaxException
- Specified by:
getQualifiedRecordID
in interface Generator
- Parameters:
key
- Name of qualifiervalue
- 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).
- Throws:
java.net.URISyntaxException
qualifyRecordID
public java.net.URI qualifyRecordID(java.net.URI uri,
java.util.Map<java.lang.String,java.lang.String> qualifiers)
throws java.net.URISyntaxException
- Description copied from interface:
Generator
- 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
Generator.getRecordID()
, returning a new URI unrelated to the passed
recordId and passed qualifier.
- Specified by:
qualifyRecordID
in interface Generator
- Parameters:
uri
- URI to append qualifier to.qualifiers
- Map of qualifier values keyed by qualifier name.
- Returns:
- New URI based off passed
uri
and passed qualifier.
- Throws:
java.net.URISyntaxException
- if probably constructing URI OR if the
resultant UUID does not differ from the one passed.
getFactory
public static GeneratorFactory getFactory()
Copyright © 2003-2011 Internet Archive. All Rights Reserved.