geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r706134 - in /geronimo/gshell/trunk: gshell-bootstrap/pom.xml gshell-support/gshell-spring/pom.xml gshell-support/gshell-spring/src/main/java/org/apache/geronimo/gshell/spring/BeanContainerImpl.java pom.xml
Date Mon, 20 Oct 2008 07:06:42 GMT
Author: jdillon
Date: Mon Oct 20 00:06:41 2008
New Revision: 706134

URL: http://svn.apache.org/viewvc?rev=706134&view=rev
Log:
Rip out ClassWorlds from the BeanContainer, just use URLClassLoader

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

Modified: geronimo/gshell/trunk/gshell-bootstrap/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-bootstrap/pom.xml?rev=706134&r1=706133&r2=706134&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-bootstrap/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-bootstrap/pom.xml Mon Oct 20 00:06:41 2008
@@ -41,6 +41,13 @@
         <dependency>
             <groupId>org.codehaus.plexus</groupId>
             <artifactId>plexus-classworlds</artifactId>
+            <version>1.2-alpha-13</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>junit</groupId>
+                    <artifactId>junit</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
     </dependencies>
     

Modified: geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml?rev=706134&r1=706133&r2=706134&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-spring/pom.xml Mon Oct 20 00:06:41 2008
@@ -84,11 +84,6 @@
         </dependency>
 
         <dependency>
-            <groupId>org.codehaus.plexus</groupId>
-            <artifactId>plexus-classworlds</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
             <scope>test</scope>

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=706134&r1=706133&r2=706134&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
Mon Oct 20 00:06:41 2008
@@ -20,18 +20,15 @@
 package org.apache.geronimo.gshell.spring;
 
 import org.apache.geronimo.gshell.chronos.StopWatch;
-import org.codehaus.plexus.classworlds.ClassWorld;
-import org.codehaus.plexus.classworlds.realm.ClassRealm;
-import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 
 import java.net.URL;
+import java.net.URLClassLoader;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Map;
-import java.util.UUID;
 
 /**
  * Default {@link BeanContainer} implementation.
@@ -43,33 +40,31 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    private final ClassRealm classRealm;
-    
+    private final ClassLoader classLoader;
+
     private final BeanContainerImpl parent;
 
     private final BeanContainerContextImpl context;
 
     public BeanContainerImpl(final ClassLoader cl) {
-        this(createClassRealm(cl), null);
+        this(cl, null);
     }
 
-    private BeanContainerImpl(final ClassRealm classRealm, final BeanContainerImpl parent)
{
-        assert classRealm != null;
+    private BeanContainerImpl(final ClassLoader classLoader, final BeanContainerImpl parent)
{
+        assert classLoader != null;
         // parent may be null
 
         this.parent = parent;
-        this.classRealm = classRealm;
+        this.classLoader = classLoader;
 
         // Construct the container and add customizations
-        context = new BeanContainerContextImpl(classRealm, parent != null ? parent.context
: null);
-        context.setId(classRealm.getId());
+        context = new BeanContainerContextImpl(classLoader, parent != null ? parent.context
: null);
 
         // Add support for BeanContainerAware
         context.addBeanPostProcessor(new BeanContainerAwareProcessor(this));
 
         // Hook up annotation processing
         // context.addBeanPostProcessor(new RequiredAnnotationBeanPostProcessor());
-        // context.addBeanPostProcessor(new AutowiredAnnotationBeanPostProcessor());
         context.addBeanPostProcessor(new LifecycleProcessor());
 
         // Add automatic trace logging of loaded beans
@@ -77,7 +72,7 @@
     }
 
     public ClassLoader getClassLoader() {
-        return classRealm;
+        return classLoader;
     }
     
     public BeanContainer getParent() {
@@ -119,21 +114,15 @@
             }
         }
 
-        ClassRealm childRealm;
-        try {
-            childRealm = classRealm.createChildRealm(id);
-        }
-        catch (DuplicateRealmException e) {
-            throw new BeanContainerException("Failed to create child container realm: " +
id, e);
-        }
-
+        URLClassLoader childLoader;
         if (classPath != null) {
-            for (URL url : classPath) {
-                childRealm.addURL(url);
-            }
+            childLoader = new URLClassLoader(classPath.toArray(new URL[classPath.size()]),
classLoader);
+        }
+        else {
+            childLoader = new URLClassLoader(new URL[0], classLoader);
         }
 
-        return new BeanContainerImpl(childRealm, this);
+        return new BeanContainerImpl(childLoader, this);
     }
 
     public BeanContainer createChild(final String id) {
@@ -191,16 +180,4 @@
 
         return getContext().getBeanNamesForType(type);
     }
-
-    private static ClassRealm createClassRealm(final ClassLoader cl) {
-        assert cl != null;
-
-        try {
-            return new ClassWorld().newRealm("gshell(" + UUID.randomUUID() + ")", cl);
-        }
-        catch (DuplicateRealmException e) {
-            // Should never happen
-            throw new Error(e);
-        }
-    }
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/pom.xml?rev=706134&r1=706133&r2=706134&view=diff
==============================================================================
--- geronimo/gshell/trunk/pom.xml (original)
+++ geronimo/gshell/trunk/pom.xml Mon Oct 20 00:06:41 2008
@@ -92,18 +92,6 @@
             </dependency>
 
             <dependency>
-                <groupId>org.codehaus.plexus</groupId>
-                <artifactId>plexus-classworlds</artifactId>
-                <version>1.2-alpha-13</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>junit</groupId>
-                        <artifactId>junit</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-
-            <dependency>
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
                 <version>3.8.2</version>



Mime
View raw message