db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r464349 - in /db/ojb/branches/OJB_1_0_RELEASE/src: java/org/apache/ojb/broker/metadata/ java/org/apache/ojb/broker/util/sequence/ test/org/apache/ojb/ test/org/apache/ojb/broker/sequence/
Date Mon, 16 Oct 2006 00:57:53 GMT
Author: arminw
Date: Sun Oct 15 17:57:52 2006
New Revision: 464349

URL: http://svn.apache.org/viewvc?view=rev&rev=464349
Log:
use renamed sequence-manager attributes

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/AbstractSequenceManager.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerInMemoryImpl.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerSeqHiLoImpl.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerStoredProcedureImpl.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_Repository.xml
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_Repository_Renamed_DTD.xml
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.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=464349&r1=464348&r2=464349
==============================================================================
--- 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
Sun Oct 15 17:57:52 2006
@@ -201,7 +201,7 @@
         buf.append( eol );
         buf.append( "         Add sequence manger properties here, using custom attributes"
);
         buf.append( eol );
-        buf.append( "         e.g. <attribute attribute-name=\"grabSize\" attribute-value=\"20\"/>"
);
+        buf.append( "         e.g. <attribute attribute-name=\"seq.grabSize\" attribute-value=\"20\"/>"
);
         buf.append( eol );
         buf.append( "         -->" );
         buf.append( eol );

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/AbstractSequenceManager.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/AbstractSequenceManager.java?view=diff&rev=464349&r1=464348&r2=464349
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/AbstractSequenceManager.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/AbstractSequenceManager.java
Sun Oct 15 17:57:52 2006
@@ -23,6 +23,7 @@
 import org.apache.ojb.broker.metadata.FieldDescriptor;
 import org.apache.ojb.broker.metadata.SequenceDescriptor;
 import org.apache.ojb.broker.platforms.Platform;
+import org.apache.commons.lang.BooleanUtils;
 
 /**
  * A base class for sequence manager implementations.
@@ -36,7 +37,8 @@
 public abstract class AbstractSequenceManager implements SequenceManager
 {
     // private Logger log = LoggerFactory.getLogger(AbstractSequenceManager.class);
-    public static final String PROPERTY_AUTO_NAMING = "autoNaming";
+    public static final String PROPERTY_AUTO_NAMING_OLD = "autoNaming";
+    public static final String PROPERTY_AUTO_NAMING = "seq.autoNaming";
 
     private PersistenceBroker brokerForClass;
     private Platform platform;
@@ -117,7 +119,12 @@
 
     public boolean useAutoNaming()
     {
-        return (Boolean.valueOf(getConfigurationProperty(PROPERTY_AUTO_NAMING, "true"))).booleanValue();
+        String str = getConfigurationProperty(PROPERTY_AUTO_NAMING, null);
+        if(str == null)
+        {
+            str = getConfigurationProperty(PROPERTY_AUTO_NAMING_OLD, "true");
+        }
+        return BooleanUtils.toBoolean(str);
     }
 
     public String calculateSequenceName(FieldDescriptor field) throws SequenceManagerException

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=464349&r1=464348&r2=464349
==============================================================================
--- 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
Sun Oct 15 17:57:52 2006
@@ -137,8 +137,8 @@
             */
             throw new SequenceManagerException("Could not find sequence-name for field '"
+
                     field + "' of class '" + field.getClassDescriptor().getClassNameOfObject()
+
-                    "', property 'autoNaming' in sequence-manager element in repository was
'" +
-                    autoNaming + "'. Set autoNaming true in sequence-descriptor or define
a " +
+                    "', property 'seq.autoNaming' in sequence-manager element in repository
was '" +
+                    autoNaming + "'. Set 'seq.autoNaming' true in sequence-descriptor or
define a " +
                     " sequence-name in field-descriptor.");
         }
 

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java?view=diff&rev=464349&r1=464348&r2=464349
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java
Sun Oct 15 17:57:52 2006
@@ -60,7 +60,7 @@
  *    </td>
  * </tr>
  * <tr>
- *     <td>autoNaming</td>
+ *     <td>seq.autoNaming</td>
  *     <td>
  *          Default was 'true'. If set 'true' OJB try to build a
  *          sequence name automatic if none found in field-descriptor
@@ -70,6 +70,16 @@
  *    </td>
  * </tr>
  * <tr>
+ *     <td>autoNaming</td>
+ *     <td>
+ *          DEPRECATED. Default was 'true'. If set 'true' OJB try to build a
+ *          sequence name automatic if none found in field-descriptor
+ *          and set this generated name as <code>sequence-name</code>
+ *          in field-descriptor. If set 'false' OJB throws an exception
+ *          if none sequence name was found in field-descriptor.
+ *    </td>
+ * </tr>
+ * <tr>
  *     <td>globalSequenceId</td>
  *     <td>
  *         Deprecated! If set 'true' implementation use global unique
@@ -119,7 +129,8 @@
      * sequence name used for global id generation.
      */
     private static final String GLOBAL_SEQUENCE_NAME = "global - default sequence name";
-    public static final String PROPERTY_GRAB_SIZE = "grabSize";
+    public static final String PROPERTY_GRAB_SIZE_OLD = "grabSize";
+    public static final String PROPERTY_GRAB_SIZE = "seq.grabSize";
     public static final String PROPERTY_GLOBAL_SEQUENCE_ID = "globalSequenceId";
     public static final String PROPERTY_GLOBAL_SEQUENCE_START = "globalSequenceStart";
     private static final Object sync = new Object();
@@ -150,7 +161,12 @@
     {
         Long start = SequenceManagerHelper.getSeqStart(getConfigurationProperties());
         sequenceStart = start != null ? start.longValue() : 1;
-        grabSize = Integer.parseInt(getConfigurationProperty(PROPERTY_GRAB_SIZE, "20"));
+        String grabSizeStr = getConfigurationProperty(PROPERTY_GRAB_SIZE, null);
+        if(grabSizeStr == null)
+        {
+            grabSizeStr = getConfigurationProperty(PROPERTY_GRAB_SIZE_OLD, "20");
+        }
+        grabSize = Integer.parseInt(grabSizeStr);
         useGlobalSequenceIdentities = Boolean.getBoolean(getConfigurationProperty(PROPERTY_GLOBAL_SEQUENCE_ID,
"false"));
         // support for deprecated properties
         long globalSequenceStart = Long.parseLong(getConfigurationProperty(PROPERTY_GLOBAL_SEQUENCE_START,
"1"));

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerInMemoryImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerInMemoryImpl.java?view=diff&rev=464349&r1=464348&r2=464349
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerInMemoryImpl.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerInMemoryImpl.java
Sun Oct 15 17:57:52 2006
@@ -54,9 +54,19 @@
  *    </td>
  * </tr>
  * <tr>
- *     <td>autoNaming</td>
+ *     <td>seq.autoNaming</td>
  *     <td>
  *          Default was 'true'. If set 'true' OJB try to build a
+ *          sequence name automatic if none found in field-descriptor
+ *          and set this generated name as <code>sequence-name</code>
+ *          in field-descriptor. If set 'false' OJB throws an exception
+ *          if none sequence name was found in field-descriptor.
+ *    </td>
+ * </tr>
+ * <tr>
+ *     <td>autoNaming</td>
+ *     <td>
+ *          DEPRECATED. Default was 'true'. If set 'true' OJB try to build a
  *          sequence name automatic if none found in field-descriptor
  *          and set this generated name as <code>sequence-name</code>
  *          in field-descriptor. If set 'false' OJB throws an exception

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java?view=diff&rev=464349&r1=464348&r2=464349
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java
Sun Oct 15 17:57:52 2006
@@ -58,9 +58,23 @@
  *     <td><strong>Property Values</strong></td>
  * </tr>
  * <tr>
- *     <td>autoNaming</td>
+ *     <td>seq.autoNaming</td>
  *     <td>
  *          Default was 'true'. If set 'true' OJB try to build a
+ *          sequence name automatic if none found in field-descriptor
+ *          and set this generated name as <code>sequence-name</code>
+ *          in field-descriptor.
+ *          <br/>
+ *          If set 'false' OJB throws an exception
+ *          if none sequence name was found in field-descriptor, ditto
+ *          OJB does NOT try to create a database sequence entry when
+ *          for given sequence name no database sequence could be found.
+ *    </td>
+ * </tr>
+ * <tr>
+ *     <td>autoNaming</td>
+ *     <td>
+ *          DEPRECATED. Default was 'true'. If set 'true' OJB try to build a
  *          sequence name automatic if none found in field-descriptor
  *          and set this generated name as <code>sequence-name</code>
  *          in field-descriptor.

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerSeqHiLoImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerSeqHiLoImpl.java?view=diff&rev=464349&r1=464348&r2=464349
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerSeqHiLoImpl.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerSeqHiLoImpl.java
Sun Oct 15 17:57:52 2006
@@ -47,7 +47,7 @@
  *    </td>
  * </tr>
  * <tr>
- *     <td>autoNaming</td>
+ *     <td>seq.autoNaming</td>
  *     <td>
  *          Default was 'true'. If set 'true' OJB try to build a
  *          sequence name automatic if none found in field-descriptor
@@ -56,6 +56,16 @@
  *          if none sequence name was found in field-descriptor.
  *    </td>
  * </tr>
+ * <tr>
+ *     <td>autoNaming</td>
+ *     <td>
+ *          DEPRECATED. Default was 'true'. If set 'true' OJB try to build a
+ *          sequence name automatic if none found in field-descriptor
+ *          and set this generated name as <code>sequence-name</code>
+ *          in field-descriptor. If set 'false' OJB throws an exception
+ *          if none sequence name was found in field-descriptor.
+ *    </td>
+ * </tr>
  * </table>
  * <br/>
  * <p>
@@ -70,6 +80,7 @@
  */
 public class SequenceManagerSeqHiLoImpl extends SequenceManagerNextValImpl
 {
+    public static final String PROPERTY_GRAB_SIZE_OLD = SequenceManagerHighLowImpl.PROPERTY_GRAB_SIZE_OLD;
     public static final String PROPERTY_GRAB_SIZE = SequenceManagerHighLowImpl.PROPERTY_GRAB_SIZE;
     private static HashMap hiLoMap = new HashMap();
 
@@ -81,7 +92,12 @@
     public SequenceManagerSeqHiLoImpl(PersistenceBroker broker)
     {
         super(broker);
-        grabSize = Integer.parseInt(getConfigurationProperty(PROPERTY_GRAB_SIZE, "20"));
+        String grabSizeStr = getConfigurationProperty(PROPERTY_GRAB_SIZE, null);
+        if(grabSizeStr == null)
+        {
+            grabSizeStr = getConfigurationProperty(PROPERTY_GRAB_SIZE_OLD, "20");
+        }
+        grabSize = Integer.parseInt(grabSizeStr);
     }
 
     public SequenceManagerSeqHiLoImpl(PersistenceBroker broker, SequenceDescriptor descriptor)

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerStoredProcedureImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerStoredProcedureImpl.java?view=diff&rev=464349&r1=464348&r2=464349
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerStoredProcedureImpl.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerStoredProcedureImpl.java
Sun Oct 15 17:57:52 2006
@@ -100,9 +100,19 @@
  * <td><strong>Property Values</strong></td>
  * </tr>
  * <tr>
- * <td>autoNaming</td>
+ * <td>seq.autoNaming</td>
  * <td>
  * Default was 'true'. If set 'true' OJB try to build a
+ * sequence name automatic if none found in field-descriptor
+ * and set this generated name as <code>sequence-name</code>
+ * in field-descriptor. If set 'false' OJB throws an exception
+ * if none sequence name was found in field-descriptor.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>autoNaming</td>
+ * <td>
+ * DEPRECATED. Default was 'true'. If set 'true' OJB try to build a
  * sequence name automatic if none found in field-descriptor
  * and set this generated name as <code>sequence-name</code>
  * in field-descriptor. If set 'false' OJB throws an exception

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml?view=diff&rev=464349&r1=464348&r2=464349
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_ConnectionDescriptor.xml
Sun Oct 15 17:57:52 2006
@@ -61,7 +61,7 @@
         />
 
         <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
-            <attribute attribute-name="grabSize" attribute-value="5"/>
+            <attribute attribute-name="seq.grabSize" attribute-value="5"/>
         </sequence-manager>
     </jdbc-connection-descriptor>
 
@@ -95,7 +95,7 @@
         />
 
         <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
-            <attribute attribute-name="grabSize" attribute-value="5"/>
+            <attribute attribute-name="seq.grabSize" attribute-value="5"/>
         </sequence-manager>
     </jdbc-connection-descriptor>
 

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_Repository.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_Repository.xml?view=diff&rev=464349&r1=464348&r2=464349
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_Repository.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_Repository.xml Sun Oct 15
17:57:52 2006
@@ -76,7 +76,7 @@
         />
 
         <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
-            <attribute attribute-name="grabSize" attribute-value="5"/>
+            <attribute attribute-name="seq.grabSize" attribute-value="5"/>
         </sequence-manager>
 
     </jdbc-connection-descriptor>

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_Repository_Renamed_DTD.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_Repository_Renamed_DTD.xml?view=diff&rev=464349&r1=464348&r2=464349
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_Repository_Renamed_DTD.xml
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/Test_Repository_Renamed_DTD.xml
Sun Oct 15 17:57:52 2006
@@ -65,7 +65,7 @@
         />
 
         <sequence-manager className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl">
-            <attribute attribute-name="grabSize" attribute-value="5"/>
+            <attribute attribute-name="seq.grabSize" attribute-value="5"/>
         </sequence-manager>
 
         <!-- add some custom attributes -->

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java?view=diff&rev=464349&r1=464348&r2=464349
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/SequenceManagerTest.java
Sun Oct 15 17:57:52 2006
@@ -169,7 +169,7 @@
             SequenceDescriptor sd = jcd.getSequenceDescriptor();
             assertNotNull("Can not find sequence-descriptor - check test", sd);
             // don't use autoNaming
-            sd.addAttribute("autoNaming", "false");
+            sd.addAttribute("seq.autoNaming", "false");
             // add new connection descriptor to global base
             mm.connectionRepository().addDescriptor(jcd);
 
@@ -192,12 +192,12 @@
                 */
                 SMAutoNaming obj = new SMAutoNaming("testAutoNaming_1");
                 sd = broker.serviceConnectionManager().getConnectionDescriptor().getSequenceDescriptor();
-                assertTrue("false".equals(sd.getAttribute("autoNaming")));
+                assertTrue("false".equals(sd.getAttribute("seq.autoNaming")));
 
                 broker.beginTransaction();
                 broker.store(obj);
                 broker.commitTransaction();
-                fail("If sequence manager implementation supports 'autoNaming' feature,"
+                fail("If sequence manager implementation supports 'seq.autoNaming' feature,"
                         +" this test should cause an exception (else ignore this failure).");
             }
             catch (PersistenceBrokerException e)
@@ -236,7 +236,7 @@
                 --> should pass
                 */
                 field.setSequenceName(null);
-                sd.addAttribute("autoNaming", "true");
+                sd.addAttribute("seq.autoNaming", "true");
                 broker = PersistenceBrokerFactory.createPersistenceBroker(tempKey);
                 SMAutoNaming obj = new SMAutoNaming("testAutoNaming_3");
                 broker.beginTransaction();



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