geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r696205 - in /geronimo/gshell/trunk/gshell-support/gshell-spring/src: main/java/org/apache/geronimo/gshell/spring/ test/java/org/apache/geronimo/gshell/spring/
Date Wed, 17 Sep 2008 08:58:57 GMT
Author: jdillon
Date: Wed Sep 17 01:58:56 2008
New Revision: 696205

URL: http://svn.apache.org/viewvc?rev=696205&view=rev
Log:
Drop BeansException from sig
Added getBeans()
Added getBeanNames()

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

Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java?rev=696205&r1=696204&r2=696205&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainer.java
Wed Sep 17 01:58:56 2008
@@ -21,10 +21,10 @@
 package org.apache.geronimo.gshell.spring;
 
 import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
-import org.springframework.beans.BeansException;
 
 import java.net.URL;
 import java.util.List;
+import java.util.Map;
 
 /**
  * An abstraction of a container of beans.
@@ -35,9 +35,13 @@
 {
     BeanContainer getParent();
     
-    <T> T getBean(Class<T> type) throws BeansException;
+    <T> T getBean(Class<T> type);
 
-    <T> T getBean(String name, Class<T> requiredType) throws BeansException;
+    <T> T getBean(String name, Class<T> requiredType);
+
+    <T> Map<String,T> getBeans(Class<T> type);
+
+    String[] getBeanNames(Class type);
 
     BeanContainer createChild(String id, List<URL> classPath) throws DuplicateRealmException;
 }

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=696205&r1=696204&r2=696205&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 01:58:56 2008
@@ -118,18 +118,4 @@
             }
         });
     }
-
-    /*
-    @Override
-    protected void finishBeanFactoryInitialization(ConfigurableListableBeanFactory beanFactory)
{
-		// Stop using the temporary ClassLoader for type matching.
-		beanFactory.setTempClassLoader(null);
-
-		// Allow for caching all bean definition metadata, not expecting further changes.
-		beanFactory.freezeConfiguration();
-
-		// Instantiate all remaining (non-lazy-init) singletons.
-		beanFactory.preInstantiateSingletons();
-	}
-    */
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java?rev=696205&r1=696204&r2=696205&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
Wed Sep 17 01:58:56 2008
@@ -30,6 +30,7 @@
 import java.net.URL;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Default {@link BeanContainer} implementation.
@@ -99,7 +100,7 @@
         return parent;
     }
 
-    public <T> T getBean(final Class<T> type) throws BeansException {
+    public <T> T getBean(final Class<T> type) {
         assert type != null;
 
         String[] names = context.getBeanNamesForType(type);
@@ -115,13 +116,26 @@
     }
 
     @SuppressWarnings({"unchecked"})
-    public <T> T getBean(final String name, final Class<T> requiredType) throws
BeansException {
+    public <T> T getBean(final String name, final Class<T> requiredType) {
         assert name != null;
         assert requiredType != null;
 
         return (T) context.getBean(name, requiredType);
     }
 
+    @SuppressWarnings({"unchecked"})
+    public <T> Map<String,T> getBeans(final Class<T> type) {
+        assert type != null;
+
+        return (Map<String,T>)context.getBeansOfType(type);
+    }
+
+    public String[] getBeanNames(final Class type) {
+        assert type != null;
+
+        return context.getBeanNamesForType(type);
+    }
+
     public BeanContainer createChild(final String id, final List<URL> classPath) throws
DuplicateRealmException {
         assert id != null;
         assert classPath != null;

Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java?rev=696205&r1=696204&r2=696205&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/src/test/java/org/apache/geronimo/gshell/spring/BeanContainerAwareProcessorTest.java
Wed Sep 17 01:58:56 2008
@@ -62,7 +62,7 @@
         }
         
         @PostConstruct
-        public void init() {
+        private void init() {
             Assert.assertNotNull(container);
         }
     }



Mime
View raw message