You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by bd...@apache.org on 2010/08/18 15:53:48 UTC

svn commit: r986678 - in /tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java: context/ invocation/

Author: bdaniel
Date: Wed Aug 18 13:53:47 2010
New Revision: 986678

URL: http://svn.apache.org/viewvc?rev=986678&view=rev
Log:
TUSCANY-3652 Inject callbacks at service invocation

Modified:
    tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
    tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java
    tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaAsyncImplementationInvoker.java
    tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
    tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
    tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
    tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java?rev=986678&r1=986677&r2=986678&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java Wed Aug 18 13:53:47 2010
@@ -36,15 +36,18 @@ public class ReflectiveInstanceFactory<T
     private final Injector<T>[] injectors;
     private final EventInvoker<T> initInvoker;
     private final EventInvoker<T> destroyInvoker;
+	private final Injector<T>[] callbackInjectors;
 
     public ReflectiveInstanceFactory(Constructor<T> ctr,
                                      ObjectFactory<?>[] ctrArgs,
                                      Injector<T>[] injectors,
+                                     Injector<T>[] callbackInjectors,
                                      EventInvoker<T> initInvoker,
                                      EventInvoker<T> destroyInvoker) {
         this.ctr = ctr;
         this.ctrArgs = ctrArgs;
         this.injectors = injectors;
+        this.callbackInjectors = callbackInjectors;
         this.initInvoker = initInvoker;
         this.destroyInvoker = destroyInvoker;
     }
@@ -88,6 +91,6 @@ public class ReflectiveInstanceFactory<T
             }
         }
 
-        return new ReflectiveInstanceWrapper<T>(instance, initInvoker, destroyInvoker);
+        return new ReflectiveInstanceWrapper<T>(instance, initInvoker, destroyInvoker, callbackInjectors);
     }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java?rev=986678&r1=986677&r2=986678&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java Wed Aug 18 13:53:47 2010
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca.implement
 import org.apache.tuscany.sca.core.factory.InstanceWrapper;
 import org.apache.tuscany.sca.core.scope.TargetDestructionException;
 import org.apache.tuscany.sca.core.scope.TargetInitializationException;
+import org.apache.tuscany.sca.implementation.java.injection.Injector;
 import org.apache.tuscany.sca.implementation.java.invocation.EventInvoker;
 
 /**
@@ -30,11 +31,13 @@ public class ReflectiveInstanceWrapper<T
     private final EventInvoker<T> initInvoker;
     private final EventInvoker<T> destroyInvoker;
     private final T instance;
+	private final Injector<T>[] callbackInjectors;
 
-    public ReflectiveInstanceWrapper(T instance, EventInvoker<T> initInvoker, EventInvoker<T> destroyInvoker) {
+    public ReflectiveInstanceWrapper(T instance, EventInvoker<T> initInvoker, EventInvoker<T> destroyInvoker, Injector<T>[] callbackInjectors) {
         this.instance = instance;
         this.initInvoker = initInvoker;
         this.destroyInvoker = destroyInvoker;
+        this.callbackInjectors = callbackInjectors;
     }
     
     public T getInstance() {
@@ -61,4 +64,9 @@ public class ReflectiveInstanceWrapper<T
             destroyInvoker.invokeEvent(instance);
         }
     }
+
+    public Injector<T>[] getCallbackInjectors() {
+    	return this.callbackInjectors;
+    }
+
 }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaAsyncImplementationInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaAsyncImplementationInvoker.java?rev=986678&r1=986677&r2=986678&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaAsyncImplementationInvoker.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaAsyncImplementationInvoker.java Wed Aug 18 13:53:47 2010
@@ -21,12 +21,12 @@ package org.apache.tuscany.sca.implement
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.tuscany.sca.core.factory.InstanceWrapper;
 import org.apache.tuscany.sca.core.factory.ObjectCreationException;
 import org.apache.tuscany.sca.core.invocation.AsyncResponseException;
 import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
 import org.apache.tuscany.sca.invocation.Message;
@@ -41,8 +41,9 @@ import org.oasisopen.sca.ServiceRuntimeE
  */
 public class JavaAsyncImplementationInvoker extends JavaImplementationInvoker {
 	
-    public JavaAsyncImplementationInvoker(Operation operation, Method method, RuntimeComponent component) {
-    	super( operation, method, component);
+    public JavaAsyncImplementationInvoker(Operation operation, Method method, RuntimeComponent component, 
+    		InterfaceContract interfaceContract) {
+    	super( operation, method, component, interfaceContract);
         assert method != null : "Operation method cannot be null";
         assert ((JavaOperation) operation).isAsyncServer() : "Operation must be async";
     } // end constructor

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java?rev=986678&r1=986677&r2=986678&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java Wed Aug 18 13:53:47 2010
@@ -52,10 +52,13 @@ import org.apache.tuscany.sca.core.scope
 import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
 import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl;
 import org.apache.tuscany.sca.implementation.java.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
 import org.apache.tuscany.sca.implementation.java.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.JavaScopeImpl;
 import org.apache.tuscany.sca.implementation.java.context.InstanceFactory;
 import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
 import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
 import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
@@ -76,6 +79,7 @@ public class JavaComponentContextProvide
     private JavaInstanceFactoryProvider<?> instanceFactoryProvider;
     private ProxyFactory proxyFactory;
     private InstanceFactory instanceFactory;
+	private JavaScopeImpl scope;
 
     public JavaComponentContextProvider(RuntimeComponent component,
                                         JavaInstanceFactoryProvider configuration,
@@ -93,6 +97,7 @@ public class JavaComponentContextProvide
         //        }
         this.component = component;
         this.propertyValueFactory = (JavaPropertyValueObjectFactory) propertyValueObjectFactory;
+        this.scope = ((JavaImplementation)component.getImplementation()).getJavaScope();
     }
 
     InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
@@ -144,6 +149,16 @@ public class JavaComponentContextProvide
     }
 
     void start() {
+    	List<JavaElementImpl> callbackInjectionList = null;
+    	
+    	// If the component implementation is stateless, we need to inject the callbacks on service invocation
+    	// rather than doing it once at the component level. 
+    	if ( scope.equals(JavaScopeImpl.STATELESS)) {
+    		callbackInjectionList = instanceFactoryProvider.getCallbackInjectionSites();
+    	} else {
+    		callbackInjectionList = instanceFactoryProvider.getInjectionSites();
+    	}
+    		
         if (!instanceFactoryProvider.getImplementation().getCallbackMembers().isEmpty()) {
             Map<String, List<EndpointReference>> callbackWires = new HashMap<String, List<EndpointReference>>();
             for (ComponentService service : component.getServices()) {
@@ -179,7 +194,7 @@ public class JavaComponentContextProvide
                         factory = new CallbackWireObjectFactory(businessInterface, proxyFactory, wires);
                     }
                     if (!(element.getAnchor() instanceof Constructor)) {
-                        instanceFactoryProvider.getInjectionSites().add(element);
+                        callbackInjectionList.add(element);
                     }
                     instanceFactoryProvider.setObjectFactory(element, factory);
                 }
@@ -288,15 +303,15 @@ public class JavaComponentContextProvide
         //cleanUpPolicyHandlers();
     }
 
-    Invoker createInvoker(Operation operation) throws NoSuchMethodException {
+    Invoker createInvoker(Operation operation, InterfaceContract interfaceContract) throws NoSuchMethodException {
         Class<?> implClass = instanceFactoryProvider.getImplementationClass();
 
         Method method = JavaInterfaceUtil.findMethod(implClass, operation);
         if (operation instanceof JavaOperation &&
             ((JavaOperation) operation).isAsyncServer() ) {
-        	return new JavaAsyncImplementationInvoker(operation, method, component);
+        	return new JavaAsyncImplementationInvoker(operation, method, component, interfaceContract);
         } else {
-        	return new JavaImplementationInvoker(operation, method, component);
+        	return new JavaImplementationInvoker(operation, method, component, interfaceContract);
         } // end if
     } // end 
 

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java?rev=986678&r1=986677&r2=986678&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java Wed Aug 18 13:53:47 2010
@@ -22,17 +22,23 @@ import java.lang.reflect.InvocationTarge
 import java.lang.reflect.Method;
 
 import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.core.factory.InstanceWrapper;
 import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.scope.Scope;
 import org.apache.tuscany.sca.core.scope.ScopeContainer;
 import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
 import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.context.ReflectiveInstanceWrapper;
+import org.apache.tuscany.sca.implementation.java.injection.Injector;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper;
 import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.oasisopen.sca.ServiceReference;
 import org.oasisopen.sca.ServiceRuntimeException;
 
 /**
@@ -48,19 +54,22 @@ public class JavaImplementationInvoker i
 
     @SuppressWarnings("unchecked")
     protected final ScopeContainer scopeContainer;
+	private final InterfaceContract interfaze;
 
-    public JavaImplementationInvoker(Operation operation, Method method, RuntimeComponent component) {
+    public JavaImplementationInvoker(Operation operation, Method method, RuntimeComponent component, InterfaceContract intf) {
         assert method != null : "Operation method cannot be null";
         this.method = method;
         this.operation = operation;
         this.scopeContainer = ((ScopedRuntimeComponent)component).getScopeContainer();
         this.allowsPBR = ((JavaImplementation)component.getImplementation()).isAllowsPassByReference(method);
+        this.interfaze = intf;
     }
 
-    public JavaImplementationInvoker(Operation operation, RuntimeComponent component) {
+    public JavaImplementationInvoker(Operation operation, RuntimeComponent component, InterfaceContract intf) {
         // used if the method can't be computed statically in advance 
         this.operation = operation;
         this.scopeContainer = ((ScopedRuntimeComponent)component).getScopeContainer();
+        this.interfaze = intf;
     }
 
     @SuppressWarnings("unchecked")
@@ -83,8 +92,14 @@ public class JavaImplementationInvoker i
         try {
             // The following call might create a new conversation, as a result, the msg.getConversationID() might 
             // return a new value
-            InstanceWrapper wrapper = scopeContainer.getWrapper(contextId);
-
+            ReflectiveInstanceWrapper wrapper = (ReflectiveInstanceWrapper) scopeContainer.getWrapper(contextId);
+            
+            // If there is a callback interface and the implementation is stateless, we need to
+            // inject callbacks at invocation time. For Composite scope, this has already been done. 
+            if (( interfaze.getCallbackInterface() != null )  && (scopeContainer.getScope().equals(Scope.STATELESS))){
+            	injectCallbacks(wrapper, (JavaInterface)interfaze.getCallbackInterface());
+            }
+            
             Object instance = wrapper.getInstance();
 
             // If the method couldn't be computed statically, or the instance being
@@ -149,4 +164,29 @@ public class JavaImplementationInvoker i
         return msg;
     }
 
+	private void injectCallbacks(ReflectiveInstanceWrapper wrapper,
+			JavaInterface callbackInterface) {
+	
+		for (Injector injector : wrapper.getCallbackInjectors()) {
+			if (injector != null) {
+				try {       
+					if (ServiceReference.class.isAssignableFrom(injector.getType())) {
+						Class<?> intf = JavaIntrospectionHelper.getBusinessInterface(injector.getType(), injector.getGenericType());
+						if ( intf.isAssignableFrom(callbackInterface.getJavaClass())) {              		                		                		
+							injector.inject(wrapper.getInstance());         
+						}
+					} else if (injector.getType().isAssignableFrom(callbackInterface.getJavaClass())) {
+						injector.inject(wrapper.getInstance());
+					} else {
+						injector.injectNull(wrapper.getInstance());
+					}
+				} catch (Exception e) {	                   
+					throw new ObjectCreationException("Exception invoking injector - " + e.getMessage(), e);
+				}
+			}
+		}
+		
+	}
+			
+
 }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java?rev=986678&r1=986677&r2=986678&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java Wed Aug 18 13:53:47 2010
@@ -118,7 +118,7 @@ public class JavaImplementationProvider 
 
     public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
         try {
-            return componentContextProvider.createInvoker(operation);
+            return componentContextProvider.createInvoker(operation, service.getInterfaceContract());
         } catch (NoSuchMethodException e) {
             // It's possible that the instance being invoked is a user-specified
             // callback object that isn't an instance of the component implementation
@@ -132,12 +132,12 @@ public class JavaImplementationProvider 
             if (iface instanceof JavaInterface) {
                 try {
                     Method method = JavaInterfaceUtil.findMethod(((JavaInterface)iface).getJavaClass(), operation);
-                    return new JavaImplementationInvoker(operation, method, componentContextProvider.getComponent());
+                    return new JavaImplementationInvoker(operation, method, componentContextProvider.getComponent(), service.getInterfaceContract());
                 } catch (NoSuchMethodException e1) {
                     throw new IllegalArgumentException(e1);
                 }
             } else {
-                return new JavaImplementationInvoker(operation, componentContextProvider.getComponent());
+                return new JavaImplementationInvoker(operation, componentContextProvider.getComponent(), service.getInterfaceContract());
             }
         }
     }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java?rev=986678&r1=986677&r2=986678&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java Wed Aug 18 13:53:47 2010
@@ -57,6 +57,7 @@ public class JavaInstanceFactoryProvider
     private final EventInvoker<T> initInvoker;
     private final EventInvoker<T> destroyInvoker;
     private final Map<JavaElementImpl, Object> factories = new HashMap<JavaElementImpl, Object>();
+	private final List<JavaElementImpl> callbackInjectionSites;
 
     public JavaInstanceFactoryProvider(JavaImplementation definition) {
         this.definition = definition;
@@ -65,6 +66,7 @@ public class JavaInstanceFactoryProvider
         this.destroyInvoker = definition.getDestroyMethod() == null ? null : new MethodEventInvoker<T>(definition
             .getDestroyMethod());
         injectionSites = new ArrayList<JavaElementImpl>();
+        callbackInjectionSites = new ArrayList<JavaElementImpl>();
     }
 
     ProxyFactory getProxyFactory() {
@@ -85,12 +87,15 @@ public class JavaInstanceFactoryProvider
     @SuppressWarnings("unchecked")
     public InstanceFactory<T> createFactory() {
         ObjectFactory<?>[] initArgs = getConstructorArgs();
-        Injector<T>[] injectors = getInjectors();
+        Injector<T>[] injectors = getInjectors(false);
+        Injector<T>[] callbackInjectors = getInjectors(true);
         return new ReflectiveInstanceFactory<T>((Constructor<T>)definition.getConstructor().getConstructor(),
-                                                initArgs, injectors, initInvoker, destroyInvoker);
+                                                initArgs, injectors, callbackInjectors, initInvoker, destroyInvoker);
     }
 
-    private ObjectFactory<?>[] getConstructorArgs() {
+ 
+
+	private ObjectFactory<?>[] getConstructorArgs() {
         JavaConstructorImpl<?> constructor = definition.getConstructor();
         ObjectFactory<?>[] initArgs = new ObjectFactory<?>[constructor.getParameters().length];
         for (int i = 0; i < initArgs.length; i++) {
@@ -101,13 +106,21 @@ public class JavaInstanceFactoryProvider
         return initArgs;
     }
 
+	   
+	   
     @SuppressWarnings("unchecked")
-    private Injector<T>[] getInjectors() {
+    private Injector<T>[] getInjectors(boolean callback) {
+    	List<JavaElementImpl> sites = null;
+    	if ( callback ) 
+    		sites = callbackInjectionSites;
+    	else
+    		sites = injectionSites;
+    	
         // work around JDK1.5 issue with allocating generic arrays
-        Injector<T>[] injectors = new Injector[injectionSites.size()];
+        Injector<T>[] injectors = new Injector[sites.size()];
 
         int i = 0;
-        for (JavaElementImpl element : injectionSites) {
+        for (JavaElementImpl element : sites) {
             Object obj = factories.get(element);
             if (obj != null) {
                 if (obj instanceof ObjectFactory) {
@@ -172,6 +185,13 @@ public class JavaInstanceFactoryProvider
         return injectionSites;
     }
 
+    /**     
+     * @return the callbackInjectionSites
+     */
+    public List<JavaElementImpl> getCallbackInjectionSites() {
+		return callbackInjectionSites;
+	}
+    
     /**
      * @return the factories
      */
@@ -179,4 +199,6 @@ public class JavaInstanceFactoryProvider
         return factories;
     }
 
+	
+
 }