[jboss-cvs] JBossAS SVN: r74750 - trunk/profileservice/src/main/org/jboss/profileservice/management.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 17 20:00:27 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-06-17 20:00:26 -0400 (Tue, 17 Jun 2008)
New Revision: 74750

Modified:
   trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
Log:
JBAS-5625,JBAS-5266 remove the managed deployments/components when the deployment is removed from the profile.

Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2008-06-17 23:57:38 UTC (rev 74749)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2008-06-18 00:00:26 UTC (rev 74750)
@@ -292,11 +292,7 @@
          log.debug("Processing ManagementComponent: "+mc);
          ComponentType type = new ComponentType(mc.type(), mc.subtype());
          ManagedComponentImpl comp = new ManagedComponentImpl(type, md, mo);
-         if(mo.getName().endsWith("DefaultDS"))
-            log.info("DefaultDS ManagementComponent");
          md.addComponent(mo.getName(), comp);
-         if(mo.getName().endsWith("QueueServiceMO"))
-            log.info("Saw QueueServiceMO");
          log.debug("Added ManagementComponent: "+mc+"under name: "+mo.getName());
          Set<ManagedComponent> typeComps = compByCompType.get(type);
          if (typeComps == null)
@@ -805,6 +801,7 @@
    public void removeDeployment(String deploymentName, DeploymentPhase phase)
       throws NoSuchProfileException, NoSuchDeploymentException, Exception
    {
+      log.debug("removeDeployment, "+deploymentName+", phase: "+phase);
       Deployment ctx = activeProfile.removeDeployment(deploymentName, phase);
       if( ctx == null )
       {
@@ -813,9 +810,37 @@
          String msg = formatter.format(args);
          throw new NoSuchDeploymentException(msg);
       }
-      // TODO i18n
+
       if( mainDeployer.removeDeployment(ctx.getName()) == false )
-         throw new NoSuchDeploymentException("MainDeployer failed to remove: "+ctx.getName());
+      {
+         formatter.applyPattern(i18n.getString("ManagementView.MainDeployerRemoveException")); //$NON-NLS-1$
+         Object[] args = {deploymentName};
+         String msg = formatter.format(args);
+         throw new NoSuchDeploymentException(msg);
+         
+      }
+      // Remove the ManagedDeployment/ManagedComponents
+      ManagedDeployment md = managedDeployments.remove(deploymentName);
+      if(md != null)
+      {
+         log.debug("removeDeployment, md: "+md);
+         Map<String, ManagedComponent> comps = md.getComponents();
+         if(comps != null)
+         {
+            for(ManagedComponent mc : comps.values())
+            {
+               ComponentType type = mc.getType();
+               Set<ManagedComponent> compsForType = compByCompType.get(type);
+               if(compsForType != null)
+               {
+                  if(compsForType.remove(mc) == true)
+                     log.debug("Removed mc: "+mc);
+                  else
+                     log.debug(mc+" was not found in set: "+compsForType);
+               }
+            }
+         }
+      }
    }
 
    /**




More information about the jboss-cvs-commits mailing list