[jboss-cvs] JBossAS SVN: r88971 - in branches/Branch_5_x: profileservice/src/main/org/jboss/profileservice/ejb and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri May 15 22:08:34 EDT 2009


Author: scott.stark at jboss.org
Date: 2009-05-15 22:08:34 -0400 (Fri, 15 May 2009)
New Revision: 88971

Removed:
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ContextStateMapper.java
Modified:
   branches/Branch_5_x/component-matrix/pom.xml
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureManagementView.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AggregatingManagementView.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/MBeanRuntimeComponentDispatcher.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/views/AbstractManagedDeploymentView.java
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/views/AbstractProfileView.java
Log:
JBAS-6911,
- Add a method to get the list of all ComponentTypes under the current profiles
- Add a KnownComponentTypes.ANY ComponentType(type="*", subtype="*")

Modified: branches/Branch_5_x/component-matrix/pom.xml
===================================================================
--- branches/Branch_5_x/component-matrix/pom.xml	2009-05-16 00:52:44 UTC (rev 88970)
+++ branches/Branch_5_x/component-matrix/pom.xml	2009-05-16 02:08:34 UTC (rev 88971)
@@ -73,7 +73,7 @@
     <version.org.jboss.ejb3.security.client>1.0.0</version.org.jboss.ejb3.security.client>
     <version.org.jboss.ejb3>1.1.5</version.org.jboss.ejb3>
     <version.org.jboss.ejb3.endpoint.deployer>0.1.3</version.org.jboss.ejb3.endpoint.deployer>
-    <version.org.jboss.integration>5.1.0.CR3</version.org.jboss.integration>
+    <version.org.jboss.integration>5.1.0.CR4</version.org.jboss.integration>
     <version.org.jboss.jbossxb>2.0.1.GA</version.org.jboss.jbossxb>
     <version.org.jboss.jopr>1.2.0.CR3</version.org.jboss.jopr>    
     <version.org.jboss.jpa>1.0.0</version.org.jboss.jpa>

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureManagementView.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureManagementView.java	2009-05-16 00:52:44 UTC (rev 88970)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/ejb/SecureManagementView.java	2009-05-16 02:08:34 UTC (rev 88971)
@@ -83,6 +83,11 @@
       return delegate.getComponent(name, type);
    }
 
+   public Set<ComponentType> getComponentTypes()
+   {
+      return delegate.getComponentTypes();
+   }
+
    public Set<ManagedComponent> getComponentsForType(ComponentType type)
          throws Exception
    {

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java	2009-05-16 00:52:44 UTC (rev 88970)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java	2009-05-16 02:08:34 UTC (rev 88971)
@@ -21,6 +21,7 @@
  */
 package org.jboss.profileservice.management;
 
+import org.jboss.deployers.spi.management.ContextStateMapper;
 import org.jboss.deployers.spi.management.RuntimeComponentDispatcher;
 import org.jboss.managed.api.ManagedOperation;
 import org.jboss.managed.api.ManagedProperty;

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AggregatingManagementView.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AggregatingManagementView.java	2009-05-16 00:52:44 UTC (rev 88970)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/AggregatingManagementView.java	2009-05-16 02:08:34 UTC (rev 88971)
@@ -297,6 +297,17 @@
       return comp;
    }
 
+   
+   public Set<ComponentType> getComponentTypes()
+   {
+      Set<ComponentType> componentTypes = new HashSet<ComponentType>();
+      for(AbstractProfileView view : profileViews.values())
+      {
+         componentTypes.addAll(view.getComponentTypes());
+      }
+      return componentTypes;
+   }
+
    public Set<ManagedComponent> getComponentsForType(ComponentType type) throws Exception
    {
       Set<ManagedComponent> components = new HashSet<ManagedComponent>();

Deleted: 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-16 00:52:44 UTC (rev 88970)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ContextStateMapper.java	2009-05-16 02:08:34 UTC (rev 88971)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.profileservice.management;
-
-import java.util.Map;
-
-import org.jboss.dependency.spi.ControllerState;
-
-/**
- * Basic state mapper.
- * 
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ContextStateMapper<T extends Enum<?>>
-{
-   
-   /** The state mappings. */
-   private Map<String, T> mappings;
-   
-   /** Installing state. */
-   private T installState;
-   
-   /** Uninstalling state. */
-   private T uninstallState;
-   
-   /** The unknown state. */
-   private T unknown;
-   
-   /** The error state. */
-   private T error;
-
-   public ContextStateMapper(Map<String, T> mappings,
-         T installState, T uninstallState, T error, T unknown)
-   {
-      this.mappings = mappings;
-      this.installState = installState;
-      this.uninstallState = uninstallState;
-      this.error = error;
-      this.unknown = unknown;
-   }
-   
-   public T getErrorState()
-   {
-      return this.error;
-   }
-   
-   public T map(ControllerState currentState, ControllerState toState)
-   {
-      // If the context is in the required state 
-      if(toState == null || currentState.equals(toState))
-         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;
-      // 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-16 00:52:44 UTC (rev 88970)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java	2009-05-16 02:08:34 UTC (rev 88971)
@@ -26,6 +26,7 @@
 
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.spi.management.ContextStateMapper;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.registry.KernelBus;

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/MBeanRuntimeComponentDispatcher.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/MBeanRuntimeComponentDispatcher.java	2009-05-16 00:52:44 UTC (rev 88970)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/MBeanRuntimeComponentDispatcher.java	2009-05-16 02:08:34 UTC (rev 88971)
@@ -29,6 +29,7 @@
 import javax.management.ObjectName;
 
 import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.spi.management.ContextStateMapper;
 import org.jboss.managed.api.ManagedOperation;
 import org.jboss.managed.api.ManagedParameter;
 import org.jboss.managed.api.ManagedProperty;

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2009-05-16 00:52:44 UTC (rev 88970)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2009-05-16 02:08:34 UTC (rev 88971)
@@ -45,7 +45,9 @@
 
 import org.jboss.deployers.client.spi.main.MainDeployer;
 import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.management.ContextStateMapper;
 import org.jboss.deployers.spi.management.DeploymentTemplate;
+import org.jboss.deployers.spi.management.KnownComponentTypes;
 import org.jboss.deployers.spi.management.KnownDeploymentTypes;
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.deployers.spi.management.NameMatcher;
@@ -1240,6 +1242,15 @@
    }
 
    /**
+    * Get a set of the component types in use in the profiles
+    * @return set of component types in use
+    */
+   public Set<ComponentType> getComponentTypes()
+   {
+      return compByCompType.keySet();
+   }
+
+   /**
     *
     * @param key
     * @param type
@@ -1249,7 +1260,24 @@
    public Set<ManagedComponent> getComponentsForType(ComponentType type)
       throws Exception
    {
-      Set<ManagedComponent> comps = compByCompType.get(type);
+      Set<ManagedComponent> comps = null;
+      // Check the any component type
+      if(type.equals(KnownComponentTypes.ANY_TYPE))
+      {
+         HashSet<ManagedComponent> all = new HashSet<ManagedComponent>();
+         for(Set<ManagedComponent> typeComps : compByCompType.values())
+         {
+            for(ManagedComponent comp : typeComps)
+            {
+               all.add(comp);
+            }
+         }
+         comps = all;
+      }
+      else
+      {
+        comps = compByCompType.get(type);
+      }
       if(comps == null)
          comps = Collections.emptySet();
       return comps;

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/views/AbstractManagedDeploymentView.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/views/AbstractManagedDeploymentView.java	2009-05-16 00:52:44 UTC (rev 88970)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/views/AbstractManagedDeploymentView.java	2009-05-16 02:08:34 UTC (rev 88971)
@@ -183,6 +183,11 @@
       return mds;
    }
    
+   public Set<ComponentType> getComponentTypes()
+   {
+      return compByCompType.keySet();      
+   }
+
    /**
     * Get component for a given type.
     * 

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/views/AbstractProfileView.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/views/AbstractProfileView.java	2009-05-16 00:52:44 UTC (rev 88970)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/views/AbstractProfileView.java	2009-05-16 02:08:34 UTC (rev 88971)
@@ -26,6 +26,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.jboss.deployers.spi.management.ContextStateMapper;
 import org.jboss.deployers.spi.management.RuntimeComponentDispatcher;
 import org.jboss.logging.Logger;
 import org.jboss.managed.api.DeploymentState;
@@ -40,7 +41,6 @@
 import org.jboss.managed.api.annotation.ViewUse;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.profileservice.management.AbstractRuntimeComponentDispatcher;
-import org.jboss.profileservice.management.ContextStateMapper;
 import org.jboss.profileservice.management.ManagedOperationProxyFactory;
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileKey;




More information about the jboss-cvs-commits mailing list