Hi The enhancement looks good, would it make sense to recurse instead, as there could be multiple CGLIB proxies involved ? Please open DOSGI JIRA and attach a patch Cheers, Sergey
On Wed, Apr 20, 2011 at 5:52 PM, Ivanhoe Abrahams <[email protected]> wrote: > Hi All > > In my local environment I use Apache Aries and lately added CXF DOSGI. > I noticed that the greeter example works fine but my own services, which are > registered by aries blueprint > did not get exported by CXF DOSGI. > > After a little scratching around I found the following code to be the > culprit. > In the dsw module there exists a class called > org.apache.cxf.dosgi.dsw.ClassUtils > > the call to the public static Class<?> getInterfaceClass(Object service, > String interfaceName) would always > return the correct interface in case of the greeter example. > But in the case of my aries registered services, it always returned a null. > > > So I changed the following method > private static Class<?> getInterfaceClass(Class<?> serviceClass, String > interfaceName) in the same class > > > OLD METHOD > private static Class<?> getInterfaceClass(Class<?> serviceClass, String > interfaceName) { > > for (Class<?> iClass : serviceClass.getInterfaces()) { > if (iClass.getName().equals(interfaceName)) { > return iClass; > } > Class<?> intf = getInterfaceClass(iClass, interfaceName); > if (intf != null) { > return intf; > } > } > if (serviceClass.getName().equals(interfaceName)) { > return serviceClass; > } > > return null; > } > > NEW METHOD > private static Class<?> getInterfaceClass(Class<?> serviceClass, String > interfaceName) { > > for (Class<?> iClass : serviceClass.getInterfaces()) { > if (iClass.getName().equals(interfaceName)) { > return iClass; > } > Class<?> intf = getInterfaceClass(iClass, interfaceName); > if (intf != null) { > return intf; > } > } > if (serviceClass.getName().equals(interfaceName)) { > return serviceClass; > } > > //Mark start amendment > //Could have been enhaced by another framework ... ie. ARIES > serviceClass = serviceClass.getSuperclass(); > if (serviceClass != null){ > for (Class<?> iClass : serviceClass.getInterfaces()) { > if (iClass.getName().equals(interfaceName)) { > return iClass; > } > Class<?> intf = getInterfaceClass(iClass, interfaceName); > if (intf != null) { > return intf; > } > } > } > //Mark end amendment > > return null; > } > > So all this extra code does is to "check" that if the passed service has > been "enhanced" (by Aries blueprint in this case), then > get the superclass and check all interfaces in the superclass. > > I guess blueprint enhances the original services by weaving in a new class > which has as superclass the original. > I hope this bit of code is helpful, and makes sense ;-) > > Regards > Ivanhoe > -- Sergey Beryozkin Application Integration Division of Talend http://sberyozkin.blogspot.com
