geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r154208 - in geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin: jmx/JMXDeploymentManager.java local/AbstractDeployCommand.java local/DistributeCommand.java local/RedeployCommand.java
Date Thu, 17 Feb 2005 23:46:19 GMT
Author: djencks
Date: Thu Feb 17 15:46:17 2005
New Revision: 154208

URL: http://svn.apache.org/viewcvs?view=rev&rev=154208
Log:
support both kinds of redeploy, as we claim

Modified:
    geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
    geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
    geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
    geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java

Modified: geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java?view=diff&r1=154207&r2=154208
==============================================================================
--- geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
(original)
+++ geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
Thu Feb 17 15:46:17 2005
@@ -217,7 +217,13 @@
     }
 
     public ProgressObject redeploy(TargetModuleID[] moduleIDList, InputStream moduleArchive,
InputStream deploymentPlan) {
-        throw new UnsupportedOperationException();
+        if (kernel == null) {
+            throw new IllegalStateException("Disconnected");
+        }
+        RedeployCommand command = new RedeployCommand(kernel, moduleIDList, moduleArchive,
deploymentPlan);
+        command.setLogErrors(logErrors);
+        new Thread(command).start();
+        return command;
     }
 
     public Locale[] getSupportedLocales() {

Modified: geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java?view=diff&r1=154207&r2=154208
==============================================================================
--- geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
(original)
+++ geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
Thu Feb 17 15:46:17 2005
@@ -18,6 +18,11 @@
 
 import java.util.Set;
 import java.util.Iterator;
+import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.FileOutputStream;
 import javax.enterprise.deploy.shared.CommandType;
 import javax.management.ObjectName;
 
@@ -51,5 +56,18 @@
         }
         return deployer;
 
+    }
+
+    protected void copyTo(File outfile, InputStream is) throws IOException {
+        byte[] buffer = new byte[4096];
+        int count;
+        OutputStream os = new FileOutputStream(outfile);
+        try {
+            while ((count = is.read(buffer)) > 0) {
+                os.write(buffer, 0, count);
+            }
+        } finally {
+            os.close();
+        }
     }
 }

Modified: geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java?view=diff&r1=154207&r2=154208
==============================================================================
--- geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
(original)
+++ geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
Thu Feb 17 15:46:17 2005
@@ -112,16 +112,4 @@
         }
     }
 
-    private void copyTo(File outfile, InputStream is) throws IOException {
-        byte[] buffer = new byte[4096];
-        int count;
-        OutputStream os = new FileOutputStream(outfile);
-        try {
-            while ((count = is.read(buffer)) > 0) {
-                os.write(buffer, 0, count);
-            }
-        } finally {
-            os.close();
-        }
-    }
 }

Modified: geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java?view=diff&r1=154207&r2=154208
==============================================================================
--- geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
(original)
+++ geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
Thu Feb 17 15:46:17 2005
@@ -17,6 +17,7 @@
 package org.apache.geronimo.deployment.plugin.local;
 
 import java.io.File;
+import java.io.InputStream;
 import java.net.URI;
 import javax.enterprise.deploy.shared.CommandType;
 import javax.enterprise.deploy.spi.TargetModuleID;
@@ -24,6 +25,7 @@
 
 import org.apache.geronimo.deployment.plugin.TargetImpl;
 import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.kernel.jmx.KernelMBean;
 
 /**
@@ -33,14 +35,26 @@
     private static final String[] DEPLOY_SIG = {File.class.getName(), File.class.getName()};
     private static final String[] UNINSTALL_SIG = {URI.class.getName()};
     private final TargetModuleID[] modules;
-    private final File moduleArchive;
-    private final File deploymentPlan;
+    private File moduleArchive;
+    private File deploymentPlan;
+    private InputStream moduleStream;
+    private InputStream deploymentStream;
+    private final boolean spool;
 
     public RedeployCommand(KernelMBean kernel, TargetModuleID modules[], File moduleArchive,
File deploymentPlan) {
         super(CommandType.START, kernel);
         this.modules = modules;
         this.moduleArchive = moduleArchive;
         this.deploymentPlan = deploymentPlan;
+        spool = false;
+    }
+
+    public RedeployCommand(KernelMBean kernel, TargetModuleID[] moduleIDList, InputStream
moduleArchive, InputStream deploymentPlan) {
+        super(CommandType.START, kernel);
+        this.modules = moduleIDList;
+        moduleStream = moduleArchive;
+        deploymentStream = deploymentPlan;
+        spool = true;
     }
 
     public void run() {
@@ -50,6 +64,16 @@
         }
 
         try {
+            if (spool) {
+                if (moduleStream != null) {
+                    moduleArchive = DeploymentUtil.createTempFile();
+                    copyTo(moduleArchive, moduleStream);
+                }
+                if (deploymentStream != null) {
+                    deploymentPlan = DeploymentUtil.createTempFile();
+                    copyTo(deploymentPlan, deploymentStream);
+                }
+            }
             for (int i = 0; i < modules.length; i++) {
                 TargetModuleIDImpl module = (TargetModuleIDImpl) modules[i];
 



Mime
View raw message