You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2006/04/17 21:04:11 UTC

svn commit: r394750 - in /geronimo/branches/1.1: assemblies/j2ee-installer/ assemblies/j2ee-jetty-server/ assemblies/j2ee-jetty-server/src/var/config/ assemblies/j2ee-jetty-server/src/var/shared/ assemblies/j2ee-jetty-server/src/var/shared/classes/ ass...

Author: djencks
Date: Mon Apr 17 12:04:09 2006
New Revision: 394750

URL: http://svn.apache.org/viewcvs?rev=394750&view=rev
Log:
GERONIMO-1848 make shared lib work: initial patch plus missing classes and lib dirs in big jetty/tomcat servers

Added:
    geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/shared/
    geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/shared/classes/
    geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/shared/lib/
    geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/shared/
    geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/shared/classes/
    geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/shared/lib/
Modified:
    geronimo/branches/1.1/assemblies/j2ee-installer/project.xml
    geronimo/branches/1.1/assemblies/j2ee-jetty-server/project.xml
    geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml
    geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml
    geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/sharedlib/SharedLib.java

Modified: geronimo/branches/1.1/assemblies/j2ee-installer/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-installer/project.xml?rev=394750&r1=394749&r2=394750&view=diff
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-installer/project.xml (original)
+++ geronimo/branches/1.1/assemblies/j2ee-installer/project.xml Mon Apr 17 12:04:09 2006
@@ -460,6 +460,16 @@
             </properties>
         </dependency>
 
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>sharedlib</artifactId>
+            <type>car</type>
+            <version>${pom.currentVersion}</version>
+            <properties>
+                <geronimo.assemble>install</geronimo.assemble>
+            </properties>
+        </dependency>
+
         <!-- unpack -->
         <dependency>
             <groupId>geronimo</groupId>

Modified: geronimo/branches/1.1/assemblies/j2ee-jetty-server/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-jetty-server/project.xml?rev=394750&r1=394749&r2=394750&view=diff
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-jetty-server/project.xml (original)
+++ geronimo/branches/1.1/assemblies/j2ee-jetty-server/project.xml Mon Apr 17 12:04:09 2006
@@ -220,6 +220,15 @@
                 <geronimo.assemble>install</geronimo.assemble>
             </properties>
         </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>sharedlib</artifactId>
+            <type>car</type>
+            <version>${pom.currentVersion}</version>
+            <properties>
+                <geronimo.assemble>install</geronimo.assemble>
+            </properties>
+        </dependency>
 <!-- applications -->
 <!--
         <dependency>

Modified: geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml?rev=394750&r1=394749&r2=394750&view=diff
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml (original)
+++ geronimo/branches/1.1/assemblies/j2ee-jetty-server/src/var/config/config.xml Mon Apr 17 12:04:09 2006
@@ -95,6 +95,14 @@
             <attribute name="port">25</attribute>
         </gbean>
     </configuration>
+
+    <configuration name="geronimo/sharedlib/${pom.currentVersion}/car">
+        <gbean name="SharedLib">
+            <attribute name="classesDirs">var/shared/classes</attribute>
+            <attribute name="libDirs">var/shared/lib</attribute>
+        </gbean>
+    </configuration>
+
     <configuration name="geronimo/jetty-deployer/${pom.currentVersion}/car"/>
     <configuration name="geronimo/welcome-jetty/${pom.currentVersion}/car"/>
     <configuration name="geronimo/ldap-demo-jetty/${pom.currentVersion}/car" load="false"/>

Modified: geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml?rev=394750&r1=394749&r2=394750&view=diff
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml (original)
+++ geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml Mon Apr 17 12:04:09 2006
@@ -220,6 +220,15 @@
                 <geronimo.assemble>install</geronimo.assemble>
             </properties>
         </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>sharedlib</artifactId>
+            <type>car</type>
+            <version>${pom.currentVersion}</version>
+            <properties>
+                <geronimo.assemble>install</geronimo.assemble>
+            </properties>
+        </dependency>
 <!-- applications -->
 <!--
         <dependency>

Modified: geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml?rev=394750&r1=394749&r2=394750&view=diff
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml (original)
+++ geronimo/branches/1.1/assemblies/j2ee-tomcat-server/src/var/config/config.xml Mon Apr 17 12:04:09 2006
@@ -108,4 +108,12 @@
     <configuration name="geronimo/daytrader-derby-tomcat/${pom.currentVersion}/car" load="false"/>
     <configuration name="geronimo/remote-deploy-tomcat/${pom.currentVersion}/car" />
     <configuration name="geronimo/hot-deployer/${pom.currentVersion}/car" />
+
+    <configuration name="geronimo/sharedlib/${pom.currentVersion}/car">
+        <gbean name="SharedLib">
+            <attribute name="libDirs">var/shared/lib</attribute>
+            <attribute name="classesDirs">var/shared/classes</attribute>
+        </gbean>
+    </configuration>
+
 </attributes>

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/sharedlib/SharedLib.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/sharedlib/SharedLib.java?rev=394750&r1=394749&r2=394750&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/sharedlib/SharedLib.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/sharedlib/SharedLib.java Mon Apr 17 12:04:09 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.geronimo.system.sharedlib;
 
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import java.util.Arrays;
 import java.util.Set;
 import java.util.HashSet;
@@ -36,39 +38,47 @@
         MultiParentClassLoader multiParentClassLoader = (MultiParentClassLoader) classLoader;
         Set currentUrls = new HashSet(Arrays.asList(multiParentClassLoader.getURLs()));
 
-        LinkedHashSet newUrls = new LinkedHashSet(classesDirs.length + libDirs.length);
-        for (int i = 0; i < classesDirs.length; i++) {
-            String classesDir = classesDirs[i];
-            File dir = serverInfo.resolve(classesDir);
-            if (!dir.exists()) {
-                throw new IllegalArgumentException("Classes dir does not exist: " + dir);
-            }
-            if (!dir.isDirectory()) {
-                throw new IllegalArgumentException("Classes dir is not a directory: " + dir);
-            }
-            URL location = dir.toURL();
-            if (!currentUrls.contains(location)) {
-                newUrls.add(location);
+        int size=0;
+        if (classesDirs != null) size += classesDirs.length;
+        if (libDirs != null) size += libDirs.length;
+
+        LinkedHashSet newUrls = new LinkedHashSet(size);
+        if (classesDirs != null) {
+            for (int i = 0; i < classesDirs.length; i++) {
+                String classesDir = classesDirs[i];
+                File dir = serverInfo.resolve(classesDir);
+                if (!dir.exists()) {
+                    throw new IllegalArgumentException("Classes dir does not exist: " + dir);
+                }
+                if (!dir.isDirectory()) {
+                    throw new IllegalArgumentException("Classes dir is not a directory: " + dir);
+                }
+                URL location = dir.toURL();
+                if (!currentUrls.contains(location)) {
+                    newUrls.add(location);
+                }
             }
         }
 
-        for (int i = 0; i < libDirs.length; i++) {
-            String libDir = libDirs[i];
-            File dir = serverInfo.resolve(libDir);
-            if (!dir.exists()) {
-                throw new IllegalArgumentException("Lib dir does not exist: " + dir);
-            }
-            if (!dir.isDirectory()) {
-                throw new IllegalArgumentException("Lib dir is not a directory: " + dir);
-            }
+        if (libDirs != null) {
+            for (int i = 0; i < libDirs.length; i++) {
+                String libDir = libDirs[i];
+                File dir = serverInfo.resolve(libDir);
+                if (!dir.exists()) {
+                    throw new IllegalArgumentException("Lib dir does not exist: " + dir);
+                }
+                if (!dir.isDirectory()) {
+                    throw new IllegalArgumentException("Lib dir is not a directory: " + dir);
+                }
 
-            File[] files = dir.listFiles();
-            for (int j = 0; j < files.length; j++) {
-                File file = files[j];
-                if (file.canRead() && file.getName().endsWith(".jar")) {
-                    URL location = dir.toURL();
-                    if (!currentUrls.contains(location)) {
-                        newUrls.add(location);
+                File[] files = dir.listFiles();
+                for (int j = 0; j < files.length; j++) {
+                    File file = files[j];
+                    if (file.canRead() && file.getName().endsWith(".jar")) {
+                        URL location = file.toURL();
+                        if (!currentUrls.contains(location)) {
+                            newUrls.add(location);
+                        }
                     }
                 }
             }
@@ -78,5 +88,22 @@
             URL url = (URL) iterator.next();
             multiParentClassLoader.addURL(url);
         }
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(SharedLib.class);
+        infoFactory.addAttribute("classLoader", ClassLoader.class, false, false);
+        infoFactory.addAttribute("classesDirs", String[].class, true, true);
+        infoFactory.addAttribute("libDirs", String[].class, true, true);
+        infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
+
+        infoFactory.setConstructor(new String[]{"classLoader", "classesDirs", "libDirs", "ServerInfo"});  
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
     }
 }