You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ps...@apache.org on 2004/03/17 12:49:24 UTC
cvs commit: jakarta-commons-sandbox/id/src/java/org/apache/commons/id DefaultIdentifierGeneratorFactory.java
psteitz 2004/03/17 03:49:24
Modified: id/src/java/org/apache/commons/id
DefaultIdentifierGeneratorFactory.java
Log:
Added UUID generator factory methods
Minor code cleanup
Contributed by Tim Reilly
PR #27725
Revision Changes Path
1.4 +29 -12 jakarta-commons-sandbox/id/src/java/org/apache/commons/id/DefaultIdentifierGeneratorFactory.java
Index: DefaultIdentifierGeneratorFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/id/src/java/org/apache/commons/id/DefaultIdentifierGeneratorFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultIdentifierGeneratorFactory.java 29 Feb 2004 16:06:33 -0000 1.3
+++ DefaultIdentifierGeneratorFactory.java 17 Mar 2004 11:49:24 -0000 1.4
@@ -1,12 +1,12 @@
/*
* Copyright 2003-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,17 +16,20 @@
package org.apache.commons.id;
import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
import org.apache.commons.id.serial.AlphanumericGenerator;
import org.apache.commons.id.serial.LongGenerator;
import org.apache.commons.id.serial.NumericGenerator;
+import org.apache.commons.id.uuid.VersionFourGenerator;
+import org.apache.commons.id.uuid.VersionOneGenerator;
import org.apache.commons.id.random.SessionIdGenerator;
/**
* A concrete identifier sequence factory. This is the default factory used by
* commons-uid.
*
- * @author Commons-Uid team
+ * @author Commons-Id team
* @version $id$
*/
public class DefaultIdentifierGeneratorFactory extends IdentifierGeneratorFactory implements Serializable {
@@ -129,17 +132,31 @@
}
/**
- * <p>Gets a new {@link StringIdentifierGenerator} that generates a sequence
- * of String objects that conform to the
- * <a href="http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-01.txt">
+ * <p>Gets a new {@link IdentifierGenerator} that generates version one UUID Obejcts that conform to the
+ * <a href="http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-02.txt">
* IETF Draft UUID specification</a>.</p>
*
- * <p>NOT IMPLEMENTED YET -- throws UnsupportedOperationExcption</p>
*
- * @return a new StringIdentifierGenerator
+ * @return a new IdentifierGenerator that generates version one UUIDs.
+ * @throws NoSuchMethodException exception thrown while instantiating the generator.
+ * @throws InvocationTargetException exception thrown while instantiating the generator.
+ * @throws IllegalAccessException exception thrown while instantiating the generator.
+ * @throws InstantiationException exception thrown while instantiating the generator.
+ */
+ public IdentifierGenerator uuidVersionOneGenerator() throws NoSuchMethodException, InvocationTargetException,
+ IllegalAccessException, InstantiationException {
+ return VersionOneGenerator.getInstance();
+ }
+
+ /**
+ * <p>Gets a new {@link IdentifierGenerator} that generates version four UUID Obejcts that conform to the
+ * <a href="http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-02.txt">
+ * IETF Draft UUID specification</a>.</p>
+ *
+ *
+ * @return a new IdentifierGenerator that generates version four UUIDs.
*/
- public StringIdentifierGenerator uuidGenerator() {
- // not implemented yet
- throw new UnsupportedOperationException();
+ public IdentifierGenerator uuidVersionFourGenerator() {
+ return VersionFourGenerator.getInstance();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org