[jboss-cvs] JBossAS SVN: r86104 - in branches/Branch_5_x: profileservice/src/main/org/jboss/profileservice/management/upload/remoting and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 19 11:46:10 EDT 2009


Author: emuckenhuber
Date: 2009-03-19 11:46:09 -0400 (Thu, 19 Mar 2009)
New Revision: 86104

Modified:
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/StreamingDeploymentTarget.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/DeploymentManagerUnitTestCase.java
Log:
[JBAS-5993] ignore DeploymentManager.prepare() for now

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java	2009-03-19 15:30:01 UTC (rev 86103)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java	2009-03-19 15:46:09 UTC (rev 86104)
@@ -81,6 +81,9 @@
          case DISTRIBUTE:
             distribute();
             break;
+         case PREPARE:
+            prepare();
+            break;
          case START:
             start();
             break;
@@ -380,4 +383,49 @@
          }
       }
    }
+   
+   protected void prepare()
+   {
+      SerializableDeploymentStatus status = new SerializableDeploymentStatus(command, StateType.RUNNING);
+      status.setMessage("Running prepare to: "+targets);
+      currentStatus = status;
+      ProgressEvent event =  new ProgressEvent(deployment, currentStatus);
+      notify(event);
+      for(DeploymentTarget target : targets)
+      {
+         if(isCancelled)
+         {
+            status = new SerializableDeploymentStatus(command, StateType.CANCELLED);
+            status.setMessage("Prepare has been cancelled");
+            currentStatus = status;
+            event =  new ProgressEvent(deployment, currentStatus);
+            notify(event);
+            break;
+         }
+
+         try
+         {
+            target.prepare(deployment);
+            status = new SerializableDeploymentStatus(command, StateType.COMPLETED);
+            status.setTarget(target);
+            status.setMessage("Completed prepare for target: "+target);
+            status.setCompleted(true);
+            status.setRunning(true);
+            currentStatus = status;
+            event =  new ProgressEvent(deployment, currentStatus);
+            notify(event);
+         }
+         catch(Exception e)
+         {
+            status = new SerializableDeploymentStatus(command, StateType.FAILED);
+            status.setTarget(target);
+            status.setFailure(e);
+            status.setFailed(true);
+            currentStatus = status;
+            ProgressEvent error = new ProgressEvent(deployment, currentStatus);
+            notify(error);
+            break;
+         }
+      }
+   }
 }

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java	2009-03-19 15:30:01 UTC (rev 86103)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java	2009-03-19 15:46:09 UTC (rev 86104)
@@ -167,6 +167,10 @@
             {
                returnValue = distribute(dtID);
             }
+            else if( parameter.equals("prepare"))
+            {
+               // TODO
+            }
             else if( parameter.equals("start") )
             {
                start(dtID);

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/StreamingDeploymentTarget.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/StreamingDeploymentTarget.java	2009-03-19 15:30:01 UTC (rev 86103)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/StreamingDeploymentTarget.java	2009-03-19 15:46:09 UTC (rev 86104)
@@ -152,9 +152,19 @@
       }
    }
 
-   public void prepare(DeploymentID deployment) throws Exception
+   public void prepare(DeploymentID dtID) throws Exception
    {
-      throw new IllegalStateException("prepare is not yet implemented");
+      Client client = getClient();
+      try
+      {
+         log.debug("Begin prepare: " + dtID);
+         invoke(client, "prepare", createArgs(dtID));
+         log.debug("End prepare: "+dtID);
+      }
+      finally
+      {
+         client.disconnect();
+      }
    }
 
    /**

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/DeploymentManagerUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/DeploymentManagerUnitTestCase.java	2009-03-19 15:30:01 UTC (rev 86103)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/DeploymentManagerUnitTestCase.java	2009-03-19 15:46:09 UTC (rev 86104)
@@ -61,6 +61,8 @@
          deployEmpty(true);
          // Test redeploy
          redeployCheckComplete(EMTPY_DEPLOYMENT);
+         // TODO implement prepare 
+         prepareCheckComplete(EMTPY_DEPLOYMENT);
       }
       finally
       {
@@ -79,6 +81,8 @@
          deployEmpty(false);
          // test redeploy
          redeployCheckComplete(EMTPY_DEPLOYMENT);
+         // TODO implement prepare
+         prepareCheckComplete(EMTPY_DEPLOYMENT);
       }
       finally
       {
@@ -133,6 +137,17 @@
       assertComplete(redeploy);
    }
    
+   void prepareCheckComplete(String name) throws Exception
+   {
+      // The deployment manager
+      DeploymentManager deployMgr = getDeploymentManager();
+      
+      // Prepare
+      DeploymentProgress prepare = deployMgr.prepare(name);
+      prepare.run();
+      assertComplete(prepare);
+   }
+   
    void stopAndRemove(String[] names) throws Exception
    {
       // The deployment manager




More information about the jboss-cvs-commits mailing list