You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2011/04/11 19:33:52 UTC

svn commit: r1091137 - in /tapestry/tapestry5/trunk/tapestry-ioc/src: main/java/org/apache/tapestry5/ioc/ main/java/org/apache/tapestry5/ioc/internal/ main/java/org/apache/tapestry5/ioc/internal/services/ main/java/org/apache/tapestry5/ioc/internal/uti...

Author: hlship
Date: Mon Apr 11 17:33:51 2011
New Revision: 1091137

URL: http://svn.apache.org/viewvc?rev=1091137&view=rev
Log:
TAP5-853: Change InternalUtils.asLocation() to use PlasticProxyFactory

Modified:
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractMethodInvokingInstrumenter.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractServiceInstrumenter.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AdvisorDefImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DecoratorDefImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceAdvisorImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PlasticProxyFactoryImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalUtils.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/RegistryBuilderTest.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImplTest.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/IOCInternalTestCase.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTest.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImplTest.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ValidatingMappedConfigurationWrapperTest.java

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java Mon Apr 11 17:33:51 2011
@@ -127,7 +127,7 @@ public final class RegistryBuilder
 
             logger.info("Adding module definition for " + c);
 
-            ModuleDef def = new DefaultModuleDefImpl(c, logger, classFactory, proxyFactory);
+            ModuleDef def = new DefaultModuleDefImpl(c, logger, proxyFactory);
             add(def);
 
             SubModule annotation = ((AnnotatedElement) c).getAnnotation(SubModule.class);

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractMethodInvokingInstrumenter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractMethodInvokingInstrumenter.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractMethodInvokingInstrumenter.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractMethodInvokingInstrumenter.java Mon Apr 11 17:33:51 2011
@@ -1,10 +1,10 @@
-// Copyright 2009 The Apache Software Foundation
+// Copyright 2009, 2011 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,6 +22,7 @@ import org.apache.tapestry5.ioc.internal
 import org.apache.tapestry5.ioc.internal.util.InjectionResources;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.apache.tapestry5.ioc.services.ClassFactory;
+import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 import org.slf4j.Logger;
 
 import java.lang.reflect.InvocationTargetException;
@@ -30,7 +31,7 @@ import java.util.Map;
 
 /**
  * Based class for service decorators and service advisors that work by invoking a module method.
- *
+ * 
  * @since 5.1.0.0
  */
 public class AbstractMethodInvokingInstrumenter
@@ -41,23 +42,23 @@ public class AbstractMethodInvokingInstr
 
     private final ServiceResources resources;
 
-    private final ClassFactory classFactory;
+    private final PlasticProxyFactory proxyFactory;
 
     protected final Method method;
 
     protected final Class serviceInterface;
 
     protected final String serviceId;
-    
+
     private final Logger logger;
 
-    public AbstractMethodInvokingInstrumenter(
-            ModuleBuilderSource moduleSource, Method method, ServiceResources resources, ClassFactory classFactory)
+    public AbstractMethodInvokingInstrumenter(ModuleBuilderSource moduleSource, Method method,
+            ServiceResources resources, PlasticProxyFactory proxyFactory)
     {
         this.moduleSource = moduleSource;
         this.method = method;
         this.resources = resources;
-        this.classFactory = classFactory;
+        this.proxyFactory = proxyFactory;
 
         serviceId = resources.getServiceId();
 
@@ -74,14 +75,12 @@ public class AbstractMethodInvokingInstr
     @Override
     public String toString()
     {
-        return classFactory.getMethodLocation(method).toString();
+        return proxyFactory.getMethodLocation(method).toString();
     }
 
     private Object getModuleInstance()
     {
-        return InternalUtils.isStatic(method)
-               ? null
-               : moduleSource.getModuleBuilder();
+        return InternalUtils.isStatic(method) ? null : moduleSource.getModuleBuilder();
     }
 
     protected Object invoke(InjectionResources injectionResources)
@@ -94,10 +93,8 @@ public class AbstractMethodInvokingInstr
 
         try
         {
-            Object[] parameters = InternalUtils.calculateParametersForMethod(
-                    method,
-                    resources,
-                    injectionResources, resources.getTracker());
+            Object[] parameters = InternalUtils.calculateParametersForMethod(method, resources, injectionResources,
+                    resources.getTracker());
 
             result = method.invoke(getModuleInstance(), parameters);
         }
@@ -111,11 +108,8 @@ public class AbstractMethodInvokingInstr
         }
 
         if (failure != null)
-            throw new RuntimeException(
-                    String.format("Exception invoking method %s: %s",
-                                  this,
-                                  InternalUtils.toMessage(failure)),
-                    failure);
+            throw new RuntimeException(String.format("Exception invoking method %s: %s", this,
+                    InternalUtils.toMessage(failure)), failure);
 
         return result;
     }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractServiceInstrumenter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractServiceInstrumenter.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractServiceInstrumenter.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractServiceInstrumenter.java Mon Apr 11 17:33:51 2011
@@ -1,4 +1,4 @@
-// Copyright 2009, 2010 The Apache Software Foundation
+// Copyright 2009, 2010, 2011 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ import org.apache.tapestry5.ioc.IdMatche
 import org.apache.tapestry5.ioc.def.ServiceDef;
 import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
-import org.apache.tapestry5.ioc.services.ClassFactory;
+import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 
 /**
  * Abstract base class for implementations of {@link org.apache.tapestry5.ioc.ServiceDecorator} (i.e., old school) and
@@ -39,18 +39,19 @@ public class AbstractServiceInstrumenter
 
     protected final String[] constraints;
 
-    protected final ClassFactory classFactory;
-   
+    protected final PlasticProxyFactory proxyFactory;
+
     private final Set<Class> markers;
-   
+
     private final Class serviceInterface;
 
-    public AbstractServiceInstrumenter(Method method, String[] patterns, String[] constraints, Class serviceInterface, Set<Class> markers, ClassFactory classFactory)
+    public AbstractServiceInstrumenter(Method method, String[] patterns, String[] constraints, Class serviceInterface,
+            Set<Class> markers, PlasticProxyFactory proxyFactory)
     {
         this.method = method;
         this.serviceInterface = serviceInterface;
         this.markers = markers;
-        this.classFactory = classFactory;
+        this.proxyFactory = proxyFactory;
 
         assert patterns != null;
 
@@ -70,7 +71,7 @@ public class AbstractServiceInstrumenter
     @Override
     public String toString()
     {
-        return InternalUtils.asString(method, classFactory);
+        return InternalUtils.asString(method, proxyFactory);
     }
 
     public String[] getConstraints()

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AdvisorDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AdvisorDefImpl.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AdvisorDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AdvisorDefImpl.java Mon Apr 11 17:33:51 2011
@@ -1,10 +1,10 @@
-// Copyright 2009, 2010 The Apache Software Foundation
+// Copyright 2009, 2010, 2011 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,16 +22,16 @@ import org.apache.tapestry5.ioc.ModuleBu
 import org.apache.tapestry5.ioc.ServiceAdvisor;
 import org.apache.tapestry5.ioc.ServiceResources;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
-import org.apache.tapestry5.ioc.services.ClassFactory;
+import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 
 public class AdvisorDefImpl extends AbstractServiceInstrumenter implements AdvisorDef2
 {
     private final String advisorId;
 
-    public AdvisorDefImpl(Method method, String[] patterns, String[] constraints, ClassFactory classFactory,
-                          String advisorId, Class serviceInterface, Set<Class> markers)
+    public AdvisorDefImpl(Method method, String[] patterns, String[] constraints, PlasticProxyFactory proxyFactory,
+            String advisorId, Class serviceInterface, Set<Class> markers)
     {
-        super(method, patterns, constraints, serviceInterface, markers, classFactory);
+        super(method, patterns, constraints, serviceInterface, markers, proxyFactory);
         assert InternalUtils.isNonBlank(advisorId);
 
         this.advisorId = advisorId;
@@ -39,7 +39,7 @@ public class AdvisorDefImpl extends Abst
 
     public ServiceAdvisor createAdvisor(ModuleBuilderSource moduleSource, ServiceResources resources)
     {
-        return new ServiceAdvisorImpl(moduleSource, method, resources, classFactory);
+        return new ServiceAdvisorImpl(moduleSource, method, resources, proxyFactory);
     }
 
     public String getAdvisorId()

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java Mon Apr 11 17:33:51 2011
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -32,7 +32,7 @@ import org.apache.tapestry5.ioc.internal
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.apache.tapestry5.ioc.internal.util.MapInjectionResources;
 import org.apache.tapestry5.ioc.internal.util.WrongConfigurationTypeGuard;
-import org.apache.tapestry5.ioc.services.ClassFactory;
+import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 import org.slf4j.Logger;
 
 public class ContributionDefImpl implements ContributionDef2
@@ -41,20 +41,21 @@ public class ContributionDefImpl impleme
 
     private final Method contributorMethod;
 
-    private final ClassFactory classFactory;
-    
+    private final PlasticProxyFactory proxyFactory;
+
     private final Set<Class> markers;
-    
+
     private final Class serviceInterface;
 
-    private static final Class[] CONFIGURATION_TYPES = new Class[] {Configuration.class, MappedConfiguration.class,
-            OrderedConfiguration.class};
+    private static final Class[] CONFIGURATION_TYPES = new Class[]
+    { Configuration.class, MappedConfiguration.class, OrderedConfiguration.class };
 
-    public ContributionDefImpl(String serviceId, Method contributorMethod, ClassFactory classFactory, Class serviceInterface, Set<Class> markers)
+    public ContributionDefImpl(String serviceId, Method contributorMethod, PlasticProxyFactory proxyFactory,
+            Class serviceInterface, Set<Class> markers)
     {
         this.serviceId = serviceId;
         this.contributorMethod = contributorMethod;
-        this.classFactory = classFactory;
+        this.proxyFactory = proxyFactory;
         this.serviceInterface = serviceInterface;
         this.markers = markers;
     }
@@ -62,7 +63,7 @@ public class ContributionDefImpl impleme
     @Override
     public String toString()
     {
-        return InternalUtils.asString(contributorMethod, classFactory);
+        return InternalUtils.asString(contributorMethod, proxyFactory);
     }
 
     public String getServiceId()
@@ -70,26 +71,25 @@ public class ContributionDefImpl impleme
         return serviceId;
     }
 
-    public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
-                           Configuration configuration)
+    public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources, Configuration configuration)
     {
         invokeMethod(moduleSource, resources, Configuration.class, configuration);
     }
 
     public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
-                           OrderedConfiguration configuration)
+            OrderedConfiguration configuration)
     {
         invokeMethod(moduleSource, resources, OrderedConfiguration.class, configuration);
     }
 
     public void contribute(ModuleBuilderSource moduleSource, ServiceResources resources,
-                           MappedConfiguration configuration)
+            MappedConfiguration configuration)
     {
         invokeMethod(moduleSource, resources, MappedConfiguration.class, configuration);
     }
 
-    private <T> void invokeMethod(ModuleBuilderSource source, ServiceResources resources,
-                                  Class<T> parameterType, T parameterValue)
+    private <T> void invokeMethod(ModuleBuilderSource source, ServiceResources resources, Class<T> parameterType,
+            T parameterValue)
     {
         Map<Class, Object> resourceMap = CollectionFactory.newMap();
 
@@ -105,23 +105,18 @@ public class ContributionDefImpl impleme
         {
             if (parameterType != t)
             {
-                injectionResources = new DelegatingInjectionResources(
-                        new WrongConfigurationTypeGuard(resources.getServiceId(), t, parameterType),
-                        injectionResources);
+                injectionResources = new DelegatingInjectionResources(new WrongConfigurationTypeGuard(
+                        resources.getServiceId(), t, parameterType), injectionResources);
             }
         }
 
-
         Throwable fail = null;
 
-        Object moduleInstance = InternalUtils.isStatic(contributorMethod) ? null : source
-                .getModuleBuilder();
+        Object moduleInstance = InternalUtils.isStatic(contributorMethod) ? null : source.getModuleBuilder();
 
         try
         {
-            Object[] parameters = InternalUtils.calculateParametersForMethod(
-                    contributorMethod,
-                    resources,
+            Object[] parameters = InternalUtils.calculateParametersForMethod(contributorMethod, resources,
                     injectionResources, resources.getTracker());
 
             contributorMethod.invoke(moduleInstance, parameters);
@@ -136,8 +131,7 @@ public class ContributionDefImpl impleme
         }
 
         if (fail != null)
-            throw new RuntimeException(IOCMessages
-                    .contributionMethodError(contributorMethod, fail), fail);
+            throw new RuntimeException(IOCMessages.contributionMethodError(contributorMethod, fail), fail);
     }
 
     public Set<Class> getMarkers()

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DecoratorDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DecoratorDefImpl.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DecoratorDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DecoratorDefImpl.java Mon Apr 11 17:33:51 2011
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2009, 2010, 2011 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,28 +22,25 @@ import org.apache.tapestry5.ioc.ServiceD
 import org.apache.tapestry5.ioc.ServiceResources;
 import org.apache.tapestry5.ioc.def.DecoratorDef2;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
-import org.apache.tapestry5.ioc.services.ClassFactory;
+import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 
 public class DecoratorDefImpl extends AbstractServiceInstrumenter implements DecoratorDef2
 {
     private final String decoratorId;
 
-    public DecoratorDefImpl(Method decoratorMethod, String[] patterns, String[] constraints, ClassFactory classFactory,
-                            String decoratorId, Class serviceInterface, Set<Class> markers
-    )
+    public DecoratorDefImpl(Method decoratorMethod, String[] patterns, String[] constraints,
+            PlasticProxyFactory proxyFactory, String decoratorId, Class serviceInterface, Set<Class> markers)
     {
-        super(decoratorMethod, patterns, constraints, serviceInterface, markers, classFactory);
+        super(decoratorMethod, patterns, constraints, serviceInterface, markers, proxyFactory);
         assert InternalUtils.isNonBlank(decoratorId);
 
         this.decoratorId = decoratorId;
 
-
     }
 
-    public ServiceDecorator createDecorator(ModuleBuilderSource moduleSource,
-                                            ServiceResources resources)
+    public ServiceDecorator createDecorator(ModuleBuilderSource moduleSource, ServiceResources resources)
     {
-        return new ServiceDecoratorImpl(method, moduleSource, resources, classFactory);
+        return new ServiceDecoratorImpl(method, moduleSource, resources, proxyFactory);
     }
 
     public String getDecoratorId()

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java Mon Apr 11 17:33:51 2011
@@ -47,7 +47,6 @@ import org.apache.tapestry5.ioc.annotati
 import org.apache.tapestry5.ioc.annotations.Order;
 import org.apache.tapestry5.ioc.annotations.PreventServiceDecoration;
 import org.apache.tapestry5.ioc.annotations.Scope;
-import org.apache.tapestry5.ioc.annotations.ServiceId;
 import org.apache.tapestry5.ioc.annotations.Startup;
 import org.apache.tapestry5.ioc.def.ContributionDef;
 import org.apache.tapestry5.ioc.def.ContributionDef2;
@@ -56,7 +55,6 @@ import org.apache.tapestry5.ioc.def.Modu
 import org.apache.tapestry5.ioc.def.ServiceDef;
 import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
-import org.apache.tapestry5.ioc.services.ClassFactory;
 import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 import org.slf4j.Logger;
 
@@ -91,8 +89,6 @@ public class DefaultModuleDefImpl implem
 
     private final Logger logger;
 
-    private final ClassFactory classFactory;
-
     private final PlasticProxyFactory proxyFactory;
 
     /**
@@ -125,18 +121,13 @@ public class DefaultModuleDefImpl implem
      *            the class that is responsible for building services, etc.
      * @param logger
      *            based on the class name of the module
-     * @param classFactory
-     *            factory used to create new classes at runtime or locate method line numbers for
-     *            error reporting
      * @param proxyFactory
      *            factory used to create proxy classes at runtime
      */
-    public DefaultModuleDefImpl(Class<?> moduleClass, Logger logger, ClassFactory classFactory,
-            PlasticProxyFactory proxyFactory)
+    public DefaultModuleDefImpl(Class<?> moduleClass, Logger logger, PlasticProxyFactory proxyFactory)
     {
         this.moduleClass = moduleClass;
         this.logger = logger;
-        this.classFactory = classFactory;
         this.proxyFactory = proxyFactory;
 
         Marker annotation = moduleClass.getAnnotation(Marker.class);
@@ -273,7 +264,7 @@ public class DefaultModuleDefImpl implem
     {
         Set<Class> markers = Collections.emptySet();
 
-        ContributionDef2 def = new ContributionDefImpl("RegistryStartup", method, classFactory, Runnable.class, markers);
+        ContributionDef2 def = new ContributionDefImpl("RegistryStartup", method, proxyFactory, Runnable.class, markers);
 
         contributionDefs.add(def);
     }
@@ -310,7 +301,7 @@ public class DefaultModuleDefImpl implem
 
         Set<Class> markers = extractMarkers(method, Contribute.class);
 
-        ContributionDef2 def = new ContributionDefImpl(serviceId, method, classFactory, serviceInterface, markers);
+        ContributionDef2 def = new ContributionDefImpl(serviceId, method, proxyFactory, serviceInterface, markers);
 
         contributionDefs.add(def);
     }
@@ -336,7 +327,7 @@ public class DefaultModuleDefImpl implem
         Set<Class> markers = extractMarkers(method, Decorate.class);
 
         DecoratorDef def = new DecoratorDefImpl(method, extractPatterns(annotation, decoratorId, method),
-                extractConstraints(method), classFactory, decoratorId, serviceInterface, markers);
+                extractConstraints(method), proxyFactory, decoratorId, serviceInterface, markers);
 
         decoratorDefs.put(decoratorId, def);
     }
@@ -403,7 +394,7 @@ public class DefaultModuleDefImpl implem
         Set<Class> markers = extractMarkers(method, Advise.class);
 
         AdvisorDef def = new AdvisorDefImpl(method, extractPatterns(annotation, advisorId, method),
-                extractConstraints(method), classFactory, advisorId, serviceInterface, markers);
+                extractConstraints(method), proxyFactory, advisorId, serviceInterface, markers);
 
         advisorDefs.put(advisorId, def);
 
@@ -416,7 +407,7 @@ public class DefaultModuleDefImpl implem
 
     private String toString(Method method)
     {
-        return InternalUtils.asString(method, classFactory);
+        return InternalUtils.asString(method, proxyFactory);
     }
 
     private String stripMethodPrefix(Method method, String prefix)

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ModuleImpl.java Mon Apr 11 17:33:51 2011
@@ -52,7 +52,6 @@ import org.apache.tapestry5.ioc.internal
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.apache.tapestry5.ioc.internal.util.MapInjectionResources;
 import org.apache.tapestry5.ioc.services.AspectDecorator;
-import org.apache.tapestry5.ioc.services.ClassFactory;
 import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 import org.apache.tapestry5.ioc.services.Status;
 import org.apache.tapestry5.plastic.ClassInstantiator;
@@ -74,8 +73,6 @@ public class ModuleImpl implements Modul
 
     private final ModuleDef2 moduleDef;
 
-    private final ClassFactory classFactory;
-
     private final PlasticProxyFactory proxyFactory;
 
     private final Logger logger;
@@ -109,13 +106,12 @@ public class ModuleImpl implements Modul
             { ObjectStreamException.class.getName() });
 
     public ModuleImpl(InternalRegistry registry, ServiceActivityTracker tracker, ModuleDef moduleDef,
-            ClassFactory classFactory, PlasticProxyFactory proxyFactory, Logger logger)
+            PlasticProxyFactory proxyFactory, Logger logger)
     {
         this.registry = registry;
         this.tracker = tracker;
         this.proxyFactory = proxyFactory;
         this.moduleDef = InternalUtils.toModuleDef2(moduleDef);
-        this.classFactory = classFactory;
         this.logger = logger;
 
         for (String id : moduleDef.getServiceIds())

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java Mon Apr 11 17:33:51 2011
@@ -209,7 +209,7 @@ public class RegistryImpl implements Reg
         {
             logger = this.loggerSource.getLogger(def.getLoggerName());
 
-            Module module = new ModuleImpl(this, tracker, def, classFactory, proxyFactory, logger);
+            Module module = new ModuleImpl(this, tracker, def, proxyFactory, logger);
 
             Set<ServiceDef2> moduleServiceDefs = CollectionFactory.newSet();
 

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceAdvisorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceAdvisorImpl.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceAdvisorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceAdvisorImpl.java Mon Apr 11 17:33:51 2011
@@ -1,10 +1,10 @@
-// Copyright 2009 The Apache Software Foundation
+// Copyright 2009, 2011 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,6 +14,9 @@
 
 package org.apache.tapestry5.ioc.internal;
 
+import java.lang.reflect.Method;
+import java.util.Map;
+
 import org.apache.tapestry5.ioc.MethodAdviceReceiver;
 import org.apache.tapestry5.ioc.ModuleBuilderSource;
 import org.apache.tapestry5.ioc.ServiceAdvisor;
@@ -21,17 +24,14 @@ import org.apache.tapestry5.ioc.ServiceR
 import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 import org.apache.tapestry5.ioc.internal.util.InjectionResources;
 import org.apache.tapestry5.ioc.internal.util.MapInjectionResources;
-import org.apache.tapestry5.ioc.services.ClassFactory;
-
-import java.lang.reflect.Method;
-import java.util.Map;
+import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 
 public class ServiceAdvisorImpl extends AbstractMethodInvokingInstrumenter implements ServiceAdvisor
 {
     public ServiceAdvisorImpl(ModuleBuilderSource moduleSource, Method method, ServiceResources resources,
-                              ClassFactory classFactory)
+            PlasticProxyFactory proxyFactory)
     {
-        super(moduleSource, method, resources, classFactory);
+        super(moduleSource, method, resources, proxyFactory);
     }
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImpl.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImpl.java Mon Apr 11 17:33:51 2011
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2011 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,16 +14,16 @@
 
 package org.apache.tapestry5.ioc.internal;
 
+import java.lang.reflect.Method;
+import java.util.Map;
+
 import org.apache.tapestry5.ioc.ModuleBuilderSource;
 import org.apache.tapestry5.ioc.ServiceDecorator;
 import org.apache.tapestry5.ioc.ServiceResources;
 import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 import org.apache.tapestry5.ioc.internal.util.InjectionResources;
 import org.apache.tapestry5.ioc.internal.util.MapInjectionResources;
-import org.apache.tapestry5.ioc.services.ClassFactory;
-
-import java.lang.reflect.Method;
-import java.util.Map;
+import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 
 /**
  * A wrapper around a decorator method.
@@ -31,10 +31,10 @@ import java.util.Map;
 public class ServiceDecoratorImpl extends AbstractMethodInvokingInstrumenter implements ServiceDecorator
 {
 
-    public ServiceDecoratorImpl(Method method, ModuleBuilderSource moduleSource,
-                                ServiceResources resources, ClassFactory classFactory)
+    public ServiceDecoratorImpl(Method method, ModuleBuilderSource moduleSource, ServiceResources resources,
+            PlasticProxyFactory proxyFactory)
     {
-        super(moduleSource, method, resources, classFactory);
+        super(moduleSource, method, resources, proxyFactory);
     }
 
     public Object createInterceptor(Object delegate)
@@ -50,14 +50,8 @@ public class ServiceDecoratorImpl extend
 
         Object result = invoke(injectionResources);
 
-        if (result != null && !serviceInterface.isInstance(result))
-        {
-            throw new RuntimeException(IOCMessages.decoratorReturnedWrongType(
-                    method,
-                    serviceId,
-                    result,
-                    serviceInterface));
-        }
+        if (result != null && !serviceInterface.isInstance(result)) { throw new RuntimeException(
+                IOCMessages.decoratorReturnedWrongType(method, serviceId, result, serviceInterface)); }
 
         return result;
     }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PlasticProxyFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PlasticProxyFactoryImpl.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PlasticProxyFactoryImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PlasticProxyFactoryImpl.java Mon Apr 11 17:33:51 2011
@@ -1,3 +1,17 @@
+// Copyright 2011 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package org.apache.tapestry5.ioc.internal.services;
 
 import java.lang.reflect.Constructor;

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalUtils.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalUtils.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/util/InternalUtils.java Mon Apr 11 17:33:51 2011
@@ -82,6 +82,7 @@ import org.apache.tapestry5.ioc.internal
 import org.apache.tapestry5.ioc.services.ClassFabUtils;
 import org.apache.tapestry5.ioc.services.ClassFactory;
 import org.apache.tapestry5.ioc.services.Coercion;
+import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 import org.apache.tapestry5.plastic.MethodAdvice;
 import org.apache.tapestry5.plastic.MethodInvocation;
 
@@ -107,19 +108,19 @@ public class InternalUtils
             Pattern.CASE_INSENSITIVE);
 
     /**
-     * Converts a method to a user presentable string using a {@link ClassFactory} to obtain a {@link Location} (where
-     * possible). {@link #asString(Method)} is used under the covers, to present a detailed, but not excessive,
+     * Converts a method to a user presentable string using a {@link PlasticProxyFactory} to obtain a {@link Location}
+     * (where possible). {@link #asString(Method)} is used under the covers, to present a detailed, but not excessive,
      * description of the class, method and parameters.
      * 
      * @param method
      *            method to convert to a string
-     * @param classFactory
+     * @param proxyFactory
      *            used to obtain the {@link Location}
      * @return the method formatted for presentation to the user
      */
-    public static String asString(Method method, ClassFactory classFactory)
+    public static String asString(Method method, PlasticProxyFactory proxyFactory)
     {
-        Location location = classFactory.getMethodLocation(method);
+        Location location = proxyFactory.getMethodLocation(method);
 
         return location != null ? location.toString() : asString(method);
     }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/RegistryBuilderTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/RegistryBuilderTest.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/RegistryBuilderTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/RegistryBuilderTest.java Mon Apr 11 17:33:51 2011
@@ -94,7 +94,7 @@ public class RegistryBuilderTest extends
         Logger logger = LoggerFactory.getLogger(getClass());
         ClassFactory classFactory = new ClassFactoryImpl();
 
-        ModuleDef module = new DefaultModuleDefImpl(ServiceBuilderModule.class, logger, classFactory, null);
+        ModuleDef module = new DefaultModuleDefImpl(ServiceBuilderModule.class, logger, null);
         
         Registry r = RegistryBuilder.buildAndStartupRegistry(module, MasterModule.class);
         

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImplTest.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImplTest.java Mon Apr 11 17:33:51 2011
@@ -73,7 +73,7 @@ public class DefaultModuleDefImplTest ex
 
         // BigDecimal is arbitrary, any class would do.
 
-        ModuleDef md = new DefaultModuleDefImpl(SimpleModule.class, logger, classFactory, null);
+        ModuleDef md = new DefaultModuleDefImpl(SimpleModule.class, logger, proxyFactory);
 
         assertEquals(md.toString(), "ModuleDef[" + className + " Barney, Fred, Wilma]");
 
@@ -119,7 +119,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef def = new DefaultModuleDefImpl(ServiceIdViaAnnotationModule.class, logger, null, null);
+        ModuleDef def = new DefaultModuleDefImpl(ServiceIdViaAnnotationModule.class, logger, null);
 
         assertEquals(def.getServiceIds().size(), 2);
 
@@ -137,7 +137,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef def = new DefaultModuleDefImpl(ServiceIdViaAnnotationModule.class, logger, null, null);
+        ModuleDef def = new DefaultModuleDefImpl(ServiceIdViaAnnotationModule.class, logger, null);
 
         assertEquals(def.getServiceIds().size(), 2);
 
@@ -155,7 +155,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef def = new DefaultModuleDefImpl(NamedServiceModule.class, logger, null, null);
+        ModuleDef def = new DefaultModuleDefImpl(NamedServiceModule.class, logger, null);
 
         assertEquals(def.getServiceIds().size(), 2);
 
@@ -173,7 +173,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef def = new DefaultModuleDefImpl(NamedServiceModule.class, logger, null, null);
+        ModuleDef def = new DefaultModuleDefImpl(NamedServiceModule.class, logger, null);
 
         assertEquals(def.getServiceIds().size(), 2);
 
@@ -191,7 +191,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef def = new DefaultModuleDefImpl(DefaultServiceIdModule.class, logger, null, null);
+        ModuleDef def = new DefaultModuleDefImpl(DefaultServiceIdModule.class, logger, null);
 
         assertEquals(def.getServiceIds().size(), 1);
 
@@ -209,10 +209,10 @@ public class DefaultModuleDefImplTest ex
     public void service_id_conflict() throws Exception
     {
         Method conflictMethod = ServiceIdConflictMethodModule.class.getMethod("buildFred");
-        String conflictMethodString = InternalUtils.asString(conflictMethod, classFactory);
+        String conflictMethodString = InternalUtils.asString(conflictMethod, proxyFactory);
 
         String expectedMethod = InternalUtils.asString(
-                ServiceIdConflictMethodModule.class.getMethod("buildFred", Object.class), classFactory);
+                ServiceIdConflictMethodModule.class.getMethod("buildFred", Object.class), proxyFactory);
 
         Logger logger = mockLogger();
 
@@ -222,7 +222,7 @@ public class DefaultModuleDefImplTest ex
 
         try
         {
-            new DefaultModuleDefImpl(ServiceIdConflictMethodModule.class, logger, classFactory, null);
+            new DefaultModuleDefImpl(ServiceIdConflictMethodModule.class, logger, proxyFactory);
 
             unreachable();
         }
@@ -248,7 +248,7 @@ public class DefaultModuleDefImplTest ex
 
         try
         {
-            new DefaultModuleDefImpl(VoidBuilderMethodModule.class, logger, null, null);
+            new DefaultModuleDefImpl(VoidBuilderMethodModule.class, logger, null);
             unreachable();
         }
         catch (RuntimeException ex)
@@ -270,7 +270,7 @@ public class DefaultModuleDefImplTest ex
 
         try
         {
-            new DefaultModuleDefImpl(BuilderMethodModule.class, logger, null, null);
+            new DefaultModuleDefImpl(BuilderMethodModule.class, logger, null);
             unreachable();
         }
         catch (RuntimeException ex)
@@ -297,7 +297,7 @@ public class DefaultModuleDefImplTest ex
 
         try
         {
-            new DefaultModuleDefImpl(moduleClass, logger, null, null);
+            new DefaultModuleDefImpl(moduleClass, logger, null);
             unreachable();
         }
         catch (RuntimeException ex)
@@ -345,7 +345,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(moduleClass, logger, classFactory, null);
+        ModuleDef md = new DefaultModuleDefImpl(moduleClass, logger, proxyFactory);
 
         Set<ContributionDef> defs = md.getContributionDefs();
 
@@ -377,7 +377,7 @@ public class DefaultModuleDefImplTest ex
 
         try
         {
-            new DefaultModuleDefImpl(moduleClass, logger, null, null);
+            new DefaultModuleDefImpl(moduleClass, logger, null);
             unreachable();
         }
         catch (RuntimeException ex)
@@ -402,7 +402,7 @@ public class DefaultModuleDefImplTest ex
 
         try
         {
-            new DefaultModuleDefImpl(moduleClass, logger, null, null);
+            new DefaultModuleDefImpl(moduleClass, logger, null);
             unreachable();
         }
         catch (RuntimeException ex)
@@ -422,7 +422,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(AutobuildModule.class, logger, classFactory, null);
+        ModuleDef md = new DefaultModuleDefImpl(AutobuildModule.class, logger, null);
 
         ServiceDef sd = md.getServiceDef("StringHolder");
 
@@ -441,7 +441,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(ComplexAutobuildModule.class, logger, classFactory, null);
+        ModuleDef md = new DefaultModuleDefImpl(ComplexAutobuildModule.class, logger, null);
 
         ServiceDef sd = md.getServiceDef("SH");
 
@@ -462,7 +462,7 @@ public class DefaultModuleDefImplTest ex
 
         try
         {
-            new DefaultModuleDefImpl(UninstantiableAutobuildServiceModule.class, logger, classFactory, null);
+            new DefaultModuleDefImpl(UninstantiableAutobuildServiceModule.class, logger, null);
             unreachable();
         }
         catch (RuntimeException ex)
@@ -484,7 +484,7 @@ public class DefaultModuleDefImplTest ex
 
         try
         {
-            new DefaultModuleDefImpl(NonStaticBindMethodModule.class, logger, classFactory, null);
+            new DefaultModuleDefImpl(NonStaticBindMethodModule.class, logger, proxyFactory);
             unreachable();
         }
         catch (RuntimeException ex)
@@ -518,8 +518,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef def = new DefaultModuleDefImpl(MutlipleAutobuildServiceConstructorsModule.class, logger,
-                classFactory, proxyFactory);
+        ModuleDef def = new DefaultModuleDefImpl(MutlipleAutobuildServiceConstructorsModule.class, logger, proxyFactory);
 
         ServiceDef sd = def.getServiceDef("StringHolder");
 
@@ -544,7 +543,7 @@ public class DefaultModuleDefImplTest ex
 
         try
         {
-            new DefaultModuleDefImpl(ExceptionInBindMethod.class, logger, classFactory, null);
+            new DefaultModuleDefImpl(ExceptionInBindMethod.class, logger, proxyFactory);
             unreachable();
         }
         catch (RuntimeException ex)
@@ -564,7 +563,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(EagerLoadViaAnnotationModule.class, logger, classFactory, null);
+        ModuleDef md = new DefaultModuleDefImpl(EagerLoadViaAnnotationModule.class, logger, null);
 
         ServiceDef sd = md.getServiceDef("Runnable");
 
@@ -580,7 +579,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, classFactory, null);
+        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, null);
 
         ServiceDef sd = md.getServiceDef("Greeter");
 
@@ -596,7 +595,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, classFactory, null);
+        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, null);
 
         ServiceDef sd = md.getServiceDef("RedGreeter");
 
@@ -612,7 +611,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, classFactory, null);
+        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, null);
 
         ServiceDef sd = md.getServiceDef("SecondRedGreeter");
 
@@ -629,7 +628,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, classFactory, null);
+        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, null);
 
         ServiceDef sd = md.getServiceDef("SurprisinglyBlueGreeter");
 
@@ -656,7 +655,7 @@ public class DefaultModuleDefImplTest ex
 
         replay();
 
-        ModuleDef md = new DefaultModuleDefImpl(moduleClass, logger, classFactory, null);
+        ModuleDef md = new DefaultModuleDefImpl(moduleClass, logger, null);
 
         // reality check that a service was found
 

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/IOCInternalTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/IOCInternalTestCase.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/IOCInternalTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/IOCInternalTestCase.java Mon Apr 11 17:33:51 2011
@@ -4,7 +4,7 @@
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -25,6 +25,7 @@ import org.apache.tapestry5.ioc.Registry
 import org.apache.tapestry5.ioc.ServiceDecorator;
 import org.apache.tapestry5.ioc.def.ServiceDef;
 import org.apache.tapestry5.ioc.services.ClassFactory;
+import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
 import org.apache.tapestry5.ioc.test.IOCTestCase;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.AfterSuite;
@@ -36,6 +37,8 @@ public class IOCInternalTestCase extends
 
     private static ClassFactory classFactory;
 
+    private static PlasticProxyFactory proxyFactory;
+
     @AfterMethod
     public final void cleanupThread()
     {
@@ -47,6 +50,11 @@ public class IOCInternalTestCase extends
         return classFactory;
     }
 
+    public final PlasticProxyFactory getProxyFactory()
+    {
+        return proxyFactory;
+    }
+
     public final <T> T getObject(Class<T> objectType, AnnotationProvider annotationProvider)
     {
         return registry.getObject(objectType, annotationProvider);
@@ -92,6 +100,8 @@ public class IOCInternalTestCase extends
         registry.performRegistryStartup();
 
         classFactory = registry.getService(ClassFactory.class);
+        proxyFactory = registry.getService(PlasticProxyFactory.class);
+
     }
 
     public final void shutdown()
@@ -135,8 +145,8 @@ public class IOCInternalTestCase extends
         expect(source.getDescription()).andReturn(description).atLeastOnce();
     }
 
-    protected final <T> void train_getService(InternalRegistry registry, String serviceId,
-            Class<T> serviceInterface, T service)
+    protected final <T> void train_getService(InternalRegistry registry, String serviceId, Class<T> serviceInterface,
+            T service)
     {
         expect(registry.getService(serviceId, serviceInterface)).andReturn(service);
     }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTest.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTest.java Mon Apr 11 17:33:51 2011
@@ -41,9 +41,9 @@ public class ModuleImplTest extends IOCI
         InternalRegistry registry = mockInternalRegistry();
         Logger logger = mockLogger();
 
-        ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, logger, null, null);
+        ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, logger, null);
 
-        Module module = new ModuleImpl(registry, null, moduleDef, null, null, logger);
+        Module module = new ModuleImpl(registry, null, moduleDef, null, logger);
 
         replay();
 
@@ -82,7 +82,7 @@ public class ModuleImplTest extends IOCI
 
         replay();
 
-        Module module = new ModuleImpl(registry, null, moduleDef, null, null, logger);
+        Module module = new ModuleImpl(registry, null, moduleDef, null, logger);
 
         Set<DecoratorDef> defs = module.findMatchingDecoratorDefs(serviceDef);
 

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImplTest.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceDecoratorImplTest.java Mon Apr 11 17:33:51 2011
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2011 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -42,7 +42,7 @@ public class ServiceDecoratorImplTest ex
 
     /**
      * Also, test logging of decorator method invocation.
-     *
+     * 
      * @throws Exception
      */
     @Test
@@ -61,17 +61,15 @@ public class ServiceDecoratorImplTest ex
 
         train_isDebugEnabled(logger, true);
 
-        logger.debug(EasyMock.contains(
-                "Invoking method org.apache.tapestry5.ioc.internal.ServiceDecoratorFixture.decoratorReturnsInterceptor(Class, Object)"));
+        logger.debug(EasyMock
+                .contains("Invoking method org.apache.tapestry5.ioc.internal.ServiceDecoratorFixture.decoratorReturnsInterceptor(Class, Object)"));
 
         replay();
 
-
         // Check that the delegate gets passed in; check that the return value of the
         // decorator method is the return value of the ServiceDecorator.
 
-        ServiceDecoratorImpl decorator = new ServiceDecoratorImpl(m, source, resources,
-                                                                  getClassFactory());
+        ServiceDecoratorImpl decorator = new ServiceDecoratorImpl(m, source, resources, getProxyFactory());
 
         Object interceptor = decorator.createInterceptor(fixture.expectedDelegate);
 
@@ -97,8 +95,7 @@ public class ServiceDecoratorImplTest ex
 
         Method m = findMethod(fixture, "decorateReturnNull");
 
-        ServiceDecoratorImpl decorator = new ServiceDecoratorImpl(m, source, resources,
-                                                                  getClassFactory());
+        ServiceDecoratorImpl decorator = new ServiceDecoratorImpl(m, source, resources, getProxyFactory());
 
         Object interceptor = decorator.createInterceptor(delegate);
 
@@ -123,11 +120,9 @@ public class ServiceDecoratorImplTest ex
 
         train_isDebugEnabled(logger, false);
 
-
         replay();
 
-        ServiceDecoratorImpl decorator = new ServiceDecoratorImpl(m, source, resources,
-                                                                  getClassFactory());
+        ServiceDecoratorImpl decorator = new ServiceDecoratorImpl(m, source, resources, getProxyFactory());
 
         try
         {
@@ -136,9 +131,10 @@ public class ServiceDecoratorImplTest ex
         }
         catch (RuntimeException ex)
         {
-            assertMessageContains(ex,
-                                  "Decorator method org.apache.tapestry5.ioc.internal.ServiceDecoratorFixture.decoratorUntyped(Object)",
-                                  "(invoked for service 'ioc.Fie') returned FoeService, which is not assignable to the org.apache.tapestry5.ioc.internal.FieService service interface.");
+            assertMessageContains(
+                    ex,
+                    "Decorator method org.apache.tapestry5.ioc.internal.ServiceDecoratorFixture.decoratorUntyped(Object)",
+                    "(invoked for service 'ioc.Fie') returned FoeService, which is not assignable to the org.apache.tapestry5.ioc.internal.FieService service interface.");
 
         }
 
@@ -163,8 +159,7 @@ public class ServiceDecoratorImplTest ex
 
         Method m = findMethod(fixture, "decoratorThrowsException");
 
-        ServiceDecoratorImpl decorator = new ServiceDecoratorImpl(m, source, resources,
-                                                                  getClassFactory());
+        ServiceDecoratorImpl decorator = new ServiceDecoratorImpl(m, source, resources, getProxyFactory());
 
         try
         {
@@ -173,9 +168,10 @@ public class ServiceDecoratorImplTest ex
         }
         catch (RuntimeException ex)
         {
-            assertMessageContains(ex,
-                                  "Exception invoking method org.apache.tapestry5.ioc.internal.ServiceDecoratorFixture.decoratorThrowsException(Object)",
-                                  "Ouch!");
+            assertMessageContains(
+                    ex,
+                    "Exception invoking method org.apache.tapestry5.ioc.internal.ServiceDecoratorFixture.decoratorThrowsException(Object)",
+                    "Ouch!");
 
             Throwable cause = ex.getCause();
 

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ValidatingMappedConfigurationWrapperTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ValidatingMappedConfigurationWrapperTest.java?rev=1091137&r1=1091136&r2=1091137&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ValidatingMappedConfigurationWrapperTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ValidatingMappedConfigurationWrapperTest.java Mon Apr 11 17:33:51 2011
@@ -214,7 +214,7 @@ public class ValidatingMappedConfigurati
 
     private ContributionDef newContributionDef(String methodName)
     {
-        return new ContributionDefImpl(SERVICE_ID, findMethod(methodName), getClassFactory(), null, null);
+        return new ContributionDefImpl(SERVICE_ID, findMethod(methodName), getProxyFactory(), null, null);
     }
 
     public void contributionPlaceholder1()