[jboss-cvs] JBossAS SVN: r58079 - in trunk/deployment/src: etc main/org/jboss/deployment/services

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 3 13:11:53 EST 2006


Author: scott.stark at jboss.org
Date: 2006-11-03 13:11:49 -0500 (Fri, 03 Nov 2006)
New Revision: 58079

Modified:
   trunk/deployment/src/etc/jsr88-service.xml
   trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java
Log:
Merge the failOnCollision, deleteOnUndeploy changes from JEE5_TCK

Modified: trunk/deployment/src/etc/jsr88-service.xml
===================================================================
--- trunk/deployment/src/etc/jsr88-service.xml	2006-11-03 18:05:16 UTC (rev 58078)
+++ trunk/deployment/src/etc/jsr88-service.xml	2006-11-03 18:11:49 UTC (rev 58079)
@@ -15,5 +15,9 @@
       <!-- The MainDeployer to process deployments -->
       <attribute name="MainDeployer"><inject bean="MainDeployer" /></attribute>
       <attribute name="UploadDir">${jboss.server.temp.dir}/jsr88</attribute>
+      <!-- If false, the an existing deployment may exist in the upload dir  -->
+      <attribute name="FailOnCollision">false</attribute>
+      <!-- If false, the deployment is retained in the upload dir -->
+      <attribute name="DeleteOnUndeploy">false</attribute>
    </mbean>
 </server>

Modified: trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java
===================================================================
--- trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java	2006-11-03 18:05:16 UTC (rev 58078)
+++ trunk/deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java	2006-11-03 18:11:49 UTC (rev 58079)
@@ -96,6 +96,8 @@
     * The local directory for uploaded content.
     */
    private File uploadDir;
+   private boolean failOnCollision;
+   private boolean deleteOnUndeploy;
 
    public MainDeployer getMainDeployer()
    {
@@ -160,6 +162,26 @@
       this.uploadDir = uploadDir;
    }
 
+   public boolean isDeleteOnUndeploy()
+   {
+      return deleteOnUndeploy;
+   }
+
+   public void setDeleteOnUndeploy(boolean deleteOnUndeploy)
+   {
+      this.deleteOnUndeploy = deleteOnUndeploy;
+   }
+
+   public boolean isFailOnCollision()
+   {
+      return failOnCollision;
+   }
+
+   public void setFailOnCollision(boolean failOnCollision)
+   {
+      this.failOnCollision = failOnCollision;
+   }
+
    public Map getModuleMap()
    {
       return Collections.unmodifiableMap(moduleMap);
@@ -179,9 +201,12 @@
       File path = new File(deployURL.getFile());
       String archive = path.getName();
       File deployFile = new File(uploadDir, archive);
-      if (deployFile.exists() == true)
+      if (failOnCollision && deployFile.exists())
          throw new IOException("deployURL(" + deployURL + ") collides with: " + deployFile.getPath());
 
+      if (deployFile.exists())
+         Files.delete(deployFile);
+
       File parentFile = deployFile.getParentFile();
       if (parentFile.exists() == false)
       {
@@ -265,8 +290,10 @@
       File deployFile = new File(uploadDir, archive);
       if (deployFile.exists() == false)
          throw new IOException("deployURL(" + url + ") has not been distributed");
-      Files.delete(deployFile);
 
+      if (deleteOnUndeploy)
+         Files.delete(deployFile);
+
       moduleMap.remove(url);
    }
 




More information about the jboss-cvs-commits mailing list