geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1448352 - in /geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin: jmx/ local/ remote/
Date Wed, 20 Feb 2013 19:04:42 GMT
Author: gawor
Date: Wed Feb 20 19:04:42 2013
New Revision: 1448352

URL: http://svn.apache.org/r1448352
Log:
improve error reporting when doing remote deployment and the remote upload service (servlet)
is not running

Modified:
    geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
    geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
    geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/DistributeCommand.java
    geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/RedeployCommand.java
    geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/RemoteDeployUtil.java

Modified: geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java?rev=1448352&r1=1448351&r2=1448352&view=diff
==============================================================================
--- geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
(original)
+++ geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/RemoteDeploymentManager.java
Wed Feb 20 19:04:42 2013
@@ -160,13 +160,27 @@ public class RemoteDeploymentManager ext
 
     @Override
     public Object startInstall(File carFile, String defaultRepository, boolean restrictToDefaultRepository,
String username, String password) {
-        File remoteFile = getRemoteFile(carFile);
+        File remoteFile = null;
+        try {
+            remoteFile = getRemoteFile(carFile);
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
         return super.startInstall(remoteFile, defaultRepository, restrictToDefaultRepository,
username, password);
     }
 
     @Override
     public Artifact installLibrary(File libFile, String groupId) throws IOException {
-        File remoteFile = getRemoteFile(libFile);
+        File remoteFile = null;
+        try {
+            remoteFile = getRemoteFile(libFile);
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
         return super.installLibrary(remoteFile, groupId);
     }
 
@@ -200,7 +214,7 @@ public class RemoteDeploymentManager ext
         }
     }
     
-    private File getRemoteFile(File file) {
+    private File getRemoteFile(File file) throws Exception {
         if (isSameMachine) {
             return file;
         } else {
@@ -217,7 +231,7 @@ public class RemoteDeploymentManager ext
             
             File[] args = new File[] {file};
             
-            RemoteDeployUtil.uploadFilesToServer(args, progress);
+            RemoteDeployUtil.uploadFilesToServerException(args, progress);
             
             // RemoteDeployUtil.uploadFilesToServer updates the args parameter with the
             // new filename on the server

Modified: geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java?rev=1448352&r1=1448351&r2=1448352&view=diff
==============================================================================
--- geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
(original)
+++ geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/AbstractDeployCommand.java
Wed Feb 20 19:04:42 2013
@@ -142,10 +142,11 @@ public abstract class AbstractDeployComm
         }
     }
 
-    protected void massageFileNames(File[] inputs) {
+    protected void massageFileNames(File[] inputs) throws Exception {
     }
 
     public URL getRemoteDeployUploadURL() throws Exception {
-       return new URL((String)kernel.getAttribute(deployer, "remoteDeployUploadURL"));
+        String remoteDeployURL = (String) kernel.getAttribute(deployer, "remoteDeployUploadURL");
+        return (remoteDeployURL == null) ? null : new URL(remoteDeployURL);
     }
 }

Modified: geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/DistributeCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/DistributeCommand.java?rev=1448352&r1=1448351&r2=1448352&view=diff
==============================================================================
--- geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/DistributeCommand.java
(original)
+++ geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/DistributeCommand.java
Wed Feb 20 19:04:42 2013
@@ -39,8 +39,9 @@ public class DistributeCommand extends o
         super(kernel, targetList, moduleType, moduleStream, deploymentStream);
     }
 
-    protected void massageFileNames(File[] inputs) {
-        RemoteDeployUtil.uploadFilesToServer(inputs, this);
+    @Override
+    protected void massageFileNames(File[] inputs) throws Exception {
+        RemoteDeployUtil.uploadFilesToServerException(inputs, this);
     }
     
     public void run() {

Modified: geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/RedeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/RedeployCommand.java?rev=1448352&r1=1448351&r2=1448352&view=diff
==============================================================================
--- geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/RedeployCommand.java
(original)
+++ geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/RedeployCommand.java
Wed Feb 20 19:04:42 2013
@@ -37,7 +37,8 @@ public class RedeployCommand extends org
         super(kernel, moduleIDList, moduleArchive, deploymentPlan);
     }
 
-    protected void massageFileNames(File[] inputs) {
-        RemoteDeployUtil.uploadFilesToServer(inputs, this);
+    @Override
+    protected void massageFileNames(File[] inputs) throws Exception {
+        RemoteDeployUtil.uploadFilesToServerException(inputs, this);
     }
 }

Modified: geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/RemoteDeployUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/RemoteDeployUtil.java?rev=1448352&r1=1448351&r2=1448352&view=diff
==============================================================================
--- geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/RemoteDeployUtil.java
(original)
+++ geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/remote/RemoteDeployUtil.java
Wed Feb 20 19:04:42 2013
@@ -17,7 +17,12 @@
 package org.apache.geronimo.deployment.plugin.remote;
 
 import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
 
+import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand;
 
 /**
@@ -26,7 +31,40 @@ import org.apache.geronimo.deployment.pl
  * @version $Rev$ $Date$
  */
 public class RemoteDeployUtil {
+    
+    public static void uploadFilesToServerException(File[] files, final AbstractDeployCommand
command) throws Exception {
+        URL url = command.getRemoteDeployUploadURL();
+        if (url == null) {
+            throw new DeploymentException("Cannot perform remote file upload. Remote upload
service may not be running.");
+        }
+        String username = command.getCommandContext().getUsername();
+        String password = command.getCommandContext().getPassword(); 
+        FileUploadClient uploadServletClient = new FileUploadServletClient();
+        final List<Exception> exceptions = new ArrayList<Exception>();
+        uploadServletClient.uploadFilesToServer(url, username, password, files, new FileUploadProgress()
{
+
+            @Override
+            public void updateStatus(String message) {
+                command.updateStatus(message);
+            }
+
+            @Override
+            public void fail(String message) {
+                exceptions.add(new IOException(message));
+            }
+
+            @Override
+            public void fail(Exception exception) {
+                exceptions.add(exception);
+            }
+            
+        });
 
+        if (!exceptions.isEmpty()) {
+            throw new DeploymentException("Remote file upload failed", exceptions);
+        }
+    }
+    
     public static void uploadFilesToServer(File[] files, AbstractDeployCommand command) {
         FileUploadClient uploadServletClient = new FileUploadServletClient();
         try {



Mime
View raw message