[jboss-cvs] JBossAS SVN: r91376 - projects/mc-tools/grapher/trunk/src/main/java/org/jboss/mctools/grapher/map.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 17 11:15:57 EDT 2009


Author: alesj
Date: 2009-07-17 11:15:57 -0400 (Fri, 17 Jul 2009)
New Revision: 91376

Modified:
   projects/mc-tools/grapher/trunk/src/main/java/org/jboss/mctools/grapher/map/ExcludeTypes.java
Log:
Expose excluded type creation.

Modified: projects/mc-tools/grapher/trunk/src/main/java/org/jboss/mctools/grapher/map/ExcludeTypes.java
===================================================================
--- projects/mc-tools/grapher/trunk/src/main/java/org/jboss/mctools/grapher/map/ExcludeTypes.java	2009-07-17 15:10:26 UTC (rev 91375)
+++ projects/mc-tools/grapher/trunk/src/main/java/org/jboss/mctools/grapher/map/ExcludeTypes.java	2009-07-17 15:15:57 UTC (rev 91376)
@@ -48,10 +48,10 @@
 
    static
    {
-      map.put("pojo", AbstractKernelControllerContext.class);
-      map.put("alias", AliasControllerContext.class);
-      map.put("ext", AbstractKernelRegistryEntry.class);
-      map.put("core", BeanKernelRegistryEntry.class);
+      mapControllerContextClass("pojo", AbstractKernelControllerContext.class);
+      mapControllerContextClass("alias", AliasControllerContext.class);
+      mapControllerContextClass("ext", AbstractKernelRegistryEntry.class);
+      mapControllerContextClass("core", BeanKernelRegistryEntry.class);
       mapControllerContextClass("mbean", "org.jboss.system.microcontainer.ServiceControllerContext");
       mapControllerContextClass("dep", "org.jboss.deployers.plugins.deployers.DeploymentControllerContext");
    }
@@ -60,19 +60,50 @@
     * Map key to class.
     *
     * @param key the key
-    * @param className the class name
+    * @param clazz the class to map
     */
-   protected static void mapControllerContextClass(String key, String className)
+   public static void mapControllerContextClass(String key, Class<? extends ControllerContext> clazz)
    {
-      try
+      if (key == null)
+         throw new IllegalArgumentException("Null key");
+
+      if (clazz == null)
       {
-         Class<? extends ControllerContext> clazz = (Class<? extends ControllerContext>)ExcludeTypes.class.getClassLoader().loadClass(className);
+         map.remove(key);
+      }
+      else
+      {
          map.put(key, clazz);
       }
-      catch (Exception e)
+   }
+
+   /**
+    * Map key to class.
+    *
+    * @param key the key
+    * @param className the class name
+    */
+   public static void mapControllerContextClass(String key, String className)
+   {
+      if (key == null)
+         throw new IllegalArgumentException("Null key");
+
+      if (className == null)
       {
-         log.warn("Unable to exclude component type: " + e);
+         map.remove(key);
       }
+      else
+      {
+         try
+         {
+            Class<? extends ControllerContext> clazz = (Class<? extends ControllerContext>)ExcludeTypes.class.getClassLoader().loadClass(className);
+            map.put(key, clazz);
+         }
+         catch (Exception e)
+         {
+            log.warn("Unable to exclude component type: " + e);
+         }
+      }
    }
 
    /**




More information about the jboss-cvs-commits mailing list