tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1297301 - /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
Date Tue, 06 Mar 2012 00:02:22 GMT
Author: rmannibucau
Date: Tue Mar  6 00:02:21 2012
New Revision: 1297301

URL: http://svn.apache.org/viewvc?rev=1297301&view=rev
Log:
ability to get injection in dynamic proxy handler + implicit injection of the proxies interface

Modified:
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java

Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java?rev=1297301&r1=1297300&r2=1297301&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
(original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
Tue Mar  6 00:02:21 2012
@@ -1279,11 +1279,27 @@ public class BeanContext extends Deploym
 
             // Create bean instance
             final Object beanInstance;
-            final InjectionProcessor injectionProcessor = new InjectionProcessor(beanConstructor.create(creationalContext),
this.getInjections(), InjectionProcessor.unwrap(ctx));
+            final InjectionProcessor injectionProcessor;
             if (!isDynamicallyImplemented()) {
+                injectionProcessor = new InjectionProcessor(beanConstructor.create(creationalContext),
getInjections(), InjectionProcessor.unwrap(ctx));
                 beanInstance = injectionProcessor.createInstance();
                 inject(beanInstance, creationalContext);
             } else {
+                // update target
+                final List<Injection> newInjections = new ArrayList<Injection>();
+                for (Injection injection : getInjections()) {
+                    if (beanClass.equals(injection.getTarget())) {
+                        final Injection updated = new Injection(injection.getJndiName(),
injection.getName(), beanDefinition.getBeanClass());
+                        newInjections.add(updated);
+                    } else {
+                        newInjections.add(injection);
+                    }
+                }
+                injections.clear();
+                injections.addAll(newInjections);
+
+                injectionProcessor = new InjectionProcessor(beanConstructor.create(creationalContext),
injections, InjectionProcessor.unwrap(ctx));
+                injectionProcessor.setProperty("implementingInterfaceClass", beanClass);
                 InvocationHandler handler = (InvocationHandler) injectionProcessor.createInstance();
                 beanInstance = DynamicProxyImplFactory.newProxy(this, handler);
                 inject(handler, creationalContext);



Mime
View raw message