svn commit: r495677 [7/9] - in /db/ojb/trunk: ./ profile/ src/java/org/apache/ojb/broker/ src/java/org/apache/ojb/broker/accesslayer/ src/java/org/apache/ojb/broker/accesslayer/batch/ src/java/org/apache/ojb/broker/accesslayer/sql/ src/java/org/apache/...

[email protected]
Newsgroups gmane.comp.jakarta.ojb.devel
Message-ID <[email protected]>
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ProcedureDescriptor.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ProcedureDescriptor.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ProcedureDescriptor.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/ProcedureDescriptor.java Fri Jan 12 10:19:39 2007
@@ -17,8 +17,9 @@
 
 import java.io.Serializable;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.lang.SystemUtils;
 
 /**
  * A ProcedureDescriptor contains information that is common for all types
@@ -28,35 +29,35 @@
  * ProcedureDescriptor instances, because instances could become invalid
  * during runtime (see {@link MetadataManager}).
  *
- * @author <a href="mailto:[email protected]">Ron Gallagher<a>
  * @version $Id$
  */
 public abstract class ProcedureDescriptor extends DescriptorBase implements Serializable
 {
-	private static final long serialVersionUID = -8228331122289787173L;
-    //---------------------------------------------------------------
+    private static final long serialVersionUID = -8228331122289787173L;
     /**
      * The the name of the procedure/function to invoke.
      */
     private String name;
 
-    //---------------------------------------------------------------
-    /**
-     * The the field descriptor that will receive the return value from the procedure/function...
-     */
-    private FieldDescriptor returnValueFieldRef;
+//    /**
+//     * The the field descriptor that will receive the return value from the procedure/function...
+//     */
+//    private FieldDescriptor returnValueFieldRef;
 
-    //---------------------------------------------------------------
     /**
      * The class descriptor that this object is related to.
      */
     private ClassDescriptor classDescriptor;
 
-    //---------------------------------------------------------------
     /**
      * The argument descriptor lists.
      */
     private ArrayList arguments = new ArrayList();
+    private boolean returnValue = false;
+    private List outArguments;
+    private Boolean outValues;
+    private Boolean inValues;
+
 
     //---------------------------------------------------------------
     /**
@@ -66,9 +67,17 @@
     {
         this.classDescriptor = classDescriptor;
         this.name = name;
+        this.returnValue = false;
+    }
+
+    private void valueChange()
+    {
+        // reset dependend values used for optimisation
+        outArguments = null;
+        outValues = null;
+        inValues = null;
     }
 
-    //---------------------------------------------------------------
     /**
      * Retrieve the the name of the procedure/function to invoke.
      *
@@ -79,109 +88,77 @@
         return this.name;
     }
 
-    //---------------------------------------------------------------
-    /**
-     * Change the field descriptor that will receive the return value
-     * from the procedure/function..
-     *
-     * @param fieldName the name of the field that will receive the
-     * return value from the procedure/function.
-     */
-    public final void setReturnValueFieldRef(String fieldName)
-    {
-        this.returnValueFieldRef = this.getClassDescriptor().getFieldDescriptorByName(fieldName);
-    }
-
-    //---------------------------------------------------------------
-    /**
-     * Change the the field descriptor that will receive the return
-     * value from the procedure/function...
-     *
-     * @param fieldDescriptor the field descriptor that will receive the
-     * return value from the procedure/function.
-     */
-    public final void setReturnValueFieldRef(FieldDescriptor fieldDescriptor)
+    public boolean hasReturnValue()
     {
-        this.returnValueFieldRef = fieldDescriptor;
+        return returnValue;
     }
 
-    //---------------------------------------------------------------
-    /**
-     * Retrieve the field descriptor that will receive the return value
-     * from the procedure/function...
-     *
-     * @return The current value
-     */
-    public final FieldDescriptor getReturnValueFieldRef()
+    public void setReturnValue(boolean returnValue)
     {
-        return this.returnValueFieldRef;
+        if(returnValue && hasOutValues())
+        {
+            throw new MetadataException("It's not allowed to mix stored procedure" +
+                    " return result set with procedure 'OUT' values: " + toString());
+        }
+        this.returnValue = returnValue;
     }
 
-    //---------------------------------------------------------------
     /**
-     * Is there a return value for this procedure?
-     *
-     * @return <code>true</code> if there is a return value for this
-     * procedure.
+     * Returns a list of procedure 'OUT' {@link ArgumentDescriptor}.
      */
-    public boolean hasReturnValue()
+    public List getOutArguments()
     {
-        return (this.returnValueFieldRef != null);
+        if(outArguments == null)
+        {
+            outArguments = new ArrayList();
+            for(int i = 0; i < arguments.size(); i++)
+            {
+                ArgumentDescriptor argumentDescriptor = (ArgumentDescriptor) arguments.get(i);
+                if(argumentDescriptor.isOutParameter())
+                {
+                    outArguments.add(argumentDescriptor);
+                }
+            }
+        }
+        return outArguments;
     }
 
-    //---------------------------------------------------------------
-    /**
-     * Does this procedure return any values to the 'caller'?
-     *
-     * @return <code>true</code> if the procedure returns at least 1
-     * value that is returned to the caller.
-     */
-    public final boolean hasReturnValues()
+    public boolean hasOutValues()
     {
-        if (this.hasReturnValue())
-        {
-            return true;
-        }
-        else
+        if(outValues == null)
         {
-            // TODO: We may be able to 'pre-calculate' the results
-            // of this loop by just checking arguments as they are added
-            // The only problem is that the 'isReturnedbyProcedure' property
-            // can be modified once the argument is added to this procedure.
-            // If that occurs, then 'pre-calculated' results will be inacccurate.
-            Iterator iter = this.getArguments().iterator();
-            while (iter.hasNext())
+            outValues = Boolean.FALSE;
+            for(int i = 0; i < arguments.size(); i++)
             {
-                ArgumentDescriptor arg = (ArgumentDescriptor) iter.next();
-                if (arg.getIsReturnedByProcedure())
+                ArgumentDescriptor argumentDescriptor = (ArgumentDescriptor) arguments.get(i);
+                if(argumentDescriptor.isOutParameter())
                 {
-                    return true;
+                    outValues = Boolean.TRUE;
+                    break;
                 }
             }
         }
-        return false;
+        return outValues.booleanValue();
     }
 
-    //---------------------------------------------------------------
-    /**
-     * Retrieve the name of the field descriptor that will receive the
-     * return value from the procedure/function...
-     *
-     * @return The current value
-     */
-    public final String getReturnValueFieldRefName()
+    public boolean hasInValues()
     {
-        if (this.returnValueFieldRef == null)
-        {
-            return null;
-        }
-        else
+        if(inValues == null)
         {
-            return this.returnValueFieldRef.getAttributeName();
+            inValues = Boolean.FALSE;
+            for(int i = 0; i < arguments.size(); i++)
+            {
+                ArgumentDescriptor argumentDescriptor = (ArgumentDescriptor) arguments.get(i);
+                if(argumentDescriptor.isInParameter())
+                {
+                    inValues = Boolean.TRUE;
+                    break;
+                }
+            }
         }
+        return inValues.booleanValue();
     }
 
-    //---------------------------------------------------------------
     /**
      * Retrieve the class descriptor that this object is related to.
      *
@@ -197,39 +174,68 @@
      */
     public abstract String toXML();
 
-    //---------------------------------------------------------------
     /**
      * Add an argument
      */
-    protected void addArgument(ArgumentDescriptor argument)
+    public void addArgument(ArgumentDescriptor argument)
     {
-        this.arguments.add(argument);
+        addArgument(-1, argument);
+    }
+
+    /**
+     * Add an argument
+     */
+    public void addArgument(int index, ArgumentDescriptor argument)
+    {
+        valueChange();
+        if(argument.isOutParameter() && returnValue)
+        {
+            throw new MetadataException("It's not allowed to mix stored procedure" +
+                    " return result set with procedure 'OUT' values: " + toString());
+        }
+        if(index > -1) arguments.add(index, argument);
+        else arguments.add(argument);
     }
 
-    //---------------------------------------------------------------
     /**
      * Set up arguments for each FieldDescriptor in an array.
      */
-    protected void addArguments(FieldDescriptor field[])
+    public void addArguments(FieldDescriptor fields[])
     {
-        for (int i = 0; i < field.length; i++)
+        for (int i = 0; i < fields.length; i++)
         {
             ArgumentDescriptor arg = new ArgumentDescriptor(this);
-            arg.setValue(field[i].getAttributeName(), false);
-            this.addArgument(arg);
+            arg.setValue(fields[i].getAttributeName(), false);
+            addArgument(arg);
         }
     }
 
-    //---------------------------------------------------------------
+    /**
+     * Removes for the first occurence of the given argument.
+     *
+     * @param   arg The argument descriptor to remove.
+     * @return  the index of the removed argument;
+     * returns <tt>-1</tt> if the object is not found.
+     */
+    public int removeArgument(ArgumentDescriptor arg)
+    {
+        int index = arguments.indexOf(arg);
+        if(index > -1 && arguments.remove(arg))
+        {
+            valueChange();
+            return index;
+        }
+        else return -1;
+    }
+
     /**
      * Get the argument descriptors for this procedure.
      */
-    public final Collection getArguments()
+    public final List getArguments()
     {
         return this.arguments;
     }
 
-    //---------------------------------------------------------------
     /**
      * Retrieves the number of arguments that are passed to the
      * procedure that this descriptor represents.
@@ -241,4 +247,123 @@
     {
         return this.arguments.size();
     }
+
+    public String toString()
+    {
+        StringBuffer buf = new StringBuffer();
+        String eol = SystemUtils.LINE_SEPARATOR;
+        buf.append(eol).append(" class=").append((classDescriptor != null ? classDescriptor.getClassNameOfObject() : ""));
+        buf.append(eol).append(" procedure=").append(name);
+        buf.append(eol).append(" returnResultSet=").append(returnValue);
+        buf.append(eol).append(" procedure-arguments[");
+        for(int i = 0; i < arguments.size(); i++)
+        {
+            ArgumentDescriptor argumentDescriptor = (ArgumentDescriptor) arguments.get(i);
+            buf.append(eol).append("  ").append(argumentDescriptor.toString());
+        }
+        buf.append("]");
+        return buf.toString();
+    }
+
+        //---------------------------------------------------------------
+//    /**
+//     * Change the field descriptor that will receive the return value
+//     * from the procedure/function..
+//     *
+//     * @param fieldName the name of the field that will receive the
+//     * return value from the procedure/function.
+//     */
+//    public final void setReturnValueFieldRef(String fieldName)
+//    {
+//        this.returnValueFieldRef = this.getClassDescriptor().getFieldDescriptorByName(fieldName);
+//    }
+//
+//    //---------------------------------------------------------------
+//    /**
+//     * Change the the field descriptor that will receive the return
+//     * value from the procedure/function...
+//     *
+//     * @param fieldDescriptor the field descriptor that will receive the
+//     * return value from the procedure/function.
+//     */
+//    public final void setReturnValueFieldRef(FieldDescriptor fieldDescriptor)
+//    {
+//        this.returnValueFieldRef = fieldDescriptor;
+//    }
+//
+//    //---------------------------------------------------------------
+//    /**
+//     * Retrieve the field descriptor that will receive the return value
+//     * from the procedure/function...
+//     *
+//     * @return The current value
+//     */
+//    public final FieldDescriptor getReturnValueFieldRef()
+//    {
+//        return this.returnValueFieldRef;
+//    }
+
+//    //---------------------------------------------------------------
+//    /**
+//     * Is there a return value for this procedure?
+//     *
+//     * @return <code>true</code> if there is a return value for this
+//     * procedure.
+//     */
+//    public boolean hasReturnValue()
+//    {
+//        return (this.returnValueFieldRef != null);
+//    }
+
+//    //---------------------------------------------------------------
+//    /**
+//     * Does this procedure return any values to the 'caller'?
+//     *
+//     * @return <code>true</code> if the procedure returns at least 1
+//     * value that is returned to the caller.
+//     */
+//    public final boolean hasReturnValues()
+//    {
+//        if (this.hasReturnValue())
+//        {
+//            return true;
+//        }
+//        else
+//        {
+//            // TODO: We may be able to 'pre-calculate' the results
+//            // of this loop by just checking arguments as they are added
+//            // The only problem is that the 'isReturnedbyProcedure' property
+//            // can be modified once the argument is added to this procedure.
+//            // If that occurs, then 'pre-calculated' results will be inacccurate.
+//            Iterator iter = this.getArguments().iterator();
+//            while (iter.hasNext())
+//            {
+//                ArgumentDescriptor arg = (ArgumentDescriptor) iter.next();
+//                if (arg.getIsReturnedByProcedure())
+//                {
+//                    return true;
+//                }
+//            }
+//        }
+//        return false;
+//    }
+
+    //---------------------------------------------------------------
+//    /**
+//     * Retrieve the name of the field descriptor that will receive the
+//     * return value from the procedure/function...
+//     *
+//     * @return The current value
+//     */
+//    public final String getReturnValueFieldRefName()
+//    {
+//        if (this.returnValueFieldRef == null)
+//        {
+//            return null;
+//        }
+//        else
+//        {
+//            return this.returnValueFieldRef.getAttributeName();
+//        }
+//    }
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryElements.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryElements.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryElements.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryElements.java Fri Jan 12 10:19:39 2007
@@ -47,7 +47,6 @@
     public static final int CLASS_PROXY = 35;
     public static final int CLASS_EXTENT = 33;
     public static final int CLASS_DISCRIMINATOR = 132;
-    public static final int EXTENDS = 76;
     public static final int TABLE_NAME = 14;
     public static final int ORDERBY = 36;
     public static final int FIELD_CONVERSION = 30;

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java Fri Jan 12 10:19:39 2007
@@ -71,7 +71,7 @@
         table.put("proxy", new Integer(CLASS_PROXY));
         table.put("discriminator-descriptor", new Integer(CLASS_DISCRIMINATOR));
         table.put("extent-class", new Integer(CLASS_EXTENT));
-        table.put("extends", new Integer(EXTENDS));
+//        table.put("extends", new Integer(EXTENDS));
         table.put("table", new Integer(TABLE_NAME));
         table.put("orderby", new Integer(ORDERBY));
         table.put("conversion", new Integer(FIELD_CONVERSION));

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java Fri Jan 12 10:19:39 2007
@@ -256,16 +256,6 @@
                             m_CurrentCLD.setRowReaderClassName(rowreader);
                         }
 
-                        // set if extends
-               // arminw: TODO: this feature doesn't work, remove this stuff?
-                        String extendsAtt = atts.getValue(RepositoryTags.getTagById(EXTENDS));
-                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(EXTENDS) + ": " + extendsAtt);
-                        if (checkString(extendsAtt))
-                        {
-                            extendsAtt = extendsAtt.trim();
-                            m_CurrentCLD.setSuperClass(extendsAtt);
-                        }
-
                         //set accept-locks attribute
                         String acceptLocks = atts.getValue(RepositoryTags.getTagById(ACCEPT_LOCKS));
                         if (acceptLocks==null)
@@ -352,7 +342,7 @@
                             if(checkString(strategy))
                             {
                                 strategy = strategy.trim();
-                                ocd.setCachingStrategy(ClassHelper.getClass(strategy));
+                                ocd.setCachingPreparer(ClassHelper.getClass(strategy));
                                 if (isDebug) logger.debug("     " + RepositoryTags.getTagById(STRATEGY) + ": " + strategy);
                             }
                             String timeout = atts.getValue(RepositoryTags.getTagById(TIMEOUT));
@@ -554,6 +544,24 @@
                         break;
                     }
 
+                case SEQUENCE_MANAGER:
+                    {
+                        if(m_CurrentFLD != null)
+                        {
+                            String className = atts.getValue(RepositoryTags.getTagById(CLASS_NAME));
+                            if(checkString(className))
+                            {
+                                SequenceDescriptor currentSequenceDescriptor = new SequenceDescriptor();
+                                m_CurrentAttrContainer = currentSequenceDescriptor;
+                                m_CurrentFLD.setSequenceDescriptor(currentSequenceDescriptor);
+                                if (isDebug) logger.debug("    > " + RepositoryTags.getTagById(SEQUENCE_MANAGER));
+                                if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CLASS_NAME) + ": " + className);
+                                currentSequenceDescriptor.setSequenceManagerClass(className);
+                            }
+                        }
+                        break;
+                    }
+
                 case REFERENCE_DESCRIPTOR:
                     {
                         if (isDebug) logger.debug("    > " + RepositoryTags.getTagById(REFERENCE_DESCRIPTOR));
@@ -935,14 +943,15 @@
                             new InsertProcedureDescriptor(m_CurrentCLD,
                                                           procName,
                                                           Boolean.valueOf(includeAllFields).booleanValue());
+                        m_CurrentCLD.setInsertProcedure(proc);
                         m_CurrentProcedure = proc;
 
-                        // Get the name of the field ref that will receive the
-                        // return value.
-                        String returnFieldRefName = atts.getValue(RepositoryTags.getTagById(RETURN_FIELD_REF));
-                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(RETURN_FIELD_REF) +
-                                                  ": " + returnFieldRefName);
-                        proc.setReturnValueFieldRef(returnFieldRefName);
+//                        // Get the name of the field ref that will receive the
+//                        // return value.
+//                        String returnFieldRefName = atts.getValue(RepositoryTags.getTagById(RETURN_FIELD_REF));
+//                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(RETURN_FIELD_REF) +
+//                                                  ": " + returnFieldRefName);
+//                        proc.setReturnValueFieldRef(returnFieldRefName);
 
                         break;
                     }
@@ -963,14 +972,15 @@
                             new UpdateProcedureDescriptor(m_CurrentCLD,
                                                           procName,
                                                           Boolean.valueOf(includeAllFields).booleanValue());
+                        m_CurrentCLD.setUpdateProcedure(proc);
                         m_CurrentProcedure = proc;
 
-                        // Get the name of the field ref that will receive the
-                        // return value.
-                        String returnFieldRefName = atts.getValue(RepositoryTags.getTagById(RETURN_FIELD_REF));
-                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(RETURN_FIELD_REF) +
-                                                  ": " + returnFieldRefName);
-                        proc.setReturnValueFieldRef(returnFieldRefName);
+//                        // Get the name of the field ref that will receive the
+//                        // return value.
+//                        String returnFieldRefName = atts.getValue(RepositoryTags.getTagById(RETURN_FIELD_REF));
+//                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(RETURN_FIELD_REF) +
+//                                                  ": " + returnFieldRefName);
+//                        proc.setReturnValueFieldRef(returnFieldRefName);
 
                         break;
                     }
@@ -991,14 +1001,15 @@
                             new DeleteProcedureDescriptor(m_CurrentCLD,
                                                           procName,
                                                           Boolean.valueOf(includeAllPkFields).booleanValue());
+                        m_CurrentCLD.setDeleteProcedure(proc);
                         m_CurrentProcedure = proc;
 
-                        // Get the name of the field ref that will receive the
-                        // return value.
-                        String returnFieldRefName = atts.getValue(RepositoryTags.getTagById(RETURN_FIELD_REF));
-                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(RETURN_FIELD_REF) +
-                                                  ": " + returnFieldRefName);
-                        proc.setReturnValueFieldRef(returnFieldRefName);
+//                        // Get the name of the field ref that will receive the
+//                        // return value.
+//                        String returnFieldRefName = atts.getValue(RepositoryTags.getTagById(RETURN_FIELD_REF));
+//                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(RETURN_FIELD_REF) +
+//                                                  ": " + returnFieldRefName);
+//                        proc.setReturnValueFieldRef(returnFieldRefName);
 
                         break;
 
@@ -1016,14 +1027,15 @@
                         SelectByPKProcedureDescriptor proc =
                             new SelectByPKProcedureDescriptor(m_CurrentCLD,
                                                           procName);
+                        m_CurrentCLD.setSelectByPKProcedure(proc);
                         m_CurrentProcedure = proc;
 
-                        // Get the name of the field ref that will receive the
-                        // return value.
-                        String returnFieldRefName = atts.getValue(RepositoryTags.getTagById(RETURN_FIELD_REF));
-                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(RETURN_FIELD_REF) +
-                                                  ": " + returnFieldRefName);
-                        proc.setReturnValueFieldRef(returnFieldRefName);
+//                        // Get the name of the field ref that will receive the
+//                        // return value.
+//                        String returnFieldRefName = atts.getValue(RepositoryTags.getTagById(RETURN_FIELD_REF));
+//                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(RETURN_FIELD_REF) +
+//                                                  ": " + returnFieldRefName);
+//                        proc.setReturnValueFieldRef(returnFieldRefName);
 
                         break;
 
@@ -1041,14 +1053,15 @@
                         SelectByFKProcedureDescriptor proc =
                             new SelectByFKProcedureDescriptor(m_CurrentCLD,
                                                           procName);
+                        m_CurrentCLD.setSelectByFKProcedure(proc);
                         m_CurrentProcedure = proc;
 
-                        // Get the name of the field ref that will receive the
-                        // return value.
-                        String returnFieldRefName = atts.getValue(RepositoryTags.getTagById(RETURN_FIELD_REF));
-                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(RETURN_FIELD_REF) +
-                                                  ": " + returnFieldRefName);
-                        proc.setReturnValueFieldRef(returnFieldRefName);
+//                        // Get the name of the field ref that will receive the
+//                        // return value.
+//                        String returnFieldRefName = atts.getValue(RepositoryTags.getTagById(RETURN_FIELD_REF));
+//                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(RETURN_FIELD_REF) +
+//                                                  ": " + returnFieldRefName);
+//                        proc.setReturnValueFieldRef(returnFieldRefName);
 
                         break;
 
@@ -1164,6 +1177,12 @@
                         m_CurrentAttrContainer = m_CurrentCLD;
                         break;
                     }
+                case SEQUENCE_MANAGER:
+                    {
+                        if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(SEQUENCE_MANAGER));
+                        m_CurrentAttrContainer = m_CurrentFLD;
+                        break;
+                    }
                 case REFERENCE_DESCRIPTOR:
                     {
                         if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(REFERENCE_DESCRIPTOR));
@@ -1235,35 +1254,30 @@
                 case INSERT_PROCEDURE:
                 {
                     if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(INSERT_PROCEDURE));
-                    m_CurrentCLD.setInsertProcedure((InsertProcedureDescriptor)m_CurrentProcedure);
                     m_CurrentProcedure = null;
                     break;
                 }
                 case UPDATE_PROCEDURE:
                     {
                         if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(UPDATE_PROCEDURE));
-                        m_CurrentCLD.setUpdateProcedure((UpdateProcedureDescriptor)m_CurrentProcedure);
                         m_CurrentProcedure = null;
                         break;
                     }
                 case DELETE_PROCEDURE:
                     {
                         if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(DELETE_PROCEDURE));
-                        m_CurrentCLD.setDeleteProcedure((DeleteProcedureDescriptor)m_CurrentProcedure);
                         m_CurrentProcedure = null;
                         break;
                     }
                 case SELECTBYPK_PROCEDURE:
                     {
                         if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(SELECTBYPK_PROCEDURE));
-                        m_CurrentCLD.setSelectByPKProcedure((SelectByPKProcedureDescriptor)m_CurrentProcedure);
                         m_CurrentProcedure = null;
                         break;
                     }
                 case SELECTBYFK_PROCEDURE:
                     {
                         if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(SELECTBYFK_PROCEDURE));
-                        m_CurrentCLD.setSelectByFKProcedure((SelectByFKProcedureDescriptor)m_CurrentProcedure);
                         m_CurrentProcedure = null;
                         break;
                     }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SelectByFKProcedureDescriptor.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SelectByFKProcedureDescriptor.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SelectByFKProcedureDescriptor.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SelectByFKProcedureDescriptor.java Fri Jan 12 10:19:39 2007
@@ -48,13 +48,13 @@
         addArguments(getClassDescriptor().getFieldDescriptions());
     }
 
-    /**
-     * SelectByFK procedure always returns one value, ResultSet
-     */
-    public boolean hasReturnValue()
-    {
-        return true;
-    }
+//    /**
+//     * SelectByFK procedure always returns one value, ResultSet
+//     */
+//    public boolean hasReturnValue()
+//    {
+//        return true;
+//    }
 
     /*
      * @see XmlCapable#toXML()
@@ -91,8 +91,8 @@
      */
     public String toString()
     {
-        ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
-        buf.append("name", this.getName());
+        ToStringBuilder buf = new ToStringBuilder(this);
+        buf.append(super.toString());
         return buf.toString();
     }
 

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SelectByPKProcedureDescriptor.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SelectByPKProcedureDescriptor.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SelectByPKProcedureDescriptor.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SelectByPKProcedureDescriptor.java Fri Jan 12 10:19:39 2007
@@ -27,33 +27,30 @@
  * SelectByPKProcedureDescriptor instances, because instances could become invalid
  * during runtime (see {@link MetadataManager}).
  *
- * @author <a href="mailto:[email protected]">Vadim Gritsenko<a>
  * @version $Id$
  */
-public class SelectByPKProcedureDescriptor extends ProcedureDescriptor
-    implements Serializable, XmlCapable
+public class SelectByPKProcedureDescriptor extends ProcedureDescriptor implements Serializable, XmlCapable
 {
     private static final long serialVersionUID = 3257566204813063731L;
 
-    //---------------------------------------------------------------
     /**
      * Constructor declaration
      */
-    public SelectByPKProcedureDescriptor(
-        ClassDescriptor classDescriptor,
-        String name)
+    public SelectByPKProcedureDescriptor(ClassDescriptor classDescriptor, String name)
     {
         super(classDescriptor, name);
+        this.setReturnValue(true);
         this.addArguments(this.getClassDescriptor().getPkFields());
         this.addArguments(this.getClassDescriptor().getLockingFields());
     }
 
-    /**
-     * SelectByPK procedure always returns one value, ResultSet
-     */
-    public boolean hasReturnValue()
+    public void addArgument(int index, ArgumentDescriptor argument)
     {
-        return true;
+        if(argument.isOutParameter())
+        {
+            setReturnValue(false);
+        }
+        super.addArgument(index, argument);
     }
 
     /*
@@ -91,8 +88,8 @@
      */
     public String toString()
     {
-        ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
-        buf.append("name", this.getName());
+        ToStringBuilder buf = new ToStringBuilder(this);
+        buf.append(super.toString());
         return buf.toString();
     }
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java Fri Jan 12 10:19:39 2007
@@ -1,13 +1,5 @@
 package org.apache.ojb.broker.metadata;
 
-import java.util.Enumeration;
-import java.util.Properties;
-
-import org.apache.commons.lang.SystemUtils;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.lang.builder.ToStringStyle;
-import org.apache.ojb.broker.util.sequence.SequenceManagerInMemoryImpl;
-
 /* Copyright 2003-2004 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,35 +14,75 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang.SystemUtils;
+import org.apache.commons.lang.BooleanUtils;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+import org.apache.ojb.broker.util.XmlHelper;
+import org.apache.ojb.broker.util.ClassHelper;
+import org.apache.ojb.broker.util.sequence.SequenceManagerInMemoryImpl;
+import org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl;
+import org.apache.ojb.broker.util.sequence.SequenceManagerMSSQLGuidImpl;
+import org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl;
+import org.apache.ojb.broker.util.sequence.SequenceManagerStoredProcedureImpl;
+import org.apache.ojb.broker.util.sequence.SequenceManagerSeqHiLoImpl;
+import org.apache.ojb.broker.util.sequence.SequenceManagerIdentityImpl;
+import org.apache.ojb.broker.util.sequence.SequenceManager;
+
+/**
+ * Encapsulates sequence manager configuration properties managed by
+ * {@link org.apache.ojb.broker.metadata.JdbcConnectionDescriptor}.
+ * <br/>
+ * All sequence manager implementation specific configuration
+ * attributes are represented by key/value pairs in a
+ * <code>Properties</code> object and could be reached via
+ * {@link #getAttributes()} or {@link #getAttribute(String key)}.
+ *
+ * @version $Id$
+ */
 public class SequenceDescriptor extends DescriptorBase implements XmlCapable
 {
-	private static final long serialVersionUID = -5161713731380949398L;
+    private static final long serialVersionUID = -5161713731380949398L;
 
-    private static final Class DEF_SEQUENCE_MANAGER_CLASS = SequenceManagerInMemoryImpl.class;
+    /**
+     * Attribute string used to enable/disable per field
+     * sequence manager instance support.
+     */
+    public static final String ATTRIBUTE_PER_FIELD = "seq.perField";
 
-    private JdbcConnectionDescriptor jcd;
-    private Class sequenceManagerClass;
+    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 = "sequence";
+    public static final String SHORTCUT_SM_PROCEDURE = "procedure";
+    public static final String SHORTCUT_SM_MS_GUID = "msguid";
 
-    public SequenceDescriptor(JdbcConnectionDescriptor jcd)
+    private static Map shortcutNamesMap = new HashMap();
+    static
     {
-        this.jcd = jcd;
-        this.sequenceManagerClass = DEF_SEQUENCE_MANAGER_CLASS;
+        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, SequenceManagerNextValImpl.class);
+        shortcutNamesMap.put(SHORTCUT_SM_PROCEDURE, SequenceManagerStoredProcedureImpl.class);
     }
 
-    public SequenceDescriptor(JdbcConnectionDescriptor jcd, Class sequenceManagerClass)
-    {
-        this(jcd);
-        this.sequenceManagerClass = sequenceManagerClass;
-    }
+    private Class sequenceManagerClass = SequenceManagerInMemoryImpl.class;
 
-    public JdbcConnectionDescriptor getJdbcConnectionDescriptor()
+    public SequenceDescriptor()
     {
-        return jcd;
     }
 
-    public void setJdbcConnectionDescriptor(JdbcConnectionDescriptor jcd)
+    public SequenceDescriptor(Class sequenceManagerClass)
     {
-        this.jcd = jcd;
+        setSequenceManagerClass(sequenceManagerClass);
     }
 
     public Class getSequenceManagerClass()
@@ -60,9 +92,45 @@
 
     public void setSequenceManagerClass(Class sequenceManagerClass)
     {
+        if(!(SequenceManager.class.isAssignableFrom(sequenceManagerClass)))
+        {
+            throw new MetadataException("Wrong class type. Expect sub-class of "
+                    + SequenceManager.class.getName() + ", specified: " + sequenceManagerClass);
+        }
         this.sequenceManagerClass = sequenceManagerClass;
     }
 
+    public void setSequenceManagerClass(String sequenceManagerName)
+    {
+        Class sc = (Class) shortcutNamesMap.get(sequenceManagerName);
+        if(sc != null)
+        {
+            this.sequenceManagerClass = sc;
+        }
+        else
+        {
+            try
+            {
+                this.sequenceManagerClass = ClassHelper.getClass(sequenceManagerName);
+            }
+            catch(ClassNotFoundException e)
+            {
+                throw new MetadataException("Can't find/resolve sequence manager class '" + sequenceManagerName + "'");
+            }
+        }
+    }
+
+    public boolean isPerFieldSequences()
+    {
+        String result = getAttribute(ATTRIBUTE_PER_FIELD, "false");
+        return BooleanUtils.toBoolean(result);
+    }
+
+    public void setPerFieldSequences(boolean enable)
+    {
+        addAttribute(ATTRIBUTE_PER_FIELD, BooleanUtils.toStringTrueFalse(enable));
+    }
+
     public String toString()
     {
         ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
@@ -87,38 +155,15 @@
         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=\"aKey\" attribute-value=\"aValue\"/>" );
         buf.append( eol );
         buf.append( "         -->" );
         buf.append( eol );
-        buf.append( buildAttributes() );
+        XmlHelper.appendSerializedAttributes(buf, "         ", getAttributes());
         buf.append( "      " );
         buf.append( RepositoryTags.getClosingTagById( SEQUENCE_MANAGER ) );
         buf.append( eol );
 
-        return buf.toString();
-    }
-
-    private String buildAttributes()
-    {
-        String eol = SystemUtils.LINE_SEPARATOR;
-        Properties prop = getAttributes();
-        if( prop == null || prop.isEmpty() )
-            return "";
-
-        StringBuffer buf = new StringBuffer();
-        Enumeration en = prop.keys();
-        while( en.hasMoreElements() )
-        {
-            String key = ( String ) en.nextElement();
-            String value = prop.getProperty( key );
-            buf.append( "         <attribute attribute-name=\"" );
-            buf.append( key );
-            buf.append( "\" attribute-value=\"" );
-            buf.append( value );
-            buf.append( "\"/>" );
-            buf.append( eol );
-        }
         return buf.toString();
     }
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SuperReferenceDescriptor.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SuperReferenceDescriptor.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SuperReferenceDescriptor.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/SuperReferenceDescriptor.java Fri Jan 12 10:19:39 2007
@@ -15,18 +15,11 @@
  * limitations under the License.
  */
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 import java.util.Vector;
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.SystemUtils;
-import org.apache.commons.lang.builder.ToStringBuilder;
 import org.apache.ojb.broker.metadata.fieldaccess.AnonymousPersistentField;
 import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
-import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldFactory;
-import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectImpl;
 import org.apache.ojb.broker.util.logging.Logger;
 import org.apache.ojb.broker.util.logging.LoggerFactory;
 
@@ -44,7 +37,6 @@
     public static final String SUPER_FIELD_NAME = RepositoryElements.TAG_SUPER;
 
     private Boolean javaInheritance;
-    private Map declaredInheritanceFields = new HashMap();
 
     public SuperReferenceDescriptor(ClassDescriptor descriptor)
     {
@@ -171,33 +163,17 @@
         return javaInheritance.booleanValue();
     }
 
-    synchronized PersistentField getDeclaredInheritanceField(Class target, String name)
-    {
-        Map fields = (HashMap) declaredInheritanceFields.get(target);
-        if(fields == null)
-        {
-            fields = new HashMap();
-            declaredInheritanceFields.put(target, fields);
-        }
-        PersistentField pf = (PersistentField) fields.get(name);
-        if(pf == null)
-        {
-            pf = PersistentFieldFactory.createPersistentField(PersistentFieldDirectImpl.class, target, name);
-            // System.out.println("## tmp field: " + target + ", name: " + name + ", field: " + pf);
-            fields.put(name, pf);
-        }
-        return pf;
-    }
-
-
 
     //====================================================
     // inner class
     //====================================================
-
+    /**
+     * A {@link org.apache.ojb.broker.metadata.fieldaccess.PersistentField} implementation
+     * to handle "table-per-subclass"-inheritance.
+     */
     public static final class SuperReferenceField extends AnonymousPersistentField
     {
-        private Logger log = LoggerFactory.getLogger(SuperReferenceField.class);
+        // private Logger log = LoggerFactory.getLogger(SuperReferenceField.class);
 
         private SuperReferenceDescriptor superRef;
 
@@ -208,8 +184,7 @@
         }
 
         /**
-         * Field values of 'value' (base object) are copied to 'obj' (derived object)
-         * then obj is saved in a map
+         * A noop-method.
          *
          * @param target - the base object instance
          * @param value - the derived object instance
@@ -217,214 +192,32 @@
          */
         public synchronized void set(Object target, Object value) throws MetadataException
         {
-            // System.out.println("target: " + target + " value: " + value);
-            ClassDescriptor superCld = superRef.getClassDescriptor().getSuperClassDescriptor();
-            if(superRef.isJavaInheritance())
-            {
-                copyFields(superCld, target, superCld, value);
-            }
-            else
+            //System.out.println("super.set: target=" + target + ", value=" + value);
+            //System.out.println(ExceptionHelper.buildExceptionStack("super.set: " + superRef));
+            if(!superRef.isJavaInheritance())
             {
                 throw new MetadataException("Declared super class '" + superRef.getClassDescriptor()
                         + "'is not assignable from " + target.getClass() + ". Reference: " + toString());
-                // copyFields(superRef.getClassDescriptor(), target, superCld, value, false, false);
             }
         }
 
         /**
-         * Field values of specified 'obj' (the derived object) are copied to
-         * 'value' (base object) then value is returned as a referenced object.
-         * If the base object is the super class of the specified 'obj', then
-         * return the specified object.
-         * Else a base class instance will be created at runtime and the field values
-         * from the derived object are copied to the base class object.
+         * A noop method.
          *
          * @param obj - the base object instance
          * @throws MetadataException
          */
         public synchronized Object get(Object obj) throws MetadataException
         {
-            if(obj == null) return null;
-            if(superRef.isJavaInheritance())
-            {
-                return obj;
-            }
-            else
+            //System.out.println("super.get: " + obj);
+            //System.out.println(ExceptionHelper.buildExceptionStack("super.get: " + superRef));
+            if(!superRef.isJavaInheritance())
             {
                 throw new MetadataException("Declared super class '" + superRef.getClassDescriptor()
                         + "'is not assignable from " + obj.getClass() + ". Reference: " + toString());
-                //return getObjectWithDeclaredSuperClass(obj);
             }
+            return obj;
         }
-
-        void copyFields(final ClassDescriptor targetCld, final Object target, final ClassDescriptor sourceCld,
-                        final Object source)
-        {
-            if(log.isDebugEnabled())
-            {
-                String msg = ("Copy fields from " + SystemUtils.LINE_SEPARATOR
-                        + "source object '" + (source != null ? source.getClass().getName() : null) + "'" + SystemUtils.LINE_SEPARATOR
-                        + "using source fields declared in '" + sourceCld.getClassNameOfObject() + "'" + SystemUtils.LINE_SEPARATOR
-                        + "to target object '" + (target != null ? target.getClass().getName() : null) + "'" + SystemUtils.LINE_SEPARATOR
-                        + "using target fields declared in '" + targetCld.getClassNameOfObject() + "'" + SystemUtils.LINE_SEPARATOR
-                        + "the fields to copy are declared in '" + targetCld.getClassNameOfObject());
-                log.debug(msg);
-            }
-            /*
-            arminw:
-            If the target object is a super object of the source object, iterate all target object fields.
-            If java inheritance is used (target is super class of source or vice versa) we can use the same
-            FieldDescriptor to copy the fields.
-            */
-            FieldDescriptor[] fields = targetCld.getFieldDescriptions();
-            for(int i = 0; i < fields.length; i++)
-            {
-                FieldDescriptor field = fields[i];
-                if(!field.isAnonymous())
-                {
-                    performFieldCopy(target, source, field.getPersistentField());
-                }
-            }
-            List refs = targetCld.getCollectionDescriptors();
-            for(int i = 0; i < refs.size(); i++)
-            {
-                CollectionDescriptor col = (CollectionDescriptor) refs.get(i);
-                PersistentField pf = col.getPersistentField();
-                performFieldCopy(target, source, pf);
-            }
-
-            refs = targetCld.getObjectReferenceDescriptors();
-            for(int i = 0; i < refs.size(); i++)
-            {
-                ObjectReferenceDescriptor ord = (ObjectReferenceDescriptor) refs.get(i);
-                PersistentField pf = ord.getPersistentField();
-                performFieldCopy(target, source, pf);
-            }
-        }
-
-        private void performFieldCopy(final Object target, final Object source, final PersistentField pf)
-        {
-            pf.set(target, pf.get(source));
-        }
-
-        public String toString()
-        {
-            return new ToStringBuilder(this)
-                    .append("name", getName())
-                    .append("type", getType())
-                    .append("super-reference", superRef)
-                    .toString();
-        }
-
-// arminw: the code below is a first attempt to support "table-per-subclass"-inheritance
-// for objects without java-subclass inheritance. But it's only possible for simple single-level
-// inheritance of "declared" objects
-//        void copyFields(final ClassDescriptor targetCld, final Object target, final ClassDescriptor sourceCld,
-//                        final Object source, final boolean targetIsSuper, final boolean javaInheritance)
-//        {
-//            if(log.isDebugEnabled())
-//            {
-//                String msg = ("Copy fields from " + SystemUtils.LINE_SEPARATOR
-//                        + "source object '" + (source != null ? source.getClass().getName() : null) + "'" + SystemUtils.LINE_SEPARATOR
-//                        + "using source fields declared in '" + sourceCld.getClassNameOfObject() + "'" + SystemUtils.LINE_SEPARATOR
-//                        + "to target object '" + (target != null ? target.getClass().getName() : null) + "'" + SystemUtils.LINE_SEPARATOR
-//                        + "using target fields declared in '" + targetCld.getClassNameOfObject() + "'" + SystemUtils.LINE_SEPARATOR
-//                        + "the fields to copy are declared in '" + (targetIsSuper ? targetCld.getClassNameOfObject() : sourceCld.getClassNameOfObject()) + "' class" + SystemUtils.LINE_SEPARATOR
-//                        + "the used classes are associated by java inheritance: " + javaInheritance + SystemUtils.LINE_SEPARATOR);
-//                log.debug(msg);
-//            }
-//            /*
-//            arminw:
-//            If the target object is a super object of the source object, iterate all target object fields.
-//            If the source object is a super object of the target object, iterate all source object fields
-//
-//            If java inheritance is used (target is super class of source or vice versa) we can use the same
-//            FieldDescriptor to copy the fields.
-//            If only a "declarative inheritance" is used (no class inheritance, only identical field names of the super class)
-//            we have to use the associated FieldDescriptor of target and source ClassDescriptor
-//            */
-//            FieldDescriptor[] fields = targetIsSuper ? targetCld.getFieldDescriptions() : sourceCld.getFieldDescriptions();
-//            for(int i = 0; i < fields.length; i++)
-//            {
-//                FieldDescriptor field = fields[i];
-//                if(!field.isAnonymous())
-//                {
-////                    performFieldCopy(target,  targetCld, source, sourceCld,
-////                                field.getPersistentField(), targetIsSuper, javaInheritance);
-//                    performFieldCopy(target, source, field.getPersistentField());
-//                }
-//            }
-//            List refs = targetIsSuper ? targetCld.getCollectionDescriptors() : sourceCld.getCollectionDescriptors();
-//            for(int i = 0; i < refs.size(); i++)
-//            {
-//                CollectionDescriptor col = (CollectionDescriptor) refs.get(i);
-//                PersistentField pf = col.getPersistentField();
-//                //performFieldCopy(target,  targetCld, source, sourceCld, pf, targetIsSuper, javaInheritance);
-//                performFieldCopy(target, source, pf);
-//            }
-//
-//            refs = targetIsSuper ? targetCld.getObjectReferenceDescriptors() : sourceCld.getObjectReferenceDescriptors();
-//            for(int i = 0; i < refs.size(); i++)
-//            {
-//                ObjectReferenceDescriptor ord = (ObjectReferenceDescriptor) refs.get(i);
-//                PersistentField pf = ord.getPersistentField();
-//                //performFieldCopy(target,  targetCld, source, sourceCld, pf, targetIsSuper, javaInheritance);
-//                performFieldCopy(target, source, pf);
-//            }
-//        }
-//
-//
-//        private void performFieldCopy(Object target, ClassDescriptor targetCld, Object source,
-//                                 ClassDescriptor sourceCld, PersistentField pf, boolean targetIsSuper, boolean javaInheritance)
-//        {
-//            if(javaInheritance)
-//            {
-//                pf.set(target, pf.get(source));
-//            }
-//            else
-//            {
-//                if(targetIsSuper)
-//                {
-//                    if(pf instanceof SuperReferenceField)
-//                    {
-//                        log.error("Declared inheritance doesn't support nested super references, target '"
-//                                + targetCld.getClassNameOfObject() + "' has super reference");
-//                    }
-//                    else
-//                    {
-//                        PersistentField tmp = superRef.getDeclaredInheritanceField(sourceCld.getClassOfObject(), pf.getName());
-//                        pf.set(target, tmp.get(source));
-//                    }
-//                }
-//                else
-//                {
-//                    PersistentField tmp = superRef.getDeclaredInheritanceField(targetCld.getClassOfObject(), pf.getName());
-//                    tmp.set(target, pf.get(source));
-//                }
-//            }
-//        }
-//
-//        private Object getObjectWithDeclaredSuperClass(Object obj)
-//        {
-//            Object value = getFromFieldCache(obj);
-//            if(value == null)
-//            {
-//                ClassDescriptor baseCld = null;
-//                try
-//                {
-//                    baseCld = superRef.getClassDescriptor().getSuperClassDescriptor();
-//                    value = ClassHelper.buildNewObjectInstance(baseCld);
-//                }
-//                catch(Exception e)
-//                {
-//                    throw new MetadataException("Can't create new base class object for '"
-//                            + (baseCld != null ? baseCld.getClassNameOfObject() : null) + "'", e);
-//                }
-//                copyFields(baseCld, value, superRef.getClassDescriptor(), obj, true, false);
-//                putToFieldCache(obj, value);
-//            }
-//            return value;
-//        }
     }
 }
 

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/UpdateProcedureDescriptor.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/UpdateProcedureDescriptor.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/UpdateProcedureDescriptor.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/UpdateProcedureDescriptor.java Fri Jan 12 10:19:39 2007
@@ -56,7 +56,7 @@
         super(classDescriptor, name);
         if (includeAllFields)
         {
-            this.addArguments(this.getClassDescriptor().getFieldDescriptions());
+            this.addArguments(this.getClassDescriptor().getFieldDescriptor(true));
         }
         this.includeAllFields = includeAllFields;
     }
@@ -106,11 +106,6 @@
         result.append(RepositoryTags.getOpeningTagNonClosingById(UPDATE_PROCEDURE));
         result.append(" ");
         result.append(RepositoryTags.getAttribute(NAME, this.getName()) );
-        if (this.hasReturnValue())
-        {
-            result.append(" ");
-            result.append(RepositoryTags.getAttribute(RETURN_FIELD_REF, this.getReturnValueFieldRefName()) );
-        }
         result.append(" ");
         result.append(RepositoryTags.getAttribute(INCLUDE_ALL_FIELDS, String.valueOf(this.getIncludeAllFields())) );
         result.append(">");
@@ -141,13 +136,9 @@
      */
     public String toString()
     {
-        ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
-        buf.append("name", this.getName());
+        ToStringBuilder buf = new ToStringBuilder(this);
         buf.append("includeAllFields", this.getIncludeAllFields());
-        if (this.hasReturnValue())
-        {
-            buf.append("returnFieldRefName", this.getReturnValueFieldRefName());
-        }
+        buf.append(super.toString());
         return buf.toString();
     }
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldBase.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldBase.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldBase.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldBase.java Fri Jan 12 10:19:39 2007
@@ -186,15 +186,14 @@
     {
         String eol = SystemUtils.LINE_SEPARATOR;
         StringBuffer buf = new StringBuffer();
-        buf
-                .append(eol + "[try to set 'object value' in 'target object'")
-                .append(eol + "  target obj class: " + (obj != null ? obj.getClass().getName() : null))
-                .append(eol + "  target field name: " + (aField != null ? aField.getName() : null))
-                .append(eol + "  target field type: " + (aField != null ? aField.getType() : null))
-                .append(eol + "  target field declared in: " + (aField != null ? aField.getDeclaringClass().getName() : null))
-                .append(eol + "  object value class: " + (value != null ? value.getClass().getName() : null))
-                .append(eol + "  object value: " + (value != null ? value : null))
-                .append(eol + "]");
+        buf.append(eol).append("[try to set 'object value' in 'target object'");
+        buf.append(eol).append("  target obj class: ").append(obj != null ? obj.getClass().getName() : null);
+        buf.append(eol).append("  target field name: ").append(aField != null ? aField.getName() : null);
+        buf.append(eol).append("  target field type: ").append(aField != null ? aField.getType() : null);
+        buf.append(eol).append("  target field declared in: ").append(aField != null ? aField.getDeclaringClass().getName() : null);
+        buf.append(eol).append("  object value class: ").append(value != null ? value.getClass().getName() : null);
+        buf.append(eol).append("  object value: ").append(value != null ? value : null);
+        buf.append(eol).append("]");
         return buf.toString();
     }
 
@@ -205,13 +204,12 @@
     {
         String eol = SystemUtils.LINE_SEPARATOR;
         StringBuffer buf = new StringBuffer();
-        buf
-                .append(eol + "[try to read from source object")
-                .append(eol + "  source obj class: " + (obj != null ? obj.getClass().getName() : null))
-                .append(eol + "  target field name: " + (aField != null ? aField.getName() : null))
-                .append(eol + "  target field type: " + (aField != null ? aField.getType() : null))
-                .append(eol + "  target field declared in: " + (aField != null ? aField.getDeclaringClass().getName() : null))
-                .append(eol + "]");
+        buf.append(eol).append("[try to read from source object");
+        buf.append(eol).append("  source obj class: ").append(obj != null ? obj.getClass().getName() : null);
+        buf.append(eol).append("  target field name: ").append(aField != null ? aField.getName() : null);
+        buf.append(eol).append("  target field type: ").append(aField != null ? aField.getType() : null);
+        buf.append(eol).append("  target field declared in: ").append(aField != null ? aField.getDeclaringClass().getName() : null);
+        buf.append(eol).append("]");
         return buf.toString();
     }
 
@@ -239,34 +237,30 @@
         String eol = SystemUtils.LINE_SEPARATOR;
         StringBuffer buf = new StringBuffer();
         String type = (isSetter ? "setter" : "getter");
-        buf
-            .append(eol + "["
-                    + (msg == null ? "try to handle " + type + " property call" : type + " property call: " + msg))
-            .append(eol + "  Declaring class [" + getDeclaringClass().getName() + "]")
-            .append(eol + "  Property Name [" + getName() + "]")
-            .append(eol + "  Property Type ["
-                    + (returnOrArgumentType != null ? returnOrArgumentType.getName() : "not available") + "]");
+        buf.append(eol).append("[").append(msg == null ? "try to handle " + type + " property call" : type + " property call: " + msg);
+        buf.append(eol).append("  Declaring class [").append(getDeclaringClass().getName()).append("]");
+        buf.append(eol).append("  Property Name [").append(getName()).append("]");
+        buf.append(eol).append("  Property Type [").append(returnOrArgumentType != null ? returnOrArgumentType.getName() : "not available").append("]");
 
         if (anObject != null)
         {
             //buf.append("the " + (isSetter ? "target" : "source") + " object was [" + anObject + "]");
-            buf.append(eol + "  the "
-                    + (isSetter ? "target" : "source") + " object type was [" + anObject.getClass().getName() + "]");
+            buf.append(eol).append("  the ").append(isSetter ? "target" : "source").append(" object type was [").append(anObject.getClass().getName()).append("]");
         }
         else
         {
-            buf.append(eol + "  the " + (isSetter ? "target" : "source") + " object was 'null'");
+            buf.append(eol).append("  the ").append(isSetter ? "target" : "source").append(" object was 'null'");
         }
         if(isSetter)
         {
             if (aValue != null)
             {
-                buf.append(eol + "  the value was [" + aValue + "]");
-                buf.append(eol + "  the value type was [" + aValue.getClass().getName() + "]");
+                buf.append(eol).append("  the value was [").append(aValue).append("]");
+                buf.append(eol).append("  the value type was [").append(aValue.getClass().getName()).append("]");
             }
             else
             {
-                buf.append(eol + "  the value was 'null'");
+                buf.append(eol).append("  the value was 'null'");
             }
         }
         return buf.toString();

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/Platform.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/Platform.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/Platform.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/Platform.java Fri Jan 12 10:19:39 2007
@@ -23,7 +23,6 @@
 import java.sql.Statement;
 import java.util.Properties;
 
-import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
 import org.apache.ojb.broker.metadata.FieldDescriptor;
 import org.apache.ojb.broker.query.LikeCriteria;
 
@@ -34,7 +33,6 @@
  * each jdbc-connection-descriptor entry in the repository file.
  *
  * @version $Id$
- * @author	 Thomas Mahler
  */
 public interface Platform
 {
@@ -83,7 +81,7 @@
      * ConnectionFactory implementation (not used for DataSource connections).
      * @param conn the Connection to be initialized
      */
-    public void initializeJdbcConnection(JdbcConnectionDescriptor jcd, Connection conn) throws PlatformException;
+    void initializeJdbcConnection(Connection conn) throws PlatformException;
 
     /**
      * Used to do a temporary change of the m_connection autoCommit state.
@@ -94,7 +92,7 @@
      * {@link org.apache.ojb.broker.metadata.JdbcConnectionDescriptor#AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE}
      * the change of the autoCommit state take effect.
      */
-    public void changeAutoCommitState(JdbcConnectionDescriptor jcd, Connection con, boolean newState);
+    void changeAutoCommitState(Connection con, boolean newState);
 
     /**
      * Called to let the Platform implementation perform any JDBC type-specific operations
@@ -103,8 +101,7 @@
      * When read in result set columns, the counterpart of this method is
      * {@link #postPrepareReadInValue(org.apache.ojb.broker.metadata.FieldDescriptor, Object)}.
      */
-    public void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType)
-            throws SQLException;
+    public void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType) throws SQLException;
 
     /**
      * Called to let the Platform implementation perform any JDBC type-specific operations
@@ -113,8 +110,7 @@
      * When read in result set columns, the counterpart of this method is
      * {@link #postPrepareReadInValue(org.apache.ojb.broker.metadata.FieldDescriptor, Object)}.
      */
-    public void setNullForStatement(PreparedStatement ps, int index, int sqlType)
-            throws SQLException;
+    public void setNullForStatement(PreparedStatement ps, int index, int sqlType) throws SQLException;
 
     /**
      * Called to let the Platform implementation perform any JDBC type-specific operations
@@ -284,6 +280,12 @@
      * @param aString
      */
     public String quoteName(String aString);
+
+    /**
+     * Returns the "...FOR UPDATE" clause or will throw an
+     * exception if not supported by the database.
+     */
+    public String getSelectForUpdateClause() throws UnsupportedOperationException;
 
     /**
      * Method specify how OJB have to handle LOB objects. Returns

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDb2Impl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDb2Impl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDb2Impl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDb2Impl.java Fri Jan 12 10:19:39 2007
@@ -21,6 +21,7 @@
 import java.util.Properties;
 
 import org.apache.ojb.broker.util.sequence.SequenceManagerHelper;
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
 
 /**
  * This class extends <code>PlatformDefaultImpl</code> and defines specific
@@ -114,11 +115,15 @@
  * </tr>
  * </table>
  *
- * @author <a href="mailto:[email protected]">Thomas Mahler<a>
  * @version $Id$
  */
 public class PlatformDb2Impl extends PlatformDefaultImpl
 {
+    public PlatformDb2Impl(JdbcConnectionDescriptor jcd)
+    {
+        super(jcd);
+    }
+
     /**
      * Patch provided by Avril Kotzen ([email protected])
      * DB2 handles TINYINT (for mapping a byte).
@@ -243,13 +248,9 @@
   
 	public String getLastInsertIdentityQuery(String tableName)
 	{
-		// [email protected]
-		// the function is used by the org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl
-		// this call must be made before commit the insert command, so you
-		// must turn off autocommit by seting the useAutoCommit="2"
-        // or use useAutoCommit="1" or use a connection with autoCommit set false
-        // by default (e.g. in managed environments)
-        // transaction demarcation is mandatory
+        // arminw: Query "values IDENTITY_VAL_LOCAL()" doesn't seems to
+        // work with DB2 Z/os v7 (reported on user-list) thus rollback to
+        //
 		return "select IDENTITY_VAL_LOCAL() from sysibm.sysdummy1";
 	}
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDefaultImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDefaultImpl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDefaultImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDefaultImpl.java Fri Jan 12 10:19:39 2007
@@ -31,6 +31,8 @@
 import org.apache.ojb.broker.PersistenceBrokerException;
 import org.apache.ojb.broker.accesslayer.JoinSyntaxTypes;
 import org.apache.ojb.broker.lob.LobHandle;
+import org.apache.ojb.broker.lob.BlobHandle;
+import org.apache.ojb.broker.lob.ClobHandle;
 import org.apache.ojb.broker.metadata.FieldDescriptor;
 import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
 import org.apache.ojb.broker.query.LikeCriteria;
@@ -45,7 +47,6 @@
  * platform specific implementations.
  *
  * @version $Id$
- * @author		Thomas Mahler
  */
 public class PlatformDefaultImpl implements Platform, JoinSyntaxTypes
 {
@@ -56,13 +57,19 @@
     protected boolean m_batchUpdatesChecked = false;
     protected boolean m_supportsBatchUpdates = false;
     protected Boolean locatorsUpdateCopy;
+    protected JdbcConnectionDescriptor jcd;
+
+    public PlatformDefaultImpl(JdbcConnectionDescriptor jcd)
+    {
+        this.jcd = jcd;
+    }
 
     public boolean supportsBatchOperations()
     {
         return m_supportsBatchUpdates;
     }
 
-    /**
+   /**
      * Sets platform information for if the jdbc driver/db combo support
      * batch operations. Will only be checked once, then have same batch
      * support setting for the entire session.
@@ -149,7 +156,7 @@
     /**
      * @see Platform#initializeJdbcConnection
      */
-    public void initializeJdbcConnection(JdbcConnectionDescriptor jcd, Connection conn) throws PlatformException
+    public void initializeJdbcConnection(Connection conn) throws PlatformException
     {
         if (jcd.getBatchMode()) checkForBatchSupport(conn);
 
@@ -205,7 +212,7 @@
         }
     }
 
-    public void changeAutoCommitState(JdbcConnectionDescriptor jcd, Connection con, boolean newState)
+    public void changeAutoCommitState(Connection con, boolean newState)
     {
         if (con == null)
         {
@@ -342,7 +349,7 @@
                     if(detectLocatorsUpdateState(ps))
                     {
                         handle.checkActive();
-                        ps.setBlob(index, b);
+                        ps.setBlob(index, ((BlobHandle) b).getBlob());
                     }
                 }
             }
@@ -401,7 +408,7 @@
                     if(detectLocatorsUpdateState(ps))
                     {
                         handle.checkActive();
-                        ps.setClob(index, c);
+                        ps.setClob(index, ((ClobHandle) c).getClob());
                     }
                 }
             }
@@ -612,6 +619,11 @@
     protected String getQuotedName(String aString)
     {
         return '"' + aString + '"'; 
+    }
+
+    public String getSelectForUpdateClause() throws UnsupportedOperationException
+    {
+        return " FOR UPDATE";
     }
 
     /**

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDerbyImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDerbyImpl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDerbyImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformDerbyImpl.java Fri Jan 12 10:19:39 2007
@@ -19,11 +19,18 @@
 import java.sql.SQLException;
 import java.sql.Types;
 
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
+
 /**
  * This class defines specific behavior for the Derby platform.
  */
 public class PlatformDerbyImpl extends PlatformDefaultImpl
 {
+    public PlatformDerbyImpl(JdbcConnectionDescriptor jcd)
+    {
+        super(jcd);
+    }
+
     /**
      * {@inheritDoc}
      */

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformFactory.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformFactory.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformFactory.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformFactory.java Fri Jan 12 10:19:39 2007
@@ -17,6 +17,7 @@
 
 import java.util.HashMap;
 import java.util.Map;
+import java.lang.reflect.InvocationTargetException;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.SystemUtils;
@@ -27,7 +28,7 @@
 import org.apache.ojb.broker.util.logging.LoggerFactory;
 
 /**
- * This factory class is responsible to manage {@link Platform} objects that
+ * This factory class is responsible to create {@link Platform} objects that
  * define RDBMS platform specific behaviour.
  *
  * @version $Id$
@@ -35,10 +36,9 @@
 public class PlatformFactory
 {
     private static Logger log = LoggerFactory.getLogger(PlatformFactory.class);
+    private static Map names = new HashMap();
 
-    private Map names = new HashMap();
-    private HashMap platforms = new HashMap();
-
+    static
     {
         // comment out the correct typed mappings (with correct upper
         // and lower case, the first letter will always transformed to upper case)
@@ -74,49 +74,52 @@
      *
      * @param jcd the JdbcConnectionDescriptor defining the platform
      */
-    public Platform getPlatformFor(JdbcConnectionDescriptor jcd)
+    public static Platform getPlatformFor(JdbcConnectionDescriptor jcd)
     {
         String dbms = jcd.getDbms();
         if(dbms == null)
         {
             throw new NullPointerException("The Platform is not specified. " + jcd);
         }
-        Platform result = (Platform) platforms.get(dbms);
-        if(result == null)
+        Platform result = resolvePlatform(jcd, dbms);
+        if(log.isEnabledFor(Logger.INFO))
         {
-            result = resolvePlatform(dbms);
-            if(log.isEnabledFor(Logger.INFO))
-            {
-                log.info("Resolve platform class for name '" + dbms + "', Platform instance: " + result);
-            }
-            platforms.put(dbms, result); // cache the Platform
+            log.info("Resolve platform class for name '" + dbms + "', Platform instance: " + result);
         }
         return result;
     }
 
-    private Platform resolvePlatform(final String platformName)
+    private static Platform resolvePlatform(JdbcConnectionDescriptor jcd, final String platformName)
     {
         Platform result = null;
         String name = null;
         try
         {
             name = createClassName(platformName);
-            result = instantiatePlatform(name);
+            result = instantiatePlatform(jcd, name);
         }
         catch(ClassNotFoundException e)
         {
             // ignore
         }
+        catch(NoClassDefFoundError e)
+        {
+            // ignore
+        }
         if(result == null)
         {
             try
             {
-                result = instantiatePlatform(platformName);
+                result = instantiatePlatform(jcd, platformName);
             }
             catch(ClassNotFoundException e)
             {
                 // ignore
             }
+            catch(NoClassDefFoundError e)
+            {
+                // ignore
+            }
         }
         if(result == null)
         {
@@ -126,7 +129,7 @@
                 if(str != null)
                 {
                     String resolvedName = createClassName(str);
-                    result = instantiatePlatform(resolvedName);
+                    result = instantiatePlatform(jcd, resolvedName);
                     log.info("The correct Platform token is '" + str
                             + "' instead of the specified '" + platformName + "'");
                 }
@@ -148,12 +151,12 @@
         return result;
     }
 
-    private Platform instantiatePlatform(String name) throws ClassNotFoundException
+    private static Platform instantiatePlatform(JdbcConnectionDescriptor jcd, String name) throws ClassNotFoundException
     {
         Platform result;
         try
         {
-            result = (Platform) ClassHelper.newInstance(name);
+            result = (Platform) ClassHelper.newInstance(name, JdbcConnectionDescriptor.class, jcd);
         }
         catch(InstantiationException e)
         {
@@ -163,6 +166,14 @@
         {
             throw new OJBRuntimeException("Platform class " + name + " exists, but access isn't allowed", e);
         }
+        catch(InvocationTargetException e)
+        {
+            throw new OJBRuntimeException("Platform class " + name + " exists, but constructor seems to cause problem", e);
+        }
+        catch(NoSuchMethodException e)
+        {
+            throw new OJBRuntimeException("Platform class " + name + " exists, but something fail", e);
+        }
         return result;
     }
 
@@ -172,7 +183,7 @@
      *
      * @param platform the name of the platform as specified in the repository
      */
-    private String createClassName(String platform)
+    private static String createClassName(String platform)
     {
         String pf;
         if(StringUtils.isNotBlank(platform))
@@ -191,14 +202,13 @@
 // for internal testing
 //    public static void main(String[] args)
 //    {
-//        PlatformFactory pf = new PlatformFactory();
-//        Iterator it = pf.names.values().iterator();
+//        Iterator it = names.values().iterator();
 //        while(it.hasNext())
 //        {
 //            String name =  (String) it.next();
 //            try
 //            {
-//                System.out.println("Platform: " + pf.instantiatePlatform(pf.createClassName(name)));
+//                System.out.println("Platform: " + instantiatePlatform(createClassName(name)));
 //            }
 //            catch(ClassNotFoundException e)
 //            {

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformFirebirdImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformFirebirdImpl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformFirebirdImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformFirebirdImpl.java Fri Jan 12 10:19:39 2007
@@ -1,5 +1,7 @@
 package org.apache.ojb.broker.platforms;
 
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
+
 /* Copyright 2003-2004 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,6 +28,11 @@
  */
 public class PlatformFirebirdImpl extends PlatformDefaultImpl
 {
+    public PlatformFirebirdImpl(JdbcConnectionDescriptor jcd)
+    {
+        super(jcd);
+    }
+
     public String createSequenceQuery(String sequenceName)
     {
         return "create generator " + sequenceName;

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformHsqldbImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformHsqldbImpl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformHsqldbImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformHsqldbImpl.java Fri Jan 12 10:19:39 2007
@@ -18,6 +18,7 @@
 import java.util.Properties;
 
 import org.apache.ojb.broker.util.sequence.SequenceManagerHelper;
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
 
 /**
  * This class extends <code>PlatformDefaultImpl</code> and defines specific
@@ -65,6 +66,11 @@
 public class PlatformHsqldbImpl extends PlatformDefaultImpl
 {
     private static final String LAST_INSERT = "CALL IDENTITY()";
+
+    public PlatformHsqldbImpl(JdbcConnectionDescriptor jcd)
+    {
+        super(jcd);
+    }
 
     /**
      * Get join syntax type for this RDBMS - one on of the constants from JoinSyntaxType interface

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformInformixImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformInformixImpl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformInformixImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformInformixImpl.java Fri Jan 12 10:19:39 2007
@@ -15,29 +15,29 @@
  * limitations under the License.
  */
 
-import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
-
+import java.sql.CallableStatement;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.sql.CallableStatement;
 import java.sql.Types;
 
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
+
 /**
  * This class extends <code>PlatformDefaultImpl</code> and defines specific
  * behavior for the Informix platform.
- * @version 	1.0
- * @author		Thomas Mahler
  */
 public class PlatformInformixImpl extends PlatformDefaultImpl
 {
+    public PlatformInformixImpl(JdbcConnectionDescriptor jcd)
+    {
+        super(jcd);
+    }
 
-    /**
-     * @see Platform#initializeJdbcConnection
-     */
-    public void initializeJdbcConnection(JdbcConnectionDescriptor jcd, Connection conn) throws PlatformException
+    /** @see Platform#initializeJdbcConnection */
+    public void initializeJdbcConnection(Connection conn) throws PlatformException
     {
-        super.initializeJdbcConnection(jcd, conn);
+        super.initializeJdbcConnection(conn);
         Statement stmt = null;
         try
         {

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMaxDBImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMaxDBImpl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMaxDBImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMaxDBImpl.java Fri Jan 12 10:19:39 2007
@@ -1,5 +1,7 @@
 package org.apache.ojb.broker.platforms;
 
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
+
 /* Copyright 2004-2004 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,5 +18,8 @@
  */
 public class PlatformMaxDBImpl extends PlatformSapdbImpl
 {
-
+    public PlatformMaxDBImpl(JdbcConnectionDescriptor jcd)
+    {
+        super(jcd);
+    }
 }

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMckoiImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMckoiImpl.java?view=diff&rev=495677&r1=495676&r2=495677
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMckoiImpl.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/platforms/PlatformMckoiImpl.java Fri Jan 12 10:19:39 2007
@@ -24,20 +24,24 @@
 import java.sql.Types;
 
 import org.apache.ojb.broker.query.LikeCriteria;
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
 
 /**
  * Platform implementation for the Mckoi database.
  * 
- * @version 1.0
- * @author <a href="mailto:[email protected]">Thomas Dudziak</a>
  * @version $Id$
  * @see http://www.mckoi.com/database
  */
 public class PlatformMckoiImpl extends PlatformDefaultImpl
 {
+    public PlatformMckoiImpl(JdbcConnectionDescriptor jcd)
+    {
+        super(jcd);
+    }
+
     /* (non-Javadoc)
-	 * @see Platform#setObjectForStatement(PreparedStatement, int, Object, int)
-	 */
+      * @see Platform#setObjectForStatement(PreparedStatement, int, Object, int)
+      */
     public void setObjectForStatement(PreparedStatement statement, int index, Object value, int sqlType) throws SQLException
     {
         switch (sqlType)
@@ -135,9 +139,9 @@
         {
             return columns[0];
         }
-        
+
         StringBuffer buf = new StringBuffer();
-        
+
         buf.append("concat(");
         for (int idx = 0; idx < columns.length; idx++)
         {
@@ -150,15 +154,15 @@
         buf.append(")");
 
         return buf.toString();
-    }    
-    
+    }
+
     /* (non-Javadoc)
-     * @see org.apache.ojb.broker.platforms.Platform#getEscapeClause(org.apache.ojb.broker.query.LikeCriteria)
-     */
+    * @see org.apache.ojb.broker.platforms.Platform#getEscapeClause(org.apache.ojb.broker.query.LikeCriteria)
+    */
     public String getEscapeClause(LikeCriteria criteria)
     {
         // [tomdz] Mckoi does not support escape characters other than \
         // TODO    Shold we throw some kind of exception here if the escape character is different ?
         return "";
-    }    
+    }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.