[jboss-cvs] JBossAS SVN: r109157 - in trunk/profileservice/src/main/java/org/jboss/profileservice/management: upload and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 5 08:57:00 EDT 2010


Author: emuckenhuber
Date: 2010-11-05 08:56:59 -0400 (Fri, 05 Nov 2010)
New Revision: 109157

Modified:
   trunk/profileservice/src/main/java/org/jboss/profileservice/management/client/upload/StreamingDeploymentTarget.java
   trunk/profileservice/src/main/java/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java
   trunk/profileservice/src/main/java/org/jboss/profileservice/management/upload/remoting/DeployHandler.java
Log:
fail if distribute on the DeploymentManager is called with the wrong parameter.

Modified: trunk/profileservice/src/main/java/org/jboss/profileservice/management/client/upload/StreamingDeploymentTarget.java
===================================================================
--- trunk/profileservice/src/main/java/org/jboss/profileservice/management/client/upload/StreamingDeploymentTarget.java	2010-11-05 12:53:47 UTC (rev 109156)
+++ trunk/profileservice/src/main/java/org/jboss/profileservice/management/client/upload/StreamingDeploymentTarget.java	2010-11-05 12:56:59 UTC (rev 109157)
@@ -21,6 +21,7 @@
  */
 package org.jboss.profileservice.management.client.upload;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Serializable;
@@ -96,10 +97,17 @@
       try
       {
          log.debug("Begin distribute: " + deployment);
+         final URL contentURL = deployment.getContentURL();
          String[] rnames;
+         if(!deployment.isCopyContent()) {            
+            final File file = new File(contentURL.toURI());
+            if(file.exists() == false) {
+               throw new RuntimeException(String.format("file (%s) does not exist. Use 'copyContent = true' " +
+               		"to copy the deployment.", contentURL));
+            }
+         }
          if (deployment.isCopyContent())
          {
-            URL contentURL = deployment.getContentURL();
             SerializableDeploymentID sdtID = new SerializableDeploymentID(deployment);
             InputStream contentIS = contentURL.openStream();
             sdtID.setContentIS(contentIS);

Modified: trunk/profileservice/src/main/java/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java
===================================================================
--- trunk/profileservice/src/main/java/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java	2010-11-05 12:53:47 UTC (rev 109156)
+++ trunk/profileservice/src/main/java/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java	2010-11-05 12:56:59 UTC (rev 109157)
@@ -31,8 +31,8 @@
 
 import org.jboss.deployers.spi.management.deploy.DeploymentManager;
 import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.deployers.spi.management.deploy.DeploymentStatus.CommandType;
 import org.jboss.deployers.spi.management.deploy.DeploymentTarget;
-import org.jboss.deployers.spi.management.deploy.DeploymentStatus.CommandType;
 import org.jboss.logging.Logger;
 import org.jboss.profileservice.management.client.upload.DeploymentProgressImpl;
 import org.jboss.profileservice.management.client.upload.SerializableDeploymentID;

Modified: trunk/profileservice/src/main/java/org/jboss/profileservice/management/upload/remoting/DeployHandler.java
===================================================================
--- trunk/profileservice/src/main/java/org/jboss/profileservice/management/upload/remoting/DeployHandler.java	2010-11-05 12:53:47 UTC (rev 109156)
+++ trunk/profileservice/src/main/java/org/jboss/profileservice/management/upload/remoting/DeployHandler.java	2010-11-05 12:56:59 UTC (rev 109157)
@@ -22,6 +22,7 @@
 package org.jboss.profileservice.management.upload.remoting;
 
 import java.io.InputStream;
+import java.net.URL;
 import java.util.Map;
 
 import javax.management.MBeanServer;
@@ -40,6 +41,8 @@
 import org.jboss.remoting.stream.StreamInvocationHandler;
 import org.jboss.security.ISecurityManagement;
 import org.jboss.security.SecurityContext;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
 
 /**
  * A profile service deploy subsystem handling transient deployments. 
@@ -137,6 +140,11 @@
             }
             else if( parameter.equals("distribute") )
             {
+               final URL url = dtID.getContentURL();
+               final VirtualFile vf = VFS.getChild(url);
+               if(vf == null || vf.exists() == false) {
+                  throw new IllegalStateException(String.format("file (%s) does not exist. Use 'copyContent = true' to copy the deployment", url));
+               }
                returnValue = delegate.distribute(dtID, null);
             }
             else if( parameter.equals("prepare"))



More information about the jboss-cvs-commits mailing list