db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r538356 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java
Date Tue, 15 May 2007 22:54:40 GMT
Author: arminw
Date: Tue May 15 15:54:40 2007
New Revision: 538356

URL: http://svn.apache.org/viewvc?view=rev&rev=538356
Log:
add shortcut name support

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java?view=diff&rev=538356&r1=538355&r2=538356
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java
Tue May 15 15:54:40 2007
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-import java.util.HashMap;
-import java.util.Map;
 import java.util.Properties;
 
 import org.apache.commons.lang.BooleanUtils;
@@ -24,15 +22,10 @@
 import org.apache.commons.lang.builder.ToStringBuilder;
 import org.apache.commons.lang.builder.ToStringStyle;
 import org.apache.ojb.broker.util.ClassHelper;
+import org.apache.ojb.broker.util.ShortcutMapper;
 import org.apache.ojb.broker.util.XmlHelper;
 import org.apache.ojb.broker.util.sequence.SequenceManager;
-import org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl;
-import org.apache.ojb.broker.util.sequence.SequenceManagerIdentityImpl;
 import org.apache.ojb.broker.util.sequence.SequenceManagerInMemoryImpl;
-import org.apache.ojb.broker.util.sequence.SequenceManagerMSSQLGuidImpl;
-import org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl;
-import org.apache.ojb.broker.util.sequence.SequenceManagerSeqHiLoImpl;
-import org.apache.ojb.broker.util.sequence.SequenceManagerStoredProcedureImpl;
 
 /**
  * Encapsulates sequence manager configuration properties managed by
@@ -48,6 +41,7 @@
 public class SequenceDescriptor extends  DescriptorBase implements XmlCapable
 {
     private static final long serialVersionUID = -5161713731380949398L;
+    public static final Class DEFAULT_SEQUENCE_MANAGER = SequenceManagerInMemoryImpl.class;
 
     /**
      * Attribute string used to enable/disable per field
@@ -55,28 +49,8 @@
      */
     public static final String ATTRIBUTE_PER_FIELD = "seq.perField";
 
-    public static final String SHORTCUT_SM_IN_MEMORY = "memory";
-    public static final String SHORTCUT_SM_HIGH_LOW = "hilo";
-    public static final String SHORTCUT_SM_SEQ_HIGH_LOW = "seqhilo";
-    public static final String SHORTCUT_SM_IDENTITY = "identity";
-    public static final String SHORTCUT_SM_NEXT_VAL_2 = "sequence";
-    public static final String SHORTCUT_SM_PROCEDURE = "procedure";
-    public static final String SHORTCUT_SM_MS_GUID = "msguid";
-
-    private static Map shortcutNamesMap = new HashMap();
-    static
-    {
-        shortcutNamesMap.put(SHORTCUT_SM_HIGH_LOW, SequenceManagerHighLowImpl.class);
-        shortcutNamesMap.put(SHORTCUT_SM_SEQ_HIGH_LOW, SequenceManagerSeqHiLoImpl.class);
-        shortcutNamesMap.put(SHORTCUT_SM_IN_MEMORY, SequenceManagerInMemoryImpl.class);
-        shortcutNamesMap.put(SHORTCUT_SM_MS_GUID, SequenceManagerMSSQLGuidImpl.class);
-        shortcutNamesMap.put(SHORTCUT_SM_IDENTITY, SequenceManagerIdentityImpl.class);
-        shortcutNamesMap.put(SHORTCUT_SM_NEXT_VAL_2, SequenceManagerNextValImpl.class);
-        shortcutNamesMap.put(SHORTCUT_SM_PROCEDURE, SequenceManagerStoredProcedureImpl.class);
-    }
-
     private JdbcConnectionDescriptor jcd;
-    private Class sequenceManagerClass = SequenceManagerInMemoryImpl.class;
+    private Class sequenceManagerClass = DEFAULT_SEQUENCE_MANAGER;
 
     public SequenceDescriptor()
     {
@@ -137,7 +111,7 @@
 
     public void setSequenceManagerClass(String sequenceManagerName)
     {
-        Class sc = (Class) shortcutNamesMap.get(sequenceManagerName);
+        Class sc = ShortcutMapper.resolve(sequenceManagerName, SequenceManager.class);
         if(sc != null)
         {
             this.sequenceManagerClass = sc;



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message