geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r148882 - /geronimo/trunk/modules/spring-builder/src/java/org/apache/geronimo/spring/deployment/SPRConfigBuilder.java
Date Fri, 28 Jan 2005 12:35:12 GMT
Author: jules
Date: Fri Jan 28 04:35:11 2005
New Revision: 148882

URL: http://svn.apache.org/viewcvs?view=rev&rev=148882
Log:
improve code that adds jars to app classloader

Modified:
   geronimo/trunk/modules/spring-builder/src/java/org/apache/geronimo/spring/deployment/SPRConfigBuilder.java

Modified: geronimo/trunk/modules/spring-builder/src/java/org/apache/geronimo/spring/deployment/SPRConfigBuilder.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/spring-builder/src/java/org/apache/geronimo/spring/deployment/SPRConfigBuilder.java?view=diff&rev=148882&p1=geronimo/trunk/modules/spring-builder/src/java/org/apache/geronimo/spring/deployment/SPRConfigBuilder.java&r1=148881&p2=geronimo/trunk/modules/spring-builder/src/java/org/apache/geronimo/spring/deployment/SPRConfigBuilder.java&r2=148882
==============================================================================
--- geronimo/trunk/modules/spring-builder/src/java/org/apache/geronimo/spring/deployment/SPRConfigBuilder.java
(original)
+++ geronimo/trunk/modules/spring-builder/src/java/org/apache/geronimo/spring/deployment/SPRConfigBuilder.java
Fri Jan 28 04:35:11 2005
@@ -108,6 +108,33 @@
     return xbdr;
   }
 
+  // TODO - it would be nice if this printed out original names of
+  // jars, rather than name of file that has been copied out...
+  protected void
+    addJarToClassPath(DeploymentContext ctx, JarFile jar)
+    throws Exception
+  {
+    String name=jar.getName();
+    log.info("Adding Jar to application ClassLoader: "+name);
+    ctx.addIncludeAsPackedJar(new URI(name+".tmp"), jar); // without the .tmp this crashes
horribly
+
+    // if NestedJarFile was transparent we could remove this test and
+    // recurse to the bottom of the innermost jar - but instead we end
+    // up hanging waiting for the first entry of the first nested jar
+    // - So we are stuck with just supporting one level of nesting for
+    // the moment - shame :-(
+    if (!(jar instanceof NestedJarFile))
+    {
+      for (Enumeration e=jar.entries(); e.hasMoreElements();)
+      {
+	ZipEntry entry = (ZipEntry) e.nextElement();
+	String ename=entry.getName();
+	if (ename.endsWith(".jar"))
+	  addJarToClassPath(ctx, new NestedJarFile(jar, ename));
+      }
+    }
+  }
+
   public List
     buildConfiguration(Object plan, JarFile sprFile, File outfile)
     throws IOException, DeploymentException
@@ -131,20 +158,13 @@
 				    kernel);
 
       // set up classpath
-      log.info("Adding jar to classpath: "+sprFile.getName());
-      ctx.addIncludeAsPackedJar(new URI(sprFile.getName()+"-root.jar"), sprFile);
+      addJarToClassPath(ctx, sprFile);
 
       for (Enumeration e=sprFile.entries(); e.hasMoreElements();)
       {
 	ZipEntry entry = (ZipEntry) e.nextElement();
 	String name=entry.getName();
 	ctx.addFile(URI.create(name), sprFile, entry);
-
-	if (name.endsWith(".jar"))
-	{
-	  log.info("Adding jar to classpath: "+sprFile.getName()+"/"+name);
-	  ctx.addIncludeAsPackedJar(new URI(sprFile.getName()+"-nested-"+name), new NestedJarFile(sprFile,
name));
-	}
       }
 
       // now we can get ClassLoader...

Mime
View raw message