[Jboss-cvs] JBossAS SVN: r56650 - in projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers: plugins/deployment plugins/structure spi/structure

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 8 10:31:15 EDT 2006


Author: adrian at jboss.org
Date: 2006-09-08 10:31:10 -0400 (Fri, 08 Sep 2006)
New Revision: 56650

Modified:
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployment/MainDeployerImpl.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java
   projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentContext.java
Log:
[JBMICROCONT-5] - Add an extensible reset mechanism for reusing contexts.

Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployment/MainDeployerImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployment/MainDeployerImpl.java	2006-09-08 14:23:50 UTC (rev 56649)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployment/MainDeployerImpl.java	2006-09-08 14:31:10 UTC (rev 56650)
@@ -142,6 +142,7 @@
          throw new IllegalArgumentException("Null deployer");
       structureDeployers.remove(deployer);
       log.debug("Remove structure deployer: " + deployer);
+      // TODO remove deployments for this structure?
    }
    
    /**
@@ -155,6 +156,7 @@
          throw new IllegalArgumentException("Null deployer");
       DeployerWrapper wrapper = new DeployerWrapper(deployer);
       deployers.add(wrapper);
+      log.debug("Added deployer: " + deployer);
       // TODO process existing deployments
    }
    
@@ -168,6 +170,7 @@
       if (deployer == null)
          throw new IllegalArgumentException("Null deployer");
       deployers.remove(deployer);
+      log.debug("Removed deployer: " + deployer);
       // TODO unprocess existing deployments
    }
 
@@ -208,9 +211,7 @@
             throw new IllegalStateException("Deployment already exists as a subdeployment: " + context.getName()); 
       }
 
-      if (context.getStructureDetermined() == YES)
-         context.setStructureDetermined(NO);
-      context.setProblem(null);
+      reset(context);
 
       topLevelDeployments.put(name, context);
       try
@@ -336,6 +337,23 @@
    }
 
    /**
+    * Reset a deployment context
+    * 
+    * @param context the context
+    * @throws IllegalArgumentException for a null context
+    */
+   protected void reset(DeploymentContext context)
+   {
+      if (context == null)
+         throw new IllegalArgumentException("Null context");
+
+      if (context.getStructureDetermined() == YES)
+         context.setStructureDetermined(NO);
+      context.setProblem(null);
+      context.reset();
+   }
+
+   /**
     * Determine the deployment structure
     * 
     * @param context the context

Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java	2006-09-08 14:23:50 UTC (rev 56649)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/structure/AbstractDeploymentContext.java	2006-09-08 14:31:10 UTC (rev 56650)
@@ -388,6 +388,17 @@
       }
    }
    
+   public void reset()
+   {
+      if (structureDetermined != StructureDetermined.PREDETERMINED)
+         children.clear();
+      else
+      {
+         for (DeploymentContext child : children)
+            child.reset();
+      }
+   }
+
    public String toString()
    {
       StringBuilder buffer = new StringBuilder();

Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentContext.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentContext.java	2006-09-08 14:23:50 UTC (rev 56649)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/spi/structure/DeploymentContext.java	2006-09-08 14:31:10 UTC (rev 56650)
@@ -221,4 +221,9 @@
     * @param problem the problem
     */
    void setProblem(Throwable problem);
+   
+   /**
+    * Reset a deployment context that is about to be deployed
+    */
+   void reset();
 }




More information about the jboss-cvs-commits mailing list