You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2007/05/27 19:01:47 UTC

svn commit: r542002 - in /tapestry/tapestry4/trunk: ./ tapestry-annotations/src/descriptor/META-INF/ tapestry-framework/ tapestry-framework/src/descriptor/META-INF/ tapestry-framework/src/java/org/apache/tapestry/enhance/ tapestry-framework/src/java/or...

Author: jkuhnert
Date: Sun May 27 10:01:46 2007
New Revision: 542002

URL: http://svn.apache.org/viewvc?view=rev&rev=542002
Log:
Removed cglib dependency and failed attempt at observing changes to simple java collection properties.

Removed:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectChangeObserverWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/CglibPropertyChangeInterceptor.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/CglibProxiedPropertyChangeObserverImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/LazyProxyDelegate.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/ObservableMethodFilter.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/record/ObservedProperty.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/record/TestPropertyChangeObserver.java
Modified:
    tapestry/tapestry4/trunk/pom.xml
    tapestry/tapestry4/trunk/tapestry-annotations/src/descriptor/META-INF/hivemodule.xml
    tapestry/tapestry4/trunk/tapestry-framework/pom.xml
    tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.enhance.xml
    tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.persist.xml
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhanceUtils.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/SpecifiedPropertyWorker.java

Modified: tapestry/tapestry4/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/pom.xml?view=diff&rev=542002&r1=542001&r2=542002
==============================================================================
--- tapestry/tapestry4/trunk/pom.xml (original)
+++ tapestry/tapestry4/trunk/pom.xml Sun May 27 10:01:46 2007
@@ -124,12 +124,6 @@
                 <version>1.1.1</version>
                 <scope>compile</scope>
             </dependency>
-            <dependency>
-                <groupId>cglib</groupId>
-                <artifactId>cglib-nodep</artifactId>
-                <version>2.1_3</version>
-                <scope>compile</scope>
-            </dependency>
             <!-- Really, a transitive dependency of hivemind. -->
             <dependency>
                 <groupId>oro</groupId>

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/descriptor/META-INF/hivemodule.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/descriptor/META-INF/hivemodule.xml?view=diff&rev=542002&r1=542001&r2=542002
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/descriptor/META-INF/hivemodule.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/descriptor/META-INF/hivemodule.xml Sun May 27 10:01:46 2007
@@ -40,7 +40,7 @@
         components.
 
         <invoke-factory>
-            <construct class="ComponentHousekeepingWorker"></construct>
+            <construct class="ComponentHousekeepingWorker" />
         </invoke-factory>
     </service-point>
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/pom.xml?view=diff&rev=542002&r1=542001&r2=542002
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/pom.xml Sun May 27 10:01:46 2007
@@ -22,10 +22,6 @@
             <scope>compile</scope>
         </dependency>
         <dependency>
-            <groupId>cglib</groupId>
-            <artifactId>cglib-nodep</artifactId>
-        </dependency>
-        <dependency>
             <groupId>hivemind</groupId>
             <artifactId>hivemind</artifactId>
         </dependency>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.enhance.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.enhance.xml?view=diff&rev=542002&r1=542001&r2=542002
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.enhance.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.enhance.xml Sun May 27 10:01:46 2007
@@ -125,8 +125,6 @@
         <command id="inject-event-invoker" object="service:InjectEventInvokerWorker" before="abstract-property" />
         <command id="inject-render-worker" object="service:InjectRenderWorker" before="abstract-property" />
         <command id="specified-property" object="service:SpecifiedPropertyWorker" before="abstract-property" />
-        <command id="inject-propertychange-worker" object="service:InjectChangeObserverWorker"
-            before="abstract-property" />
         <command id="parameter" object="service:ParameterPropertyWorker" before="abstract-property" />
         <command id="dispatch-inject" object="service:DispatchToInjectWorker" before="abstract-property" />
         <command id="inject-component" object="service:InjectComponentWorker" before="abstract-property" />
@@ -355,18 +353,6 @@
 
         <invoke-factory>
             <construct class="InjectAssetWorker" />
-        </invoke-factory>
-
-    </service-point>
-
-    <service-point id="InjectChangeObserverWorker" interface="EnhancementWorker">
-
-        Injects the PropertyChangeObserver service into page instances.
-
-        <invoke-factory>
-            <construct class="InjectChangeObserverWorker">
-                <set-service property="propertyChangeObserver" service-id="tapestry.persist.PropertyChangeObserver" />
-            </construct>
         </invoke-factory>
 
     </service-point>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.persist.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.persist.xml?view=diff&rev=542002&r1=542001&r2=542002
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.persist.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.persist.xml Sun May 27 10:01:46 2007
@@ -136,14 +136,4 @@
     <strategy name="client:app" object="service:AppClientPropertyPersistenceStrategy"/>
   </contribution>
   
-  <service-point id="PropertyChangeObserver" interface="PropertyChangeObserver">
-    
-    Used to observe changes to persistent page properties.
-    
-     <invoke-factory>
-      <construct class="CglibProxiedPropertyChangeObserverImpl" />
-    </invoke-factory>
-    
-  </service-point>
-  
 </module>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhanceUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhanceUtils.java?view=diff&rev=542002&r1=542001&r2=542002
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhanceUtils.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhanceUtils.java Sun May 27 10:01:46 2007
@@ -14,13 +14,6 @@
 
 package org.apache.tapestry.enhance;
 
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.Factory;
-
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.Location;
 import org.apache.hivemind.service.ClassFabUtils;
@@ -32,6 +25,10 @@
 import org.apache.tapestry.event.PageEvent;
 import org.apache.tapestry.spec.IComponentSpecification;
 
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Convienience methods needed by various parts of the enhancement subsystem.
  * 
@@ -334,9 +331,6 @@
     public static boolean canProxyPropertyType(Class type)
     {
         // if it's already enhanced it must be by someone else
-        
-        if (Enhancer.isEnhanced(type) || Factory.class.isAssignableFrom(type))
-            return false;
         
         if (type.isInterface())
             return true;

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/SpecifiedPropertyWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/SpecifiedPropertyWorker.java?view=diff&rev=542002&r1=542001&r2=542002
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/SpecifiedPropertyWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/SpecifiedPropertyWorker.java Sun May 27 10:01:46 2007
@@ -14,13 +14,9 @@
 
 package org.apache.tapestry.enhance;
 
-import java.lang.reflect.Modifier;
-import java.util.Iterator;
-
 import org.apache.hivemind.ErrorLog;
 import org.apache.hivemind.Location;
 import org.apache.hivemind.service.BodyBuilder;
-import org.apache.hivemind.service.ClassFabUtils;
 import org.apache.hivemind.service.MethodSignature;
 import org.apache.hivemind.util.Defense;
 import org.apache.tapestry.IBinding;
@@ -30,6 +26,9 @@
 import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.IPropertySpecification;
 
+import java.lang.reflect.Modifier;
+import java.util.Iterator;
+
 /**
  * Responsible for adding properties to a class corresponding to specified
  * properties in the component's specification - which may come from .jwc / .page specifications
@@ -37,8 +36,6 @@
  * 
  * @author Howard M. Lewis Ship
  * @since 4.0
- * @see org.apache.tapestry.annotations.PersistAnnotationWorker
- * @see org.apache.tapestry.annotations.InitialValueAnnotationWorker
  */
 public class SpecifiedPropertyWorker implements EnhancementWorker
 {
@@ -105,19 +102,13 @@
         // overwriting methods in the base component class.
         
         EnhanceUtils.createSimpleAccessor(op, field, propertyName, propertyType, location);
-        
-        boolean canProxy = false;
-        /* if (ps.isProxyChecked())
-            canProxy = ps.canProxy();
-        else
-            canProxy = persistent && EnhanceUtils.canProxyPropertyType(propertyType);
-        */
-        addMutator(op, propertyName, propertyType, field, persistent, canProxy, location);
+                
+        addMutator(op, propertyName, propertyType, field, persistent, location);
         
         if (initialValue == null)
             addReinitializer(op, propertyType, field);
         else 
-            addInitialValue(op, propertyName, propertyType, field, initialValue, persistent, canProxy, location);
+            addInitialValue(op, propertyName, propertyType, field, initialValue, persistent, location);
     }
 
     private void addReinitializer(EnhancementOperation op, Class propertyType, String fieldName)
@@ -138,7 +129,7 @@
     }
 
     private void addInitialValue(EnhancementOperation op, String propertyName, Class propertyType, 
-            String fieldName, String initialValue, boolean persistent, boolean canProxy, Location location)
+            String fieldName, String initialValue, boolean persistent, Location location)
     {
         String description = EnhanceMessages.initialValueForProperty(propertyName);
 
@@ -160,16 +151,6 @@
         
         builder.addln("{0} = {1};", fieldName, EnhanceUtils.createUnwrapExpression(op, bindingField, propertyType));
         
-        // add proxy observers if we can
-        
-        if (canProxy)  {
-            
-            builder.add(fieldName + " = (" + ClassFabUtils.getJavaClassName(propertyType) + ") getPage().getPropertyChangeObserver().observePropertyChanges(this, (" 
-                    + ClassFabUtils.getJavaClassName(propertyType) + ") " + fieldName + ",");
-            builder.addQuoted(propertyName);
-            builder.addln(");");
-        }
-        
         String code = builder.toString();
         
         // In finishLoad() and pageDetach(), de-reference the binding to get the
@@ -182,8 +163,7 @@
     }
 
     private void addMutator(EnhancementOperation op, String propertyName,
-            Class propertyType, String fieldName, boolean persistent,  boolean canProxy, 
-            Location location)
+            Class propertyType, String fieldName, boolean persistent, Location location)
     {
         String methodName = EnhanceUtils.createMutatorMethodName(propertyName);
 
@@ -193,32 +173,12 @@
         
         if (persistent) {
             
-            if (!propertyType.isArray() && !propertyType.isPrimitive() && canProxy) {
-                
-                body.addln("if ($1 != null && org.apache.tapestry.record.ObservedProperty.class.isAssignableFrom($1.getClass())) {");
-                body.add(" $1 = (" + ClassFabUtils.getJavaClassName(propertyType) + ")((org.apache.tapestry.record.ObservedProperty)$1)");
-                body.addln(".getCGProperty();");
-                body.addln("}");
-            }
-            
             body.add("org.apache.tapestry.Tapestry#fireObservedChange(this, ");
             body.addQuoted(propertyName);
             body.addln(", ($w) $1);");
         }
-        
-        if (canProxy) {
-            
-            // set the field to the proxied type
-            
-            body.add(fieldName + " = (" + ClassFabUtils.getJavaClassName(propertyType) + ") getPage().getPropertyChangeObserver().observePropertyChanges(this, ($w) $1,");
-            body.addQuoted(propertyName);
-            body.addln(");");
-            
-        } else {
-            
-            body.addln(fieldName + " = $1;");
-        }
-        
+
+        body.addln(fieldName + " = $1;");
         body.end();
         
         MethodSignature sig = new MethodSignature(void.class, methodName, new Class[] { propertyType }, null);