[jboss-cvs] JBossAS SVN: r109191 - trunk/system-jmx/src/main/java/org/jboss/deployment.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 8 06:09:35 EST 2010


Author: emuckenhuber
Date: 2010-11-08 06:09:34 -0500 (Mon, 08 Nov 2010)
New Revision: 109191

Modified:
   trunk/system-jmx/src/main/java/org/jboss/deployment/MainDeployer.java
Log:
JBAS-8319

Modified: trunk/system-jmx/src/main/java/org/jboss/deployment/MainDeployer.java
===================================================================
--- trunk/system-jmx/src/main/java/org/jboss/deployment/MainDeployer.java	2010-11-07 13:10:51 UTC (rev 109190)
+++ trunk/system-jmx/src/main/java/org/jboss/deployment/MainDeployer.java	2010-11-08 11:09:34 UTC (rev 109191)
@@ -21,17 +21,23 @@
  */
 package org.jboss.deployment;
 
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
 import org.jboss.bootstrap.api.as.config.JBossASServerConfig;
 import org.jboss.deployers.client.spi.DeployerClient;
 import org.jboss.deployers.client.spi.Deployment;
@@ -356,14 +362,21 @@
       {
          try
          {
-            // avoid caching
+            // 
             VirtualFile file = VFS.getChild(url);
-            if (file == null || file.exists() == false)
-               throw new DeploymentException("File doesn't exist: " + url);
-
-            VFSDeployment deployment = deploymentFactory.createVFSDeployment(file);
+            if (file == null || file.exists() == false) {
+               // copy to temp location and deploy from there.
+               final File temp = File.createTempFile("tmp", getShortName(url.getPath()), getTempDir());
+               temp.deleteOnExit();
+               copy(url, temp);
+               file = VFS.getChild(temp.toURI());
+               deploymentName = url.toExternalForm();
+            } else {
+               deploymentName = file.asFileURI().toString();               
+            }
+            
+            final VFSDeployment deployment = deploymentFactory.createVFSDeployment(deploymentName, file);
             delegate.addDeployment(deployment);
-            deploymentName = deployment.getName();
             delegate.process();
             // TODO: JBAS-4292
             contextMap.put(url, deploymentName);
@@ -570,13 +583,21 @@
       }
    }
 
+   @Deprecated
    public void deploy(Deployment deployment) throws org.jboss.deployers.spi.DeploymentException
    {
       delegate.deploy(deployment);
    }
 
+   @Deprecated
    public void undeploy(Deployment deployment) throws org.jboss.deployers.spi.DeploymentException
    {
       delegate.undeploy(deployment);
    }
+   
+   private static String getShortName(String name) {
+      if (name.endsWith("/")) name = name.substring(0, name.length() - 1);
+      name = name.substring(name.lastIndexOf("/") + 1);
+      return name;
+   }
 }



More information about the jboss-cvs-commits mailing list