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/fieldaccess PersistentNestedFieldMaxPerformanceImpl.java PersistentFieldMaxPerformanceImpl.java PersistentFieldFactory.java PersistentFieldDynaBeanImpl.java
Date Thu, 03 Jul 2003 09:55:07 GMT
arminw      2003/07/03 02:55:07

  Modified:    src/java/org/apache/ojb/broker/metadata/fieldaccess
                        PersistentNestedFieldMaxPerformanceImpl.java
                        PersistentFieldMaxPerformanceImpl.java
                        PersistentFieldFactory.java
                        PersistentFieldDynaBeanImpl.java
  Log:
  - add default constructor to all
  PersistentField implementations
  (needed in PF-Factory)
  - add logging
  
  Revision  Changes    Path
  1.9       +8 -3      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentNestedFieldMaxPerformanceImpl.java
  
  Index: PersistentNestedFieldMaxPerformanceImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentNestedFieldMaxPerformanceImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PersistentNestedFieldMaxPerformanceImpl.java	30 Jun 2003 21:15:10 -0000	1.8
  +++ PersistentNestedFieldMaxPerformanceImpl.java	3 Jul 2003 09:55:07 -0000	1.9
  @@ -19,6 +19,11 @@
       public static final String PATH_TOKEN = "::";
       private String m_fieldname;
   
  +    public PersistentNestedFieldMaxPerformanceImpl()
  +    {
  +        super();
  +    }
  +
       public PersistentNestedFieldMaxPerformanceImpl(Field f)
       {
           super(f);
  @@ -186,9 +191,9 @@
   	{
   		return false;
   	}
  -	
  +
   	 public String getName()
   	 {
  -	 	return this.m_fieldname;	
  +	 	return this.m_fieldname;
   	 }
   }
  
  
  
  1.15      +5 -1      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldMaxPerformanceImpl.java
  
  Index: PersistentFieldMaxPerformanceImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldMaxPerformanceImpl.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PersistentFieldMaxPerformanceImpl.java	2 May 2003 18:21:53 -0000	1.14
  +++ PersistentFieldMaxPerformanceImpl.java	3 Jul 2003 09:55:07 -0000	1.15
  @@ -74,6 +74,10 @@
       private String m_fieldname;
       private Logger m_logger = LoggerFactory.getLogger(this.getClass());
   
  +    public PersistentFieldMaxPerformanceImpl()
  +    {
  +    }
  +
       public PersistentFieldMaxPerformanceImpl(Field f)
       {
           this.m_field = f;
  
  
  
  1.6       +18 -19    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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PersistentFieldFactory.java	26 Apr 2003 23:18:25 -0000	1.5
  +++ PersistentFieldFactory.java	3 Jul 2003 09:55:07 -0000	1.6
  @@ -54,12 +54,13 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.metadata.MetadataException;
   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 java.lang.reflect.Constructor;
  +import org.apache.ojb.broker.util.logging.Logger;
  +import org.apache.ojb.broker.util.logging.LoggerFactory;
   
   /**
    * @author <a href="mailto:thma@apache.org">Thomas Mahler<a>
  @@ -68,6 +69,9 @@
   
   public class PersistentFieldFactory
   {
  +    private static Logger log = LoggerFactory.getLogger(PersistentFieldFactory.class);
  +    public static final Class DEFAULT_PERSISTENT_FIELD_IMPL = PersistentFieldDefaultImpl.class;
  +
       private static Class persistentFieldClass = null;
       private static boolean usesAccessorsAndMutators = false;
       private static boolean usesAccessorsAndMutatorsCheck = false;
  @@ -86,15 +90,9 @@
                       persistentFieldClass = getPersistentFieldClass();
                   }
               }
  -
               Class[] types = {Class.class, String.class};
  -            Constructor c = persistentFieldClass.getConstructor(types);
  -
  -            Object[] args =
  -                    {attributeType, attributeName};
  -            Object instance = c.newInstance(args);
  -
  -            return (PersistentField) instance;
  +            Object[] args = {attributeType, attributeName};
  +            return (PersistentField) ClassHelper.newInstance(persistentFieldClass, types,
args);
           }
           catch (Exception ex)
           {
  @@ -113,18 +111,18 @@
               PersistentField field = null;
               try
               {
  -                field = (PersistentField) clazz.newInstance();
  +                field = (PersistentField) ClassHelper.newInstance(clazz);
                   usesAccessorsAndMutators = field.usesAccessorsAndMutators();
                   retval = usesAccessorsAndMutators;
  -                usesAccessorsAndMutatorsCheck = true;
               }
  -            catch (InstantiationException e)
  +            catch (Exception e)
               {
  -                System.out.println("InstantiationException in usesAccessorsAndMutators
" + e.getMessage());
  +                log.error("Cannot verify 'usesAccessorsAndMutators' attribute for class
" + clazz, e);
  +                // System.out.println("InstantiationException in usesAccessorsAndMutators
" + e.getMessage());
               }
  -            catch (IllegalAccessException e)
  +            finally
               {
  -                System.out.println("IllegalAccessException error in usesAccessorsAndMutators
" + e.getMessage());
  +                usesAccessorsAndMutatorsCheck = true;
               }
           }
           return retval;
  @@ -143,7 +141,8 @@
           }
           catch (ConfigurationException e)
           {
  -            return PersistentFieldDefaultImpl.class;
  +            log.error("Cannot look-up PersistentField class, use default implementation
instead", e);
  +            return DEFAULT_PERSISTENT_FIELD_IMPL;
           }
       }
   
  
  
  
  1.4       +8 -4      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDynaBeanImpl.java
  
  Index: PersistentFieldDynaBeanImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDynaBeanImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PersistentFieldDynaBeanImpl.java	20 Dec 2002 01:53:31 -0000	1.3
  +++ PersistentFieldDynaBeanImpl.java	3 Jul 2003 09:55:07 -0000	1.4
  @@ -63,9 +63,9 @@
   /**
    * This class accesses a property from a {@link DynaBean}.
    * Note that because of the way that PersistentField works,
  - * at run time the type of the field could actually be different, since 
  + * at run time the type of the field could actually be different, since
    * it depends on the DynaClass of the DynaBean that is given at runtime.
  - * 
  + *
    * @author James Strachan
    * @version $Id$
    */
  @@ -75,6 +75,10 @@
   	private String propertyName;
   	private Class propertyType;
   
  +    public PersistentFieldDynaBeanImpl()
  +    {
  +    }
  +
   	public PersistentFieldDynaBeanImpl(Class aPropertyType, String aPropertyName)
   	{
   		this.propertyType = aPropertyType;
  @@ -222,7 +226,7 @@
   			logger.error("anObject was null");
   		}
   	}
  -	
  +
   	public boolean usesAccessorsAndMutators()
   	{
   		return false;
  
  
  

Mime
View raw message