You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/09/17 14:07:03 UTC

svn commit: r696266 - /geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java

Author: jdillon
Date: Wed Sep 17 05:07:03 2008
New Revision: 696266

URL: http://svn.apache.org/viewvc?rev=696266&view=rev
Log:
Filter resources of parent BeanContainerContext if there is one

Modified:
    geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java

Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java?rev=696266&r1=696265&r2=696266&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerContext.java Wed Sep 17 05:07:03 2008
@@ -29,6 +29,7 @@
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.support.GenericApplicationContext;
+import org.springframework.context.ApplicationContext;
 import org.springframework.core.io.Resource;
 
 import java.io.IOException;
@@ -58,7 +59,7 @@
         this(classLoader, null);
     }
 
-    public BeanContainerContext(final ClassLoader classLoader, BeanContainerContext parent) {
+    public BeanContainerContext(final ClassLoader classLoader, final BeanContainerContext parent) {
         super(parent);
         assert classLoader != null;
 
@@ -103,7 +104,15 @@
             }
         }
 
-        return list.toArray(new Resource[list.size()]);
+        Resource[] filteredResources = list.toArray(new Resource[list.size()]);
+
+        // If we have a parent, then ask it to filter resources as well
+        ApplicationContext parent = getParent();
+        if (parent instanceof BeanContainerContext) {
+            filteredResources = ((BeanContainerContext)parent).filterOwnedResources(filteredResources);
+        }
+
+        return filteredResources;
     }
 
     public void addBeanPostProcessor(final BeanPostProcessor processor) {