tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkuhn...@apache.org
Subject svn commit: r566354 - in /tapestry/tapestry4/trunk/tapestry-framework/src: java/org/apache/tapestry/enhance/ java/org/apache/tapestry/services/impl/ test/org/apache/tapestry/enhance/
Date Wed, 15 Aug 2007 22:00:24 GMT
Author: jkuhnert
Date: Wed Aug 15 15:00:22 2007
New Revision: 566354

URL: http://svn.apache.org/viewvc?view=rev&rev=566354
Log:
Fixes incompatible change that ~I~ made to InjectWOrker. .... Easily fixed by adding a getter
for IComponentSpecification.  (which could probably be removed from the majority of worker
interfaces, if it weren't too late )

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/DispatchToInjectWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhancementOperation.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhancementOperationImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectEnhancementWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectMetaWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectObjectWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectPageWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectScriptWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectStateFlagWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectStateWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ComponentConstructorFactoryImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/InjectStateFlagWorkerTest.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestDispatchToInjectWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectMetaWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectObjectWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectPageWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectScriptWorker.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectStateWorker.java

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/DispatchToInjectWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/DispatchToInjectWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/DispatchToInjectWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/DispatchToInjectWorker.java
Wed Aug 15 15:00:22 2007
@@ -24,7 +24,7 @@
 /**
  * Iterates over the {@link org.apache.tapestry.spec.InjectSpecification}s and locates and
  * delegates to a {@link org.apache.tapestry.enhance.InjectEnhancementWorker} for each one.
- * 
+ *
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
@@ -42,11 +42,11 @@
         {
             InjectSpecification is = (InjectSpecification) i.next();
 
-            invokeWorker(op, is, spec);
+            invokeWorker(op, is);
         }
     }
 
-    private void invokeWorker(EnhancementOperation op, InjectSpecification spec, IComponentSpecification
componentSpec)
+    private void invokeWorker(EnhancementOperation op, InjectSpecification spec)
     {
         try
         {
@@ -58,12 +58,12 @@
                 return;
             }
 
-            worker.performEnhancement(op, spec, componentSpec);
+            worker.performEnhancement(op, spec);
         }
         catch (Exception ex)
         {
-            _errorLog.error(EnhanceMessages.errorAddingProperty(spec.getProperty(), op.getBaseClass(),
ex), 
-                    spec.getLocation(), ex);
+            _errorLog.error(EnhanceMessages.errorAddingProperty(spec.getProperty(), op.getBaseClass(),
ex),
+                            spec.getLocation(), ex);
         }
     }
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhancementOperation.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhancementOperation.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhancementOperation.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhancementOperation.java
Wed Aug 15 15:00:22 2007
@@ -16,6 +16,7 @@
 
 import org.apache.hivemind.Location;
 import org.apache.hivemind.service.MethodSignature;
+import org.apache.tapestry.spec.IComponentSpecification;
 
 import java.util.List;
 
@@ -212,4 +213,11 @@
      */
 
     boolean implementsInterface(Class interfaceClass);
+
+    /**
+     * The specification defined for the component class being enhanced.
+     *
+     * @return The specification for the component being enhanced.
+     */
+    IComponentSpecification getSpecification();
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhancementOperationImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhancementOperationImpl.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhancementOperationImpl.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/EnhancementOperationImpl.java
Wed Aug 15 15:00:22 2007
@@ -44,14 +44,14 @@
  * knows how to collect class changes from enhancements. The method
  * {@link #getConstructor()} finalizes the enhancement into a
  * {@link org.apache.tapestry.services.ComponentConstructor}.
- * 
+ *
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
 public class EnhancementOperationImpl implements EnhancementOperation
 {
     static int _uid = 0;
-    
+
     private ClassResolver _resolver;
 
     private IComponentSpecification _specification;
@@ -122,10 +122,10 @@
     {
         _log = null;
     }
-    
+
     public EnhancementOperationImpl(ClassResolver classResolver,
-            IComponentSpecification specification, Class baseClass,
-            ClassFactory classFactory, Log log)
+                                    IComponentSpecification specification, Class baseClass,
+                                    ClassFactory classFactory, Log log)
     {
         Defense.notNull(classResolver, "classResolver");
         Defense.notNull(specification, "specification");
@@ -182,7 +182,7 @@
     }
 
     private void addPropertiesDeclaredInBaseClass()
-        throws IntrospectionException
+      throws IntrospectionException
     {
         Class introspectClass = _baseClass;
 
@@ -216,9 +216,9 @@
     }
 
     private void addPropertiesDeclaredInClass(Class introspectClass)
-        throws IntrospectionException
+      throws IntrospectionException
     {
-        
+
         BeanInfo bi = Introspector.getBeanInfo(introspectClass);
 
         PropertyDescriptor[] pds = bi.getPropertyDescriptors();
@@ -229,7 +229,7 @@
 
             String name = pd.getName();
 
-            if (!_properties.containsKey(name)) 
+            if (!_properties.containsKey(name))
                 _properties.put(name, pd);
         }
     }
@@ -243,29 +243,29 @@
 
         _claimedProperties.add(propertyName);
     }
-    
-    /** 
+
+    /**
      * {@inheritDoc}
      */
     public boolean canClaimAsReadOnlyProperty(String propertyName)
     {
-        if(_claimedProperties.contains(propertyName)) 
+        if(_claimedProperties.contains(propertyName))
             return false;
-        
+
         PropertyDescriptor pd = getPropertyDescriptor(propertyName);
-        
-        if (pd == null) 
+
+        if (pd == null)
             return false;
-        
+
         return pd.getWriteMethod() == null ? true : false;
     }
 
     public void claimReadonlyProperty(String propertyName)
     {
         claimProperty(propertyName);
-        
+
         PropertyDescriptor pd = getPropertyDescriptor(propertyName);
-        
+
         if (pd != null && pd.getWriteMethod() != null)
             throw new ApplicationRuntimeException(EnhanceMessages.readonlyProperty(propertyName,
pd.getWriteMethod()));
     }
@@ -285,7 +285,7 @@
 
         // See if this object has been previously added.
 
-        if (existing != null) 
+        if (existing != null)
             return existing;
 
         // TODO: Should be ensure that the name is unique?
@@ -345,17 +345,17 @@
 
         PropertyDescriptor pd = getPropertyDescriptor(name);
 
-        if (pd == null) 
+        if (pd == null)
             return;
 
         Class propertyType = pd.getPropertyType();
 
-        if (propertyType.equals(expectedType)) 
+        if (propertyType.equals(expectedType))
             return;
 
         throw new ApplicationRuntimeException(EnhanceMessages.propertyTypeMismatch(_baseClass,
name, propertyType, expectedType));
     }
-    
+
     PropertyDescriptor getPropertyDescriptor(String name)
     {
         return (PropertyDescriptor) _properties.get(name);
@@ -399,7 +399,7 @@
 
         String result = (String) _finalFields.get(clazz);
 
-        if (result == null) 
+        if (result == null)
             result = addClassReference(clazz);
 
         return result;
@@ -463,8 +463,7 @@
 
             Object[] params = _constructorArguments.toArray();
 
-            return new ComponentConstructorImpl(c, params,
-                    _classFab.toString(), _specification.getLocation());
+            return new ComponentConstructorImpl(c, params, _classFab.toString(), _specification.getLocation());
         }
         catch (Throwable t)
         {
@@ -479,13 +478,13 @@
         if (_constructorBuilder != null)
         {
             _constructorBuilder.end();
-            
+
             Class[] types = (Class[]) _constructorTypes.toArray(new Class[_constructorTypes.size()]);
-            
+
             _classFab.addConstructor(types, null, _constructorBuilder.toString());
         }
 
-        if (_log != null && _log.isDebugEnabled()) 
+        if (_log != null && _log.isDebugEnabled())
             _log.debug("Creating class:\n\n" + _classFab);
     }
 
@@ -510,7 +509,7 @@
     private Constructor findConstructor()
     {
         Class componentClass = _classFab.createClass();
-        
+
         // The fabricated base class always has exactly one constructor
 
         return componentClass.getConstructors()[0];
@@ -542,7 +541,7 @@
 
     private void addInterfaceIfNeeded(Class interfaceClass)
     {
-        if (implementsInterface(interfaceClass)) 
+        if (implementsInterface(interfaceClass))
             return;
 
         _classFab.addInterface(interfaceClass);
@@ -551,7 +550,7 @@
 
     public boolean implementsInterface(Class interfaceClass)
     {
-        if (interfaceClass.isAssignableFrom(_baseClass)) 
+        if (interfaceClass.isAssignableFrom(_baseClass))
             return true;
 
         Iterator i = _addedInterfaces.iterator();
@@ -559,7 +558,7 @@
         {
             Class addedInterface = (Class) i.next();
 
-            if (interfaceClass.isAssignableFrom(addedInterface)) 
+            if (interfaceClass.isAssignableFrom(addedInterface))
                 return true;
         }
 
@@ -616,7 +615,7 @@
             try
             {
                 return c.getDeclaredMethod(sig.getName(), sig
-                        .getParameterTypes());
+                  .getParameterTypes());
             }
             catch (NoSuchMethodException ex)
             {
@@ -641,10 +640,10 @@
 
             String name = pd.getName();
 
-            if (_claimedProperties.contains(name)) 
+            if (_claimedProperties.contains(name))
                 continue;
 
-            if (isAbstractProperty(pd)) 
+            if (isAbstractProperty(pd))
                 result.add(name);
         }
 
@@ -660,11 +659,16 @@
     private boolean isAbstractProperty(PropertyDescriptor pd)
     {
         return isExistingAbstractMethod(pd.getReadMethod())
-                || isExistingAbstractMethod(pd.getWriteMethod());
+               || isExistingAbstractMethod(pd.getWriteMethod());
     }
 
     private boolean isExistingAbstractMethod(Method m)
     {
         return m != null && Modifier.isAbstract(m.getModifiers());
+    }
+
+    public IComponentSpecification getSpecification()
+    {
+        return _specification;
     }
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectEnhancementWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectEnhancementWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectEnhancementWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectEnhancementWorker.java
Wed Aug 15 15:00:22 2007
@@ -14,7 +14,6 @@
 
 package org.apache.tapestry.enhance;
 
-import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.InjectSpecification;
 
 /**
@@ -39,10 +38,8 @@
      * @param op
      *          Current enhancement context.
      * @param spec
- *              The injection specificiation configuration.
-     * @param componentSpec
-     *          The component injection is for.
+*              The injection specificiation configuration.
      */
-    void performEnhancement(EnhancementOperation op, InjectSpecification spec, IComponentSpecification
componentSpec);
+    void performEnhancement(EnhancementOperation op, InjectSpecification spec);
 
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectMetaWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectMetaWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectMetaWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectMetaWorker.java
Wed Aug 15 15:00:22 2007
@@ -21,7 +21,6 @@
 import org.apache.hivemind.util.Defense;
 import org.apache.tapestry.coerce.ValueConverter;
 import org.apache.tapestry.services.ComponentPropertySource;
-import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.InjectSpecification;
 
 import java.lang.reflect.Modifier;
@@ -32,7 +31,7 @@
  * Injects meta data obtained via {@link org.apache.tapestry.services.ComponentPropertySource}
  * (meaning that meta-data is searched for in the component's specification, then it's namespace
  * (library or application specification), then the global application properties.
- * 
+ *
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
@@ -43,7 +42,7 @@
     private ComponentPropertySource _source;
 
     private ValueConverter _valueConverter;
-    
+
     private Map _primitiveParser = new HashMap();
     {
         _primitiveParser.put(short.class, "java.lang.Short.parseShort");
@@ -53,7 +52,7 @@
         _primitiveParser.put(float.class, "java.lang.Float.parseFloat");
     }
 
-    public void performEnhancement(EnhancementOperation op, InjectSpecification spec, IComponentSpecification
componentSpec)
+    public void performEnhancement(EnhancementOperation op, InjectSpecification spec)
     {
         String propertyName = spec.getProperty();
         String metaKey = spec.getObject();
@@ -62,21 +61,21 @@
     }
 
     public void injectMetaValue(EnhancementOperation op, String propertyName, String metaKey,
-            Location location)
+                                Location location)
     {
         Defense.notNull(op, "op");
         Defense.notNull(propertyName, "propertyName");
         Defense.notNull(metaKey, "metaKey");
 
         Class propertyType = op.getPropertyType(propertyName);
-        
+
         // Default to object if not specified
-        
+
         if (propertyType == null) {
-            
+
             propertyType = Object.class;
         }
-        
+
         op.claimReadonlyProperty(propertyName);
 
         String sourceName = op.addInjectedField(SOURCE_NAME, ComponentPropertySource.class,
_source);
@@ -89,12 +88,12 @@
         {
             addPrimitive(op, metaKey, propertyName, sig, sourceName, parser, location);
             return;
-        } else if (propertyType == boolean.class) 
+        } else if (propertyType == boolean.class)
         {
             addBoolean(op, metaKey, propertyName, sig, sourceName, location);
             return;
         }
-        
+
         if (propertyType == char.class)
         {
             addCharacterPrimitive(op, metaKey, propertyName, sig, sourceName, location);
@@ -105,44 +104,43 @@
     }
 
     private void addPrimitive(EnhancementOperation op, String metaKey, String propertyName,
-            MethodSignature sig, String sourceName, String parser, Location location)
+                              MethodSignature sig, String sourceName, String parser, Location
location)
     {
         BodyBuilder builder = new BodyBuilder();
         builder.begin();
-        builder.addln(
-                "java.lang.String meta = {0}.getComponentProperty(this, \"{1}\");",
-                sourceName,
-                metaKey);
+        builder.addln("java.lang.String meta = {0}.getComponentProperty(this, \"{1}\");",
+                      sourceName,
+                      metaKey);
         builder.addln("return {0}(meta);", parser);
         builder.end();
 
         op.addMethod(Modifier.PUBLIC, sig, builder.toString(), location);
     }
-    
+
     private void addBoolean(EnhancementOperation op, String metaKey, String propertyName,
-            MethodSignature sig, String sourceName, Location location)
+                            MethodSignature sig, String sourceName, Location location)
     {
         BodyBuilder builder = new BodyBuilder();
         builder.begin();
         builder.addln(
-                "java.lang.String meta = {0}.getComponentProperty(this, \"{1}\");",
-                sourceName,
-                metaKey);
+          "java.lang.String meta = {0}.getComponentProperty(this, \"{1}\");",
+          sourceName,
+          metaKey);
         builder.addln("return java.lang.Boolean.valueOf(meta).booleanValue();");
         builder.end();
-        
+
         op.addMethod(Modifier.PUBLIC, sig, builder.toString(), location);
     }
-    
+
     private void addCharacterPrimitive(EnhancementOperation op, String metaKey,
-            String propertyName, MethodSignature sig, String sourceName, Location location)
+                                       String propertyName, MethodSignature sig, String sourceName,
Location location)
     {
         BodyBuilder builder = new BodyBuilder();
         builder.begin();
         builder.addln(
-                "java.lang.String meta = {0}.getComponentProperty(this, \"{1}\");",
-                sourceName,
-                metaKey);
+          "java.lang.String meta = {0}.getComponentProperty(this, \"{1}\");",
+          sourceName,
+          metaKey);
         builder.addln("return meta.charAt(0);");
         builder.end();
 
@@ -150,21 +148,21 @@
     }
 
     private void addObject(EnhancementOperation op, String metaKey, String propertyName,
-            Class propertyType, MethodSignature sig, String sourceName, Location location)
+                           Class propertyType, MethodSignature sig, String sourceName, Location
location)
     {
         String valueConverterName = op.addInjectedField("_$valueConverter", ValueConverter.class,
_valueConverter);
-        
+
         String classRef = op.getClassReference(propertyType);
-        
+
         BodyBuilder builder = new BodyBuilder();
         builder.begin();
         builder.addln("java.lang.String meta = {0}.getComponentProperty(this, \"{1}\");",
-                sourceName,
-                metaKey);
+                      sourceName,
+                      metaKey);
         builder.addln("return ({0}) {1}.coerceValue(meta, {2});", ClassFabUtils
-                .getJavaClassName(propertyType), valueConverterName, classRef);
+          .getJavaClassName(propertyType), valueConverterName, classRef);
         builder.end();
-        
+
         op.addMethod(Modifier.PUBLIC, sig, builder.toString(), location);
     }
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectObjectWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectObjectWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectObjectWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectObjectWorker.java
Wed Aug 15 15:00:22 2007
@@ -19,7 +19,6 @@
 import org.apache.hivemind.service.MethodSignature;
 import org.apache.hivemind.util.Defense;
 import org.apache.tapestry.services.InjectedValueProvider;
-import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.InjectSpecification;
 
 import java.lang.reflect.Modifier;
@@ -27,7 +26,7 @@
 /**
  * Implementation for injection type "object" (the default). Adds read-only
  * properties to the enhanced class that contain objects injected from HiveMind.
- * 
+ *
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
@@ -36,8 +35,7 @@
 
     private InjectedValueProvider _provider;
 
-    public void performEnhancement(EnhancementOperation op,
-                                   InjectSpecification is, IComponentSpecification componentSpec)
+    public void performEnhancement(EnhancementOperation op, InjectSpecification is)
     {
         String name = is.getProperty();
         String objectReference = is.getObject();
@@ -47,7 +45,7 @@
     }
 
     public void injectObject(EnhancementOperation op, String objectReference,
-            String propertyName, Location location)
+                             String propertyName, Location location)
     {
         Defense.notNull(op, "op");
         Defense.notNull(propertyName, "propertyName");
@@ -60,22 +58,22 @@
         op.claimReadonlyProperty(propertyName);
 
         Object injectedValue = _provider.obtainValue(objectReference, location);
-        
+
         if (injectedValue == null)
             throw new ApplicationRuntimeException(EnhanceMessages
-                    .locatedValueIsNull(objectReference), location, null);
-        
+              .locatedValueIsNull(objectReference), location, null);
+
         if (!propertyType.isInstance(injectedValue))
             throw new ApplicationRuntimeException(EnhanceMessages.incompatibleInjectType(objectReference,
injectedValue, propertyType),
-                    location, null);
-        
+                                                  location, null);
+
         String fieldName = op.addInjectedField("_$" + propertyName,
-                propertyType, injectedValue);
-        
+                                               propertyType, injectedValue);
+
         String methodName = EnhanceUtils.createAccessorMethodName(propertyName);
 
         op.addMethod(Modifier.PUBLIC, new MethodSignature(propertyType,
-                methodName, null, null), "return " + fieldName + ";", location);
+                                                          methodName, null, null), "return
" + fieldName + ";", location);
     }
 
     public void setProvider(InjectedValueProvider provider)

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectPageWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectPageWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectPageWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectPageWorker.java
Wed Aug 15 15:00:22 2007
@@ -19,7 +19,6 @@
 import org.apache.hivemind.service.BodyBuilder;
 import org.apache.hivemind.service.MethodSignature;
 import org.apache.tapestry.IPage;
-import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.InjectSpecification;
 
 import java.lang.reflect.Modifier;
@@ -32,7 +31,7 @@
  */
 public class InjectPageWorker implements InjectEnhancementWorker
 {
-    public void performEnhancement(EnhancementOperation op, InjectSpecification spec, IComponentSpecification
componentSpec)
+    public void performEnhancement(EnhancementOperation op, InjectSpecification spec)
     {
         performEnhancement(op, spec.getObject(), spec.getProperty(), spec.getLocation());
     }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectScriptWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectScriptWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectScriptWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectScriptWorker.java
Wed Aug 15 15:00:22 2007
@@ -22,7 +22,6 @@
 import org.apache.tapestry.IScript;
 import org.apache.tapestry.asset.AssetSource;
 import org.apache.tapestry.engine.IScriptSource;
-import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.InjectSpecification;
 
 import java.lang.reflect.Modifier;
@@ -39,13 +38,13 @@
 
     private AssetSource _assetSource;
 
-    public void performEnhancement(EnhancementOperation op, InjectSpecification spec, IComponentSpecification
componentSpec)
+    public void performEnhancement(EnhancementOperation op, InjectSpecification spec)
     {
         String propertyName = spec.getProperty();
         String scriptName = spec.getObject();
         Location location = spec.getLocation();
 
-        injectScript(op, propertyName, scriptName, location, componentSpec);
+        injectScript(op, propertyName, scriptName, location);
     }
 
     /**
@@ -60,12 +59,10 @@
      * @param location
      *            the location of the specification; primarily used as the base location
for finding
      *            the script.
-     * @param componentSpec
-     *          Component specification.
      */
 
     public void injectScript(EnhancementOperation op, String propertyName,
-                             String scriptName, Location location, IComponentSpecification
componentSpec)
+                             String scriptName, Location location)
     {
         Defense.notNull(op, "op");
         Defense.notNull(propertyName, "propertyName");
@@ -86,7 +83,7 @@
 
         if (resource.getResourceURL() == null)
         {
-            IAsset scriptAsset = _assetSource.findAsset(location.getResource(), componentSpec,
+            IAsset scriptAsset = _assetSource.findAsset(location.getResource(), op.getSpecification(),
                                                         scriptName, null, location);
 
             if (scriptAsset != null)

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectStateFlagWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectStateFlagWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectStateFlagWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectStateFlagWorker.java
Wed Aug 15 15:00:22 2007
@@ -20,7 +20,6 @@
 import org.apache.hivemind.service.MethodSignature;
 import org.apache.hivemind.util.Defense;
 import org.apache.tapestry.engine.state.ApplicationStateManager;
-import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.InjectSpecification;
 
 import java.lang.reflect.Modifier;
@@ -37,7 +36,7 @@
 {
     private ApplicationStateManager _applicationStateManager;
 
-    public void performEnhancement(EnhancementOperation op, InjectSpecification spec, IComponentSpecification
componentSpec)
+    public void performEnhancement(EnhancementOperation op, InjectSpecification spec)
     {
         injectStateFlag(op, spec.getObject(), spec.getProperty(), spec.getLocation());
     }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectStateWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectStateWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectStateWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/enhance/InjectStateWorker.java
Wed Aug 15 15:00:22 2007
@@ -21,7 +21,6 @@
 import org.apache.hivemind.util.Defense;
 import org.apache.tapestry.engine.state.ApplicationStateManager;
 import org.apache.tapestry.event.PageDetachListener;
-import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.InjectSpecification;
 
 import java.lang.reflect.Modifier;
@@ -44,7 +43,7 @@
     private ApplicationStateManager _applicationStateManager;
 
     public void performEnhancement(EnhancementOperation op,
-                                   InjectSpecification spec, IComponentSpecification componentSpec)
+                                   InjectSpecification spec)
     {
         injectState(op, spec.getObject(), spec.getProperty(), spec.getLocation());
     }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ComponentConstructorFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ComponentConstructorFactoryImpl.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ComponentConstructorFactoryImpl.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ComponentConstructorFactoryImpl.java
Wed Aug 15 15:00:22 2007
@@ -15,11 +15,6 @@
 package org.apache.tapestry.services.impl;
 
 import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.commons.logging.Log;
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.ClassResolver;
@@ -35,18 +30,22 @@
 import org.apache.tapestry.services.ComponentConstructorFactory;
 import org.apache.tapestry.spec.IComponentSpecification;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * Implementation of the {@link org.apache.tapestry.services.ComponentConstructorFactory}
service
  * interface.
- * 
+ *
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
 public class ComponentConstructorFactoryImpl implements ComponentConstructorFactory,
-        ResetEventListener, ReportStatusListener
+                                                        ResetEventListener, ReportStatusListener
 {
     private final ReentrantLock _lock = new ReentrantLock();
-    
+
     private String _serviceId;
 
     private Log _log;
@@ -74,54 +73,53 @@
     public synchronized void reportStatus(ReportStatusEvent event)
     {
         event.title(_serviceId);
-        
+
         event.property("enhanced class count", _cachedConstructors.size());
         event.collection("enhanced classes", _cachedConstructors.keySet());
     }
 
     public ComponentConstructor getComponentConstructor(IComponentSpecification specification,
-            String className)
+                                                        String className)
     {
         Defense.notNull(specification, "specification");
-        
-        try {
-            
+
+        try
+        {
             _lock.lockInterruptibly();
-            
+
             ComponentConstructor result = (ComponentConstructor) _cachedConstructors.get(specification);
-            
-            if (result == null) {
-                
+
+            if (result == null)
+            {
                 Class baseClass = _classResolver.findClass(className);
-                
-                EnhancementOperationImpl eo = new EnhancementOperationImpl(_classResolver,
-                        specification, baseClass, _classFactory, _log);
-                
+
+                EnhancementOperationImpl eo = new EnhancementOperationImpl(_classResolver,
specification, baseClass, _classFactory, _log);
+
                 // Invoking on the chain is the same as invoking on every
                 // object in the chain (because method performEnhancement() is type void).
-                
+
                 _chain.performEnhancement(eo, specification);
-                
+
                 result = eo.getConstructor();
-                
+
                 // TODO: This should be optional to work around that IBM JVM bug.
-                
+
                 _validator.validate(baseClass, result.getComponentClass(), specification);
-                
+
                 _cachedConstructors.put(specification, result);
             }
-            
+
             return result;
-            
-        } catch (InterruptedException e) {
-            
-           throw new ApplicationRuntimeException(e);
-        } finally {
-            
+
+        } catch (InterruptedException e)
+        {
+            throw new ApplicationRuntimeException(e);
+        } finally
+        {
             _lock.unlock();
         }
     }
-    
+
     public void setClassFactory(ClassFactory classFactory)
     {
         _classFactory = classFactory;

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/InjectStateFlagWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/InjectStateFlagWorkerTest.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/InjectStateFlagWorkerTest.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/InjectStateFlagWorkerTest.java
Wed Aug 15 15:00:22 2007
@@ -70,7 +70,7 @@
 
         worker.setApplicationStateManager(asm);
 
-        worker.performEnhancement(op, is, null);
+        worker.performEnhancement(op, is);
 
         verify();
     }
@@ -112,7 +112,7 @@
 
         worker.setApplicationStateManager(asm);
 
-        worker.performEnhancement(op, is, null);
+        worker.performEnhancement(op, is);
 
         verify();
     }
@@ -139,7 +139,7 @@
 
         try
         {
-            worker.performEnhancement(op, is, null);
+            worker.performEnhancement(op, is);
             unreachable();
         }
         catch (ApplicationRuntimeException ex)

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestDispatchToInjectWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestDispatchToInjectWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestDispatchToInjectWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestDispatchToInjectWorker.java
Wed Aug 15 15:00:22 2007
@@ -77,7 +77,7 @@
         Map map = newMap("object", worker);
         IComponentSpecification spec = newSpec(is);
 
-        worker.performEnhancement(op, is, spec);
+        worker.performEnhancement(op, is);
 
         replay();
 
@@ -128,7 +128,7 @@
         Throwable t = new RuntimeException("Simulated failure.");
         ErrorLog log = newErrorLog();
 
-        worker.performEnhancement(op, is, spec);
+        worker.performEnhancement(op, is);
         expectLastCall().andThrow(t);
 
         expect(op.getBaseClass()).andReturn(BasePage.class);

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectMetaWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectMetaWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectMetaWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectMetaWorker.java
Wed Aug 15 15:00:22 2007
@@ -86,7 +86,7 @@
 
         worker.setSource(source);
 
-        worker.performEnhancement(op, spec, null);
+        worker.performEnhancement(op, spec);
 
         verify();
     }
@@ -124,7 +124,7 @@
 
         worker.setSource(source);
 
-        worker.performEnhancement(op, spec, null);
+        worker.performEnhancement(op, spec);
 
         verify();
     }
@@ -163,7 +163,7 @@
 
         worker.setSource(source);
 
-        worker.performEnhancement(op, spec, null);
+        worker.performEnhancement(op, spec);
 
         verify();
     }
@@ -209,7 +209,7 @@
         worker.setSource(source);
         worker.setValueConverter(converter);
 
-        worker.performEnhancement(op, spec, null);
+        worker.performEnhancement(op, spec);
 
         verify();
     }
@@ -252,7 +252,7 @@
         worker.setSource(source);
         worker.setValueConverter(converter);
 
-        worker.performEnhancement(op, spec, null);
+        worker.performEnhancement(op, spec);
 
         verify();
     }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectObjectWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectObjectWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectObjectWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectObjectWorker.java
Wed Aug 15 15:00:22 2007
@@ -84,7 +84,7 @@
         InjectObjectWorker w = new InjectObjectWorker();
         w.setProvider(p);
 
-        w.performEnhancement(op, spec, null);
+        w.performEnhancement(op, spec);
 
         verify();
     }
@@ -116,7 +116,7 @@
         InjectObjectWorker w = new InjectObjectWorker();
         w.setProvider(p);
 
-        w.performEnhancement(op, spec, null);
+        w.performEnhancement(op, spec);
 
         verify();
     }
@@ -149,7 +149,7 @@
 
         try
         {
-            w.performEnhancement(op, spec, null);
+            w.performEnhancement(op, spec);
             unreachable();
         }
         catch (ApplicationRuntimeException ex)
@@ -184,7 +184,7 @@
 
         try
         {
-            w.performEnhancement(op, spec, null);
+            w.performEnhancement(op, spec);
             unreachable();
 
         }
@@ -226,7 +226,7 @@
         InjectObjectWorker w = new InjectObjectWorker();
         w.setProvider(p);
         
-        w.performEnhancement(op, spec, null);
+        w.performEnhancement(op, spec);
 
         verify();
     }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectPageWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectPageWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectPageWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectPageWorker.java
Wed Aug 15 15:00:22 2007
@@ -49,7 +49,7 @@
 
         try
         {
-            new InjectPageWorker().performEnhancement(op, is, null);
+            new InjectPageWorker().performEnhancement(op, is);
             unreachable();
         }
         catch (ApplicationRuntimeException ex)
@@ -101,7 +101,7 @@
 
         InjectSpecification is = newSpec(l);
 
-        new InjectPageWorker().performEnhancement(op, is, null);
+        new InjectPageWorker().performEnhancement(op, is);
 
         verify();
     }
@@ -134,7 +134,7 @@
 
         InjectSpecification is = newSpec(l);
 
-        new InjectPageWorker().performEnhancement(op, is, null);
+        new InjectPageWorker().performEnhancement(op, is);
 
         verify();
     }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectScriptWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectScriptWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectScriptWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectScriptWorker.java
Wed Aug 15 15:00:22 2007
@@ -69,7 +69,7 @@
         InjectScriptWorker worker = new InjectScriptWorker();
         worker.setSource(source);
 
-        worker.performEnhancement(op, is, null);
+        worker.performEnhancement(op, is);
 
         verify();
     }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectStateWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectStateWorker.java?view=diff&rev=566354&r1=566353&r2=566354
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectStateWorker.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/enhance/TestInjectStateWorker.java
Wed Aug 15 15:00:22 2007
@@ -106,7 +106,7 @@
         InjectStateWorker w = new InjectStateWorker();
         w.setApplicationStateManager(asm);
 
-        w.performEnhancement(op, spec, null);
+        w.performEnhancement(op, spec);
 
         verify();
     }



Mime
View raw message