db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r538350 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java
Date Tue, 15 May 2007 22:47:17 GMT
Author: arminw
Date: Tue May 15 15:47:16 2007
New Revision: 538350

URL: http://svn.apache.org/viewvc?view=rev&rev=538350
Log:
use default sequence manager defined in SequenceDescriptor, add more logging

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java?view=diff&rev=538350&r1=538349&r2=538350
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java
Tue May 15 15:47:16 2007
@@ -24,11 +24,10 @@
 import org.apache.ojb.broker.PersistenceBroker;
 import org.apache.ojb.broker.PersistenceBrokerException;
 import org.apache.ojb.broker.accesslayer.StatementManagerIF;
-import org.apache.ojb.broker.platforms.Platform;
 import org.apache.ojb.broker.metadata.ClassDescriptor;
-import org.apache.ojb.broker.metadata.DescriptorRepository;
 import org.apache.ojb.broker.metadata.FieldDescriptor;
 import org.apache.ojb.broker.metadata.SequenceDescriptor;
+import org.apache.ojb.broker.platforms.Platform;
 import org.apache.ojb.broker.query.Query;
 import org.apache.ojb.broker.util.ClassHelper;
 import org.apache.ojb.broker.util.logging.Logger;
@@ -37,7 +36,6 @@
 /**
  * Helper class for SequenceManager implementations.
  *
- * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
  * @version $Id$
  */
 public class SequenceManagerHelper
@@ -139,7 +137,6 @@
                  * sequence name. Else we take the table name of the 'targetClass'.
                  */
                 ClassDescriptor cldTargetClass = field.getClassDescriptor();
-                DescriptorRepository model = cldTargetClass.getRepository();
                 /*
                 check for table-per-subclass inheritance
                 */
@@ -512,21 +509,24 @@
      * Create a new {@link SequenceManager} instance.
      *
      * @param broker The broker instance.
-     * @param descriptor The {@link org.apache.ojb.broker.metadata.SequenceDescriptor}.
+     * @param descriptor The {@link org.apache.ojb.broker.metadata.SequenceDescriptor}. If
<tt>null</tt>
+     * a default {@link SecurityManager} will be returned.
      * @return The new instance.
      */
     public static SequenceManager createManager(PersistenceBroker broker, SequenceDescriptor
descriptor)
     {
-        // Default sequence manager (if no explicit SequenceDescriptor / <sequence-manager/>)
-        // is SequenceManagerHighLowImpl, according to:
-        // http://db.apache.org/ojb/docu/guides/sequencemanager.html#How+to+change+the+sequence+manager%3F
-        // (mkalen: NB! The deprecated SequenceManagerFactory used SequenceManagerInMemoryImpl
as default)
-        Class sequenceManagerClass = SequenceManagerHighLowImpl.class;
-        if(descriptor != null) {
+        Class sequenceManagerClass = SequenceDescriptor.DEFAULT_SEQUENCE_MANAGER;
+        if(descriptor != null)
+        {
             sequenceManagerClass = descriptor.getSequenceManagerClass();
         }
+        else
+        {
+            log.info("No sequence descriptor specified, use default sequence manager: " +
sequenceManagerClass);
+        }
         try
         {
+            log.info("Create instance: " + sequenceManagerClass);
             return (SequenceManager) ClassHelper.newInstance(
                     sequenceManagerClass,
                     new Class[]{PersistenceBroker.class, SequenceDescriptor.class},
@@ -537,6 +537,7 @@
             // for backward compatibility try the deprecated constructor
             try
             {
+                log.info("Use deprecated constructor to create instance: " + sequenceManagerClass);
                 return (SequenceManager) ClassHelper.newInstance(
                         sequenceManagerClass,
                         new Class[]{PersistenceBroker.class},
@@ -544,9 +545,9 @@
             }
             catch(Exception e1)
             {
-                log.error("Can't instantiate sequence manager", e);
+                log.error("Can't instantiate sequence manager: " + sequenceManagerClass,
e);
                 log.error("Can't instantiate sequence manager using deprecated constructor",
e1);
-                throw new OJBRuntimeException("Can't instantiate sequence manager", e);
+                throw new OJBRuntimeException("Can't instantiate sequence manager: " + sequenceManagerClass,
e);
             }
         }
     }



---------------------------------------------------------------------
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