org.mycore.services.urn
Class MCRNISSBuilderDateCounter
java.lang.Object
org.mycore.services.urn.MCRNISSBuilderDateCounter
- All Implemented Interfaces:
- MCRNISSBuilder
public class MCRNISSBuilderDateCounter
- extends Object
- implements MCRNISSBuilder
Builds a new, unique NISS based on the current date and/or time
in combination with a counter. The date/time can be formatted with
a Java SimpleDateFormat pattern, the counter ca be formatted with
a Java DecimalFormat pattern. The property "NISSPattern" is used
for configuring the instance. Example configuration:
MCR.URN.SubNamespace.Essen.Prefix=urn:nbn:de:465-miless-
MCR.URN.SubNamespace.Essen.NISSBuilder=org.mycore.services.urn.MCRNISSBuilderDateCounter
MCR.URN.SubNamespace.Essen.NISSPattern=yyyyMMdd-HHmmss-000
Subsequent calls to MCRURN.buildURN( "Essen" ) could then generate
the following URNs, for example:
urn:nbn:de:465-miless-20060622-213404-0017
urn:nbn:de:465-miless-20060622-213404-0025
urn:nbn:de:465-miless-20060622-213448-0013
The last character is the checksum digit.
In the first two URNs, the generated date pattern is the same, so
the counter is increased (starting at 1). The use of "0" instead of
"#" in the pattern produces leading zeros.
A pattern might have no date part (only use counter)
or no counter part (only use date pattern)
- Author:
- Frank Lützenkirchen
|
Method Summary |
String |
buildNISS()
Builds a new NISS. |
void |
init(String configID)
Initializes this instance of a MCRNISSBuilder. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MCRNISSBuilderDateCounter
public MCRNISSBuilderDateCounter()
init
public void init(String configID)
- Description copied from interface:
MCRNISSBuilder
- Initializes this instance of a MCRNISSBuilder. This method is only called
once for each instance before this builder is used.
- Specified by:
init in interface MCRNISSBuilder
- Parameters:
configID - the ID of a subnamespace configuration in mycore.properties
buildNISS
public String buildNISS()
- Description copied from interface:
MCRNISSBuilder
- Builds a new NISS. No MCRNISSBuilder object must generate the same NISS
twice, they must ensure the NISS is unique.
- Specified by:
buildNISS in interface MCRNISSBuilder