cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1205521 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/common/util/ rt/core/src/main/java/org/apache/cxf/bus/blueprint/
Date Wed, 23 Nov 2011 18:16:09 GMT
Author: dkulp
Date: Wed Nov 23 18:16:08 2011
New Revision: 1205521

URL: http://svn.apache.org/viewvc?rev=1205521&view=rev
Log:
Update blueprint to support both Aries blueprint 0.3 and an upcoming
0.4.1+.   (0.4.0 is not usable)
When possible, use the ComponentMetadata directly to avoid direct
dependency on Aries for that.

Added:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java
  (with props)
Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBus.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/ConfigurerImpl.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java?rev=1205521&r1=1205520&r2=1205521&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ReflectionUtil.java Wed
Nov 23 18:16:08 2011
@@ -28,6 +28,7 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.net.*;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -226,4 +227,42 @@ public final class ReflectionUtil {
             return beanInfo.getPropertyDescriptors();
         }
     }
+
+    /**
+     * Try to find a method we can use.   If the object implements a public  
+     * interface that has the public version of that method, we'll use the interface
+     * defined method in case the actual instance class is not public 
+     */
+    public static Method findMethod(Class<?> cls,
+                                    String name,
+                                    Class<?> ... params) {
+        if (cls == null) {
+            return null;
+        }
+        for (Class<?> cs : cls.getInterfaces()) {
+            if (Modifier.isPublic(cs.getModifiers())) {
+                Method m = findMethod(cs, name, params);
+                if (m != null && Modifier.isPublic(m.getModifiers())) {
+                    return m;
+                }
+            }
+        }
+        try {
+            Method m = cls.getDeclaredMethod(name, params);
+            if (m != null && Modifier.isPublic(m.getModifiers())) {
+                return m;
+            }
+        } catch (Exception e) {
+            //ignore
+        }
+        Method m = findMethod(cls.getSuperclass(), name, params);
+        if (m == null) {
+            try {
+                m = cls.getMethod(name, params);
+            } catch (Exception e) {
+                //ignore
+            }
+        }
+        return m;
+    }
 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java?rev=1205521&r1=1205520&r2=1205521&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBeanLocator.java
Wed Nov 23 18:16:08 2011
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.bus.blueprint;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -27,16 +28,18 @@ import java.util.List;
 import java.util.Set;
 import java.util.logging.Logger;
 
-import org.apache.aries.blueprint.ExtendedBlueprintContainer;
-import org.apache.aries.blueprint.container.BeanRecipe;
-import org.apache.aries.blueprint.di.ExecutionContext;
-import org.apache.aries.blueprint.di.Recipe;
+import org.apache.aries.blueprint.ExtendedBeanMetadata;
 import org.apache.cxf.bus.extension.ExtensionManagerImpl;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.ReflectionUtil;
 import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.blueprint.container.BlueprintContainer;
+import org.osgi.service.blueprint.container.NoSuchComponentException;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.BeanProperty;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
 
 /**
  * 
@@ -44,14 +47,14 @@ import org.osgi.service.blueprint.contai
 public class BlueprintBeanLocator implements ConfiguredBeanLocator {
     private static final Logger LOG = LogUtils.getL7dLogger(BlueprintBeanLocator.class);
     ConfiguredBeanLocator orig;
-    ExtendedBlueprintContainer container;
+    BlueprintContainer container;
     BundleContext context;
     
     public BlueprintBeanLocator(ConfiguredBeanLocator orig, 
                                 BlueprintContainer cont, 
                                 BundleContext context) {
         this.orig = orig;
-        this.container = (ExtendedBlueprintContainer)cont;
+        this.container = cont;
         this.context = context;
         if (orig instanceof ExtensionManagerImpl) {
             List<String> names = new ArrayList<String>(container.getComponentIds());
@@ -59,35 +62,53 @@ public class BlueprintBeanLocator implem
         }
     }
     
-    public <T> T getBeanOfType(String name, Class<T> type) {
-        ExecutionContext origContext 
-            = ExecutionContext.Holder.setContext((ExecutionContext)container.getRepository());
-        try {
-            Recipe r = container.getRepository().getRecipe(name);
-            if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
-                && type.isAssignableFrom(((BeanRecipe)r).getType())) {
-                return type.cast(container.getComponentInstance(name));
+    static Class<?> getClassForMetaData(BlueprintContainer container, ComponentMetadata
cmd) {
+        Class<?> cls = null;
+        if (cmd instanceof BeanMetadata) {
+            BeanMetadata bm = (BeanMetadata)cmd;
+            if (bm instanceof ExtendedBeanMetadata) {
+                cls = ((ExtendedBeanMetadata)bm).getRuntimeClass();
+            } 
+            if (cls == null) {
+                try {
+                    Method m = ReflectionUtil.findMethod(container.getClass(), "loadClass",
String.class);
+                    cls = (Class)ReflectionUtil.setAccessible(m).invoke(container, bm.getClassName());
+                } catch (Exception e) {
+                    //ignore
+                }
             }
-        } finally {
-            ExecutionContext.Holder.setContext(origContext);
+        }
+        return cls;
+    }
+    private Class<?> getClassForMetaData(ComponentMetadata cmd) {
+        return getClassForMetaData(container, cmd);
+    }
+    private ComponentMetadata getComponentMetadata(String id) {
+        try {
+            return container.getComponentMetadata(id);
+        } catch (NoSuchComponentException nsce) {
+            return null;
+        }
+    }
+    
+    public <T> T getBeanOfType(String name, Class<T> type) {
+        
+        ComponentMetadata cmd = getComponentMetadata(name);
+        Class<?> cls = getClassForMetaData(cmd);
+        if (cls != null && type.isAssignableFrom(cls)) {
+            return type.cast(container.getComponentInstance(name));
         }
         return orig.getBeanOfType(name, type);
     }
     /** {@inheritDoc}*/
     public List<String> getBeanNamesOfType(Class<?> type) {
         Set<String> names = new LinkedHashSet<String>();
-        ExecutionContext origContext 
-            = ExecutionContext.Holder.setContext((ExecutionContext)container.getRepository());
-        try {
-            for (String s : container.getComponentIds()) {
-                Recipe r = container.getRepository().getRecipe(s);
-                if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
-                    && type.isAssignableFrom(((BeanRecipe)r).getType())) {
-                    names.add(s);
-                }
+        for (String s : container.getComponentIds()) {
+            ComponentMetadata cmd = container.getComponentMetadata(s);
+            Class<?> cls = getClassForMetaData(cmd);
+            if (cls != null && type.isAssignableFrom(cls)) {
+                names.add(s);
             }
-        } finally {
-            ExecutionContext.Holder.setContext(origContext);
         }
         names.addAll(orig.getBeanNamesOfType(type));
         return new ArrayList<String>(names);
@@ -97,19 +118,12 @@ public class BlueprintBeanLocator implem
     public <T> Collection<? extends T> getBeansOfType(Class<T> type) {
         List<T> list = new ArrayList<T>();
         
-        ExecutionContext origContext 
-            = ExecutionContext.Holder.setContext((ExecutionContext)container.getRepository());
-        try {
-            for (String s : container.getComponentIds()) {
-                Recipe r = container.getRepository().getRecipe(s);
-                if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
-                    && type.isAssignableFrom(((BeanRecipe)r).getType())) {
-                    
-                    list.add(type.cast(container.getComponentInstance(s)));
-                } 
+        for (String s : container.getComponentIds()) {
+            ComponentMetadata cmd = container.getComponentMetadata(s);
+            Class<?> cls = getClassForMetaData(cmd);
+            if (cls != null && type.isAssignableFrom(cls)) {
+                list.add(type.cast(container.getComponentInstance(s)));
             }
-        } finally {
-            ExecutionContext.Holder.setContext(origContext);
         }
         list.addAll(orig.getBeansOfType(type));
         if (list.isEmpty()) {
@@ -134,51 +148,39 @@ public class BlueprintBeanLocator implem
     public <T> boolean loadBeansOfType(Class<T> type, BeanLoaderListener<T>
listener) {
         List<String> names = new ArrayList<String>();
         boolean loaded = false;
-        ExecutionContext origContext 
-            = ExecutionContext.Holder.setContext((ExecutionContext)container.getRepository());
-        try {
-            for (String s : container.getComponentIds()) {
-                Recipe r = container.getRepository().getRecipe(s);
-                if (r instanceof BeanRecipe && ((BeanRecipe)r).getType() != null
-                    && type.isAssignableFrom(((BeanRecipe)r).getType())) {
-                    names.add(s);
+        for (String s : container.getComponentIds()) {
+            ComponentMetadata cmd = container.getComponentMetadata(s);
+            Class<?> cls = getClassForMetaData(cmd);
+            if (cls != null && type.isAssignableFrom(cls)) {
+                names.add(s);
+            }
+        }
+        Collections.reverse(names);
+        for (String s : names) {
+            ComponentMetadata cmd = container.getComponentMetadata(s);
+            Class<?> beanType = getClassForMetaData(cmd);
+            Class<? extends T> t = beanType.asSubclass(type);
+            if (listener.loadBean(s, t)) {
+                Object o = container.getComponentInstance(s);
+                if (listener.beanLoaded(s, type.cast(o))) {
+                    return true;
                 }
+                loaded = true;
             }
-            Collections.reverse(names);
-            for (String s : names) {
-                BeanRecipe r = (BeanRecipe)container.getRepository().getRecipe(s);
-                Class<?> beanType = r.getType();
-                Class<? extends T> t = beanType.asSubclass(type);
-                if (listener.loadBean(s, t)) {
-                    Object o = container.getComponentInstance(s);
-                    if (listener.beanLoaded(s, type.cast(o))) {
-                        return true;
-                    }
-                    loaded = true;
-                }
-            }
-        } finally {
-            ExecutionContext.Holder.setContext(origContext);
         }
         return loaded || orig.loadBeansOfType(type, listener);
     }
 
     public boolean hasConfiguredPropertyValue(String beanName, String propertyName, String
value) {
-        ExecutionContext origContext 
-            = ExecutionContext.Holder.setContext((ExecutionContext)container.getRepository());
-        try {
-            Recipe r = container.getRepository().getRecipe(beanName);
-            if (r instanceof BeanRecipe) {
-                BeanRecipe br = (BeanRecipe)r;
-                Object o = br.getProperty(propertyName);
-                if (o == null) {
-                    return false;
+        ComponentMetadata cmd = getComponentMetadata(beanName);
+        if (cmd instanceof BeanMetadata) {
+            BeanMetadata br = (BeanMetadata)cmd;
+            for (BeanProperty s : br.getProperties()) {
+                if (propertyName.equals(s.getName())) {
+                    return true;
                 }
-                //TODO - need to check the values of the property
-                return false;
             }
-        } finally {
-            ExecutionContext.Holder.setContext(origContext);
+            return false;
         }
         return orig.hasConfiguredPropertyValue(beanName, propertyName, value);
     }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBus.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBus.java?rev=1205521&r1=1205520&r2=1205521&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBus.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BlueprintBus.java Wed Nov
23 18:16:08 2011
@@ -20,7 +20,6 @@
 package org.apache.cxf.bus.blueprint;
 
 
-import org.apache.aries.blueprint.utils.BundleDelegatingClassLoader;
 import org.apache.cxf.bus.extension.ExtensionManagerBus;
 import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.configuration.Configurer;

Added: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java?rev=1205521&view=auto
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java
(added)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java
Wed Nov 23 18:16:08 2011
@@ -0,0 +1,133 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.bus.blueprint;
+
+import java.io.IOException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * A ClassLoader delegating to a given OSGi bundle.
+ */
+public class BundleDelegatingClassLoader extends ClassLoader {
+
+    private final Bundle bundle;
+    private final ClassLoader classLoader;
+
+    public BundleDelegatingClassLoader(Bundle bundle) {
+        this(bundle, null);
+    }
+
+    public BundleDelegatingClassLoader(Bundle bundle, ClassLoader classLoader) {
+        this.bundle = bundle;
+        this.classLoader = classLoader;
+    }
+
+    protected Class<?> findClass(final String name) throws ClassNotFoundException {
+        try {
+            return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>()
{
+                public Class<?> run() throws ClassNotFoundException {
+                    return bundle.loadClass(name);
+                }
+            });
+        } catch (PrivilegedActionException e) {
+            Exception cause = e.getException();
+          
+            if (cause instanceof ClassNotFoundException) {
+                throw (ClassNotFoundException)cause;
+            } else {
+                throw (RuntimeException)cause;
+            }
+        }    
+    }
+
+    protected URL findResource(final String name) {
+        URL resource = AccessController.doPrivileged(new PrivilegedAction<URL>() {
+            public URL run() {
+                return bundle.getResource(name);
+            }
+        });        
+        if (classLoader != null && resource == null) {
+            resource = classLoader.getResource(name);
+        }
+        return resource;
+    }
+
+    protected Enumeration<URL> findResources(final String name) throws IOException
{
+        Enumeration<URL> urls;
+        try {
+            urls =  AccessController.doPrivileged(new PrivilegedExceptionAction<Enumeration<URL>>()
{
+                @SuppressWarnings("unchecked")
+                public Enumeration<URL> run() throws IOException {
+                    return (Enumeration<URL>)bundle.getResources(name);
+                }
+          
+            });
+        } catch (PrivilegedActionException e) {
+            Exception cause = e.getException();
+        
+            if (cause instanceof IOException) {
+                throw (IOException)cause;
+            } else {
+                throw (RuntimeException)cause;
+            }
+        }
+      
+        if (urls == null) {
+            urls = Collections.enumeration(new ArrayList<URL>());
+        }
+      
+        return urls;    
+    }
+
+    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
{
+        Class clazz;
+        try {
+            clazz = findClass(name);
+        } catch (ClassNotFoundException cnfe) {
+            if (classLoader != null) {
+                try {
+                    clazz = classLoader.loadClass(name);
+                } catch (ClassNotFoundException e) {
+                    throw new ClassNotFoundException(name + " from bundle " + bundle.getBundleId()

+                                                     + " (" + bundle.getSymbolicName() +
")", cnfe);
+                }
+            } else {
+                throw new ClassNotFoundException(name + " from bundle " + bundle.getBundleId()

+                                                 + " (" + bundle.getSymbolicName() + ")",
cnfe);
+            }
+        }
+        if (resolve) {
+            resolveClass(clazz);
+        }
+        return clazz;
+    }
+
+    public Bundle getBundle() {
+        return bundle;
+    }
+}

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/BundleDelegatingClassLoader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/ConfigurerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/ConfigurerImpl.java?rev=1205521&r1=1205520&r2=1205521&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/ConfigurerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/blueprint/ConfigurerImpl.java Wed Nov
23 18:16:08 2011
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.bus.blueprint;
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -29,20 +30,21 @@ import java.util.logging.Logger;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.aries.blueprint.ExtendedBlueprintContainer;
-import org.apache.aries.blueprint.container.BeanRecipe;
-import org.apache.aries.blueprint.di.Recipe;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.ReflectionUtil;
 import org.apache.cxf.configuration.Configurable;
 import org.apache.cxf.configuration.Configurer;
 import org.osgi.service.blueprint.container.BlueprintContainer;
+import org.osgi.service.blueprint.container.NoSuchComponentException;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
 
 /**
  * 
  */
 public class ConfigurerImpl implements Configurer {
     private static final Logger LOG = LogUtils.getL7dLogger(ConfigurerImpl.class);
-    ExtendedBlueprintContainer container;
+    BlueprintContainer container;
     
     private final Map<String, List<MatcherHolder>> wildCardBeanDefinitions
         = new HashMap<String, List<MatcherHolder>>();
@@ -58,7 +60,7 @@ public class ConfigurerImpl implements C
     
     
     public ConfigurerImpl(BlueprintContainer con) {
-        container = (ExtendedBlueprintContainer)con;
+        container = con;
         initializeWildcardMap();
     }
     private boolean isWildcardBeanName(String bn) {
@@ -69,19 +71,19 @@ public class ConfigurerImpl implements C
     private void initializeWildcardMap() {
         for (String s : container.getComponentIds()) {
             if (isWildcardBeanName(s)) {
-                Recipe r = container.getRepository().getRecipe(s);
-                if (r instanceof BeanRecipe) {
-                    Class c = ((BeanRecipe)r).getType();
+                ComponentMetadata cmd = container.getComponentMetadata(s);
+                Class<?> cls = BlueprintBeanLocator.getClassForMetaData(container,
cmd);
+                if (cls != null) {
                     String orig = s;
                     if (s.charAt(0) == '*') {
                         //old wildcard
                         s = "." + s.replaceAll("\\.", "\\."); 
                     }
                     Matcher matcher = Pattern.compile(s).matcher("");
-                    List<MatcherHolder> m = wildCardBeanDefinitions.get(c.getName());
+                    List<MatcherHolder> m = wildCardBeanDefinitions.get(cls.getName());
                     if (m == null) {
                         m = new ArrayList<MatcherHolder>();
-                        wildCardBeanDefinitions.put(c.getName(), m);
+                        wildCardBeanDefinitions.put(cls.getName(), m);
                     }
                     MatcherHolder holder = new MatcherHolder(orig, matcher);
                     m.add(holder);
@@ -109,9 +111,42 @@ public class ConfigurerImpl implements C
             configureWithWildCard(bn, beanInstance);
         }
         
-        Recipe r = container.getRepository().getRecipe(bn);
-        if (r instanceof BeanRecipe) {
-            ((BeanRecipe)r).setProperties(beanInstance);
+        
+        Method m = ReflectionUtil.findMethod(container.getClass(), "injectBeanInstance",
+                                             BeanMetadata.class, Object.class);
+        try {
+            if (m != null) {
+                //Aries blueprint 0.4.1+
+                ComponentMetadata cm = null;
+                try {
+                    cm = container.getComponentMetadata(bn);
+                } catch (NoSuchComponentException nsce) {
+                    cm = null;
+                }
+                if (cm instanceof BeanMetadata) {
+                    ReflectionUtil.setAccessible(m);
+                    m.invoke(container, (BeanMetadata)cm, beanInstance);
+                }
+            } else {
+                //Aries blueprint 0.3.x
+                m = ReflectionUtil.findMethod(container.getClass(), "getRepository");
+                Object o = ReflectionUtil.setAccessible(m).invoke(container);
+                m = ReflectionUtil.findMethod(container.getClass(), "getRecipe", String.class);
+                o = ReflectionUtil.setAccessible(m).invoke(o, bn);  //returns the recipe
+                m = ReflectionUtil.findMethod(o.getClass(), "setProperties", Object.class);
+                if (m != null) {
+                    ReflectionUtil.setAccessible(m).invoke(o, beanInstance);
+                }
+            }
+        } catch (InvocationTargetException ite) {
+            Throwable t = ite.getCause();
+            if (t instanceof RuntimeException) {
+                throw (RuntimeException)t;
+            } else {
+                throw new RuntimeException(t);
+            }
+        } catch (Exception ex) {
+            LOG.log(Level.FINE, "Could not configure object " + bn, ex);
         }
     }
     private void configureWithWildCard(String bn, Object beanInstance) {



Mime
View raw message