db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata BatchDescriptor.java AnonymousObjectReferenceDescriptor.java AttributeContainer.java ClassDescriptor.java ConnectionDescriptorXmlHandler.java ConnectionPoolDescriptor.java DescriptorBase.java JdbcConnectionDescriptor.java ObjectCacheDescriptor.java ObjectReferenceDescriptor.java RepositoryElements.java RepositoryTags.java RepositoryXmlHandler.java SequenceDescriptor.java
Date Tue, 14 Sep 2004 16:17:42 GMT
arminw      2004/09/14 09:17:42

  Modified:    src/java/org/apache/ojb/broker/metadata
                        AnonymousObjectReferenceDescriptor.java
                        AttributeContainer.java ClassDescriptor.java
                        ConnectionDescriptorXmlHandler.java
                        ConnectionPoolDescriptor.java DescriptorBase.java
                        JdbcConnectionDescriptor.java
                        ObjectCacheDescriptor.java
                        ObjectReferenceDescriptor.java
                        RepositoryElements.java RepositoryTags.java
                        RepositoryXmlHandler.java SequenceDescriptor.java
  Added:       src/java/org/apache/ojb/broker/metadata BatchDescriptor.java
  Log:
  - add new batch handling
  - update/refactoring Statement classes
  - add new PB.update(Object obj, String[] fields)
  - change insert order of m:n relations
  - change repository.dtd, add element 'batch', rename element
  'connection-pool' to 'connection-factory', remove implementation
  dependent attributes and add custom-attributes instead
  
  Revision  Changes    Path
  1.10      +6 -2      db-ojb/src/java/org/apache/ojb/broker/metadata/AnonymousObjectReferenceDescriptor.java
  
  Index: AnonymousObjectReferenceDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/AnonymousObjectReferenceDescriptor.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AnonymousObjectReferenceDescriptor.java	6 May 2004 19:40:36 -0000	1.9
  +++ AnonymousObjectReferenceDescriptor.java	14 Sep 2004 16:17:41 -0000	1.10
  @@ -20,9 +20,8 @@
   public class AnonymousObjectReferenceDescriptor extends ObjectReferenceDescriptor
   {
       private static final long serialVersionUID = -9132555799710533265L;
  -    
       public static final String ANONYMOUS_NAME = null;
  -    
  +
   	public AnonymousObjectReferenceDescriptor(ClassDescriptor descriptor)
   	{
   		super(descriptor);
  @@ -35,6 +34,11 @@
           // prevent using this reference in queries.
   	    //
           m_PersistentField = new AnonymousPersistentFieldForInheritance(m_ClassDescriptor, ANONYMOUS_NAME);
  +        // declare field as multi-mapped if true
  +        if(fieldname != null && fieldname.equals(TAG_SUPER))
  +        {
  +            setMultiMappedClass(true);
  +        }
       }
   }
   
  
  
  
  1.7       +6 -0      db-ojb/src/java/org/apache/ojb/broker/metadata/AttributeContainer.java
  
  Index: AttributeContainer.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/AttributeContainer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AttributeContainer.java	14 Apr 2004 23:10:39 -0000	1.6
  +++ AttributeContainer.java	14 Sep 2004 16:17:41 -0000	1.7
  @@ -1,6 +1,7 @@
   package org.apache.ojb.broker.metadata;
   
   import java.io.Serializable;
  +import java.util.Properties;
   
   /* Copyright 2002-2004 The Apache Software Foundation
    *
  @@ -44,5 +45,10 @@
        * @return the attribute value
        */
       public String getAttribute(String attributeName);
  +
  +    /**
  +     * Return all attributes of this container.
  +     */ 
  +    public Properties getAttributes();
   }
   
  
  
  
  1.92      +334 -275  db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
  
  Index: ClassDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- ClassDescriptor.java	23 Aug 2004 18:35:58 -0000	1.91
  +++ ClassDescriptor.java	14 Sep 2004 16:17:41 -0000	1.92
  @@ -135,6 +135,10 @@
        * of these must be present for this function to be successful.
        */
       private Class factoryClass;
  +
  +    private boolean batchable = true;
  +    private int useIdentityColumn = 0;
  +
       private String baseClass = null;
       /**
        * transaction isolation level specified for this class, used in the ODMG server
  @@ -1333,252 +1337,6 @@
           return zeroArgumentConstructor;
       }
   
  -    /*
  -     * @see XmlCapable#toXML()
  -     */
  -    public String toXML()
  -    {
  -        String eol = System.getProperty("line.separator");
  -
  -        // comment on class
  -        StringBuffer result = new StringBuffer(1024);
  -        result.append( eol);
  -        result.append( "  <!-- Mapping for Class ");
  -        result.append( this.getClassNameOfObject());
  -        result.append( " -->");
  -        result.append( eol );
  -
  -        // opening tag and attributes
  -        result.append( "  ");
  -        result.append( RepositoryTags.getOpeningTagNonClosingById(CLASS_DESCRIPTOR));
  -        result.append( eol );
  -
  -        // class
  -        result.append( "    ");
  -        result.append( RepositoryTags.getAttribute(CLASS_NAME, this.getClassNameOfObject()));
  -        result.append( eol );
  -
  -        // isolation level is optional
  -        if (null != getRepository())
  -        {
  -            if (getIsolationLevel() != this.getRepository().getDefaultIsolationLevel())
  -            {
  -                result.append( "    ");
  -                result.append( RepositoryTags.getAttribute(ISOLATION_LEVEL, this.isolationLevelXml()) );
  -                result.append( eol );
  -            }
  -        }
  -
  -        Class theProxyClass = null;
  -        try
  -        {
  -            theProxyClass = this.getProxyClass();
  -        }
  -        catch (Throwable t)
  -        {
  -            // Ignore this exception, just try to get the Class object of the
  -            // proxy class in order to be able to decide, whether the class
  -            // is a dynamic proxy or not.
  -        }
  -
  -        // proxy is optional
  -        if (theProxyClass != null)
  -	{
  -	    if (ProxyHelper.isNormalOjbProxy(theProxyClass))   // tomdz: What about VirtualProxy ?
  -            {
  -        	result.append( "    ");
  -                result.append( RepositoryTags.getAttribute(CLASS_PROXY, "dynamic"));
  -                result.append( eol );
  -    	    }
  -            else
  -	    {
  -    	        result.append( "    ");
  -            result.append( RepositoryTags.getAttribute(CLASS_PROXY, this.getProxyClassName()));
  -            result.append( eol );
  -            }
  -            result.append( "        ");
  -        result.append( RepositoryTags.getAttribute(PROXY_PREFETCHING_LIMIT, "" + this.getProxyPrefetchingLimit()));
  -        result.append( eol );
  -	}
  -
  -        // schema is optional
  -        if (this.getSchema() != null)
  -        {
  -            result.append( "    ");
  -            result.append( RepositoryTags.getAttribute(SCHEMA_NAME, this.getSchema()));
  -            result.append( eol );
  -        }
  -
  -        // table name
  -        if (this.getTableName() != null)
  -        {
  -            result.append("    ");
  -            result.append( RepositoryTags.getAttribute(TABLE_NAME, this.getTableName()));
  -            result.append( eol );
  -        }
  -
  -        // rowreader is optional
  -        if (this.getRowReaderClassName() != null)
  -        {
  -            result.append( "    ");
  -            result.append( RepositoryTags.getAttribute(ROW_READER, this.getRowReaderClassName()));
  -            result.append( eol );
  -        }
  -
  -        //accept-locks is optional, enabled by default
  -        if (!this.acceptLocks)
  -        {
  -            result.append( "        ");
  -            result.append( RepositoryTags.getAttribute(ACCEPT_LOCKS, "false"));
  -            result.append( eol );
  -        }
  -        // sequence manager attribute not yet implemented
  -
  -        // initialization method is optional
  -        if (this.getInitializationMethod() != null)
  -        {
  -            result.append( "    ");
  -            result.append( RepositoryTags.getAttribute(INITIALIZATION_METHOD, this.getInitializationMethod().getName()));
  -            result.append( eol );
  -        }
  -
  -        // factory class is optional
  -        if (this.getFactoryClass() != null)
  -        {
  -            result.append( "    ");
  -            result.append( RepositoryTags.getAttribute(FACTORY_CLASS, this.getFactoryClass().getName()) );
  -            result.append( eol );
  -        }
  -
  -        //	factory method is optional
  -        if (this.getFactoryMethod() != null)
  -        {
  -            result.append( "    ");
  -            result.append( RepositoryTags.getAttribute(FACTORY_METHOD, this.getFactoryMethod().getName()) );
  -            result.append( eol );
  -        }
  -
  -        //reference refresh is optional, disabled by default
  -        if (isAlwaysRefresh())
  -        {
  -            result.append( "    ");
  -            result.append( RepositoryTags.getAttribute(REFRESH, "true"));
  -            result.append( eol );
  -        }
  -
  -        result.append( "  >");
  -        result.append( eol );
  -
  -        // end of attributes
  -
  -        // begin of elements
  -        if (isInterface())
  -        {
  -            // extent-class
  -            for (int i = 0; i < getExtentClassNames().size(); i++)
  -            {
  -                result.append( "      ");
  -                result.append( RepositoryTags.getOpeningTagNonClosingById(CLASS_EXTENT));
  -                result.append( " " );
  -                result.append( RepositoryTags.getAttribute(CLASS_REF, getExtentClassNames().get(i).toString()) );
  -                result.append( " />");
  -                result.append( eol );
  -            }
  -        }
  -        else
  -        {
  -            // class extent is optional
  -            if (isExtent())
  -            {
  -                for (int i = 0; i < getExtentClassNames().size(); i++)
  -                {
  -                    result.append( "      ");
  -                    result.append( RepositoryTags.getOpeningTagNonClosingById(CLASS_EXTENT));
  -                    result.append( " " );
  -                    result.append( RepositoryTags.getAttribute(CLASS_REF, getExtentClassNames().get(i).toString()) );
  -                    result.append( " />");
  -                    result.append( eol );
  -                }
  -            }
  -
  -            // write all FieldDescriptors
  -            FieldDescriptor[] fields = getFieldDescriptions();
  -            for (int i = 0; i < fields.length; i++)
  -            {
  -                result.append( fields[i].toXML() );
  -            }
  -
  -            // write optional ReferenceDescriptors
  -            Vector refs = getObjectReferenceDescriptors();
  -            for (int i = 0; i < refs.size(); i++)
  -            {
  -                result.append( ((ObjectReferenceDescriptor) refs.get(i)).toXML() );
  -            }
  -
  -            // write optional CollectionDescriptors
  -            Vector cols = getCollectionDescriptors();
  -            for (int i = 0; i < cols.size(); i++)
  -            {
  -                result.append( ((CollectionDescriptor) cols.get(i)).toXML() );
  -            }
  -
  -            // write optional IndexDescriptors
  -            for (int i = 0; i < indexes.size(); i++)
  -            {
  -                IndexDescriptor indexDescriptor = (IndexDescriptor) indexes.elementAt(i);
  -                result.append( indexDescriptor.toXML() );
  -            }
  -
  -            // Write out the procedures
  -            if (this.getInsertProcedure() != null)
  -            {
  -                result.append( this.getInsertProcedure().toXML() );
  -            }
  -            if (this.getUpdateProcedure() != null)
  -            {
  -                result.append( this.getUpdateProcedure().toXML() );
  -            }
  -            if (this.getDeleteProcedure() != null)
  -            {
  -                result.append( this.getDeleteProcedure().toXML() );
  -            }
  -        }
  -        result.append( "  ");
  -        result.append( RepositoryTags.getClosingTagById(CLASS_DESCRIPTOR) );
  -        return result.toString();
  -    }
  -
  -    private String isolationLevelXml()
  -    {
  -        switch (this.getIsolationLevel())
  -        {
  -            case (IL_OPTIMISTIC) :
  -                {
  -                    return LITERAL_IL_OPTIMISTIC;
  -                }
  -            case (IL_READ_COMMITTED) :
  -                {
  -                    return LITERAL_IL_READ_COMMITTED;
  -                }
  -            case (IL_READ_UNCOMMITTED) :
  -                {
  -                    return LITERAL_IL_READ_UNCOMMITTED;
  -                }
  -            case (IL_REPEATABLE_READ) :
  -                {
  -                    return LITERAL_IL_REPEATABLE_READ;
  -                }
  -            case (IL_SERIALIZABLE) :
  -                {
  -                    return LITERAL_IL_SERIALIZABLE;
  -                }
  -            default :
  -                {
  -                    return LITERAL_IL_READ_UNCOMMITTED;
  -                }
  -        }
  -    }
  -
       /**
        * Set name of the super class.
        */
  @@ -1615,7 +1373,7 @@
       /**
        * Return true, if the described class is
        * an 'interface'. That is if the class is <b>not</b> mapped to a table.
  -     * @see mappedToTable()
  +     * @see #isMappedToTable()
        */
       public boolean isInterface()
       {
  @@ -1756,27 +1514,9 @@
       }
   
       /**
  -     * Return a string representation of this class.
  +     * sets the initialization method for this descriptor
        */
  -    public String toString()
  -    {
  -        ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
  -        return buf
  -            .append("classNameOfObject", getClassNameOfObject())
  -            .append("tableName", getTableName())
  -            .append("schema", getSchema())
  -            .append("isInterface", isInterface())
  -            .append("extendClassNames", getExtentClassNames().toString())
  -            //.append("[fieldDescriptions:")
  -            .append(getFieldDescriptions())
  -            //.append("]")
  -            .toString();
  -    }
  -
  -    /**
  -     * sets the initialization method for this descriptor
  -     */
  -    private void setInitializationMethod(Method newMethod)
  +    private void setInitializationMethod(Method newMethod)
       {
           if (newMethod != null)
           {
  @@ -2083,7 +1823,6 @@
           return statementsForClassFactory.getStatementsForClass(broker);
       }
   
  -
       /**
        * @param pfClassName
        */
  @@ -2107,7 +1846,7 @@
       {
           String result = null;
           FieldDescriptor fd = getDiscriminatorField();
  -        
  +
           if (fd != null)
           {
               result = fd.getPersistentField().get(null).toString();
  @@ -2122,7 +1861,7 @@
       {
           return m_discriminatorField;
       }
  -    
  +
       /**
        * @param discriminatorField The discriminatorField to set.
        */
  @@ -2130,4 +1869,324 @@
       {
           m_discriminatorField = discriminatorField;
       }
  +
  +    /**
  +     * Indicates if this class can be used in batch operations.
  +     *
  +     * @return <em>True</em> if it is allowed to use this class in batch operations.
  +     */
  +    public boolean isBatchable()
  +    {
  +        return batchable;
  +    }
  +
  +    /**
  +     * Set <em>true</em> to allow this class participate in batch operations,
  +     * oterwise set <em>false</em>.
  +     */
  +    public void setBatchable(boolean batchable)
  +    {
  +        this.batchable = batchable;
  +    }
  +
  +    /**
  +     * Returns <em>true</em> if an DB Identity column field based sequence
  +     * manager was used. In that cases we will find an autoincrement field with
  +     * read-only access and return true, otherwise false.
  +     */
  +     public boolean useIdentityColumnField()
  +     {
  +         if(useIdentityColumn == 0)
  +         {
  +             useIdentityColumn = -1;
  +             FieldDescriptor[] pkFields = getPkFields();
  +             for (int i = 0; i < pkFields.length; i++)
  +             {
  +                 // to find the identity column we search for a autoincrement
  +                 // read-only field
  +                if (pkFields[i].isAutoIncrement() && pkFields[i].isAccessReadOnly())
  +                {
  +                    useIdentityColumn = 1;
  +                    break;
  +                }
  +             }
  +         }
  +        return useIdentityColumn == 1;
  +     }
  +
  +    /**
  +     * Return a string representation of this class.
  +     */
  +    public String toString()
  +    {
  +        ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
  +        return buf
  +            .append("classNameOfObject", getClassNameOfObject())
  +            .append("tableName", getTableName())
  +            .append("schema", getSchema())
  +            .append("isInterface", isInterface())
  +            .append("extendClassNames", getExtentClassNames().toString())
  +            .append("special ObjectCache", objectCacheDescriptor)
  +            .append(getFieldDescriptions())
  +            //.append("]")
  +            .toString();
  +    }
  +
  +    /*
  +     * @see XmlCapable#toXML()
  +     */
  +    public String toXML()
  +    {
  +        String eol = System.getProperty("line.separator");
  +
  +        // comment on class
  +        StringBuffer result = new StringBuffer(1024);
  +        result.append( eol);
  +        result.append( "  <!-- Mapping for Class ");
  +        result.append( this.getClassNameOfObject());
  +        result.append( " -->");
  +        result.append( eol );
  +
  +        // opening tag and attributes
  +        result.append( "  ");
  +        result.append( RepositoryTags.getOpeningTagNonClosingById(CLASS_DESCRIPTOR));
  +        result.append( eol );
  +
  +        // class
  +        result.append( "    ");
  +        result.append( RepositoryTags.getAttribute(CLASS_NAME, this.getClassNameOfObject()));
  +        result.append( eol );
  +
  +        // isolation level is optional
  +        if (null != getRepository())
  +        {
  +            if (getIsolationLevel() != this.getRepository().getDefaultIsolationLevel())
  +            {
  +                result.append( "    ");
  +                result.append( RepositoryTags.getAttribute(ISOLATION_LEVEL, this.isolationLevelXml()) );
  +                result.append( eol );
  +            }
  +        }
  +
  +        Class theProxyClass = null;
  +        try
  +        {
  +            theProxyClass = this.getProxyClass();
  +        }
  +        catch (Throwable t)
  +        {
  +            // Ignore this exception, just try to get the Class object of the
  +            // proxy class in order to be able to decide, whether the class
  +            // is a dynamic proxy or not.
  +        }
  +
  +        // proxy is optional
  +        if (theProxyClass != null)
  +	{
  +	    if (ProxyHelper.isNormalOjbProxy(theProxyClass))   // tomdz: What about VirtualProxy ?
  +            {
  +        	result.append( "    ");
  +                result.append( RepositoryTags.getAttribute(CLASS_PROXY, "dynamic"));
  +                result.append( eol );
  +    	    }
  +            else
  +	    {
  +    	        result.append( "    ");
  +            result.append( RepositoryTags.getAttribute(CLASS_PROXY, this.getProxyClassName()));
  +            result.append( eol );
  +            }
  +            result.append( "        ");
  +        result.append( RepositoryTags.getAttribute(PROXY_PREFETCHING_LIMIT, "" + this.getProxyPrefetchingLimit()));
  +        result.append( eol );
  +	}
  +
  +        // schema is optional
  +        if (this.getSchema() != null)
  +        {
  +            result.append( "    ");
  +            result.append( RepositoryTags.getAttribute(SCHEMA_NAME, this.getSchema()));
  +            result.append( eol );
  +        }
  +
  +        // table name
  +        if (this.getTableName() != null)
  +        {
  +            result.append("    ");
  +            result.append( RepositoryTags.getAttribute(TABLE_NAME, this.getTableName()));
  +            result.append( eol );
  +        }
  +
  +        // rowreader is optional
  +        if (this.getRowReaderClassName() != null)
  +        {
  +            result.append( "    ");
  +            result.append( RepositoryTags.getAttribute(ROW_READER, this.getRowReaderClassName()));
  +            result.append( eol );
  +        }
  +
  +        //accept-locks is optional, enabled by default
  +        if (!this.acceptLocks)
  +        {
  +            result.append( "        ");
  +            result.append( RepositoryTags.getAttribute(ACCEPT_LOCKS, "false"));
  +            result.append( eol );
  +        }
  +        // sequence manager attribute not yet implemented
  +
  +        // initialization method is optional
  +        if (this.getInitializationMethod() != null)
  +        {
  +            result.append( "    ");
  +            result.append( RepositoryTags.getAttribute(INITIALIZATION_METHOD, this.getInitializationMethod().getName()));
  +            result.append( eol );
  +        }
  +
  +        // factory class is optional
  +        if (this.getFactoryClass() != null)
  +        {
  +            result.append( "    ");
  +            result.append( RepositoryTags.getAttribute(FACTORY_CLASS, this.getFactoryClass().getName()) );
  +            result.append( eol );
  +        }
  +
  +        //	factory method is optional
  +        if (this.getFactoryMethod() != null)
  +        {
  +            result.append( "    ");
  +            result.append( RepositoryTags.getAttribute(FACTORY_METHOD, this.getFactoryMethod().getName()) );
  +            result.append( eol );
  +        }
  +
  +        //reference refresh is optional, disabled by default
  +        if (isAlwaysRefresh())
  +        {
  +            result.append( "    ");
  +            result.append( RepositoryTags.getAttribute(REFRESH, "true"));
  +            result.append( eol );
  +        }
  +
  +        //set batchable attribute
  +        result.append( "    ");
  +        result.append( RepositoryTags.getAttribute(BATCHABLE, "true"));
  +        result.append( eol );
  +
  +        result.append( "  >");
  +        result.append( eol );
  +
  +        // end of attributes
  +
  +        if(this.getObjectCacheDescriptor() != null)
  +        {
  +            result.append( this.getObjectCacheDescriptor().toXML() );
  +            result.append( eol );
  +        }
  +
  +        // begin of elements
  +        if (isInterface())
  +        {
  +            // extent-class
  +            for (int i = 0; i < getExtentClassNames().size(); i++)
  +            {
  +                result.append( "      ");
  +                result.append( RepositoryTags.getOpeningTagNonClosingById(CLASS_EXTENT));
  +                result.append( " " );
  +                result.append( RepositoryTags.getAttribute(CLASS_REF, getExtentClassNames().get(i).toString()) );
  +                result.append( " />");
  +                result.append( eol );
  +            }
  +        }
  +        else
  +        {
  +            // class extent is optional
  +            if (isExtent())
  +            {
  +                for (int i = 0; i < getExtentClassNames().size(); i++)
  +                {
  +                    result.append( "      ");
  +                    result.append( RepositoryTags.getOpeningTagNonClosingById(CLASS_EXTENT));
  +                    result.append( " " );
  +                    result.append( RepositoryTags.getAttribute(CLASS_REF, getExtentClassNames().get(i).toString()) );
  +                    result.append( " />");
  +                    result.append( eol );
  +                }
  +            }
  +
  +            // write all FieldDescriptors
  +            FieldDescriptor[] fields = getFieldDescriptions();
  +            for (int i = 0; i < fields.length; i++)
  +            {
  +                result.append( fields[i].toXML() );
  +            }
  +
  +            // write optional ReferenceDescriptors
  +            Vector refs = getObjectReferenceDescriptors();
  +            for (int i = 0; i < refs.size(); i++)
  +            {
  +                result.append( ((ObjectReferenceDescriptor) refs.get(i)).toXML() );
  +            }
  +
  +            // write optional CollectionDescriptors
  +            Vector cols = getCollectionDescriptors();
  +            for (int i = 0; i < cols.size(); i++)
  +            {
  +                result.append( ((CollectionDescriptor) cols.get(i)).toXML() );
  +            }
  +
  +            // write optional IndexDescriptors
  +            for (int i = 0; i < indexes.size(); i++)
  +            {
  +                IndexDescriptor indexDescriptor = (IndexDescriptor) indexes.elementAt(i);
  +                result.append( indexDescriptor.toXML() );
  +            }
  +
  +            // Write out the procedures
  +            if (this.getInsertProcedure() != null)
  +            {
  +                result.append( this.getInsertProcedure().toXML() );
  +            }
  +            if (this.getUpdateProcedure() != null)
  +            {
  +                result.append( this.getUpdateProcedure().toXML() );
  +            }
  +            if (this.getDeleteProcedure() != null)
  +            {
  +                result.append( this.getDeleteProcedure().toXML() );
  +            }
  +        }
  +        result.append( "  ");
  +        result.append( RepositoryTags.getClosingTagById(CLASS_DESCRIPTOR) );
  +        return result.toString();
  +    }
  +
  +    private String isolationLevelXml()
  +    {
  +        switch (this.getIsolationLevel())
  +        {
  +            case (IL_OPTIMISTIC) :
  +                {
  +                    return LITERAL_IL_OPTIMISTIC;
  +                }
  +            case (IL_READ_COMMITTED) :
  +                {
  +                    return LITERAL_IL_READ_COMMITTED;
  +                }
  +            case (IL_READ_UNCOMMITTED) :
  +                {
  +                    return LITERAL_IL_READ_UNCOMMITTED;
  +                }
  +            case (IL_REPEATABLE_READ) :
  +                {
  +                    return LITERAL_IL_REPEATABLE_READ;
  +                }
  +            case (IL_SERIALIZABLE) :
  +                {
  +                    return LITERAL_IL_SERIALIZABLE;
  +                }
  +            default :
  +                {
  +                    return LITERAL_IL_READ_UNCOMMITTED;
  +                }
  +        }
  +    }
  +
   }
  
  
  
  1.13      +71 -94    db-ojb/src/java/org/apache/ojb/broker/metadata/ConnectionDescriptorXmlHandler.java
  
  Index: ConnectionDescriptorXmlHandler.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ConnectionDescriptorXmlHandler.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ConnectionDescriptorXmlHandler.java	11 Aug 2004 00:41:46 -0000	1.12
  +++ ConnectionDescriptorXmlHandler.java	14 Sep 2004 16:17:41 -0000	1.13
  @@ -15,19 +15,19 @@
    * limitations under the License.
    */
   
  +import java.util.ArrayList;
  +import java.util.Iterator;
  +import java.util.List;
  +
   import org.apache.ojb.broker.PersistenceBrokerException;
  +import org.apache.ojb.broker.util.ClassHelper;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  -import org.apache.ojb.broker.util.ClassHelper;
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   import org.xml.sax.SAXParseException;
   import org.xml.sax.helpers.DefaultHandler;
   
  -import java.util.ArrayList;
  -import java.util.Iterator;
  -import java.util.List;
  -
   /**
    * The handler catches Parsing events raised by the xml-parser
    * and builds up the {@link ConnectionRepository} that is used
  @@ -50,7 +50,6 @@
   
       private ConnectionRepository con_repository;
       private JdbcConnectionDescriptor m_CurrentJCD;
  -    private SequenceDescriptor currentSequenceDescriptor;
       private List conDesList;
       private AttributeContainer currentAttributeContainer;
       private boolean defaultConnectionFound = false;
  @@ -182,11 +181,6 @@
                           if (isDebug) logger.debug("     " + RepositoryTags.getTagById(USER_PASSWD) + ": " + password);
                           m_CurrentJCD.setPassWord(password);
   
  -                        // set eager-release attribute
  -                        String eagerRelease = atts.getValue(RepositoryTags.getTagById(EAGER_RELEASE));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(EAGER_RELEASE) + ": " + eagerRelease);
  -                        m_CurrentJCD.setEagerRelease(Boolean.valueOf(eagerRelease).booleanValue());
  -
                           // set batch-mode attribute
                           String batchMode = atts.getValue(RepositoryTags.getTagById(BATCH_MODE));
                           if (isDebug) logger.debug("     " + RepositoryTags.getTagById(BATCH_MODE) + ": " + batchMode);
  @@ -204,101 +198,84 @@
   
                           break;
                       }
  -                case CONNECTION_POOL:
  +                case BATCH:
  +                    {
  +                        if (isDebug) logger.debug("    > " + RepositoryTags.getTagById(BATCH));
  +                        BatchDescriptor batchDescriptor = m_CurrentJCD.getBatchDescriptor();
  +                        this.currentAttributeContainer = batchDescriptor;
  +
  +                        // set batch-manager class
  +                        String batchManager = atts.getValue(RepositoryTags.getTagById(CLASS_NAME));
  +                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CLASS_NAME) + ": " + batchManager);
  +                        if(checkString(batchManager)) batchDescriptor.setBatchManager(
  +                                ClassHelper.getClass(batchManager));
  +
  +                        // set batch-strategy class
  +                        String batchStrategy = atts.getValue(RepositoryTags.getTagById(STRATEGY));
  +                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(STRATEGY) + ": " + batchStrategy);
  +                        if(checkString(batchStrategy)) batchDescriptor.setBatchStrategy(
  +                                ClassHelper.getClass(batchStrategy));
  +
  +                        // set batch-limit value
  +                        String batchLimit = atts.getValue(RepositoryTags.getTagById(LIMIT));
  +                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(LIMIT) + ": " + batchLimit);
  +                        if(checkString(batchLimit)) batchDescriptor.setBatchLimit(
  +                                (new Integer(batchLimit)).intValue());
  +                        break;
  +                    }
  +                case CONNECTION_FACTORY:
                       {
  -                        if (isDebug) logger.debug("    > " + RepositoryTags.getTagById(CONNECTION_POOL));
  +                        if (isDebug) logger.debug("    > " + RepositoryTags.getTagById(CONNECTION_FACTORY));
                           ConnectionPoolDescriptor m_CurrentCPD = m_CurrentJCD.getConnectionPoolDescriptor();
  +                        this.currentAttributeContainer = m_CurrentCPD;
   
  -                        String connectionFactoryStr = atts.getValue(RepositoryTags.getTagById(CONNECTION_FACTORY));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CONNECTION_FACTORY) + ": " + connectionFactoryStr);
  +                        String connectionFactoryStr = atts.getValue(RepositoryTags.getTagById(CLASS_NAME));
  +                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CLASS_NAME) + ": " + connectionFactoryStr);
                           if (checkString(connectionFactoryStr)) m_CurrentCPD.setConnectionFactory(ClassHelper.getClass(connectionFactoryStr));
   
  -
  -                        String maxActive = atts.getValue(RepositoryTags.getTagById(CON_MAX_ACTIVE));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_MAX_ACTIVE) + ": " + maxActive);
  -                        if (checkString(maxActive)) m_CurrentCPD.setMaxActive(Integer.parseInt(maxActive));
  -
  -                        String maxIdle = atts.getValue(RepositoryTags.getTagById(CON_MAX_IDLE));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_MAX_IDLE) + ": " + maxIdle);
  -                        if (checkString(maxIdle)) m_CurrentCPD.setMaxIdle(Integer.parseInt(maxIdle));
  -
  -                        String maxWait = atts.getValue(RepositoryTags.getTagById(CON_MAX_WAIT));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_MAX_WAIT) + ": " + maxWait);
  -                        if (checkString(maxWait)) m_CurrentCPD.setMaxWait(Integer.parseInt(maxWait));
  -
  -                        String minEvictableIdleTimeMillis = atts.getValue(RepositoryTags.getTagById(CON_MIN_EVICTABLE_IDLE_TIME_MILLIS));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_MIN_EVICTABLE_IDLE_TIME_MILLIS) + ": " + minEvictableIdleTimeMillis);
  -                        if (checkString(minEvictableIdleTimeMillis)) m_CurrentCPD.setMinEvictableIdleTimeMillis(Long.parseLong(minEvictableIdleTimeMillis));
  -
  -                        String numTestsPerEvictionRun = atts.getValue(RepositoryTags.getTagById(CON_NUM_TESTS_PER_EVICTION_RUN));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_NUM_TESTS_PER_EVICTION_RUN) + ": " + numTestsPerEvictionRun);
  -                        if (checkString(numTestsPerEvictionRun)) m_CurrentCPD.setNumTestsPerEvictionRun(Integer.parseInt(numTestsPerEvictionRun));
  -
  -                        String testOnBorrow = atts.getValue(RepositoryTags.getTagById(CON_TEST_ON_BORROW));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_TEST_ON_BORROW) + ": " + testOnBorrow);
  -                        if (checkString(testOnBorrow)) m_CurrentCPD.setTestOnBorrow(Boolean.valueOf(testOnBorrow).booleanValue());
  -
  -                        String testOnReturn = atts.getValue(RepositoryTags.getTagById(CON_TEST_ON_RETURN));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_TEST_ON_RETURN) + ": " + testOnReturn);
  -                        if (checkString(testOnReturn)) m_CurrentCPD.setTestOnReturn(Boolean.valueOf(testOnReturn).booleanValue());
  -
  -                        String testWhileIdle = atts.getValue(RepositoryTags.getTagById(CON_TEST_WHILE_IDLE));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_TEST_WHILE_IDLE) + ": " + testWhileIdle);
  -                        if (checkString(testWhileIdle)) m_CurrentCPD.setTestWhileIdle(Boolean.valueOf(testWhileIdle).booleanValue());
  -
  -                        String timeBetweenEvictionRunsMillis = atts.getValue(RepositoryTags.getTagById(CON_TIME_BETWEEN_EVICTION_RUNS_MILLIS));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_TIME_BETWEEN_EVICTION_RUNS_MILLIS) + ": " + timeBetweenEvictionRunsMillis);
  -                        if (checkString(timeBetweenEvictionRunsMillis)) m_CurrentCPD.setTimeBetweenEvictionRunsMillis(Long.parseLong(timeBetweenEvictionRunsMillis));
  -
  -                        String whenExhaustedAction = atts.getValue(RepositoryTags.getTagById(CON_WHEN_EXHAUSTED_ACTION));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_WHEN_EXHAUSTED_ACTION) + ": " + whenExhaustedAction);
  -                        if (checkString(whenExhaustedAction)) m_CurrentCPD.setWhenExhaustedAction(Byte.parseByte(whenExhaustedAction));
  -
                           String validationQuery = atts.getValue(RepositoryTags.getTagById(VALIDATION_QUERY));
                           if (isDebug) logger.debug("     " + RepositoryTags.getTagById(VALIDATION_QUERY) + ": " + validationQuery);
                           if (checkString(validationQuery)) m_CurrentCPD.setValidationQuery(validationQuery);
   
  -                        // abandoned connection properties
  -                        String logAbandoned = atts.getValue(RepositoryTags.getTagById(CON_LOG_ABANDONED));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_LOG_ABANDONED) + ": " + logAbandoned);
  -                        if (checkString(logAbandoned)) m_CurrentCPD.setLogAbandoned(Boolean.valueOf(logAbandoned).booleanValue());
  -
  -                        String removeAbandoned = atts.getValue(RepositoryTags.getTagById(CON_REMOVE_ABANDONED));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_REMOVE_ABANDONED) + ": " + removeAbandoned);
  -                        if (checkString(removeAbandoned)) m_CurrentCPD.setRemoveAbandoned(Boolean.valueOf(removeAbandoned).booleanValue());
  -
  -                        String removeAbandonedTimeout = atts.getValue(RepositoryTags.getTagById(CON_REMOVE_ABANDONED_TIMEOUT));
  -                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CON_REMOVE_ABANDONED_TIMEOUT) + ": " + removeAbandonedTimeout);
  -                        if (checkString(removeAbandonedTimeout)) m_CurrentCPD.setRemoveAbandonedTimeout(Integer.parseInt(removeAbandonedTimeout));
  -
                           break;
                       }
   
                   case OBJECT_CACHE:
                       {
  -                        String className = atts.getValue(RepositoryTags.getTagById(CLASS_NAME));
  -                        if(checkString(className) && m_CurrentJCD != null)
  +                        if (isDebug) logger.debug("    > " + RepositoryTags.getTagById(OBJECT_CACHE));
  +                        if(m_CurrentJCD != null)
                           {
  -                            ObjectCacheDescriptor ocd = new ObjectCacheDescriptor();
  +                            ObjectCacheDescriptor ocd = m_CurrentJCD.getObjectCacheDescriptor();
                               this.currentAttributeContainer = ocd;
  -                            ocd.setObjectCache(ClassHelper.getClass(className));
  -                            m_CurrentJCD.setObjectCacheDescriptor(ocd);
  -                            if (isDebug) logger.debug("    > " + RepositoryTags.getTagById(OBJECT_CACHE));
  -                            if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CLASS_NAME) + ": " + className);
  +                            String className = atts.getValue(RepositoryTags.getTagById(CLASS_NAME));
  +                            if(checkString(className))
  +                            {
  +                                ocd.setObjectCache(ClassHelper.getClass(className));
  +                                if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CLASS_NAME) + ": " + className);
  +                            }
  +                            String strategy = atts.getValue(RepositoryTags.getTagById(STRATEGY));
  +                            if(checkString(strategy))
  +                            {
  +                                ocd.setCacheStrategy(ClassHelper.getClass(strategy));
  +                                if (isDebug) logger.debug("     " + RepositoryTags.getTagById(STRATEGY) + ": " + strategy);
  +                            }
                           }
                           break;
                       }
                   case SEQUENCE_MANAGER:
                       {
  -                        String className = atts.getValue(RepositoryTags.getTagById(SEQUENCE_MANAGER_CLASS));
  -                        if(checkString(className))
  +                        if (isDebug) logger.debug("    > " + RepositoryTags.getTagById(SEQUENCE_MANAGER));
  +                        if(m_CurrentJCD != null)
                           {
  -                            this.currentSequenceDescriptor = new SequenceDescriptor(this.m_CurrentJCD);
  -                            this.currentAttributeContainer = currentSequenceDescriptor;
  -                            this.m_CurrentJCD.setSequenceDescriptor(this.currentSequenceDescriptor);
  -                            if (isDebug) logger.debug("    > " + RepositoryTags.getTagById(SEQUENCE_MANAGER));
  -                            if (isDebug) logger.debug("     " + RepositoryTags.getTagById(SEQUENCE_MANAGER_CLASS) + ": " + className);
  -                            if (checkString(className)) currentSequenceDescriptor.setSequenceManagerClass(ClassHelper.getClass(className));
  +                            SequenceDescriptor sd = m_CurrentJCD.getSequenceDescriptor();
  +                            sd.setJdbcConnectionDescriptor(m_CurrentJCD);
  +                            this.currentAttributeContainer = sd;
  +                            String className = atts.getValue(RepositoryTags.getTagById(CLASS_NAME));
  +                            if(checkString(className))
  +                            {
  +                                if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CLASS_NAME) + ": " + className);
  +                                sd.setSequenceManagerClass(ClassHelper.getClass(className));
  +                            }
                           }
                           break;
                       }
  @@ -307,7 +284,6 @@
                           //handle custom attributes
                           String attributeName = atts.getValue(RepositoryTags.getTagById(ATTRIBUTE_NAME));
                           String attributeValue = atts.getValue(RepositoryTags.getTagById(ATTRIBUTE_VALUE));
  -
                           // If we have a container to store this attribute in, then do so.
                           if (this.currentAttributeContainer != null)
                           {
  @@ -389,21 +365,23 @@
                           currentAttributeContainer = null;
                           break;
                       }
  -                case CLASS_DESCRIPTOR:
  -                    {
  -                        currentAttributeContainer = null;
  -                        break;
  -                    }
                   case JDBC_CONNECTION_DESCRIPTOR:
                       {
                           logger.debug("   < " + RepositoryTags.getTagById(JDBC_CONNECTION_DESCRIPTOR));
                           m_CurrentJCD = null;
                           currentAttributeContainer = null;
  +                        m_CurrentJCD = null;
  +                        break;
  +                    }
  +                case BATCH:
  +                    {
  +                        logger.debug("   < " + RepositoryTags.getTagById(BATCH));
  +                        currentAttributeContainer = m_CurrentJCD;
                           break;
                       }
  -                case CONNECTION_POOL:
  +                case CONNECTION_FACTORY:
                       {
  -                        logger.debug("   < " + RepositoryTags.getTagById(CONNECTION_POOL));
  +                        logger.debug("   < " + RepositoryTags.getTagById(CONNECTION_FACTORY));
                           currentAttributeContainer = m_CurrentJCD;
                           break;
                       }
  @@ -411,7 +389,6 @@
                       {
                           if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(SEQUENCE_MANAGER));
                           // set to null at the end of the tag!!
  -                        this.currentSequenceDescriptor = null;
                           currentAttributeContainer = m_CurrentJCD;
                           break;
                       }
  
  
  
  1.16      +76 -41    db-ojb/src/java/org/apache/ojb/broker/metadata/ConnectionPoolDescriptor.java
  
  Index: ConnectionPoolDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ConnectionPoolDescriptor.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ConnectionPoolDescriptor.java	11 Aug 2004 00:41:46 -0000	1.15
  +++ ConnectionPoolDescriptor.java	14 Sep 2004 16:17:41 -0000	1.16
  @@ -16,10 +16,12 @@
    * limitations under the License.
    */
   
  -import java.io.Serializable;
  +import java.util.Enumeration;
  +import java.util.Properties;
   
   import org.apache.commons.lang.SystemUtils;
  -import org.apache.ojb.broker.util.pooling.PoolConfiguration;
  +import org.apache.commons.lang.builder.ToStringBuilder;
  +import org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl;
   
   
   /**
  @@ -32,27 +34,20 @@
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
    */
  -public class ConnectionPoolDescriptor extends PoolConfiguration implements Serializable, XmlCapable
  +public class ConnectionPoolDescriptor extends DescriptorBase implements  XmlCapable
   {
   	private static final long serialVersionUID = -3071461685659671879L;
  +
  +    private static final Class DEF_CONNECTION_FACTORY = ConnectionFactoryPooledImpl.class;
  +
       private Class connectionFactory;
  +    private String validationQuery;
   
       public ConnectionPoolDescriptor()
       {
           super();
  -        init();
  -    }
  -
  -    /**
  -     * Set some initial values.
  -     */
  -    public void init()
  -    {
  -        this.setTestOnBorrow(true);
  -        this.setTestOnReturn(false);
  -        this.setTestWhileIdle(false);
  -        this.setLogAbandoned(false);
  -        this.setRemoveAbandoned(false);
  +        this.connectionFactory = DEF_CONNECTION_FACTORY;
  +        this.validationQuery = null;
       }
   
       public Class getConnectionFactory()
  @@ -66,34 +61,74 @@
           this.connectionFactory = connectionFactory;
       }
   
  +    public String getValidationQuery()
  +    {
  +        return validationQuery;
  +    }
  +
  +    public void setValidationQuery(String validationQuery)
  +    {
  +        this.validationQuery = validationQuery;
  +    }
  +
  +    public String toString()
  +    {
  +        ToStringBuilder buf = new ToStringBuilder(this);
  +        buf.
  +        append("connectionFactory", connectionFactory).
  +        append("validationQuery", validationQuery);
  +        return buf.toString();
  +
  +    }
  +
       public String toXML()
       {
           String eol = SystemUtils.LINE_SEPARATOR;
           StringBuffer buf = new StringBuffer();
  -        //opening tag + attributes
  -        buf.append("      " + RepositoryTags.getOpeningTagNonClosingById(CONNECTION_POOL) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_MAX_ACTIVE, "" + getMaxActive()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_MAX_IDLE, "" + getMaxIdle()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_MAX_WAIT, "" + getMaxWait()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_MIN_EVICTABLE_IDLE_TIME_MILLIS, "" +
  -                getMinEvictableIdleTimeMillis()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_NUM_TESTS_PER_EVICTION_RUN, "" +
  -                getNumTestsPerEvictionRun()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_TEST_ON_BORROW, "" + isTestOnBorrow()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_TEST_ON_RETURN, "" + isTestOnReturn()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_TEST_WHILE_IDLE, "" + isTestWhileIdle()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_TIME_BETWEEN_EVICTION_RUNS_MILLIS, "" +
  -                getTimeBetweenEvictionRunsMillis()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_WHEN_EXHAUSTED_ACTION, "" +
  -                getWhenExhaustedAction()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.VALIDATION_QUERY, "" + getValidationQuery()) + eol);
  -
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_LOG_ABANDONED, "" + isLogAbandoned()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_REMOVE_ABANDONED, "" +
  -                isRemoveAbandoned()) + eol);
  -        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CON_REMOVE_ABANDONED_TIMEOUT, "" +
  -                getRemoveAbandonedTimeout()) + eol);
  -        buf.append("      />" + eol);
  +        buf.append( "      " );
  +        buf.append( RepositoryTags.getOpeningTagNonClosingById(CONNECTION_FACTORY) );
  +        buf.append( eol );
  +        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.CLASS_NAME, getConnectionFactory().getName()));
  +        buf.append( eol );
  +        buf.append("         " + RepositoryTags.getAttribute(RepositoryElements.VALIDATION_QUERY,
  +                 (getValidationQuery()!=null ? getValidationQuery() : "")) + eol);
  +        buf.append( "      >" );
  +        buf.append( eol );
  +        buf.append( "         <!-- " );
  +        buf.append( eol );
  +        buf.append( "         Add connection factory properties here, using custom attributes" );
  +        buf.append( eol );
  +        buf.append( "         e.g. <attribute attribute-name=\"maxActive\" attribute-value=\"20\"/>" );
  +        buf.append( eol );
  +        buf.append( "         -->" );
  +        buf.append( eol );
  +        buf.append( buildAttributes() );
  +        buf.append( "      " );
  +        buf.append( RepositoryTags.getClosingTagById(CONNECTION_FACTORY));
  +        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 enum = prop.keys();
  +        while( enum.hasMoreElements() )
  +        {
  +            String key = ( String ) enum.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();
       }
   }
  
  
  
  1.10      +11 -16    db-ojb/src/java/org/apache/ojb/broker/metadata/DescriptorBase.java
  
  Index: DescriptorBase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/DescriptorBase.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DescriptorBase.java	4 Apr 2004 23:53:34 -0000	1.9
  +++ DescriptorBase.java	14 Sep 2004 16:17:41 -0000	1.10
  @@ -16,8 +16,7 @@
    */
   
   import java.io.Serializable;
  -import java.util.HashMap;
  -import java.util.Map;
  +import java.util.Properties;
   
   /**
    * base class for all Descriptors. It is used to implement the AttributeContainer
  @@ -28,7 +27,7 @@
   {
   	static final long serialVersionUID = 713914612744155925L;
       /** holds user defined attributes */
  -    private Map attributeMap = null;
  +    private Properties attributes = new Properties();
   
       /**
        * Constructor for DescriptorBase.
  @@ -37,6 +36,11 @@
       {
       }
   
  +    public Properties getAttributes()
  +    {
  +        return attributes;
  +    }
  +
       /**
        * @see org.apache.ojb.broker.metadata.AttributeContainer#addAttribute(String, String)
        */
  @@ -47,13 +51,8 @@
           {
               return;
           }
  -        // Set up the attribute list
  -        if (attributeMap == null)
  -        {
  -            attributeMap = new HashMap();
  -        }
           // Add the entry.
  -        attributeMap.put(attributeName, attributeValue);
  +        attributes.setProperty(attributeName, attributeValue);
       }
   
       /**
  @@ -62,13 +61,9 @@
       public String getAttribute(String attributeName, String defaultValue)
       {
           String result = defaultValue;
  -        if (attributeMap != null)
  +        if (attributes != null)
           {
  -            result = (String) attributeMap.get(attributeName);
  -            if (result == null)
  -            {
  -                result = defaultValue;
  -            }
  +            result = attributes.getProperty(attributeName, defaultValue);
           }
           return result;
       }
  @@ -85,7 +80,7 @@
       {
           StringBuffer buf = new StringBuffer();
           buf.append("custom attributes [");
  -        buf.append(attributeMap);
  +        buf.append(attributes);
           buf.append("]");
           return buf.toString();
       }
  
  
  
  1.33      +56 -47    db-ojb/src/java/org/apache/ojb/broker/metadata/JdbcConnectionDescriptor.java
  
  Index: JdbcConnectionDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/JdbcConnectionDescriptor.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- JdbcConnectionDescriptor.java	11 Aug 2004 00:41:47 -0000	1.32
  +++ JdbcConnectionDescriptor.java	14 Sep 2004 16:17:41 -0000	1.33
  @@ -17,14 +17,14 @@
   
   import java.io.Serializable;
   
  -import org.apache.ojb.broker.util.logging.Logger;
  -import org.apache.ojb.broker.util.logging.LoggerFactory;
  -import org.apache.ojb.broker.PBKey;
  -import org.apache.ojb.broker.platforms.PlatformFactory;
  -import org.apache.ojb.broker.platforms.Platform;
  +import org.apache.commons.lang.SystemUtils;
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.commons.lang.builder.ToStringStyle;
  -import org.apache.commons.lang.SystemUtils;
  +import org.apache.ojb.broker.PBKey;
  +import org.apache.ojb.broker.platforms.Platform;
  +import org.apache.ojb.broker.platforms.PlatformFactory;
  +import org.apache.ojb.broker.util.logging.Logger;
  +import org.apache.ojb.broker.util.logging.LoggerFactory;
   
   /**
    * JdbcConnectionDescriptor describes all relevant parameters of
  @@ -48,7 +48,6 @@
       private String m_UserName;
       private String m_Password;
       private double m_JdbcLevel = 2.0;
  -    private boolean m_eagerRelease = false;
       private boolean m_batchMode = false;
       private boolean defaultConnection = false;
       private int useAutoCommit = 1;
  @@ -57,6 +56,7 @@
       private ConnectionPoolDescriptor cpd;
       private SequenceDescriptor sequenceDescriptor;
       private ObjectCacheDescriptor objectCacheDescriptor;
  +    private BatchDescriptor batchDescriptor;
   
       private transient PlatformFactory platformFactory;
   
  @@ -70,6 +70,9 @@
       public JdbcConnectionDescriptor()
       {
           cpd = new ConnectionPoolDescriptor();
  +        sequenceDescriptor = new SequenceDescriptor(this);
  +        objectCacheDescriptor = new ObjectCacheDescriptor();
  +        batchDescriptor = new BatchDescriptor();
       }
   
       /**
  @@ -89,6 +92,16 @@
           this.objectCacheDescriptor = objectCacheDescriptor;
       }
   
  +    public BatchDescriptor getBatchDescriptor()
  +    {
  +        return batchDescriptor;
  +    }
  +
  +    public void setBatchDescriptor(BatchDescriptor batchDescriptor)
  +    {
  +        this.batchDescriptor = batchDescriptor;
  +    }
  +
       /**
        * Get the alias name for this descriptor.
        */
  @@ -178,32 +191,6 @@
           this.pbKey = null;
       }
   
  -    /**
  -     * Returns a String representation of this class.
  -     */
  -    public String toString()
  -    {
  -        ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
  -        buf.
  -        append("jcd-alias", m_jcdAlias).
  -        append("default-connection", defaultConnection).
  -        append("dbms", m_Dbms).
  -        append("jdbc-level", m_JdbcLevel).
  -        append("driver", m_Driver).
  -        append("protocol", m_Protocol).
  -        append("sub-protocol", m_SubProtocol).
  -        append("db-alias", m_DbAlias).
  -        append("user", m_UserName).
  -        append("password", "*****").
  -        append("eager-release", m_eagerRelease).
  -        append("ConnectionPoolDescriptor", cpd).
  -        append("batchMode", m_batchMode).
  -        append("useAutoCommit", getUseAutoCommitAsString(useAutoCommit)).
  -        append("ignoreAutoCommitExceptions", ignoreAutoCommitExceptions).
  -        append("sequenceDescriptor", sequenceDescriptor);
  -        return buf.toString();
  -    }
  -
       public int getUseAutoCommit()
       {
           return useAutoCommit;
  @@ -400,16 +387,6 @@
           m_JdbcLevel = jdbcLevel;
       }
   
  -    public boolean getEagerRelease()
  -    {
  -    	return m_eagerRelease;
  -    }
  -
  -    public void setEagerRelease(boolean flag)
  -    {
  -    	m_eagerRelease = flag;
  -    }
  -
       public boolean getBatchMode()
       {
       	return m_batchMode;
  @@ -430,6 +407,34 @@
           return platformFactory.getPlatformFor(this);
       }
   
  +    /**
  +     * Returns a String representation of this class.
  +     */
  +    public String toString()
  +    {
  +        ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
  +        buf.
  +        append("jcd-alias", m_jcdAlias).
  +        append("default-connection", defaultConnection).
  +        append("dbms", m_Dbms).
  +        append("jdbc-level", m_JdbcLevel).
  +        append("driver", m_Driver).
  +        append("protocol", m_Protocol).
  +        append("sub-protocol", m_SubProtocol).
  +        append("db-alias", m_DbAlias).
  +        append("user", m_UserName).
  +        append("password", "*****").
  +        append("ConnectionPoolDescriptor", cpd).
  +        append("batch-mode", m_batchMode).
  +        append("useAutoCommit", getUseAutoCommitAsString(useAutoCommit)).
  +        append("ignoreAutoCommitExceptions", ignoreAutoCommitExceptions).
  +        append("objectCacheDescriptor", objectCacheDescriptor).
  +        append("batchDescriptor", batchDescriptor).
  +        append("connectionPoolDescriptor", cpd).
  +        append("sequenceDescriptor", sequenceDescriptor);
  +        return buf.toString();
  +    }
  +
       /*
        * @see XmlCapable#toXML()
        */
  @@ -505,11 +510,9 @@
               strReturn.append( eol );
           }
           strReturn.append( "    " );
  -        strReturn.append( RepositoryTags.getAttribute( EAGER_RELEASE, "" + this.getEagerRelease() ) );
  -        strReturn.append( eol );
  -        strReturn.append( "    " );
           strReturn.append( RepositoryTags.getAttribute( BATCH_MODE, "" + this.getBatchMode() ) );
           strReturn.append( eol );
  +
           strReturn.append( "    " );
           strReturn.append( RepositoryTags.getAttribute( USE_AUTOCOMMIT, "" + this.getUseAutoCommit() ) );
           strReturn.append( eol );
  @@ -519,6 +522,12 @@
   
           strReturn.append( "  >" );
           strReturn.append( eol );
  +        strReturn.append( eol );
  +
  +        strReturn.append( this.getObjectCacheDescriptor().toXML() );
  +        strReturn.append( eol );
  +
  +        strReturn.append( this.getBatchDescriptor().toXML() );
           strReturn.append( eol );
   
           strReturn.append( this.getConnectionPoolDescriptor().toXML() );
  
  
  
  1.8       +11 -8     db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectCacheDescriptor.java
  
  Index: ObjectCacheDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectCacheDescriptor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ObjectCacheDescriptor.java	11 Aug 2004 00:41:47 -0000	1.7
  +++ ObjectCacheDescriptor.java	14 Sep 2004 16:17:41 -0000	1.8
  @@ -7,6 +7,8 @@
   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.cache.ObjectCacheDefaultImpl;
  +import org.apache.ojb.broker.cache.CacheStrategyDefaultImpl;
   
   /* Copyright 2003-2004 The Apache Software Foundation
    *
  @@ -25,6 +27,10 @@
   public class ObjectCacheDescriptor implements Serializable, XmlCapable, AttributeContainer
   {
   	private static final long serialVersionUID = 2583853027407750053L;
  +
  +    private static final Class DEF_OBJECT_CACHE = ObjectCacheDefaultImpl.class;
  +    private static final Class DEF_CACHE_STRATEGY = CacheStrategyDefaultImpl.class;
  +
       private Class objectCache;
       private Class cacheStrategy;
       private Properties configurationProperties;
  @@ -32,11 +38,8 @@
       public ObjectCacheDescriptor()
       {
           this.configurationProperties = new Properties();
  -    }
  -
  -    public ObjectCacheDescriptor(Class objectCacheClass)
  -    {
  -        this.objectCache = objectCacheClass;
  +        objectCache = DEF_OBJECT_CACHE;
  +        cacheStrategy = DEF_CACHE_STRATEGY;
       }
   
       public Class getObjectCache()
  @@ -76,7 +79,7 @@
           return result;
       }
   
  -    public Properties getConfigurationProperties()
  +    public Properties getAttributes()
       {
           return configurationProperties;
       }
  @@ -91,7 +94,7 @@
           ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
           buf.append("ObjectCache", getObjectCache()).
           append("CacheStrategy", getCacheStrategy()).
  -        append("Properties", getConfigurationProperties());
  +        append("Properties", getAttributes());
           return buf.toString();
       }
   
  @@ -126,7 +129,7 @@
       private String buildAttributes()
       {
           String eol = SystemUtils.LINE_SEPARATOR;
  -        Properties prop = getConfigurationProperties();
  +        Properties prop = getAttributes();
           if(prop == null || prop.isEmpty()) return "";
   
           StringBuffer buf = new StringBuffer(1024);
  
  
  
  1.39      +25 -0     db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java
  
  Index: ObjectReferenceDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ObjectReferenceDescriptor.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- ObjectReferenceDescriptor.java	11 Aug 2004 00:41:47 -0000	1.38
  +++ ObjectReferenceDescriptor.java	14 Sep 2004 16:17:41 -0000	1.39
  @@ -51,6 +51,7 @@
       private Class m_ProxyOfItems = null;
       private boolean m_LookedUpProxy = false;
       private boolean m_OtmDependent = false;
  +    private boolean multiMappedClass = false;
   
       /**
        * holds the foreign-key field descriptor array for a specified class
  @@ -483,6 +484,29 @@
           m_OtmDependent = b;
       }
   
  +    public boolean isMultiMappedClass()
  +    {
  +        return multiMappedClass;
  +    }
  +
  +    public void setMultiMappedClass(boolean multiMappedClass)
  +    {
  +        this.multiMappedClass = multiMappedClass;
  +    }
  +
  +    public void setPersistentField(Class c, String fieldname)
  +    {
  +        super.setPersistentField(c, fieldname);
  +        if(fieldname != null && fieldname.equals(RepositoryTags.TAG_SUPER))
  +        {
  +            setMultiMappedClass(true);
  +        }
  +        else
  +        {
  +            setMultiMappedClass(false);
  +        }
  +    }
  +
       public String toString()
       {
           return new ToStringBuilder(this)
  @@ -491,6 +515,7 @@
                   .append("cascade_delete", getCascadeAsString(m_CascadeDelete))
                   .append("is_lazy", lazy)
                   .append("class_of_Items", m_ClassOfItems)
  +                .append("isMultiMappedClass", multiMappedClass)
                   .toString();
       }
   
  
  
  
  1.38      +20 -16    db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryElements.java
  
  Index: RepositoryElements.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryElements.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- RepositoryElements.java	15 Aug 2004 12:42:28 -0000	1.37
  +++ RepositoryElements.java	14 Sep 2004 16:17:41 -0000	1.38
  @@ -86,25 +86,24 @@
       public static final int SCALE = 54;
       public static final int ACCESS = 99;
   
  -    public static final int CON_MAX_ACTIVE = 55;
  -    public static final int CON_MAX_IDLE = 56;
  -    public static final int CON_MAX_WAIT = 57;
  -    public static final int CON_MIN_EVICTABLE_IDLE_TIME_MILLIS = 58;
  -    public static final int CON_NUM_TESTS_PER_EVICTION_RUN = 59;
  -    public static final int CON_TEST_ON_BORROW = 60;
  -    public static final int CON_TEST_ON_RETURN = 61;
  -    public static final int CON_TEST_WHILE_IDLE = 62;
  -    public static final int CON_TIME_BETWEEN_EVICTION_RUNS_MILLIS = 63;
  -    public static final int CON_WHEN_EXHAUSTED_ACTION = 64;
  -    public static final int CON_LOG_ABANDONED = 87;
  -    public static final int CON_REMOVE_ABANDONED = 85;
  -    public static final int CON_REMOVE_ABANDONED_TIMEOUT = 86;
  +//    public static final int CON_MAX_ACTIVE = 55;
  +//    public static final int CON_MAX_IDLE = 56;
  +//    public static final int CON_MAX_WAIT = 57;
  +//    public static final int CON_MIN_EVICTABLE_IDLE_TIME_MILLIS = 58;
  +//    public static final int CON_NUM_TESTS_PER_EVICTION_RUN = 59;
  +//    public static final int CON_TEST_ON_BORROW = 60;
  +//    public static final int CON_TEST_ON_RETURN = 61;
  +//    public static final int CON_TEST_WHILE_IDLE = 62;
  +//    public static final int CON_TIME_BETWEEN_EVICTION_RUNS_MILLIS = 63;
  +//    public static final int CON_WHEN_EXHAUSTED_ACTION = 64;
  +//    public static final int CON_LOG_ABANDONED = 87;
  +//    public static final int CON_REMOVE_ABANDONED = 85;
  +//    public static final int CON_REMOVE_ABANDONED_TIMEOUT = 86;
   
  -    public static final int CONNECTION_POOL = 65;
  +    // public static final int CONNECTION_POOL = 65;
       public static final int CONNECTION_FACTORY = 66;
       public static final int VALIDATION_QUERY = 79;
       public static final int SEQUENCE_MANAGER = 88;
  -    public static final int SEQUENCE_MANAGER_CLASS = 89;
   
       public static final int REPOSITORY_VERSION = 67;
       public static final int CLASS_REF = 68;
  @@ -136,13 +135,18 @@
       public static final int INCLUDE_PK_FIELDS_ONLY = 110;
       public static final int RETURN = 111;
       public static final int VALUE = 112;
  +    public static final int BATCHABLE = 116;
  +    public static final int BATCH = 119;
  +    
  +    public static final int LIMIT = 118;
  +    public static final int STRATEGY = 117;
   
       public static final int OBJECT_CACHE = 113;
   
       public static final int PROXY_PREFETCHING_LIMIT = 114;
   
       // maintain a next id to keep track where we are
  -    static final int _NEXT = 116;
  +    static final int _NEXT = 120;
   
       // String constants
       public static final String TAG_ACCESS = "access";
  
  
  
  1.38      +29 -26    db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java
  
  Index: RepositoryTags.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- RepositoryTags.java	15 Aug 2004 12:42:28 -0000	1.37
  +++ RepositoryTags.java	14 Sep 2004 16:17:41 -0000	1.38
  @@ -17,7 +17,6 @@
   
   import org.apache.ojb.broker.util.DoubleHashtable;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  -import org.apache.ojb.broker.util.pooling.PoolConfiguration;
   
   /**
    * this class maintains a table mapping the xml-tags used in the
  @@ -118,32 +117,32 @@
           table.put("unique", new Integer(UNIQUE));
           table.put("name", new Integer(NAME));
   
  -        table.put(PoolConfiguration.MAX_ACTIVE, new Integer(CON_MAX_ACTIVE));
  -        table.put(PoolConfiguration.MAX_IDLE, new Integer(CON_MAX_IDLE));
  -        table.put(PoolConfiguration.MAX_WAIT, new Integer(CON_MAX_WAIT));
  -        table.put(
  -            PoolConfiguration.MIN_EVICTABLE_IDLE_TIME_MILLIS,
  -            new Integer(CON_MIN_EVICTABLE_IDLE_TIME_MILLIS));
  -        table.put(
  -            PoolConfiguration.NUM_TESTS_PER_EVICTION_RUN,
  -            new Integer(CON_NUM_TESTS_PER_EVICTION_RUN));
  -        table.put(PoolConfiguration.TEST_ON_BORROW, new Integer(CON_TEST_ON_BORROW));
  -        table.put(PoolConfiguration.TEST_ON_RETURN, new Integer(CON_TEST_ON_RETURN));
  -        table.put(PoolConfiguration.TEST_WHILE_IDLE, new Integer(CON_TEST_WHILE_IDLE));
  -        table.put(
  -            PoolConfiguration.TIME_BETWEEN_EVICTION_RUNS_MILLIS,
  -            new Integer(CON_TIME_BETWEEN_EVICTION_RUNS_MILLIS));
  -        table.put(PoolConfiguration.WHEN_EXHAUSTED_ACTION, new Integer(CON_WHEN_EXHAUSTED_ACTION));
  -        table.put(PoolConfiguration.VALIDATION_QUERY, new Integer(VALIDATION_QUERY));
  -
  -        table.put(PoolConfiguration.LOG_ABANDONED, new Integer(CON_LOG_ABANDONED));
  -        table.put(PoolConfiguration.REMOVE_ABANDONED, new Integer(CON_REMOVE_ABANDONED));
  -        table.put(
  -            PoolConfiguration.REMOVE_ABANDONED_TIMEOUT,
  -            new Integer(CON_REMOVE_ABANDONED_TIMEOUT));
  +//        table.put(PoolConfiguration.MAX_ACTIVE, new Integer(CON_MAX_ACTIVE));
  +//        table.put(PoolConfiguration.MAX_IDLE, new Integer(CON_MAX_IDLE));
  +//        table.put(PoolConfiguration.MAX_WAIT, new Integer(CON_MAX_WAIT));
  +//        table.put(
  +//            PoolConfiguration.MIN_EVICTABLE_IDLE_TIME_MILLIS,
  +//            new Integer(CON_MIN_EVICTABLE_IDLE_TIME_MILLIS));
  +//        table.put(
  +//            PoolConfiguration.NUM_TESTS_PER_EVICTION_RUN,
  +//            new Integer(CON_NUM_TESTS_PER_EVICTION_RUN));
  +//        table.put(PoolConfiguration.TEST_ON_BORROW, new Integer(CON_TEST_ON_BORROW));
  +//        table.put(PoolConfiguration.TEST_ON_RETURN, new Integer(CON_TEST_ON_RETURN));
  +//        table.put(PoolConfiguration.TEST_WHILE_IDLE, new Integer(CON_TEST_WHILE_IDLE));
  +//        table.put(
  +//            PoolConfiguration.TIME_BETWEEN_EVICTION_RUNS_MILLIS,
  +//            new Integer(CON_TIME_BETWEEN_EVICTION_RUNS_MILLIS));
  +//        table.put(PoolConfiguration.WHEN_EXHAUSTED_ACTION, new Integer(CON_WHEN_EXHAUSTED_ACTION));
  +//        table.put(PoolConfiguration.VALIDATION_QUERY, new Integer(VALIDATION_QUERY));
  +//
  +//        table.put(PoolConfiguration.LOG_ABANDONED, new Integer(CON_LOG_ABANDONED));
  +//        table.put(PoolConfiguration.REMOVE_ABANDONED, new Integer(CON_REMOVE_ABANDONED));
  +//        table.put(
  +//            PoolConfiguration.REMOVE_ABANDONED_TIMEOUT,
  +//            new Integer(CON_REMOVE_ABANDONED_TIMEOUT));
   
           table.put("connection-factory", new Integer(CONNECTION_FACTORY));
  -        table.put("connection-pool", new Integer(CONNECTION_POOL));
  +        table.put("validationQuery", new Integer(VALIDATION_QUERY));
           table.put("class-ref", new Integer(CLASS_REF));
           table.put("id", new Integer(ID));
           table.put("field-id-ref", new Integer(FIELD_ID_REF));
  @@ -155,7 +154,6 @@
           table.put("accept-locks", new Integer(ACCEPT_LOCKS));
   
           table.put("sequence-manager", new Integer(SEQUENCE_MANAGER));
  -        table.put("className", new Integer(SEQUENCE_MANAGER_CLASS));
   
           table.put("query-customizer", new Integer(QUERY_CUSTOMIZER));
           table.put("initialization-method", new Integer(INITIALIZATION_METHOD));
  @@ -176,6 +174,11 @@
           table.put("object-cache", new Integer(OBJECT_CACHE));
   
           table.put("proxy-prefetching-limit", new Integer(PROXY_PREFETCHING_LIMIT));
  +        table.put("batchable", new Integer(BATCHABLE));
  +        table.put("batch", new Integer(BATCH));
  +        
  +        table.put("limit", new Integer(LIMIT));
  +        table.put("strategy", new Integer(STRATEGY));
   
           // add new tags here !
       }
  
  
  
  1.62      +22 -29    db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java
  
  Index: RepositoryXmlHandler.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- RepositoryXmlHandler.java	23 Aug 2004 18:35:58 -0000	1.61
  +++ RepositoryXmlHandler.java	14 Sep 2004 16:17:41 -0000	1.62
  @@ -304,27 +304,41 @@
   						if (isDebug) logger.debug("     persistent-field-class: " + pfClassName);
   						m_CurrentCLD.setPersistentFieldClassName(pfClassName);
   
  +                        // set batch attribute
  +                        String batchable = atts.getValue(RepositoryTags.getTagById(BATCHABLE));
  +                        if (isDebug) logger.debug("     " + RepositoryTags.getTagById(BATCHABLE) + ": " + batchable);
  +                        m_CurrentCLD.setBatchable((Boolean.valueOf(batchable)).booleanValue());
  +
                           break;
                       }
                   case OBJECT_CACHE:
                       {
  +                        if (isDebug) logger.debug("     > " + RepositoryTags.getTagById(OBJECT_CACHE));
                           // we only interessted in object-cache tags declared within
                           // an class-descriptor
                           if(m_CurrentCLD != null)
                           {
  +                            ObjectCacheDescriptor ocd = m_CurrentCLD.getObjectCacheDescriptor();
  +                            // per default class-descriptor doesn't have an descriptor set
  +                            if(ocd == null)
  +                            {
  +                                ocd = new ObjectCacheDescriptor();
  +                                m_CurrentCLD.setObjectCacheDescriptor(ocd);
  +                            }
  +                            this.m_CurrentAttrContainer = ocd;
                               String className = atts.getValue(RepositoryTags.getTagById(CLASS_NAME));
                               if(checkString(className))
                               {
  -                                if (isDebug) logger.debug("     > " + RepositoryTags.getTagById(OBJECT_CACHE));
  -                                ObjectCacheDescriptor ocd = new ObjectCacheDescriptor();
  -                                this.m_CurrentAttrContainer = ocd;
                                   ocd.setObjectCache(ClassHelper.getClass(className));
  -                                if(m_CurrentCLD != null)
  -                                {
  -                                    m_CurrentCLD.setObjectCacheDescriptor(ocd);
  -                                }
                                   if (isDebug) logger.debug("     " + RepositoryTags.getTagById(CLASS_NAME) + ": " + className);
                               }
  +
  +                            String strategy = atts.getValue(RepositoryTags.getTagById(STRATEGY));
  +                            if(checkString(strategy))
  +                            {
  +                                ocd.setCacheStrategy(ClassHelper.getClass(strategy));
  +                                if (isDebug) logger.debug("     " + RepositoryTags.getTagById(STRATEGY) + ": " + strategy);
  +                            }
                           }
                           break;
                       }
  @@ -1053,27 +1067,6 @@
                           if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(DOCUMENTATION));
                           break;
                       }
  -//                case SEQUENCE_MANAGER:
  -//                    {
  -//                        // currently not used on class-descriptor level
  -//                        // if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(SEQUENCE_MANAGER));
  -//                        this.m_CurrentAttrContainer = null;
  -//                        break;
  -//                    }
  -//                case CONNECTION_POOL:
  -//                    {
  -//                        // not used on class-descriptor level
  -//                        // if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(CONNECTION_POOL));
  -//                        this.m_CurrentAttrContainer = null;
  -//                        break;
  -//                    }
  -//                case JDBC_CONNECTION_DESCRIPTOR:
  -//                    {
  -//                        // not used on class-descriptor level
  -//                        // if (isDebug) logger.debug("    < " + RepositoryTags.getTagById(JDBC_CONNECTION_DESCRIPTOR));
  -//                        this.m_CurrentAttrContainer = null;
  -//                        break;
  -//                    }
                   case QUERY_CUSTOMIZER:
                       {
                           m_CurrentAttrContainer = m_CurrentCOD;
  
  
  
  1.13      +9 -34     db-ojb/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java
  
  Index: SequenceDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/SequenceDescriptor.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SequenceDescriptor.java	11 Aug 2004 00:41:47 -0000	1.12
  +++ SequenceDescriptor.java	14 Sep 2004 16:17:42 -0000	1.13
  @@ -1,12 +1,12 @@
   package org.apache.ojb.broker.metadata;
   
  -import java.io.Serializable;
   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
    *
  @@ -22,17 +22,19 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -public class SequenceDescriptor implements Serializable, XmlCapable, AttributeContainer
  +public class SequenceDescriptor extends DescriptorBase implements XmlCapable
   {
   	private static final long serialVersionUID = -5161713731380949398L;
  +
  +    private static final Class DEF_SEQUENCE_MANAGER_CLASS = SequenceManagerInMemoryImpl.class;
  +
       private JdbcConnectionDescriptor jcd;
       private Class sequenceManagerClass;
  -    private Properties configurationProperties;
   
       public SequenceDescriptor(JdbcConnectionDescriptor jcd)
       {
           this.jcd = jcd;
  -        this.configurationProperties = new Properties();
  +        this.sequenceManagerClass = DEF_SEQUENCE_MANAGER_CLASS;
       }
   
       public SequenceDescriptor(JdbcConnectionDescriptor jcd, Class sequenceManagerClass)
  @@ -61,38 +63,11 @@
           this.sequenceManagerClass = sequenceManagerClass;
       }
   
  -    public void addAttribute(String attributeName, String attributeValue)
  -    {
  -        configurationProperties.setProperty(attributeName, attributeValue);
  -    }
  -
  -    public String getAttribute(String key)
  -    {
  -        return getAttribute(key, null);
  -    }
  -
  -    public String getAttribute(String attributeName, String defaultValue)
  -    {
  -        String result = configurationProperties.getProperty(attributeName);
  -        if(result == null) result = defaultValue;
  -        return result;
  -    }
  -
  -    public Properties getConfigurationProperties()
  -    {
  -        return configurationProperties;
  -    }
  -
  -    public void setConfigurationProperties(Properties configurationProperties)
  -    {
  -        this.configurationProperties = configurationProperties;
  -    }
  -
       public String toString()
       {
           ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
           buf.append("   sequenceManagerClass", getSequenceManagerClass()).
  -        append("   Properties", getConfigurationProperties());
  +        append("   Properties", getAttributes());
           return buf.toString();
       }
   
  @@ -105,7 +80,7 @@
           buf.append( RepositoryTags.getOpeningTagNonClosingById( SEQUENCE_MANAGER ) );
           buf.append( eol );
           buf.append( "         " );
  -        buf.append( RepositoryTags.getAttribute( SEQUENCE_MANAGER_CLASS, "" + getSequenceManagerClass().getName() ) );
  +        buf.append( RepositoryTags.getAttribute(CLASS_NAME, "" + getSequenceManagerClass().getName() ) );
           buf.append( "      >" );
           buf.append( eol );
           buf.append( "         <!-- " );
  @@ -127,7 +102,7 @@
       private String buildAttributes()
       {
           String eol = SystemUtils.LINE_SEPARATOR;
  -        Properties prop = getConfigurationProperties();
  +        Properties prop = getAttributes();
           if( prop == null || prop.isEmpty() )
               return "";
   
  
  
  
  1.1                  db-ojb/src/java/org/apache/ojb/broker/metadata/BatchDescriptor.java
  
  Index: BatchDescriptor.java
  ===================================================================
  package org.apache.ojb.broker.metadata;
  
  import java.util.Properties;
  import java.util.Enumeration;
  
  import org.apache.commons.lang.SystemUtils;
  import org.apache.commons.lang.builder.ToStringBuilder;
  import org.apache.ojb.broker.accesslayer.batch.BatchManagerImpl;
  import org.apache.ojb.broker.accesslayer.batch.BatchStrategyDefaultImpl;
  
  /* Copyright 2002-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * Encapsulates metadata for OJB batch handling.
   *
   * @author <a href="mailto:arminw@apache.org">Armin Waibel</a>
   * @version $Id: BatchDescriptor.java,v 1.1 2004/09/14 16:17:41 arminw Exp $
   */
  public class BatchDescriptor extends DescriptorBase implements XmlCapable
  {
      private static final Class DEFAULT_BATCH_MANAGER = BatchManagerImpl.class;
      private static final Class DEFAULT_BATCH_STRATEGY = BatchStrategyDefaultImpl.class;
      private static final int DEFAULT_BATCH_LIMIT = 50;
  
      private Class batchManager;
      private Class batchStrategy;
      private int batchLimit;
  
      public BatchDescriptor()
      {
          this.batchManager = DEFAULT_BATCH_MANAGER;
          this.batchStrategy = DEFAULT_BATCH_STRATEGY;
          this.batchLimit = DEFAULT_BATCH_LIMIT;
      }
  
      public Class getBatchManager()
      {
          return batchManager;
      }
  
      public void setBatchManager(Class batchManager)
      {
          this.batchManager = batchManager;
      }
  
      public Class getBatchStrategy()
      {
          return batchStrategy;
      }
  
      public void setBatchStrategy(Class batchStrategy)
      {
          this.batchStrategy = batchStrategy;
      }
  
      public int getBatchLimit()
      {
          return batchLimit;
      }
  
      public void setBatchLimit(int batchLimit)
      {
          this.batchLimit = batchLimit;
      }
  
      public String toString()
      {
          ToStringBuilder buf = new ToStringBuilder(this);
          buf.
          append("batch-manager", batchManager).
          append("batch-strategy", batchStrategy).
          append("batch-limit", batchLimit);
          return buf.toString();
      }
  
      public String toXML()
      {
          String eol = SystemUtils.LINE_SEPARATOR;
  
          StringBuffer buf = new StringBuffer( 1024 );
          buf.append( eol );
          buf.append( "      " );
          buf.append( RepositoryTags.getOpeningTagNonClosingById(BATCH) );
          buf.append( eol );
          if(getBatchManager() != null)
          {
              buf.append("         " +  RepositoryTags.getAttribute(CLASS_NAME, "" + this.getBatchManager().getName()));
              buf.append( eol );
          }
          if(getBatchStrategy() != null)
          {
              buf.append("         " +  RepositoryTags.getAttribute(STRATEGY, "" + this.getBatchStrategy().getName()));
              buf.append( eol );
          }
          buf.append("         " +  RepositoryTags.getAttribute(LIMIT, "" + this.getBatchLimit()));
          buf.append( eol );
          buf.append( "      >" );
          buf.append( eol );
          buf.append( "         <!-- " );
          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( eol );
          buf.append( "         -->" );
          buf.append( eol );
          buf.append( buildAttributes() );
          buf.append( "      " );
          buf.append( RepositoryTags.getClosingTagById(BATCH) );
          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 enum = prop.keys();
          while( enum.hasMoreElements() )
          {
              String key = ( String ) enum.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();
      }
  }
  
  
  

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