geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/util FileUtil.java
Date Mon, 01 Mar 2004 20:50:07 GMT
djencks     2004/03/01 12:50:07

  Modified:    modules/assembly/src/plan j2ee-deployer-plan.xml
                        j2ee-server-plan.xml
               modules/connector/src/java/org/apache/geronimo/connector/deployment
                        AbstractRARConfigBuilder.java
               modules/deployment/src/java/org/apache/geronimo/deployment
                        DeploymentContext.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local
                        DistributeCommand.java
               modules/deployment/src/java/org/apache/geronimo/deployment/util
                        FileUtil.java
  Log:
  Allow for deploying from stream by copying entries into temp files. Add the rar deployer
  
  Revision  Changes    Path
  1.4       +5 -3      incubator-geronimo/modules/assembly/src/plan/j2ee-deployer-plan.xml
  
  Index: j2ee-deployer-plan.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/assembly/src/plan/j2ee-deployer-plan.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- j2ee-deployer-plan.xml	28 Feb 2004 10:08:47 -0000	1.3
  +++ j2ee-deployer-plan.xml	1 Mar 2004 20:50:07 -0000	1.4
  @@ -25,12 +25,13 @@
       <include>
           <uri>geronimo/jars/geronimo-transaction-DEV.jar</uri>
       </include>
  -    <include>
  -        <uri>geronimo-spec/jars/geronimo-spec-j2ee-DEV.jar</uri>
  -    </include>
       <dependency>
           <uri>geronimo-spec/jars/geronimo-spec-j2eeschema-DEV.jar</uri>
       </dependency>
  +    <!-- seems to be required to load jetty deployer - but I think this should not be
here-->
  +    <dependency>
  +        <uri>geronimo-spec/jars/geronimo-spec-j2ee-DEV.jar</uri>
  +    </dependency>
   
       <gbean name="geronimo.deployment:role=Deployer,config=org/apache/geronimo/J2EEDeployer"
class="org.apache.geronimo.deployment.Deployer">
           <reference name="Builders">geronimo.deployer:role=Builder,config=org/apache/geronimo/J2EEDeployer,*</reference>
  @@ -38,6 +39,7 @@
       </gbean>
   
       <gbean name="geronimo.deployer:role=Builder,type=RAR_1_0,config=org/apache/geronimo/J2EEDeployer"
class="org.apache.geronimo.connector.deployment.RAR_1_0ConfigBuilder">
  +        <attribute name="ConnectionTrackerNamePattern" type="javax.management.ObjectName">geronimo.server:type=ConnectionTracker</attribute>
           <reference name="Kernel">geronimo.boot:role=Kernel</reference>
           <reference name="Repository">*:role=Repository,*</reference>
       </gbean>
  
  
  
  1.2       +4 -1      incubator-geronimo/modules/assembly/src/plan/j2ee-server-plan.xml
  
  Index: j2ee-server-plan.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/assembly/src/plan/j2ee-server-plan.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- j2ee-server-plan.xml	25 Feb 2004 08:01:08 -0000	1.1
  +++ j2ee-server-plan.xml	1 Mar 2004 20:50:07 -0000	1.2
  @@ -31,8 +31,11 @@
           <uri>geronimo/jars/geronimo-naming-DEV.jar</uri>
       </dependency>
       <dependency>
  -        <uri>geronimo/jars/geronimo-j2ee-DEV.jar</uri>
  +        <uri>geronimo/jars/geronimo-security-DEV.jar</uri>
       </dependency>
  +
  +    <gbean name="geronimo.server:type=ConnectionTracker" class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator">
  +    </gbean>
   
       <!-- default WAR container using Jetty -->
       <gbean name="geronimo.server:type=WebContainer,container=Jetty" class="org.apache.geronimo.jetty.JettyContainerImpl">
  
  
  
  1.6       +6 -7      incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/AbstractRARConfigBuilder.java
  
  Index: AbstractRARConfigBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/AbstractRARConfigBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractRARConfigBuilder.java	28 Feb 2004 10:08:47 -0000	1.5
  +++ AbstractRARConfigBuilder.java	1 Mar 2004 20:50:07 -0000	1.6
  @@ -17,16 +17,16 @@
   
   package org.apache.geronimo.connector.deployment;
   
  +import java.io.BufferedInputStream;
   import java.io.BufferedOutputStream;
   import java.io.File;
  +import java.io.FileInputStream;
   import java.io.FileOutputStream;
   import java.io.IOException;
  -import java.io.BufferedInputStream;
  -import java.io.FileInputStream;
  +import java.net.MalformedURLException;
   import java.net.URI;
   import java.net.URISyntaxException;
   import java.net.URL;
  -import java.net.MalformedURLException;
   import java.util.jar.JarEntry;
   import java.util.jar.JarInputStream;
   import java.util.jar.JarOutputStream;
  @@ -100,9 +100,7 @@
                   }
                   if (name.endsWith(".jar")) {
                       URI uri = moduleBase.resolve(name);
  -                    context.addFile(uri, jarInputStream);
  -                    //URL rarPath = entry.
  -                    context.addToClassPath(uri, null);
  +                    context.addStreamInclude(uri, jarInputStream);
                   }
                   //native libraries?
               }
  @@ -187,6 +185,7 @@
               os.flush();
           } finally {
               fos.close();
  +
           }
       }
   
  
  
  
  1.8       +24 -2     incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
  
  Index: DeploymentContext.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DeploymentContext.java	28 Feb 2004 10:08:47 -0000	1.7
  +++ DeploymentContext.java	1 Mar 2004 20:50:07 -0000	1.8
  @@ -17,6 +17,7 @@
   
   package org.apache.geronimo.deployment;
   
  +import java.io.File;
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.ObjectOutputStream;
  @@ -25,6 +26,7 @@
   import java.net.URL;
   import java.net.URLClassLoader;
   import java.util.ArrayList;
  +import java.util.Collection;
   import java.util.Collections;
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -35,9 +37,11 @@
   import java.util.jar.JarOutputStream;
   import java.util.zip.ZipEntry;
   import java.util.zip.ZipInputStream;
  +
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   
  +import org.apache.geronimo.deployment.util.FileUtil;
   import org.apache.geronimo.gbean.jmx.GBeanMBean;
   import org.apache.geronimo.kernel.Kernel;
   import org.apache.geronimo.kernel.config.Configuration;
  @@ -61,6 +65,7 @@
       private final byte[] buffer = new byte[4096];
       private final List ancestors;
       private final ClassLoader parentCL;
  +    private final Collection tmpfiles = new ArrayList();
   
       public DeploymentContext(JarOutputStream jos, URI id, URI parentID, Kernel kernel)
throws IOException, MalformedObjectNameException, DeploymentException {
           this.configID = id;
  @@ -132,6 +137,13 @@
           addToClassPath(path, url);
       }
   
  +    public void addStreamInclude(URI path, InputStream is) throws IOException {
  +        File tmp = FileUtil.toTempFile(is);
  +        addInclude(path, tmp.toURL());
  +        tmpfiles.add(tmp);
  +
  +    }
  +
       public void addArchive(URI path, ZipInputStream archive) throws IOException {
           ZipEntry src;
           while ((src = archive.getNextEntry()) != null) {
  @@ -140,7 +152,10 @@
           }
       }
   
  -    public void addToClassPath(URI path, URL url) {
  +    //This method was once public.  It appears to be useless in most cases so I made it
private.
  +    //Deploying from a stream (usual jsr 88 case) there is no URL to map unless the stream
  +    //contents are copied to a temp file.
  +    private void addToClassPath(URI path, URL url) {
           classPath.add(path);
           includes.put(path, url);
       }
  @@ -192,6 +207,13 @@
           saveConfiguration();
           jos.flush();
           jos.close();
  +
  +        for (Iterator iterator = tmpfiles.iterator(); iterator.hasNext();) {
  +            try {
  +                ((File) iterator.next()).delete();
  +            } catch (Exception e) {
  +            }
  +        }
   
           if (kernel != null && ancestors != null && ancestors.size() >
0) {
               try {
  
  
  
  1.7       +1 -3      incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
  
  Index: DistributeCommand.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DistributeCommand.java	28 Feb 2004 10:08:47 -0000	1.6
  +++ DistributeCommand.java	1 Mar 2004 20:50:07 -0000	1.7
  @@ -21,10 +21,8 @@
   import java.util.jar.JarInputStream;
   
   import javax.enterprise.deploy.shared.CommandType;
  -import javax.enterprise.deploy.spi.Target;
   
   import org.apache.geronimo.deployment.ConfigurationBuilder;
  -import org.apache.geronimo.kernel.config.ConfigurationParent;
   import org.apache.geronimo.kernel.config.ConfigurationStore;
   import org.apache.xmlbeans.XmlObject;
   
  
  
  
  1.3       +23 -1     incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/util/FileUtil.java
  
  Index: FileUtil.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/util/FileUtil.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FileUtil.java	25 Feb 2004 09:57:39 -0000	1.2
  +++ FileUtil.java	1 Mar 2004 20:50:07 -0000	1.3
  @@ -18,6 +18,9 @@
   package org.apache.geronimo.deployment.util;
   
   import java.io.File;
  +import java.io.InputStream;
  +import java.io.IOException;
  +import java.io.FileOutputStream;
   
   /**
    *
  @@ -25,6 +28,25 @@
    * @version $Revision$ $Date$
    */
   public class FileUtil {
  +
  +    private static int i;
  +
  +    public static File toTempFile(InputStream is) throws IOException {
  +        File tmp;
  +       // do {
  +            tmp = File.createTempFile("geronimodeployment" + i++, "tmp");
  +        //} while (tmp.exists());
  +        FileOutputStream fos = new FileOutputStream(tmp);
  +        byte[] buffer = new byte[4096];
  +        int count;
  +        while ((count = is.read(buffer)) > 0) {
  +            fos.write(buffer, 0, count);
  +        }
  +        fos.flush();
  +        fos.close();
  +        return tmp;
  +    }
  +
       public static void recursiveDelete(File root) {
           if (root.isDirectory()) {
               File[] files = root.listFiles();
  
  
  

Mime
View raw message