[jboss-cvs] JBossAS SVN: r88418 - in branches/Branch_5_x: system/src/main/org/jboss/deployers/plugins/managed and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri May 8 05:45:28 EDT 2009


Author: emuckenhuber
Date: 2009-05-08 05:45:27 -0400 (Fri, 08 May 2009)
New Revision: 88418

Modified:
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ContextStateMapper.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java
   branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java
Log:
update deployment state mapping

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ContextStateMapper.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ContextStateMapper.java	2009-05-08 07:50:42 UTC (rev 88417)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ContextStateMapper.java	2009-05-08 09:45:27 UTC (rev 88418)
@@ -64,30 +64,29 @@
       return this.error;
    }
    
-   public T map(String currentState, String toState)
+   public T map(ControllerState currentState, ControllerState toState)
    {
-      if(currentState == null)
-         throw new IllegalArgumentException("null current controller state.");
       // If the context is in the required state 
       if(toState == null || currentState.equals(toState))
-      {
-         T state = mappings.get(currentState);
-         if(state == null)
-            state = unknown;
-         return state;
-      }
+         return getMapping(currentState);
+      // The error state
+      if(ControllerState.ERROR.equals(currentState))
+         return error;
       // installing state
       if(ControllerState.INSTALLED.equals(toState))
          return installState;
       // uninstalling state
       if(ControllerState.NOT_INSTALLED.equals(toState))
          return uninstallState;
-      
-      T state = null;
-      state = mappings.get(currentState);
-      if(state == null)
-         state = unknown;
-      
+      // Fallback
+      return getMapping(currentState);
+   }
+   
+   protected T getMapping(ControllerState controllerState)
+   {
+      T state = unknown;
+      if(controllerState != null)
+       state = mappings.get(controllerState.getStateString());
       return state;
    }
    

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java	2009-05-08 07:50:42 UTC (rev 88417)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java	2009-05-08 09:45:27 UTC (rev 88418)
@@ -30,6 +30,7 @@
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.registry.KernelBus;
 import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.logging.Logger;
 import org.jboss.managed.api.ManagedOperation;
 import org.jboss.managed.api.ManagedParameter;
 import org.jboss.managed.api.ManagedProperty;
@@ -48,6 +49,9 @@
  */
 public class KernelBusRuntimeComponentDispatcher extends AbstractRuntimeComponentDispatcher
 {
+   
+   private static final Logger log = Logger.getLogger(KernelBusRuntimeComponentDispatcher.class);
+   
    private KernelBus bus;
    private Kernel kernel;
 
@@ -224,7 +228,6 @@
       // FIXME
       if(context instanceof KernelRegistryEntry == false)
          requiredState = context.getRequiredState();
-      String requiredStateString = requiredState != null ? requiredState.getStateString() : null;
-      return mapper.map(context.getState().getStateString(), requiredStateString);
+      return mapper.map(context.getState(), requiredState);
    }
 }

Modified: branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java	2009-05-08 07:50:42 UTC (rev 88417)
+++ branches/Branch_5_x/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java	2009-05-08 09:45:27 UTC (rev 88418)
@@ -170,7 +170,7 @@
                      ManagedObject compMO = (ManagedObject) gv.getValue();
                      // Use the ManagedObject name if it's not the same as the attachmentName
                      String managedObjectName = compUnit.getName();
-                     if(compMO.getAttachmentName() != null)
+                     if(compMO != null && compMO.getAttachmentName() != null)
                      {
                         managedObjectName = compMO.getAttachmentName().equals(compMO.getName()) ?
                               compUnit.getName() : compMO.getName();

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java	2009-05-08 07:50:42 UTC (rev 88417)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java	2009-05-08 09:45:27 UTC (rev 88418)
@@ -144,11 +144,8 @@
          log.debug("Failed ", e);
          throw e;
       }
-      finally
-      {
-         stopAndRemove(new String[]
-            { FAILING_DEPLOYMENT, EMTPY_DEPLOYMENT } );
-      }
+      stopAndRemove(new String[]
+         { FAILING_DEPLOYMENT, EMTPY_DEPLOYMENT } );
    }
 
    /**
@@ -174,11 +171,8 @@
          log.error("Failed ", e);
          throw e;
       }
-      finally
-      {
-         stopAndRemove(new String[]
-            { FAILING_DEPLOYMENT, EMTPY_DEPLOYMENT } );
-      }
+      stopAndRemove(new String[]
+          { FAILING_DEPLOYMENT, EMTPY_DEPLOYMENT } );
    }
 
    /**
@@ -197,6 +191,9 @@
          deployEmpty(true);
          // Test redeploy
          redeployCheckComplete(EMTPY_DEPLOYMENT);
+         // stop and remove
+         stopAndRemove(new String[]
+             { FAILING_DEPLOYMENT, EMTPY_DEPLOYMENT } );
       }
       catch(Exception e)
       {
@@ -205,16 +202,8 @@
       }
       finally
       {
-         try
-         {
-            stopAndRemove(new String[]
-               { FAILING_DEPLOYMENT, EMTPY_DEPLOYMENT } );
-         }
-         finally
-         {
-            // Make sure that we release the profile
-            getDeploymentManager().releaseProfile();
-         }
+         // Make sure that we release the profile
+         getDeploymentManager().releaseProfile();
       }
    }
 




More information about the jboss-cvs-commits mailing list