incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r919192 - /incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
Date Thu, 04 Mar 2010 21:45:56 GMT
Author: not
Date: Thu Mar  4 21:45:56 2010
New Revision: 919192

URL: http://svn.apache.org/viewvc?rev=919192&view=rev
Log:
ARIES-128 Change the way we generate the dynamic proxy to base it around the target service,
not the owning bundle.

Modified:
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java

Modified: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java?rev=919192&r1=919191&r2=919192&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
(original)
+++ incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
Thu Mar  4 21:45:56 2010
@@ -197,11 +197,14 @@
       
       List<Class<?>> clazz = new ArrayList<Class<?>>(interfaces.length);
       
-      Bundle b = ctx.getBundle();
+      Bundle serviceProviderBundle = pair.ref.getBundle();
+      Bundle owningBundle = ctx.getBundle();
       
       for (String interfaceName : interfaces) {
         try {
-          clazz.add(b.loadClass(interfaceName));
+          Class<?> potentialClass = serviceProviderBundle.loadClass(interfaceName);
+          
+          if (pair.ref.isAssignableTo(owningBundle, interfaceName)) clazz.add(potentialClass);
         } catch (ClassNotFoundException e) {
         }
       }
@@ -212,7 +215,8 @@
       
       InvocationHandler ih = new JNDIServiceDamper(ctx, interface1, filter, pair, dynamicRebind);
       
-      result = Proxy.newProxyInstance(new BundleToClassLoaderAdapter(b), clazz.toArray(new
Class<?>[clazz.size()]), ih);
+      // TODO not sure this is quite right, but it'll do for now
+      result = Proxy.newProxyInstance(new BundleToClassLoaderAdapter(serviceProviderBundle),
clazz.toArray(new Class<?>[clazz.size()]), ih);
     }
     
     return result;
@@ -234,6 +238,8 @@
           }
         });
         
+        Bundle b = ctx.getBundle();
+        
         for (ServiceReference ref : refs) {
           Object service = ctx.getService(ref);
           



Mime
View raw message