db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata/torque TorqueRepositoryGenerator.java
Date Sun, 14 Nov 2004 09:36:10 GMT
tomdz       2004/11/14 01:36:10

  Modified:    src/java/org/apache/ojb/broker/metadata/fieldaccess
                        PersistentFieldIntrospectorImplNew.java
                        PersistentFieldAutoProxyImplNew.java
                        PersistentFieldDirectAccessImplNew.java
                        PersistentFieldIntrospectorImpl.java
                        AbstractPersistentField.java
                        PersistentFieldDirectAccessImpl.java
                        PersistentFieldBase.java
                        PersistentFieldPrivilegedImplNew.java
                        PersistentFieldAutoProxyImpl.java
                        PersistentFieldFactory.java
                        PersistentFieldPrivilegedImpl.java
                        PersistentFieldDynaBeanImplNew.java
                        PersistentFieldDynaBeanAccessImpl.java
               src/java/org/apache/ojb/broker/metadata
                        AttributeDescriptorBase.java MetadataManager.java
                        RepositoryPersistor.java ClassDescriptor.java
                        RepositoryXmlHandler.java
                        ObjectReferenceDescriptor.java
                        DescriptorRepository.java
               src/java/org/apache/ojb/broker/metadata/torque
                        TorqueRepositoryGenerator.java
  Log:
  Reworked the OJB core:
  - replaced the factories/configuration concept with the ComponentContainer
  - removal of most static calls within OJB
  - removed the old "D" collection implementations and renamed the new ones
  - moved StatementForClassIF handling to the PersistenceConfiguration
  - moved RowReader caching from the ClassDescriptor to the PersistenceConfiguration
  and other changes (see mail on the dev list for more details)
  
  Revision  Changes    Path
  1.4       +1 -6      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldIntrospectorImplNew.java
  
  Index: PersistentFieldIntrospectorImplNew.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldIntrospectorImplNew.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PersistentFieldIntrospectorImplNew.java	27 Jun 2004 13:48:32 -0000	1.3
  +++ PersistentFieldIntrospectorImplNew.java	14 Nov 2004 09:36:10 -0000	1.4
  @@ -46,11 +46,6 @@
       private Class type;
       private transient List propertyGraph;
   
  -    public PersistentFieldIntrospectorImplNew()
  -    {
  -        super();
  -    }
  -
       public PersistentFieldIntrospectorImplNew(Class aClass, String aPropertyName)
       {
           super(aClass, aPropertyName);
  
  
  
  1.8       +0 -4      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldAutoProxyImplNew.java
  
  Index: PersistentFieldAutoProxyImplNew.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldAutoProxyImplNew.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PersistentFieldAutoProxyImplNew.java	25 Sep 2004 14:54:56 -0000	1.7
  +++ PersistentFieldAutoProxyImplNew.java	14 Nov 2004 09:36:10 -0000	1.8
  @@ -47,10 +47,6 @@
       private ExceptionWrapper latestException;
       int index = 0;
   
  -    public PersistentFieldAutoProxyImplNew()
  -    {
  -    }
  -
       public PersistentFieldAutoProxyImplNew(Class clazz, String fieldname)
       {
           super(clazz, fieldname);
  
  
  
  1.6       +1 -5      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDirectAccessImplNew.java
  
  Index: PersistentFieldDirectAccessImplNew.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDirectAccessImplNew.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PersistentFieldDirectAccessImplNew.java	1 Sep 2004 01:27:45 -0000	1.5
  +++ PersistentFieldDirectAccessImplNew.java	14 Nov 2004 09:36:10 -0000	1.6
  @@ -44,10 +44,6 @@
       private transient Field field;
       private transient boolean nonNested;
   
  -    public PersistentFieldDirectAccessImplNew()
  -    {
  -    }
  -
       public PersistentFieldDirectAccessImplNew(Class type, String fieldname)
       {
           super(type, fieldname);
  
  
  
  1.12      +1 -6      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldIntrospectorImpl.java
  
  Index: PersistentFieldIntrospectorImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldIntrospectorImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PersistentFieldIntrospectorImpl.java	26 Jun 2004 23:51:37 -0000	1.11
  +++ PersistentFieldIntrospectorImpl.java	14 Nov 2004 09:36:10 -0000	1.12
  @@ -40,11 +40,6 @@
       private static final long serialVersionUID = 8805309492150404444L;
       private transient PropertyDescriptor propertyDescriptor;
   
  -    public PersistentFieldIntrospectorImpl()
  -    {
  -        super();
  -    }
  -
       public PersistentFieldIntrospectorImpl(Class aClass, String aPropertyName)
       {
           super(aClass, aPropertyName);
  
  
  
  1.23      +2 -13     db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/AbstractPersistentField.java
  
  Index: AbstractPersistentField.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/AbstractPersistentField.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- AbstractPersistentField.java	26 Jun 2004 23:51:37 -0000	1.22
  +++ AbstractPersistentField.java	14 Nov 2004 09:36:10 -0000	1.23
  @@ -48,17 +48,6 @@
        */
       private int isNestedField = UNKNOWN_FIELD;
   
  -    /**
  -     * For internal use only!!
  -     * TODO: Default constructor only needed to support
  -     * PersistentFieldFactory#usesAccessorsAndMutators()
  -     * method - find a better solution. Make 'public' to
  -     * allow helper class to instantiate class.
  -     */
  -    public AbstractPersistentField()
  -    {
  -    }
  -
       public AbstractPersistentField(Class clazz, String fieldname)
       {
           this.rootObjectType = clazz;
  @@ -339,7 +328,7 @@
       {
           try
           {
  -            return PersistentFieldFactory.createPersistentField(fieldType, aFieldName);
  +            return new PersistentFieldFactory(getClass()).createPersistentField(fieldType, aFieldName);
           }
           catch (Exception e)
           {
  
  
  
  1.14      +1 -5      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDirectAccessImpl.java
  
  Index: PersistentFieldDirectAccessImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDirectAccessImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- PersistentFieldDirectAccessImpl.java	9 Apr 2004 13:22:29 -0000	1.13
  +++ PersistentFieldDirectAccessImpl.java	14 Nov 2004 09:36:10 -0000	1.14
  @@ -36,10 +36,6 @@
   {
       private static final long serialVersionUID = -5458024240998909205L;
   
  -    public PersistentFieldDirectAccessImpl()
  -    {
  -    }
  -
       public PersistentFieldDirectAccessImpl(Class type, String fieldname)
       {
           super(type, fieldname);
  
  
  
  1.3       +1 -12     db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldBase.java
  
  Index: PersistentFieldBase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldBase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersistentFieldBase.java	27 Jun 2004 13:48:32 -0000	1.2
  +++ PersistentFieldBase.java	14 Nov 2004 09:36:10 -0000	1.3
  @@ -39,17 +39,6 @@
       private String fieldName;
       protected Class rootObjectType;
   
  -    /**
  -     * For internal use only!!
  -     * TODO: Default constructor only needed to support
  -     * PersistentFieldFactory#usesAccessorsAndMutators()
  -     * method - find a better solution. Make 'public' to
  -     * allow helper class to instantiate class.
  -     */
  -    public PersistentFieldBase()
  -    {
  -    }
  -
       public PersistentFieldBase(Class clazz, String fieldname)
       {
           this.rootObjectType = clazz;
  
  
  
  1.4       +1 -5      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldPrivilegedImplNew.java
  
  Index: PersistentFieldPrivilegedImplNew.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldPrivilegedImplNew.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PersistentFieldPrivilegedImplNew.java	25 Sep 2004 14:54:56 -0000	1.3
  +++ PersistentFieldPrivilegedImplNew.java	14 Nov 2004 09:36:10 -0000	1.4
  @@ -41,10 +41,6 @@
       private static final int ACCESSIBLE_STATE_FALSE = 1;
       private static final int ACCESSIBLE_STATE_SET_TRUE = 2;
   
  -    public PersistentFieldPrivilegedImplNew()
  -    {
  -    }
  -
       public PersistentFieldPrivilegedImplNew(Class type, String fieldname)
       {
           super(type, fieldname);
  
  
  
  1.11      +0 -8      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldAutoProxyImpl.java
  
  Index: PersistentFieldAutoProxyImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldAutoProxyImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PersistentFieldAutoProxyImpl.java	25 Jun 2004 17:35:12 -0000	1.10
  +++ PersistentFieldAutoProxyImpl.java	14 Nov 2004 09:36:10 -0000	1.11
  @@ -38,14 +38,6 @@
       private AbstractPersistentField wrapped;
       /** Whether we actually found a field handler, or it is still the default one */
       private boolean hasBeenDetermined = false;
  -    
  -    /**
  -     * Being nice to Class.newInstance() seems popular.
  -     */
  -    public PersistentFieldAutoProxyImpl()
  -    {
  -        super();
  -    }
   
       /**
        * Creates a new auto handler object for the indicated field.
  
  
  
  1.13      +42 -72    db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldFactory.java
  
  Index: PersistentFieldFactory.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldFactory.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PersistentFieldFactory.java	11 Aug 2004 00:41:46 -0000	1.12
  +++ PersistentFieldFactory.java	14 Nov 2004 09:36:10 -0000	1.13
  @@ -15,102 +15,72 @@
    * limitations under the License.
    */
   
  -import org.apache.ojb.broker.core.PersistenceBrokerConfiguration;
   import org.apache.ojb.broker.metadata.MetadataException;
   import org.apache.ojb.broker.util.ClassHelper;
  -import org.apache.ojb.broker.util.configuration.ConfigurationException;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfigurator;
  -import org.apache.ojb.broker.util.logging.Logger;
  -import org.apache.ojb.broker.util.logging.LoggerFactory;
   
   /**
  + * Factory for creating persistent field objects.
  + * 
    * @author <a href="mailto:thma@apache.org">Thomas Mahler<a>
    * @version $Id$
    */
  -
   public class PersistentFieldFactory
   {
  -    private static Logger log = LoggerFactory.getLogger(PersistentFieldFactory.class);
  -    private static final Class DEFAULT_PERSISTENT_FIELD_IMPL = PersistentFieldDirectAccessImplNew.class;
  -    private static final Class[] METHOD_PARAMETER_TYPES = {Class.class, String.class};
  -
  -    private static boolean usesAccessorsAndMutators = false;
  -    private static boolean usesAccessorsAndMutatorsCheck = false;
  +    /** The standard field class */
  +    private Class persistentFieldClass;
   
       /**
  -     * @throws MetadataException if an erros occours when creating the PersistenteField
  +     * Creates a new factory.
  +     * 
  +     * @param persistentFieldClass The standard field class
        */
  -	public static PersistentField createPersistentField(Class attributeType, String attributeName)
  +    public PersistentFieldFactory(Class persistentFieldClass)
  +    {
  +        this.persistentFieldClass = persistentFieldClass;
  +    }
  +    
  +    /**
  +     * Creates a new field object.
  +     * 
  +     * @param attributeType The data type of the field
  +     * @param attributeName The name of the field
  +     * @throws MetadataException If an error occours during creation of the field object
  +     */
  +	public PersistentField createPersistentField(Class attributeType, String attributeName)
   	{
  -		return createPersistentField(null,attributeType,attributeName);
  +		return createPersistentField(null, attributeType, attributeName);
   	}
       
  -    public static PersistentField createPersistentField(String persistentFieldClassName, Class attributeType, String attributeName)
  +    /**
  +     * Creates a new field object of the specified type.
  +     * 
  +     * @param persistentFieldClassName The type of the field object
  +     * @param attributeType            The data type of the field
  +     * @param attributeName            The name of the field
  +     * @throws MetadataException If an error occours during creation of the field object
  +     */
  +    public PersistentField createPersistentField(String persistentFieldClassName, Class attributeType, String attributeName)
       {
           try
           {
  -            if (persistentFieldClassName == null)
  -            {
  -                synchronized (PersistentFieldFactory.class)
  -                {
  -                    persistentFieldClassName = getDefaultPersistentFieldClassName();
  -                }
  -            }
  -            Object[] args = {attributeType, attributeName};
  -            PersistentField pf = (PersistentField) ClassHelper.newInstance(persistentFieldClassName, METHOD_PARAMETER_TYPES, args);
  -            return pf;
  -            
  -        }
  -        catch (Exception ex)
  -        {
  -            throw new MetadataException("Error creating PersistentField: " +
  -                    attributeType.getName() + ", " + attributeName, ex);
  -        }
  -    }
  +            Class[]         types = { Class.class, String.class };
  +            Object[]        args  = { attributeType, attributeName };
  +            PersistentField pf    = null;
   
  -    public static boolean usesAccessorsAndMutators()
  -    {
  -        boolean retval = false;
  -        if (usesAccessorsAndMutatorsCheck)
  -            retval = usesAccessorsAndMutators;
  -        else
  -        {
  -            String className = getDefaultPersistentFieldClassName();
  -            PersistentField field = null;
  -            try
  -            {
  -                field = (PersistentField) ClassHelper.newInstance(className);
  -                usesAccessorsAndMutators = field.usesAccessorsAndMutators();
  -                retval = usesAccessorsAndMutators;
  -            }
  -            catch (Exception e)
  +            if (persistentFieldClassName != null)
               {
  -                log.error("Cannot verify 'usesAccessorsAndMutators' attribute for class " + className, e);
  +                pf = (PersistentField)ClassHelper.newInstance(persistentFieldClassName, types, args);
               }
  -            finally
  +            else
               {
  -                usesAccessorsAndMutatorsCheck = true;
  +                pf = (PersistentField)persistentFieldClass.getConstructor(types).newInstance(args);
               }
  +            return pf;
  +            
           }
  -        return retval;
  -    }
  -
  -    private static String getDefaultPersistentFieldClassName()
  -    {
  -        try
  -        {
  -            PersistenceBrokerConfiguration config =
  -                    (PersistenceBrokerConfiguration) OjbConfigurator.getInstance().getConfigurationFor(
  -                            null);
  -
  -            Class clazz = config.getPersistentFieldClass();
  -            return clazz.getName();
  -        }
  -        catch (ConfigurationException e)
  +        catch (Exception ex)
           {
  -            log.error("Cannot look-up PersistentField class, use default implementation instead", e);
  -            return DEFAULT_PERSISTENT_FIELD_IMPL.getName();
  +            throw new MetadataException("Error creating persistent field  " + attributeType.getName() + ", " + attributeName, ex);
           }
       }
  -
   }
  
  
  
  1.12      +1 -5      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldPrivilegedImpl.java
  
  Index: PersistentFieldPrivilegedImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldPrivilegedImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PersistentFieldPrivilegedImpl.java	4 Apr 2004 23:53:35 -0000	1.11
  +++ PersistentFieldPrivilegedImpl.java	14 Nov 2004 09:36:10 -0000	1.12
  @@ -44,10 +44,6 @@
       private static final int ACCESSIBLE_STATE_FALSE = 1;
       private static final int ACCESSIBLE_STATE_SET_TRUE = 2;
   
  -    public PersistentFieldPrivilegedImpl()
  -    {
  -    }
  -
       public PersistentFieldPrivilegedImpl(Class type, String fieldname)
       {
           super(type, fieldname);
  
  
  
  1.2       +1 -6      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDynaBeanImplNew.java
  
  Index: PersistentFieldDynaBeanImplNew.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDynaBeanImplNew.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PersistentFieldDynaBeanImplNew.java	27 Jun 2004 23:36:23 -0000	1.1
  +++ PersistentFieldDynaBeanImplNew.java	14 Nov 2004 09:36:10 -0000	1.2
  @@ -42,11 +42,6 @@
       */
       private static final long serialVersionUID = 4728858060905429509L;
   
  -    public PersistentFieldDynaBeanImplNew()
  -    {
  -        super();
  -    }
  -
       public PersistentFieldDynaBeanImplNew(Class aPropertyType, String aPropertyName)
       {
           super(aPropertyType, aPropertyName);
  
  
  
  1.6       +1 -5      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDynaBeanAccessImpl.java
  
  Index: PersistentFieldDynaBeanAccessImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDynaBeanAccessImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PersistentFieldDynaBeanAccessImpl.java	4 Apr 2004 23:53:35 -0000	1.5
  +++ PersistentFieldDynaBeanAccessImpl.java	14 Nov 2004 09:36:10 -0000	1.6
  @@ -33,10 +33,6 @@
   public class PersistentFieldDynaBeanAccessImpl extends AbstractPersistentField
   {
       private static final long serialVersionUID = 4728858060905429509L;
  -    public PersistentFieldDynaBeanAccessImpl()
  -    {
  -        super();
  -    }
   
       public PersistentFieldDynaBeanAccessImpl(Class aPropertyType, String aPropertyName)
       {
  
  
  
  1.18      +1 -10     db-ojb/src/java/org/apache/ojb/broker/metadata/AttributeDescriptorBase.java
  
  Index: AttributeDescriptorBase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/AttributeDescriptorBase.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- AttributeDescriptorBase.java	4 Apr 2004 23:53:34 -0000	1.17
  +++ AttributeDescriptorBase.java	14 Nov 2004 09:36:10 -0000	1.18
  @@ -16,7 +16,6 @@
    */
   
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
  -import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldFactory;
   
   import java.io.Serializable;
   
  @@ -40,14 +39,6 @@
       public AttributeDescriptorBase(ClassDescriptor descriptor)
       {
           this.m_ClassDescriptor = descriptor;
  -    }
  -
  -    /**
  -     * @throws MetadataException if an error occours when setting the PersistenteField
  -     */
  -    public void setPersistentField(Class c, String fieldname)
  -    {
  -        m_PersistentField = PersistentFieldFactory.createPersistentField(c, fieldname);
       }
   
   	public void setPersistentField(PersistentField pf)
  
  
  
  1.23      +115 -29   db-ojb/src/java/org/apache/ojb/broker/metadata/MetadataManager.java
  
  Index: MetadataManager.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/MetadataManager.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- MetadataManager.java	26 Oct 2004 15:27:40 -0000	1.22
  +++ MetadataManager.java	14 Nov 2004 09:36:10 -0000	1.23
  @@ -24,9 +24,8 @@
   import org.apache.commons.lang.SerializationUtils;
   import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBrokerFactory;
  -import org.apache.ojb.broker.core.Factories;
  -import org.apache.ojb.broker.core.PersistenceBrokerConfiguration;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfigurator;
  +import org.apache.ojb.broker.core.configuration.NeedsInitialization;
  +import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldFactory;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   
  @@ -120,49 +119,120 @@
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
    */
  -public class MetadataManager
  +public class MetadataManager implements NeedsInitialization
   {
  -    private Factories factories;
  +    /** The default repository file */
  +    public static final String DEFAULT_REPOSITORY_PATH = "repository.xml";
  +    private static final String MSG_STR = "* Can't find DescriptorRepository for current thread, use default one *";
   
  -    private static Logger log = LoggerFactory.getLogger(MetadataManager.class);
  +    /** The factory for creating field objects in the metamodel*/
  +    private PersistentFieldFactory fieldFactory;
  +    /** The repository file i/o */
  +    private RepositoryPersistor persistor;
  +
  +    private Logger log = LoggerFactory.getLogger(MetadataManager.class);
   
  -    private static final String MSG_STR = "* Can't find DescriptorRepository for current thread, use default one *";
       private static ThreadLocal threadedRepository = new ThreadLocal();
   
  +    /** The path to the repository file */
  +    private String repositoryPath = DEFAULT_REPOSITORY_PATH;
  +
       private Hashtable metadataProfiles;
       private DescriptorRepository globalRepository;
       private ConnectionRepository connectionRepository;
       private boolean enablePerThreadChanges;
       private PBKey defaultPBKey;
   
  -    // singleton
  -    public MetadataManager(Factories factories)
  +    public MetadataManager(PersistentFieldFactory fieldFactory)
       {
  -        init(factories);
  +        this.fieldFactory = fieldFactory;
  +        this.persistor    = getRepositoryPersistor();
       }
   
  -    private void init(Factories factories)
  +    /**
  +     * Returns the repository path.
  +     * 
  +     * @return The repository path
  +     */
  +    public String getRepositoryPath()
  +    {
  +        return repositoryPath;
  +    }
  +
  +    /**
  +     * Sets the repository path.
  +     *
  +     * @param repositoryPath The new repository path
  +     */
  +    public void setRepositoryPath(String repositoryPath)
  +    {
  +        this.repositoryPath = repositoryPath;
  +    }
  +
  +    /**
  +     * Returns whether we're using a serialized repository.
  +     * 
  +     * @return <code>true</code> if we're using a serialized repository
  +     */
  +    public boolean isUsingSerializedRepository()
  +    {
  +        return persistor.isUsingSerializedRepository();
  +    }
  +
  +    /**
  +     * Specifies whether we're using a serialized repository.
  +     *
  +     * @param usingSerializedRepository <code>true</code> if we're using
  +     *                                  a serialized repository
  +     */
  +    public void setUsingSerializedRepository(boolean usingSerializedRepository)
  +    {
  +        persistor.setUsingSerializedRepository(usingSerializedRepository);
  +    }
  +
  +    /**
  +     * Returns the path of the serialized repository.
  +     * 
  +     * @return The path
  +     */
  +    public String getSerializedRepositoryPath()
  +    {
  +        return persistor.getSerializedRepositoryPath();
  +    }
  +
  +    /**
  +     * Sets the path of the serialized repository.
  +     *
  +     * @param serializedRepositoryPath The new path
  +     */
  +    public void setSerializedRepositoryPath(String serializedRepositoryPath)
  +    {
  +        persistor.setSerializedRepositoryPath(serializedRepositoryPath);
  +    }
  +
  +    /**
  +     * Initializes the metadata, i.e. parses the repository file. 
  +     */
  +    public void initialize()
       {
  -    	this.factories = factories;
           metadataProfiles = new Hashtable();
  -        String repository = ((PersistenceBrokerConfiguration) OjbConfigurator.getInstance()
  -                .getConfigurationFor(null)).getRepositoryFilename();
  +
           try
           {
  -            globalRepository     = new RepositoryPersistor(factories).readDescriptorRepository(repository);
  -            connectionRepository = new RepositoryPersistor(factories).readConnectionRepository(repository);
  +            globalRepository     = persistor.readDescriptorRepository(repositoryPath);
  +            connectionRepository = persistor.readConnectionRepository(repositoryPath);
           }
           catch (FileNotFoundException ex)
           {
  -            globalRepository     = new DescriptorRepository(this.factories);
  +            globalRepository     = new DescriptorRepository();
               connectionRepository = new ConnectionRepository();
               log.info("No repository.xml file found, starting with empty metadata and connection configuration");
           }
           catch (Exception ex)
           {
  -            throw new MetadataException("Can't read repository file '" + repository + "'", ex);
  +            throw new MetadataException("Can't read repository file '" + repositoryPath + "'", ex);
           }
  -        this.defaultPBKey = buildDefaultKey();
  +        defaultPBKey = buildDefaultKey();
       }
   
       /**
  @@ -171,7 +241,7 @@
       public static synchronized MetadataManager getInstance()
       {
           // we use the setup'd OJB instance
  -        return PersistenceBrokerFactory.getOjb(null).getMetadataManager();
  +        return PersistenceBrokerFactory.getOjb().getMetadataManager();
       }
   
       public PersistenceConfigurationDescriptor getConfigurationFor(PBKey key)
  @@ -184,6 +254,26 @@
       }
   
       /**
  +     * Returns the field factory used by the metadata manager.
  +     * 
  +     * @return The field factory
  +     */
  +    public PersistentFieldFactory getFieldFactory()
  +    {
  +        return fieldFactory;
  +    }
  +
  +    /**
  +     * Returns a repository persistor instance.
  +     * 
  +     * @return The persistor
  +     */
  +    public RepositoryPersistor getRepositoryPersistor()
  +    {
  +        return new RepositoryPersistor(fieldFactory);
  +    }
  +    
  +    /**
        * Returns the current valid {@link org.apache.ojb.broker.metadata.DescriptorRepository} for
        * the caller. This is the provided way to obtain the
        * {@link org.apache.ojb.broker.metadata.DescriptorRepository}.
  @@ -327,8 +417,7 @@
       {
           try
           {
  -            RepositoryPersistor persistor = new RepositoryPersistor(this.factories);
  -            return persistor.readDescriptorRepository(fileName);
  +            return getRepositoryPersistor().readDescriptorRepository(fileName);
           }
           catch (Exception e)
           {
  @@ -344,8 +433,7 @@
       {
           try
           {
  -            RepositoryPersistor persistor = new RepositoryPersistor(this.factories);
  -            return persistor.readDescriptorRepository(inst);
  +            return getRepositoryPersistor().readDescriptorRepository(inst);
           }
           catch (Exception e)
           {
  @@ -362,8 +450,7 @@
       {
           try
           {
  -            RepositoryPersistor persistor = new RepositoryPersistor(this.factories);
  -            return persistor.readConnectionRepository(fileName);
  +            return getRepositoryPersistor().readConnectionRepository(fileName);
           }
           catch (Exception e)
           {
  @@ -380,8 +467,7 @@
       {
           try
           {
  -            RepositoryPersistor persistor = new RepositoryPersistor(this.factories);
  -            return persistor.readConnectionRepository(inst);
  +            return getRepositoryPersistor().readConnectionRepository(inst);
           }
           catch (Exception e)
           {
  
  
  
  1.28      +52 -26    db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryPersistor.java
  
  Index: RepositoryPersistor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryPersistor.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- RepositoryPersistor.java	11 Nov 2004 23:21:57 -0000	1.27
  +++ RepositoryPersistor.java	14 Nov 2004 09:36:10 -0000	1.28
  @@ -17,12 +17,8 @@
   
   import org.apache.commons.lang.SerializationUtils;
   import org.apache.commons.lang.SystemUtils;
  -import org.apache.ojb.broker.core.Factories;
  +import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldFactory;
   import org.apache.ojb.broker.util.ClassHelper;
  -import org.apache.ojb.broker.util.configuration.Configurable;
  -import org.apache.ojb.broker.util.configuration.Configuration;
  -import org.apache.ojb.broker.util.configuration.ConfigurationException;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfigurator;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.xml.sax.ContentHandler;
  @@ -55,34 +51,66 @@
    * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
    * @version $Id$
    */
  -public class RepositoryPersistor implements Configurable
  +public class RepositoryPersistor
   {
       // TODO: Refactoring of the metadata reading/handling?
   
  -    private Factories factories;
  -
  -    private static Logger log = LoggerFactory.getLogger(RepositoryPersistor.class);
  +    private Logger log = LoggerFactory.getLogger(RepositoryPersistor.class);
   
       private static final String SER_FILE_SUFFIX = "serialized";
       private static final String SERIALIZED_REPOSITORY_PATH = "serializedRepositoryPath";
   
  -    private boolean useSerializedRepository = false;
  -
  +    /** The factory for creating field objects */
  +    private PersistentFieldFactory fieldFactory;
  +    /** Whether we're using a serialized repository */
  +    private boolean usingSerializedRepository = false;
  +    /** The place where the serialized repository is */
  +    private String serializedRepositoryPath = ".";
   
  -	public RepositoryPersistor()
  +	public RepositoryPersistor(PersistentFieldFactory fieldFactory)
   	{
  -		OjbConfigurator.getInstance().configure(this);
  +        this.fieldFactory = fieldFactory;
   	}
  -	
  -    public RepositoryPersistor(Factories factories)
  +    
  +    /**
  +     * Returns the path of the serialized repository.
  +     * 
  +     * @return The path
  +     */
  +    public String getSerializedRepositoryPath()
  +    {
  +        return serializedRepositoryPath;
  +    }
  +
  +    /**
  +     * Sets the path of the serialized repository.
  +     *
  +     * @param serializedRepositoryPath The new path
  +     */
  +    public void setSerializedRepositoryPath(String serializedRepositoryPath)
  +    {
  +        this.serializedRepositoryPath = serializedRepositoryPath;
  +    }
  +
  +    /**
  +     * Returns whether we're using a serialized repository.
  +     * 
  +     * @return <code>true</code> if we're using a serialized repository
  +     */
  +    public boolean isUsingSerializedRepository()
       {
  -    	this.factories = factories;
  -        OjbConfigurator.getInstance().configure(this);
  +        return usingSerializedRepository;
       }
   
  -    public void configure(Configuration pConfig) throws ConfigurationException
  +    /**
  +     * Specifies whether we're using a serialized repository.
  +     *
  +     * @param usingSerializedRepository <code>true</code> if we're using
  +     *                                  a serialized repository
  +     */
  +    public void setUsingSerializedRepository(boolean usingSerializedRepository)
       {
  -        useSerializedRepository = ((MetadataConfiguration) pConfig).useSerializedRepository();
  +        this.usingSerializedRepository = usingSerializedRepository;
       }
   
       /**
  @@ -148,13 +176,11 @@
               throws MalformedURLException, ParserConfigurationException, SAXException, IOException
       {
           DescriptorRepository result;
  -        if (useSerializedRepository)
  +        if (usingSerializedRepository)
           // use serialized repository
           {
               // build File object pointing to serialized repository location
  -            Configuration config = OjbConfigurator.getInstance().getConfigurationFor(null);
  -            String pathPrefix = config.getString(SERIALIZED_REPOSITORY_PATH, ".");
  -            File serFile = new File(pathPrefix + File.separator + filename + "." + SER_FILE_SUFFIX);
  +            File serFile = new File(serializedRepositoryPath + File.separator + filename + "." + SER_FILE_SUFFIX);
   
               if (serFile.exists() && serFile.length() > 0)
               // if file exists load serialized version of repository
  @@ -303,9 +329,9 @@
           if (DescriptorRepository.class.equals(target))
           {
               // create an empty repository:
  -            DescriptorRepository repository = new DescriptorRepository(this.factories);
  +            DescriptorRepository repository = new DescriptorRepository();
               // create handler for building the repository structure
  -            ContentHandler handler = new RepositoryXmlHandler(repository);
  +            ContentHandler handler = new RepositoryXmlHandler(fieldFactory, repository);
               // tell parser to use our handler:
               reader.setContentHandler(handler);
               reader.parse(source);
  
  
  
  1.95      +7 -72     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.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- ClassDescriptor.java	26 Oct 2004 15:27:39 -0000	1.94
  +++ ClassDescriptor.java	14 Nov 2004 09:36:10 -0000	1.95
  @@ -33,20 +33,12 @@
   
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.commons.lang.builder.ToStringStyle;
  -import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerException;
  -import org.apache.ojb.broker.accesslayer.RowReader;
  -import org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl;
  -import org.apache.ojb.broker.accesslayer.StatementsForClassFactory;
  -import org.apache.ojb.broker.accesslayer.StatementsForClassIF;
   import org.apache.ojb.broker.core.ValueContainer;
   import org.apache.ojb.broker.core.proxy.ProxyHelper;
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
   import org.apache.ojb.broker.util.ClassHelper;
   import org.apache.ojb.broker.util.SqlHelper;
  -import org.apache.ojb.broker.util.configuration.Configuration;
  -import org.apache.ojb.broker.util.configuration.Configurator;
  -import org.apache.ojb.broker.util.configuration.impl.OjbConfigurator;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   //#ifdef JDK13
   import java.lang.reflect.Proxy;
  @@ -122,15 +114,6 @@
        */
       private transient Constructor zeroArgumentConstructor = null;
   
  -    /**
  -     * We have to bound {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
  -     * instance to this class, because metadata may change.
  -     */
  -    private transient StatementsForClassFactory statementsForClassFactory;
  -    //---------------------------------------------------------------
  -    // end transient fields
  -    //---------------------------------------------------------------
  -
       private DescriptorRepository m_repository;
       /**
        * optional class.method to be invoked to create object instance.  Both
  @@ -163,10 +146,8 @@
        */
       private String m_TableName = null;
       private Vector superPersistentFieldDescriptors = null;
  -    /**
  -     * the RowReader for this class
  -     */
  -    private RowReader m_rowReader = null;
  +    /** The class name of the row reader specifically configured for this class */ 
  +    private String rowReaderClassName = null;
       /**
        * the class that this class extends
        */
  @@ -310,54 +291,17 @@
           this.objectCacheDescriptor = objectCacheDescriptor;
       }
   
  -
  -    /**
  -     * sets the row reader class for this descriptor
  -     */
  -    public void setRowReader(RowReader newReader)
  -    {
  -        m_rowReader = newReader;
  -    }
  -
  -    /**
  -     * Returns the {@link org.apache.ojb.broker.accesslayer.RowReader}
  -     * for this descriptor.
  -     */
  -    public synchronized RowReader getRowReader()
  -    {
  -        if (m_rowReader == null)
  -        {
  -            Configurator configurator = OjbConfigurator.getInstance();
  -            Configuration config = configurator.getConfigurationFor(null);
  -            Class rrClass = config.getClass("RowReaderDefaultClass", RowReaderDefaultImpl.class);
  -
  -            setRowReader(rrClass.getName());
  -        }
  -        return m_rowReader;
  -    }
  -
       /**
        * sets the row reader class name for thie class descriptor
        */
  -    public void setRowReader(String newReaderClassName)
  +    public void setRowReaderClassName(String newReaderClassName)
       {
  -        try
  -        {
  -            m_rowReader =
  -                (RowReader) ClassHelper.newInstance(
  -                    newReaderClassName,
  -                    ClassDescriptor.class,
  -                    this);
  -        }
  -        catch (Exception e)
  -        {
  -            throw new MetadataException("Instantiating of current set RowReader failed", e);
  -        }
  +        rowReaderClassName = newReaderClassName;
       }
   
       public String getRowReaderClassName()
       {
  -        return m_rowReader != null ? m_rowReader.getClass().getName() : null;
  +        return rowReaderClassName;
       }
   
       /**
  @@ -524,7 +468,7 @@
           if (ord == null)
           {
               ObjectReferenceDescriptor superOrd = 
  -                (ObjectReferenceDescriptor) m_objectReferenceDescriptorsNameMap.get(AnonymousObjectReferenceDescriptor.ANONYMOUS_NAME);
  +                (ObjectReferenceDescriptor) m_objectReferenceDescriptorsNameMap.get(ObjectReferenceDescriptor.ANONYMOUS_NAME);
               
               if (superOrd != null)
               {
  @@ -1824,15 +1768,6 @@
       public FieldDescriptor getOjbConcreteClassField()
       {
           return getDiscriminatorField();
  -    }
  -
  -    public StatementsForClassIF getStatementsForClass(PersistenceBroker broker)
  -    {
  -        if(statementsForClassFactory == null)
  -        {
  -            statementsForClassFactory = new StatementsForClassFactory(this);
  -        }
  -        return statementsForClassFactory.getStatementsForClass(broker);
       }
   
       /**
  
  
  
  1.66      +33 -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.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- RepositoryXmlHandler.java	11 Nov 2004 23:10:50 -0000	1.65
  +++ RepositoryXmlHandler.java	14 Nov 2004 09:36:10 -0000	1.66
  @@ -16,6 +16,7 @@
    */
   
   import org.apache.ojb.broker.accesslayer.QueryCustomizer;
  +import org.apache.ojb.broker.metadata.fieldaccess.AnonymousPersistentFieldForInheritance;
   import org.apache.ojb.broker.metadata.fieldaccess.AnonymousPersistentFieldHelper;
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentField;
   import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldFactory;
  @@ -47,6 +48,8 @@
   {
       private Logger logger = LoggerFactory.getLogger(RepositoryXmlHandler.class);
   
  +    /** The factory for creating field objects */
  +    private PersistentFieldFactory fieldFactory;
       private DescriptorRepository m_repository;
       private ClassDescriptor m_CurrentCLD;
       private ProcedureDescriptor m_CurrentProcedure;
  @@ -67,6 +70,23 @@
       private int m_lastId;
   
       /**
  +     * build a handler that fills the given repository
  +     * from an XML file.
  +     */
  +    public RepositoryXmlHandler(PersistentFieldFactory fieldFactory, DescriptorRepository dr)
  +    {
  +        this.fieldFactory = fieldFactory;
  +        if (dr != null)
  +        {
  +            m_repository = dr;
  +        }
  +        else
  +        {
  +            throw new MetadataException("Given DescriptorRepository argument was null");
  +        }
  +    }
  +
  +    /**
        * returns the XmlCapable id associated with the literal.
        * OJB maintains a RepositoryTags table that provides
        * a mapping from xml-tags to XmlCapable ids.
  @@ -91,22 +111,6 @@
       }
   
       /**
  -     * build a handler that fills the given repository
  -     * from an XML file.
  -     */
  -    public RepositoryXmlHandler(DescriptorRepository dr)
  -    {
  -        if (dr != null)
  -        {
  -            m_repository = dr;
  -        }
  -        else
  -        {
  -            throw new MetadataException("Given DescriptorRepository argument was null");
  -        }
  -    }
  -
  -    /**
        * startDocument callback, nothing to do here.
        */
       public void startDocument()
  @@ -246,7 +250,7 @@
                           if (isDebug) logger.debug("     " + RepositoryTags.getTagById(ROW_READER) + ": " + rowreader);
                           if (rowreader != null)
                           {
  -                            m_CurrentCLD.setRowReader(rowreader);
  +                            m_CurrentCLD.setRowReaderClassName(rowreader);
                           }
   
                           // set if extends
  @@ -405,7 +409,7 @@
                           {
                               m_CurrentFLD = new FieldDescriptor(m_CurrentCLD, m_lastId);
                               String classname = m_CurrentCLD.getClassNameOfObject();
  -							PersistentField pf = PersistentFieldFactory.createPersistentField(m_CurrentCLD.getPersistentFieldClassName(),ClassHelper.getClass(classname),fieldName);
  +							PersistentField pf = fieldFactory.createPersistentField(m_CurrentCLD.getPersistentFieldClassName(),ClassHelper.getClass(classname),fieldName);
                               m_CurrentFLD.setPersistentField(pf);
                           }
                           
  @@ -514,22 +518,22 @@
                           String classRef = atts.getValue(RepositoryTags.getTagById(REFERENCED_CLASS));
                           if (isDebug) logger.debug("     " + RepositoryTags.getTagById(REFERENCED_CLASS) + ": " + classRef);
   
  -                        ObjectReferenceDescriptor ord = null;
  +                        m_CurrentORD = new ObjectReferenceDescriptor(m_CurrentCLD);
  +
  +                        PersistentField pf = null;
  +
                           if (name.equals(TAG_SUPER))
                           {
                               checkThis(classRef);
  -                            AnonymousObjectReferenceDescriptor aord =
  -                                new AnonymousObjectReferenceDescriptor(m_CurrentCLD);
  -                            aord.setPersistentField(null, TAG_SUPER);
  -                            ord = aord;
  +                            pf = new AnonymousPersistentFieldForInheritance(m_CurrentCLD, ObjectReferenceDescriptor.ANONYMOUS_NAME);
                           }
                           else
                           {
  -                            ord = new ObjectReferenceDescriptor(m_CurrentCLD);
  -                            PersistentField pf = PersistentFieldFactory.createPersistentField(m_CurrentCLD.getPersistentFieldClassName(),m_CurrentCLD.getClassOfObject(),name);
  -                            ord.setPersistentField(pf);
  +                            pf = fieldFactory.createPersistentField(m_CurrentCLD.getPersistentFieldClassName(),
  +                                                                    m_CurrentCLD.getClassOfObject(),
  +                                                                    name);
                           }
  -                        m_CurrentORD = ord;
  +                        m_CurrentORD.setPersistentField(pf);
   
                           // now we add the new descriptor
                           m_CurrentCLD.addObjectReferenceDescriptor(m_CurrentORD);
  @@ -637,7 +641,7 @@
                           // set name attribute
                           name = atts.getValue(RepositoryTags.getTagById(FIELD_NAME));
                           if (isDebug) logger.debug("     " + RepositoryTags.getTagById(FIELD_NAME) + ": " + name);
  -						PersistentField pf = PersistentFieldFactory.createPersistentField(m_CurrentCLD.getPersistentFieldClassName(),m_CurrentCLD.getClassOfObject(),name);
  +						PersistentField pf = fieldFactory.createPersistentField(m_CurrentCLD.getPersistentFieldClassName(),m_CurrentCLD.getClassOfObject(),name);
                           m_CurrentCOD.setPersistentField(pf);
   
                           // set collection-class attribute
  
  
  
  1.40      +4 -3      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.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- ObjectReferenceDescriptor.java	14 Sep 2004 16:17:41 -0000	1.39
  +++ ObjectReferenceDescriptor.java	14 Nov 2004 09:36:10 -0000	1.40
  @@ -37,6 +37,7 @@
   {
       private static final long serialVersionUID = 5561562217150972131L;
   
  +    public static final String ANONYMOUS_NAME = null;
       public static final int CASCADE_NONE = 17;
       public static final int CASCADE_LINK = 19;
       public static final int CASCADE_OBJECT = 23;
  @@ -494,10 +495,10 @@
           this.multiMappedClass = multiMappedClass;
       }
   
  -    public void setPersistentField(Class c, String fieldname)
  +    public void setPersistentField(PersistentField field)
       {
  -        super.setPersistentField(c, fieldname);
  -        if(fieldname != null && fieldname.equals(RepositoryTags.TAG_SUPER))
  +        super.setPersistentField(field);
  +        if ((field.getName() != null) && field.getName().equals(RepositoryTags.TAG_SUPER))
           {
               setMultiMappedClass(true);
           }
  
  
  
  1.56      +28 -17    db-ojb/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java
  
  Index: DescriptorRepository.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- DescriptorRepository.java	26 Oct 2004 15:27:39 -0000	1.55
  +++ DescriptorRepository.java	14 Nov 2004 09:36:10 -0000	1.56
  @@ -27,8 +27,6 @@
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.commons.lang.builder.ToStringStyle;
   import org.apache.ojb.broker.OJBRuntimeException;
  -import org.apache.ojb.broker.PersistenceBrokerException;
  -import org.apache.ojb.broker.core.Factories;
   import org.apache.ojb.broker.util.ClassHelper;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   
  @@ -46,7 +44,6 @@
   public final class DescriptorRepository extends DescriptorBase
           implements Serializable, XmlCapable, IsolationLevels
   {
  -    private Factories factories;
       static final long serialVersionUID = -1556339982311359524L;
       /**
        * The version identifier of the Repository.
  @@ -74,9 +71,8 @@
       private transient Map m_firstConcreteClassMap;
       private transient Map m_allConcreteSubClass;
   
  -	public DescriptorRepository(Factories factories)
  +	public DescriptorRepository()
   	{
  -        this.factories = factories;
           descriptorTable = new HashMap();
           extentTable = new HashMap();
       }
  @@ -86,12 +82,6 @@
           return VERSION;
       }
   
  -	public Factories getFactories()
  -	{
  -		return factories;
  -	}
  -
  -
       /**
        * Add a pair of extent/classdescriptor to the extentTable to gain speed
        * while retrieval of extents.
  @@ -133,7 +123,11 @@
                   m_topLevelClassTable.remove(extClass);
                   // clear map with first concrete classes, because the removed
                   // extent could be such a first found concrete class
  -                m_firstConcreteClassMap = null;
  +                if (m_firstConcreteClassMap != null)
  +                {
  +                    m_firstConcreteClassMap.clear();
  +                    m_firstConcreteClassMap = null;
  +                }
               }
           }
       }
  @@ -523,10 +517,26 @@
   
       private void changeDescriptorEvent()
       {
  -        m_multiMappedTableMap = null;
  -        m_topLevelClassTable = null;
  -        m_firstConcreteClassMap = null;
  -        m_allConcreteSubClass = null;
  +        if (m_multiMappedTableMap != null)
  +        {
  +            m_multiMappedTableMap.clear();
  +            m_multiMappedTableMap = null;
  +        }
  +        if (m_topLevelClassTable != null)
  +        {
  +            m_topLevelClassTable.clear();
  +            m_topLevelClassTable = null;
  +        }
  +        if (m_firstConcreteClassMap != null)
  +        {
  +            m_firstConcreteClassMap.clear();
  +            m_firstConcreteClassMap = null;
  +        }
  +        if (m_allConcreteSubClass != null)
  +        {
  +            m_allConcreteSubClass.clear();
  +            m_allConcreteSubClass = null;
  +        }
       }
   
       /**
  @@ -707,6 +717,7 @@
   
       protected void finalize() throws Throwable
       {
  +        changeDescriptorEvent();
           LoggerFactory.getDefaultLogger().info("# finalize DescriptorRepository instance #");
       }
   }
  
  
  
  1.8       +3 -1      db-ojb/src/java/org/apache/ojb/broker/metadata/torque/TorqueRepositoryGenerator.java
  
  Index: TorqueRepositoryGenerator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/torque/TorqueRepositoryGenerator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TorqueRepositoryGenerator.java	4 Apr 2004 23:53:35 -0000	1.7
  +++ TorqueRepositoryGenerator.java	14 Nov 2004 09:36:10 -0000	1.8
  @@ -17,6 +17,8 @@
   
   import org.apache.ojb.broker.metadata.DescriptorRepository;
   import org.apache.ojb.broker.metadata.RepositoryPersistor;
  +import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDirectAccessImplNew;
  +import org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldFactory;
   
   import java.io.FileWriter;
   import java.io.IOException;
  @@ -30,7 +32,7 @@
   
       public TorqueRepositoryGenerator(String xmlInputFile, boolean ignoreAutoIncrement) throws Exception
       {
  -        RepositoryPersistor persistor = new RepositoryPersistor();
  +        RepositoryPersistor persistor = new RepositoryPersistor(new PersistentFieldFactory(PersistentFieldDirectAccessImplNew.class));
           DescriptorRepository repository = persistor.readDescriptorRepository(xmlInputFile);
   
           this.tablePreprocessor = new TorqueTablePreprocessor(repository);
  
  
  

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