[jboss-cvs] JBossAS SVN: r70100 - in projects/microcontainer/trunk: deployers-client-spi/src/main/org/jboss/deployers/client/spi and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 26 09:41:45 EST 2008


Author: adrian at jboss.org
Date: 2008-02-26 09:41:45 -0500 (Tue, 26 Feb 2008)
New Revision: 70100

Added:
   projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/spi/
   projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/spi/deployer/
   projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStage.java
   projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStages.java
   projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/main/test/DeployerChangeStageTestCase.java
Removed:
   projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStage.java
   projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStages.java
Modified:
   projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/client/spi/DeployerClient.java
   projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java
   projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java
   projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/main/test/DeployerSingleDeploymentTestCase.java
   projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/Deployers.java
Log:
Add support for changing the deployment stage of a deployment manually using the DeployerClient

Modified: projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/client/spi/DeployerClient.java
===================================================================
--- projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/client/spi/DeployerClient.java	2008-02-26 14:40:49 UTC (rev 70099)
+++ projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/client/spi/DeployerClient.java	2008-02-26 14:41:45 UTC (rev 70100)
@@ -26,6 +26,7 @@
 
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.DeploymentState;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
 import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.util.graph.Graph;
@@ -101,6 +102,15 @@
    void undeploy(Deployment... deployments) throws DeploymentException;
 
    /**
+    * Change the state of a deployment
+    * 
+    * @param deploymentName the deployment name
+    * @param stage the stage
+    * @throws DeploymentException for any error
+    */
+   void change(String deploymentName, DeploymentStage stage) throws DeploymentException;
+
+   /**
     * Check all the deployments are complete
     * 
     * @throws DeploymentException when some deployment is not complete

Copied: projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStage.java (from rev 70083, projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStage.java)
===================================================================
--- projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStage.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStage.java	2008-02-26 14:41:45 UTC (rev 70100)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.spi.deployer;
+
+import java.io.Serializable;
+
+/**
+ * DeploymentStage.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeploymentStage implements Serializable
+{
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 3302613286025012191L;
+
+   /** Our stage */
+   private String name;
+   
+   /** The previous state */
+   private String after;
+   
+   /** The next state */
+   private String before;
+
+   /**
+    * Safely get the name of stage
+    * 
+    * @param stage the stage
+    * @param context the context for an error
+    * @return the stage name
+    */
+   private static String getStageName(DeploymentStage stage, String context)
+   {
+      if (stage == null)
+         throw new IllegalArgumentException("Null " + context);
+      return stage.getName();
+   }
+   
+   /**
+    * Create a new DeploymentStage.
+    * 
+    * @param name the name of the stage
+    * @throws IllegalArgumentException for a null name
+    */
+   public DeploymentStage(String name)
+   {
+      this(name, (String) null);
+   }
+
+   /**
+    * Create a new DeploymentStage.
+    * 
+    * @param name the name of the stage
+    * @param after the name of the stage before our stage
+    * @throws IllegalArgumentException for a null name
+    */
+   public DeploymentStage(String name, String after)
+   {
+      this(name, after, null);
+   }
+
+   /**
+    * Create a new DeploymentStage.
+    * 
+    * @param name the name of the stage
+    * @param after the stage before our stage
+    * @throws IllegalArgumentException for a null parameter
+    */
+   public DeploymentStage(String name, DeploymentStage after)
+   {
+      this(name, getStageName(after, "after"), null);
+   }
+
+   /**
+    * Create a new DeploymentStage.
+    * 
+    * @param name the name of the stage
+    * @param after he stage before our stage
+    * @param before the stage after our stage
+    * @throws IllegalArgumentException for a null parameter
+    */
+   public DeploymentStage(String name, DeploymentStage after, DeploymentStage before)
+   {
+      this(name, getStageName(after, "after"), getStageName(before, "before"));
+   }
+
+   /**
+    * Create a new DeploymentStage.
+    * 
+    * @param name the name of the stage
+    * @param after the name of the stage before our stage
+    * @param before the name of the stage after our stage
+    * @throws IllegalArgumentException for a null name
+    */
+   public DeploymentStage(String name, String after, String before)
+   {
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+      this.name = name;
+      this.after = after;
+      this.before = before;
+   }
+
+   /**
+    * Get the name.
+    * 
+    * @return the name.
+    */
+   public String getName()
+   {
+      return name;
+   }
+
+   /**
+    * Get the after.
+    * 
+    * @return the after.
+    */
+   public String getAfter()
+   {
+      return after;
+   }
+
+   /**
+    * Get the before.
+    * 
+    * @return the before.
+    */
+   public String getBefore()
+   {
+      return before;
+   }
+   
+   @Override
+   public String toString()
+   {
+      return getName();
+   }
+}

Copied: projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStages.java (from rev 70083, projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStages.java)
===================================================================
--- projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStages.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-client-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStages.java	2008-02-26 14:41:45 UTC (rev 70100)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.spi.deployer;
+
+/**
+ * The Standard DeploymentStages.
+ * 
+ * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DeploymentStages
+{
+   /** The not installed stage - nothing is done here */
+   DeploymentStage NOT_INSTALLED = new DeploymentStage("Not Installed");
+
+   /** The parse stage - where metadata is read */
+   DeploymentStage PARSE = new DeploymentStage("Parse", NOT_INSTALLED);
+
+   /** The describe stage - where dependencies are established */
+   DeploymentStage DESCRIBE = new DeploymentStage("Describe", PARSE);
+
+   /** The classloader stage - where classloaders are created */
+   DeploymentStage CLASSLOADER = new DeploymentStage("ClassLoader", DESCRIBE);
+
+   /** The post classloader stage - e.g. aop */
+   DeploymentStage POST_CLASSLOADER = new DeploymentStage("PostClassLoader", CLASSLOADER);
+
+   /** The real stage - where real deployment processing is done */
+   DeploymentStage REAL = new DeploymentStage("Real", POST_CLASSLOADER);
+
+   /** The installed stage - could be used to provide valve in future? */
+   DeploymentStage INSTALLED = new DeploymentStage("Installed", REAL);
+}

Modified: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java	2008-02-26 14:40:49 UTC (rev 70099)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java	2008-02-26 14:41:45 UTC (rev 70100)
@@ -384,8 +384,38 @@
       }
    }
 
+   public void change(DeploymentContext context, DeploymentStage stage) throws DeploymentException
+   {
+      if (context == null)
+         throw new DeploymentException("Null context");
+      if (stage == null)
+         throw new DeploymentException("Null stage");
+      
+      String stageName = stage.getName();
+      if (stages.containsKey(stage.getName()) == false)
+         throw new DeploymentException("Unknown deployment stage: " + stage);
+      
+      DeploymentControllerContext deploymentControllerContext = context.getTransientAttachments().getAttachment(ControllerContext.class.getName(), DeploymentControllerContext.class);
+      if (deploymentControllerContext == null)
+         throw new DeploymentException("Deployment " + context.getName() + " has no deployment controller context");
+      
+      ControllerState state = new ControllerState(stageName);
+      try
+      {
+         controller.change(deploymentControllerContext, state);
+      }
+      catch (Throwable t)
+      {
+         context.setState(DeploymentState.ERROR);
+         context.setProblem(t);
+         throw DeploymentException.rethrowAsDeploymentException("Error changing to stage " + stage + " for " + context.getName(), t);
+      }
+   }
+   
    public void process(List<DeploymentContext> deploy, List<DeploymentContext> undeploy)
    {
+      boolean trace = log.isTraceEnabled();
+      
       // There is something to undeploy
       if (undeploy != null && undeploy.isEmpty() == false)
       {
@@ -415,8 +445,10 @@
             ControllerState state = states.get(i);
             for (DeploymentControllerContext deploymentControllerContext : toUndeploy)
             {
+               ControllerState current = deploymentControllerContext.getState();
+               int currentIdx = states.indexOf(current);
                DeploymentContext context = deploymentControllerContext.getDeploymentContext();
-               if (ControllerState.ERROR.equals(context.getState()) == false)
+               if (currentIdx != -1 && currentIdx > i)
                {
                   try
                   {
@@ -429,6 +461,11 @@
                      context.setProblem(t);
                   }
                }
+               else
+               {
+                  if (trace)
+                     log.trace("Not moving " + deploymentControllerContext + " to state " + state + " it is at " + current);
+               }
             }
          }
 
@@ -486,13 +523,16 @@
 
          // Go through the states in order
          List<ControllerState> states = controller.getStates();
-         for (ControllerState state : states)
+         for (int i = 0; i < states.size(); ++i)
          {
+            ControllerState state = states.get(i);
             for (DeploymentContext context : deploy)
             {
-               if (DeploymentState.ERROR.equals(context.getState()) == false)
+               DeploymentControllerContext deploymentControllerContext = context.getTransientAttachments().getAttachment(ControllerContext.class.getName(), DeploymentControllerContext.class);
+               ControllerState current = deploymentControllerContext.getState();
+               int currentIdx = states.indexOf(current);
+               if (currentIdx != -1 && currentIdx < i)
                {
-                  DeploymentControllerContext deploymentControllerContext = context.getTransientAttachments().getAttachment(ControllerContext.class.getName(), DeploymentControllerContext.class);
                   try
                   {
                      controller.change(deploymentControllerContext, state);
@@ -503,6 +543,11 @@
                      context.setProblem(t);
                   }
                }
+               else
+               {
+                  if (trace)
+                     log.trace("Not moving " + deploymentControllerContext + " to state " + state + " it is at " + current);
+               }
             }
          }
       }

Modified: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java	2008-02-26 14:40:49 UTC (rev 70099)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java	2008-02-26 14:41:45 UTC (rev 70100)
@@ -38,6 +38,7 @@
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.DeploymentState;
 import org.jboss.deployers.spi.deployer.Deployers;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
 import org.jboss.deployers.spi.deployer.managed.ManagedDeploymentCreator;
 import org.jboss.deployers.structure.spi.DeploymentContext;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -555,6 +556,33 @@
       }
    }
 
+   public void change(String deploymentName, DeploymentStage stage) throws DeploymentException
+   {
+      lockRead();
+      try
+      {
+         DeploymentContext context = getTopLevelDeploymentContext(deploymentName);
+         if (context == null)
+            throw new DeploymentException("Top level deployment " + deploymentName + " not found");
+         try
+         {
+            deployers.change(context, stage);
+         }
+         catch (Error e)
+         {
+            throw e;
+         }
+         catch (Throwable t)
+         {
+            throw DeploymentException.rethrowAsDeploymentException("Error changing context " + deploymentName + " to stage " + stage, t);
+         }
+      }
+      finally
+      {
+         unlockRead();
+      }
+   }
+
    // enable locking - so that we don't pick up current single deployments
    public void shutdown()
    {

Added: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/main/test/DeployerChangeStageTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/main/test/DeployerChangeStageTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/main/test/DeployerChangeStageTestCase.java	2008-02-26 14:41:45 UTC (rev 70100)
@@ -0,0 +1,125 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.deployers.main.test;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.StructuralDeployers;
+import org.jboss.deployers.structure.spi.StructureBuilder;
+import org.jboss.deployers.structure.spi.helpers.AbstractStructureBuilder;
+import org.jboss.test.deployers.main.support.AddDeploymentRunnable;
+import org.jboss.test.deployers.main.support.AddProcessRemoveProcessRunnable;
+import org.jboss.test.deployers.main.support.DeployRunnable;
+import org.jboss.test.deployers.main.support.DeployUndeployRunnable;
+import org.jboss.test.deployers.main.support.DeployerTestRunnable;
+import org.jboss.test.deployers.main.support.FailedDeployUndeployRunnable;
+import org.jboss.test.deployers.main.support.ProcessRunnable;
+import org.jboss.test.deployers.main.support.ShutdownRunnable;
+import org.jboss.test.deployers.main.support.TestDeployment;
+import org.jboss.test.deployers.main.support.UndeployRunnable;
+
+/**
+ * DeployerChangeStageTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class DeployerChangeStageTestCase extends AbstractMainDeployerTest
+{
+   public DeployerChangeStageTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(DeployerChangeStageTestCase.class);
+   }
+
+   public void testMainDeployerInUnit() throws Throwable
+   {
+      DeployerClient main = getMainDeployer();
+
+      Deployment single = createSimpleDeployment("single");
+      main.deploy(single);
+      List<String> expected = new ArrayList<String>();
+      expected.add(single.getName());
+      assertEquals(expected, deployer.getDeployedUnits());
+
+      DeploymentUnit unit = assertDeploymentUnit(main, single.getName());
+      assertEquals(main, unit.getMainDeployer());
+      
+      main.undeploy(single);
+      assertNull(unit.getMainDeployer());
+   }
+
+   public void testChangeStage() throws Throwable
+   {
+      DeployerClient main = getMainDeployer();
+
+      Deployment single = createSimpleDeployment("single");
+      main.deploy(single);
+      List<String> expected = new ArrayList<String>();
+      expected.add(single.getName());
+      assertEquals(expected, deployer.getDeployedUnits());
+
+      main.change(single.getName(), DeploymentStages.CLASSLOADER);
+      assertEquals(expected, deployer.getUndeployedUnits());
+      
+      main.undeploy(single);
+      assertEquals(expected, deployer.getDeployedUnits());
+      assertEquals(expected, deployer.getUndeployedUnits());
+      try
+      {
+         main.change(single.getName(), DeploymentStages.REAL);
+      }
+      catch (Throwable t)
+      {
+         checkThrowable(DeploymentException.class, t);
+      }
+      
+      deployer.clear();
+      main.deploy(single);
+      assertEquals(expected, deployer.getDeployedUnits());
+      main.change(single.getName(), DeploymentStages.CLASSLOADER);
+      deployer.clear();
+      main.change(single.getName(), DeploymentStages.REAL);
+      assertEquals(expected, deployer.getDeployedUnits());
+   }
+}

Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/main/test/DeployerSingleDeploymentTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/main/test/DeployerSingleDeploymentTestCase.java	2008-02-26 14:40:49 UTC (rev 70099)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/main/test/DeployerSingleDeploymentTestCase.java	2008-02-26 14:41:45 UTC (rev 70100)
@@ -37,7 +37,6 @@
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
 import org.jboss.deployers.structure.spi.DeploymentContext;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.structure.spi.StructuralDeployers;
 import org.jboss.deployers.structure.spi.StructureBuilder;
 import org.jboss.deployers.structure.spi.helpers.AbstractStructureBuilder;
@@ -326,21 +325,4 @@
       }
       log.info("Names: " + names.size() + " - " + names);
    }
-
-   public void testMainDeployerInUnit() throws Throwable
-   {
-      DeployerClient main = getMainDeployer();
-
-      Deployment single = createSimpleDeployment("single");
-      main.deploy(single);
-      List<String> expected = new ArrayList<String>();
-      expected.add(single.getName());
-      assertEquals(expected, deployer.getDeployedUnits());
-
-      DeploymentUnit unit = assertDeploymentUnit(main, single.getName());
-      assertEquals(main, unit.getMainDeployer());
-      
-      main.undeploy(single);
-      assertNull(unit.getMainDeployer());
-   }
 }

Modified: projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/Deployers.java
===================================================================
--- projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/Deployers.java	2008-02-26 14:40:49 UTC (rev 70099)
+++ projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/Deployers.java	2008-02-26 14:41:45 UTC (rev 70100)
@@ -56,6 +56,15 @@
    void process(List<DeploymentContext> deploy, List<DeploymentContext> undeploy);
 
    /**
+    * Change the state of a deployment
+    * 
+    * @param context the context
+    * @param stage the stage
+    * @throws DeploymentException for any error
+    */
+   void change(DeploymentContext context, DeploymentStage stage) throws DeploymentException;
+
+   /**
     * Check all the deployments are complete
     *
     * @param errors the contexts in error

Deleted: projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStage.java
===================================================================
--- projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStage.java	2008-02-26 14:40:49 UTC (rev 70099)
+++ projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStage.java	2008-02-26 14:41:45 UTC (rev 70100)
@@ -1,156 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployers.spi.deployer;
-
-
-/**
- * DeploymentStage.
- * 
- * @author <a href="adrian at jboss.org">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class DeploymentStage
-{
-   /** Our stage */
-   private String name;
-   
-   /** The previous state */
-   private String after;
-   
-   /** The next state */
-   private String before;
-
-   /**
-    * Safely get the name of stage
-    * 
-    * @param stage the stage
-    * @param context the context for an error
-    * @return the stage name
-    */
-   private static String getStageName(DeploymentStage stage, String context)
-   {
-      if (stage == null)
-         throw new IllegalArgumentException("Null " + context);
-      return stage.getName();
-   }
-   
-   /**
-    * Create a new DeploymentStage.
-    * 
-    * @param name the name of the stage
-    * @throws IllegalArgumentException for a null name
-    */
-   public DeploymentStage(String name)
-   {
-      this(name, (String) null);
-   }
-
-   /**
-    * Create a new DeploymentStage.
-    * 
-    * @param name the name of the stage
-    * @param after the name of the stage before our stage
-    * @throws IllegalArgumentException for a null name
-    */
-   public DeploymentStage(String name, String after)
-   {
-      this(name, after, null);
-   }
-
-   /**
-    * Create a new DeploymentStage.
-    * 
-    * @param name the name of the stage
-    * @param after the stage before our stage
-    * @throws IllegalArgumentException for a null parameter
-    */
-   public DeploymentStage(String name, DeploymentStage after)
-   {
-      this(name, getStageName(after, "after"), null);
-   }
-
-   /**
-    * Create a new DeploymentStage.
-    * 
-    * @param name the name of the stage
-    * @param after he stage before our stage
-    * @param before the stage after our stage
-    * @throws IllegalArgumentException for a null parameter
-    */
-   public DeploymentStage(String name, DeploymentStage after, DeploymentStage before)
-   {
-      this(name, getStageName(after, "after"), getStageName(before, "before"));
-   }
-
-   /**
-    * Create a new DeploymentStage.
-    * 
-    * @param name the name of the stage
-    * @param after the name of the stage before our stage
-    * @param before the name of the stage after our stage
-    * @throws IllegalArgumentException for a null name
-    */
-   public DeploymentStage(String name, String after, String before)
-   {
-      if (name == null)
-         throw new IllegalArgumentException("Null name");
-      this.name = name;
-      this.after = after;
-      this.before = before;
-   }
-
-   /**
-    * Get the name.
-    * 
-    * @return the name.
-    */
-   public String getName()
-   {
-      return name;
-   }
-
-   /**
-    * Get the after.
-    * 
-    * @return the after.
-    */
-   public String getAfter()
-   {
-      return after;
-   }
-
-   /**
-    * Get the before.
-    * 
-    * @return the before.
-    */
-   public String getBefore()
-   {
-      return before;
-   }
-   
-   @Override
-   public String toString()
-   {
-      return getName();
-   }
-}

Deleted: projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStages.java
===================================================================
--- projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStages.java	2008-02-26 14:40:49 UTC (rev 70099)
+++ projects/microcontainer/trunk/deployers-spi/src/main/org/jboss/deployers/spi/deployer/DeploymentStages.java	2008-02-26 14:41:45 UTC (rev 70100)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2007, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.deployers.spi.deployer;
-
-/**
- * The Standard DeploymentStages.
- * 
- * @author <a href="adrian at jboss.org">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public interface DeploymentStages
-{
-   /** The not installed stage - nothing is done here */
-   DeploymentStage NOT_INSTALLED = new DeploymentStage("Not Installed");
-
-   /** The parse stage - where metadata is read */
-   DeploymentStage PARSE = new DeploymentStage("Parse", NOT_INSTALLED);
-
-   /** The describe stage - where dependencies are established */
-   DeploymentStage DESCRIBE = new DeploymentStage("Describe", PARSE);
-
-   /** The classloader stage - where classloaders are created */
-   DeploymentStage CLASSLOADER = new DeploymentStage("ClassLoader", DESCRIBE);
-
-   /** The post classloader stage - e.g. aop */
-   DeploymentStage POST_CLASSLOADER = new DeploymentStage("PostClassLoader", CLASSLOADER);
-
-   /** The real stage - where real deployment processing is done */
-   DeploymentStage REAL = new DeploymentStage("Real", POST_CLASSLOADER);
-
-   /** The installed stage - could be used to provide valve in future? */
-   DeploymentStage INSTALLED = new DeploymentStage("Installed", REAL);
-}




More information about the jboss-cvs-commits mailing list