geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r697459 - /geronimo/gshell/trunk/gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java
Date Sun, 21 Sep 2008 08:44:25 GMT
Author: jdillon
Date: Sun Sep 21 01:44:25 2008
New Revision: 697459

URL: http://svn.apache.org/viewvc?rev=697459&view=rev
Log:
Refactor to allow fields to be final
Use the class realm id as the containers display name

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

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=697459&r1=697458&r2=697459&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
Sun Sep 21 01:44:25 2008
@@ -38,38 +38,29 @@
 {
     private static final String REALM_ID = "gshell";
 
-    private BeanContainer parent;
+    private final BeanContainer parent;
 
-    private BeanContainerContext context;
+    private final BeanContainerContext context;
 
-    private ClassRealm classRealm;
-    
-    public BeanContainerImpl(final ClassLoader classLoader) {
-        assert classLoader != null;
+    private final ClassRealm classRealm;
+
+    private static ClassRealm createDefaultClassRealm(final ClassLoader cl) {
+        assert cl != null;
 
-        ClassRealm realm;
         try {
-            realm = new ClassWorld().newRealm(REALM_ID, classLoader);
+            return new ClassWorld().newRealm(REALM_ID, cl);
         }
         catch (DuplicateRealmException e) {
             // Should never happen
             throw new Error(e);
         }
-
-        configureContext(realm, null);
     }
 
-    /**
-     * Child container constructor.
-     */
-    private BeanContainerImpl(final ClassRealm classRealm, final BeanContainerImpl parent)
{
-        assert parent != null;
-        assert classRealm != null;
-
-        configureContext(classRealm, parent);
+    public BeanContainerImpl(final ClassLoader cl) {
+        this(createDefaultClassRealm(cl), null);
     }
 
-    private void configureContext(final ClassRealm classRealm, final BeanContainerImpl parent)
{
+    private BeanContainerImpl(final ClassRealm classRealm, final BeanContainerImpl parent)
{
         assert classRealm != null;
         // parent may be null
 
@@ -78,6 +69,7 @@
 
         // Construct the container and add customizations
         context = new BeanContainerContext(classRealm, parent != null ? parent.context :
null);
+        context.setDisplayName(classRealm.getId());
         context.registerShutdownHook();
         context.addBeanPostProcessor(new BeanContainerAwareProcessor(this));
 



Mime
View raw message