You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Anton Tagunov <at...@mail.cnt.ru> on 2003/04/30 01:48:18 UTC

[PATCH] bug 19450 (If a component implements Poolable but not Component ECM may be not able serve it)

Here we go with

19450. If a component implements Poolable but not Component
       ECM may be not able serve it
http://issues.apache.org/bugzilla/show_bug.cgi?id=19450

(the bugzilla has got a testcase)

diff -ru avalon-excalibur.0/component/src/java/org/apache/avalon/excalibur/component/ComponentProxyGenerator.java avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ComponentProxyGenerator.java
--- avalon-excalibur.0/component/src/java/org/apache/avalon/excalibur/component/ComponentProxyGenerator.java    2003-02-25 19:28:22.000000000 +0300
+++ avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ComponentProxyGenerator.java      2003-04-28 18:18:46.000000000 +0400
@@ -95,15 +95,25 @@
     }
 
     /**
-     * Get the Component wrapped in the proxy.  The role must be the service
-     * interface's fully qualified classname to work.
+     * Get the Component wrapped in the proxy.
      */
     public Component getProxy( String role, Object service ) throws Exception
     {
-        Class serviceInterface = m_classLoader.loadClass( role );
+        Class interfaces[] = service.getClass().getInterfaces();
+
+        Class newInterfaces[] = new Class[ interfaces.length+1 ];
+
+        int i=0;
+
+        newInterfaces[i++] = Component.class;
+
+        for(int j=0; j<interfaces.length; )
+        {
+            newInterfaces[i++] = interfaces[j++];
+        }
 
         return (Component)Proxy.newProxyInstance( m_classLoader,
-                                                  new Class[]{Component.class, serviceInterface},
+                                                  newInterfaces,
                                                   new ComponentInvocationHandler( service ) );
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org