geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject cvs commit: incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment Deployer.java
Date Fri, 20 Feb 2004 21:04:02 GMT
jboynes     2004/02/20 13:04:02

  Modified:    modules/deployment/src/java/org/apache/geronimo/deployment
                        Deployer.java
  Log:
  Pass module to builder
  
  Revision  Changes    Path
  1.8       +38 -15    incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java
  
  Index: Deployer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/Deployer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Deployer.java	20 Feb 2004 19:20:59 -0000	1.7
  +++ Deployer.java	20 Feb 2004 21:04:02 -0000	1.8
  @@ -56,6 +56,7 @@
   package org.apache.geronimo.deployment;
   
   import java.io.File;
  +import java.io.IOException;
   import java.net.MalformedURLException;
   import java.net.URI;
   import java.net.URISyntaxException;
  @@ -66,6 +67,7 @@
   import java.util.List;
   import java.util.ArrayList;
   import java.util.Arrays;
  +import java.util.jar.JarInputStream;
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   
  @@ -140,27 +142,48 @@
               throw new DeploymentException("No plan or module supplied");
           }
   
  -        boolean saveOutput;
  -        if (cmd.carfile == null) {
  -            saveOutput = false;
  -            cmd.carfile = File.createTempFile("deployer", ".car");
  +        JarInputStream moduleStream;
  +        if (cmd.module != null) {
  +            try {
  +                moduleStream = new JarInputStream(cmd.module.openStream());
  +            } catch (IOException e) {
  +                throw new DeploymentException("Unable to open module", e);
  +            }
           } else {
  -            saveOutput = true;
  +            moduleStream = null;
           }
  -        try {
  -            builder.buildConfiguration(cmd.carfile, null, plan);
   
  +        try {
  +            boolean saveOutput;
  +            if (cmd.carfile == null) {
  +                saveOutput = false;
  +                cmd.carfile = File.createTempFile("deployer", ".car");
  +            } else {
  +                saveOutput = true;
  +            }
               try {
  -                if (cmd.install) {
  -                    kernel.install(cmd.carfile.toURL());
  +                builder.buildConfiguration(cmd.carfile, moduleStream, plan);
  +
  +                try {
  +                    if (cmd.install) {
  +                        kernel.install(cmd.carfile.toURL());
  +                    }
  +                } catch (InvalidConfigException e) {
  +                    // unlikely as we just built this
  +                    throw new DeploymentException(e);
  +                }
  +            } finally {
  +                if (!saveOutput) {
  +                    cmd.carfile.delete();
                   }
  -            } catch (InvalidConfigException e) {
  -                // unlikely as we just built this
  -                throw new DeploymentException(e);
               }
           } finally {
  -            if (!saveOutput) {
  -                cmd.carfile.delete();
  +            if (moduleStream != null) {
  +                try {
  +                    moduleStream.close();
  +                } catch (IOException e) {
  +                    // ignore to allow cause through
  +                }
               }
           }
       }
  
  
  

Mime
View raw message