cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r479165 - in /incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne: map/ reflect/ reflect/generic/ reflect/valueholder/
Date Sat, 25 Nov 2006 18:56:39 GMT
Author: aadamchik
Date: Sat Nov 25 10:56:38 2006
New Revision: 479165

URL: http://svn.apache.org/viewvc?view=rev&rev=479165
Log:
CAY-701: "property" package refactoring
(creating subpackages in refelect package to organize descriptors by the object type)

Added:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/DataObjectAccessor.java
      - copied, changed from r479156, incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/DataObjectAccessor.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/ToManyListProperty.java
      - copied, changed from r479156, incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ToManyListProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/valueholder/
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/valueholder/ValueHolderProperty.java
      - copied, changed from r479156, incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ValueHolderProperty.java
Removed:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/DataObjectAccessor.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ToManyListProperty.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ValueHolderProperty.java
Modified:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EntityResolver.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/PersistentDescriptorFactory.java
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/DataObjectDescriptorFactory.java

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EntityResolver.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EntityResolver.java?view=diff&rev=479165&r1=479164&r2=479165
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EntityResolver.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/map/EntityResolver.java
Sat Nov 25 10:56:38 2006
@@ -34,9 +34,9 @@
 import org.apache.cayenne.query.Query;
 import org.apache.cayenne.reflect.ClassDescriptor;
 import org.apache.cayenne.reflect.ClassDescriptorMap;
-import org.apache.cayenne.reflect.PersistentDescriptorFactory;
 import org.apache.cayenne.reflect.generic.DataObjectDescriptorFactory;
 import org.apache.cayenne.reflect.pojo.EnhancedPojoDescriptorFactory;
+import org.apache.cayenne.reflect.valueholder.ValueHolderDescriptorFactory;
 import org.apache.commons.collections.collection.CompositeCollection;
 
 /**
@@ -656,7 +656,7 @@
             ClassDescriptorMap classDescriptorMap = new ClassDescriptorMap(this);
 
             // add factories in reverse of the desired chain order
-            classDescriptorMap.addFactory(new PersistentDescriptorFactory(
+            classDescriptorMap.addFactory(new ValueHolderDescriptorFactory(
                     classDescriptorMap));
             classDescriptorMap.addFactory(new EnhancedPojoDescriptorFactory(
                     classDescriptorMap));

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/PersistentDescriptorFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/PersistentDescriptorFactory.java?view=diff&rev=479165&r1=479164&r2=479165
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/PersistentDescriptorFactory.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/PersistentDescriptorFactory.java
Sat Nov 25 10:56:38 2006
@@ -19,24 +19,20 @@
 package org.apache.cayenne.reflect;
 
 import java.util.Iterator;
-import java.util.List;
 
 import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.ValueHolder;
 import org.apache.cayenne.map.EntityInheritanceTree;
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.ObjRelationship;
 
 /**
- * A ClassDescriptorFactory that handles creation of ClassDescriptors for Persistent
- * objects.
+ * A convenience superclass for {@link ClassDescriptorFactory} implementors.
  * 
  * @since 3.0
  * @author Andrus Adamchik
  */
-// corresponds to the client variety of objects with ValueHolders...
-public class PersistentDescriptorFactory implements ClassDescriptorFactory {
+public abstract class PersistentDescriptorFactory implements ClassDescriptorFactory {
 
     protected ClassDescriptorMap descriptorMap;
 
@@ -112,41 +108,13 @@
                 attribute));
     }
 
-    protected void createToOneProperty(
+    protected abstract void createToOneProperty(
             PersistentDescriptor descriptor,
-            ObjRelationship relationship) {
-        ClassDescriptor targetDescriptor = descriptorMap.getDescriptor(relationship
-                .getTargetEntityName());
-        String reverseName = relationship.getReverseRelationshipName();
+            ObjRelationship relationship);
 
-        Accessor accessor = createAccessor(
-                descriptor,
-                relationship.getName(),
-                ValueHolder.class);
-        Property property = new ValueHolderProperty(
-                descriptor,
-                targetDescriptor,
-                accessor,
-                reverseName);
-
-        descriptor.addDeclaredProperty(property);
-    }
-
-    protected void createToManyProperty(
+    protected abstract void createToManyProperty(
             PersistentDescriptor descriptor,
-            ObjRelationship relationship) {
-
-        ClassDescriptor targetDescriptor = descriptorMap.getDescriptor(relationship
-                .getTargetEntityName());
-        String reverseName = relationship.getReverseRelationshipName();
-
-        Accessor accessor = createAccessor(descriptor, relationship.getName(), List.class);
-        descriptor.addDeclaredProperty(new ListProperty(
-                descriptor,
-                targetDescriptor,
-                accessor,
-                reverseName));
-    }
+            ObjRelationship relationship);
 
     protected void indexSubclassDescriptors(
             PersistentDescriptor descriptor,

Copied: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/DataObjectAccessor.java
(from r479156, incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/DataObjectAccessor.java)
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/DataObjectAccessor.java?view=diff&rev=479165&p1=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/DataObjectAccessor.java&r1=479156&p2=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/DataObjectAccessor.java&r2=479165
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/DataObjectAccessor.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/DataObjectAccessor.java
Sat Nov 25 10:56:38 2006
@@ -17,9 +17,11 @@
  *  under the License.
  ****************************************************************/
 
-package org.apache.cayenne.reflect;
+package org.apache.cayenne.reflect.generic;
 
 import org.apache.cayenne.DataObject;
+import org.apache.cayenne.reflect.Accessor;
+import org.apache.cayenne.reflect.PropertyException;
 
 /**
  * A PropertyAccessor that uses DataObject API to read/write values.

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/DataObjectDescriptorFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/DataObjectDescriptorFactory.java?view=diff&rev=479165&r1=479164&r2=479165
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/DataObjectDescriptorFactory.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/DataObjectDescriptorFactory.java
Sat Nov 25 10:56:38 2006
@@ -27,12 +27,10 @@
 import org.apache.cayenne.reflect.ClassDescriptor;
 import org.apache.cayenne.reflect.ClassDescriptorFactory;
 import org.apache.cayenne.reflect.ClassDescriptorMap;
-import org.apache.cayenne.reflect.DataObjectAccessor;
 import org.apache.cayenne.reflect.PersistentDescriptor;
 import org.apache.cayenne.reflect.PersistentDescriptorFactory;
 import org.apache.cayenne.reflect.PersistentObjectProperty;
 import org.apache.cayenne.reflect.PropertyException;
-import org.apache.cayenne.reflect.ToManyListProperty;
 
 /**
  * A {@link ClassDescriptorFactory} that creates descriptors for classes implementing

Copied: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/ToManyListProperty.java
(from r479156, incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ToManyListProperty.java)
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/ToManyListProperty.java?view=diff&rev=479165&p1=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ToManyListProperty.java&r1=479156&p2=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/ToManyListProperty.java&r2=479165
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ToManyListProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/generic/ToManyListProperty.java
Sat Nov 25 10:56:38 2006
@@ -17,11 +17,15 @@
  *  under the License.
  ****************************************************************/
 
-package org.apache.cayenne.reflect;
+package org.apache.cayenne.reflect.generic;
 
 import org.apache.cayenne.Fault;
 import org.apache.cayenne.Persistent;
 import org.apache.cayenne.ValueHolder;
+import org.apache.cayenne.reflect.Accessor;
+import org.apache.cayenne.reflect.ClassDescriptor;
+import org.apache.cayenne.reflect.ListProperty;
+import org.apache.cayenne.reflect.PropertyException;
 
 /**
  * A list property that is intended to work with

Copied: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/valueholder/ValueHolderProperty.java
(from r479156, incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ValueHolderProperty.java)
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/valueholder/ValueHolderProperty.java?view=diff&rev=479165&p1=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ValueHolderProperty.java&r1=479156&p2=incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/valueholder/ValueHolderProperty.java&r2=479165
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/ValueHolderProperty.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/reflect/valueholder/ValueHolderProperty.java
Sat Nov 25 10:56:38 2006
@@ -17,10 +17,14 @@
  *  under the License.
  ****************************************************************/
 
-package org.apache.cayenne.reflect;
+package org.apache.cayenne.reflect.valueholder;
 
 import org.apache.cayenne.Persistent;
 import org.apache.cayenne.ValueHolder;
+import org.apache.cayenne.reflect.Accessor;
+import org.apache.cayenne.reflect.BaseToOneProperty;
+import org.apache.cayenne.reflect.ClassDescriptor;
+import org.apache.cayenne.reflect.PropertyException;
 import org.apache.cayenne.util.PersistentObjectHolder;
 
 /**



Mime
View raw message