[jboss-cvs] JBossAS SVN: r81159 - in trunk: profileservice/src/main/org/jboss/profileservice/management and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Nov 17 03:15:39 EST 2008


Author: scott.stark at jboss.org
Date: 2008-11-17 03:15:39 -0500 (Mon, 17 Nov 2008)
New Revision: 81159

Added:
   trunk/profileservice/src/main/org/jboss/profileservice/management/matchers/
   trunk/profileservice/src/main/org/jboss/profileservice/management/matchers/AliasMatcher.java
   trunk/system/src/main/org/jboss/deployers/spi/management/NameMatcher.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
Removed:
   trunk/profileservice/src/main/org/jboss/profileservice/management/plugins/
Modified:
   trunk/profileservice/pom.xml
   trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
   trunk/profileservice/src/resources/profileservice-jboss-beans.xml
   trunk/server/src/etc/conf/default/jmx.xml
   trunk/server/src/etc/conf/default/profile-repository.xml
   trunk/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
   trunk/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java
   trunk/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
   trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java
   trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java
Log:
JBAS-5689, JBAS-5529 make bootstrap deployments visible to profileservice and deploy ServerInfo as an mcbean

Modified: trunk/profileservice/pom.xml
===================================================================
--- trunk/profileservice/pom.xml	2008-11-17 07:24:17 UTC (rev 81158)
+++ trunk/profileservice/pom.xml	2008-11-17 08:15:39 UTC (rev 81159)
@@ -48,7 +48,6 @@
     <dependency>
       <groupId>org.jboss.jbossas</groupId>
       <artifactId>jboss-as-system</artifactId>
-      <classifier>profileservice-spi</classifier> 
     </dependency>
     <dependency>
       <groupId>junit</groupId>

Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2008-11-17 07:24:17 UTC (rev 81158)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2008-11-17 08:15:39 UTC (rev 81159)
@@ -47,6 +47,7 @@
 import org.jboss.deployers.plugins.main.MainDeployerImpl;
 import org.jboss.deployers.spi.management.DeploymentTemplate;
 import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.NameMatcher;
 import org.jboss.deployers.spi.management.RuntimeComponentDispatcher;
 import org.jboss.deployers.spi.structure.ContextInfo;
 import org.jboss.deployers.spi.structure.StructureMetaData;
@@ -71,7 +72,6 @@
 import org.jboss.managed.api.annotation.ManagementObjectRef;
 import org.jboss.managed.api.annotation.ManagementProperty;
 import org.jboss.managed.api.annotation.ViewUse;
-import org.jboss.managed.plugins.BasicDeploymentTemplateInfo;
 import org.jboss.managed.plugins.ManagedComponentImpl;
 import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
 import org.jboss.metatype.api.types.ArrayMetaType;
@@ -110,7 +110,7 @@
    /** The deployment factory */
    private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
    
-   /** */
+   /** The ProfileService for loading profiles */
    private ProfileService ps;
    /** The currently loaded profile */
    private Profile activeProfile;
@@ -120,13 +120,13 @@
 
    private InvokerLocator locator;
 
-   /** */
+   /** The deployment templates that have been registered with the MV */
    private HashMap<String, DeploymentTemplate> templates = new HashMap<String, DeploymentTemplate>();
    /** The internationalization resource bundle */
    private ResourceBundle i18n;
-   /** */
+   /** the Locale for the i18n messages */
    private Locale currentLocale;
-   /** */
+   /** The formatter used for i18n messages */
    private MessageFormat formatter = new MessageFormat("");
    /** An index of ManagedComponent by ComponentType */
    private HashMap<ComponentType, Set<ManagedComponent>> compByCompType = new HashMap<ComponentType, Set<ManagedComponent>>();
@@ -134,6 +134,8 @@
    private Map<String, ManagedObject> moRegistry = new HashMap<String, ManagedObject>();
    /** The deployment name to ManagedDeployment map */
    private Map<String, ManagedDeployment> managedDeployments = new HashMap<String, ManagedDeployment>();
+   /** The bootstrap deployment name to ManagedDeployment map */
+   private Map<String, ManagedDeployment> bootstrapManagedDeployments = Collections.emptyMap();
    /** The ManagedPropertys with unresolved ManagementObjectRefs */
    private Map<String, Set<ManagedProperty>> unresolvedRefs = new HashMap<String, Set<ManagedProperty>>();
    /** A map of runtime ManagedObjects needing to be merged with their
@@ -152,7 +154,9 @@
 
    /**
     * Load and associate the given profile with the ManagementView
-    * for future operations.
+    * for future operations. This must be called before the other ManagementView
+    * operations may be used. Currently there can only be one actively loaded
+    * profile against which a client is performing management operations.
     * 
     * @param key - the profile to load
     * @throws NoSuchProfileException
@@ -186,23 +190,41 @@
       this.unresolvedRefs.clear();
 
       // Process the deployments
+      boolean trace = log.isTraceEnabled();
       Collection<VFSDeployment> deployments = activeProfile.getDeployments();
       for(VFSDeployment deployment : deployments)
       {
          try
          {
             ManagedDeployment md = getManagedDeployment(deployment);
-            processManagedDeployment(md, 0, log.isTraceEnabled());
+            processManagedDeployment(md, 0, trace);
          }
          catch(Exception e)
          {
             log.warn("Failed to create ManagedDeployment for: " + deployment.getName(), e);
          }
       }
+      // Process the bootstrap deployments
+      for(ManagedDeployment md : bootstrapManagedDeployments.values())
+      {
+         try
+         {
+            processManagedDeployment(md, 0, trace);
+         }
+         catch(Exception e)
+         {
+            log.warn("Failed to process ManagedDeployment for: " + md.getName(), e);
+         }
+      }
       if(this.runtimeMOs.size() > 0)
          log.warn("Failed to merged the following runtime ManagedObjects: "+runtimeMOs);
       activeProfileLastModified = activeProfile.getLastModified();
    }
+   public void reloadProfile() throws Exception
+   {
+      activeProfileLastModified = 0;
+      loadProfile(activeProfile.getKey());
+   }
 
    /**
     * Process managed deployment.
@@ -225,6 +247,8 @@
          processManagedObject(mo, md);
       }
       managedDeployments.put(name, md);
+
+      // Process children
       List<ManagedDeployment> mdChildren = md.getChildren();
       if(mdChildren != null && mdChildren.isEmpty() == false)
       {
@@ -293,6 +317,20 @@
       // Check for unresolved refs
       checkForReferences(key, mo);
 
+      // Map any existing ManagedComponent types
+      for(ManagedComponent comp : md.getComponents().values())
+      {
+         log.debug("Processing ManagementComponent: "+comp);
+         ComponentType type = comp.getType();
+         Set<ManagedComponent> typeComps = compByCompType.get(type);
+         if (typeComps == null)
+         {
+            typeComps = new HashSet<ManagedComponent>();
+            compByCompType.put(type, typeComps);
+         }
+         typeComps.add(comp);
+      }
+
       // Create ManagedComponents for ManagedObjects annotated with ManagementComponent
       ManagementComponent mc = (ManagementComponent) moAnns.get(ManagementComponent.class.getName());
       if (mc != null)
@@ -436,6 +474,17 @@
       }
    }
 
+   
+   public Map<String, ManagedDeployment> getBootstrapManagedDeployments()
+   {
+      return bootstrapManagedDeployments;
+   }
+   public void setBootstrapManagedDeployments(
+         Map<String, ManagedDeployment> bootstrapManagedDeployments)
+   {
+      this.bootstrapManagedDeployments = bootstrapManagedDeployments;
+   }
+
    public Map<String, Set<ManagedProperty>> getUnresolvedRefs()
    {
       return unresolvedRefs;
@@ -473,11 +522,6 @@
       log.debug("setMainDeployer: "+mainDeployer);
    }
 
-   public String getName()
-   {
-      return this.getClass().getName();
-   }
-
    public void setDispatcher(RuntimeComponentDispatcher dispatcher)
    {
       this.dispatcher = dispatcher;
@@ -503,8 +547,6 @@
       for(ManagedDeployment md : managedDeployments.values())
       {
          String name = md.getName();
-         if(name.indexOf("jbossweb.sar") >= 0)
-            log.info("Processing jbossweb.sar: "+md);
          Set<String> types = md.getTypes();
          if(types != null)
          {
@@ -515,6 +557,19 @@
             }
          }
       }
+      for(ManagedDeployment md : bootstrapManagedDeployments.values())
+      {
+         String name = md.getName();
+         Set<String> types = md.getTypes();
+         if(types != null)
+         {
+            if(types.contains(type))
+            {
+               log.debug(name+" matches type: "+type+", types:"+types);
+               matches.add(name);
+            }
+         }
+      }
       return matches;
    }
 
@@ -539,6 +594,12 @@
       }
       return matches;
    }
+   public Set<ManagedDeployment> getMatchingDeployments(String name, NameMatcher<ManagedDeployment> matcher)
+      throws NoSuchDeploymentException, Exception
+   {
+      Set<ManagedDeployment> matches = new HashSet<ManagedDeployment>();
+      return matches;
+   }
 
    public Set<String> getTemplateNames()
    {
@@ -568,6 +629,11 @@
    {
       Deployment ctx = activeProfile.getDeployment(name, phase);
       ManagedDeployment md = this.managedDeployments.get(ctx.getName());
+      if(md == null)
+      {
+         // Check the bootstrap deployments
+         md = this.bootstrapManagedDeployments.get(name);
+      }
       // Do not return null
       if(md == null)
          throw new NoSuchDeploymentException("Managed deployment: "+ name + " not found.");
@@ -637,6 +703,26 @@
       }
       return comp;
    }
+   public Set<ManagedComponent> getMatchingComponents(String name, ComponentType type,
+         NameMatcher<ManagedComponent> matcher)
+      throws Exception
+   {
+      Set<ManagedComponent> components = compByCompType.get(type);
+      Set<ManagedComponent> matched = new HashSet<ManagedComponent>();
+      if(components != null)
+      {
+         for(ManagedComponent mc : components)
+         {
+            if(matcher.matches(mc, name))
+               matched.add(mc);
+         }
+      }
+      if(matched.size() > 0)
+      {
+         log.debug("getComponents matched: "+matched);
+      }
+      return matched;
+   }
 
    public DeploymentTemplateInfo getTemplate(String name)
       throws NoSuchDeploymentException

Added: trunk/profileservice/src/main/org/jboss/profileservice/management/matchers/AliasMatcher.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/matchers/AliasMatcher.java	                        (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/matchers/AliasMatcher.java	2008-11-17 08:15:39 UTC (rev 81159)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.matchers;
+
+import java.io.Serializable;
+
+import org.jboss.deployers.spi.management.NameMatcher;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.values.ArrayValue;
+import org.jboss.metatype.api.values.SimpleValue;
+
+/**
+ * A NameMatcher that matches against a component alias property values in
+ * addition to the component name.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class AliasMatcher implements NameMatcher<ManagedComponent>
+   , Serializable
+{
+   private static final long serialVersionUID = 1;
+   private String propertyName;
+
+   public AliasMatcher()
+   {
+      this("alias");
+   }
+   public AliasMatcher(String propertyName)
+   {
+      this.propertyName = propertyName;
+   }
+
+   public String getPropertyName()
+   {
+      return propertyName;
+   }
+   public void setPropertyName(String propertyName)
+   {
+      this.propertyName = propertyName;
+   }
+
+   /* (non-Javadoc)
+    * @see org.jboss.deployers.spi.management.NameMatcher#matches(java.lang.Object, java.lang.String)
+    */
+   public boolean matches(ManagedComponent comp, String name)
+   {
+      boolean matches = comp.getName().equals(name);
+      if(matches == false)
+      {
+         // Look for an alias property
+         ManagedProperty prop = comp.getProperty(propertyName);
+         if(prop != null)
+         {
+            MetaType type = prop.getMetaType();
+            if(type.isSimple())
+            {
+               SimpleValue value = (SimpleValue) prop.getValue();
+               String n = value.getValue().toString();
+               matches = name.equals(n);
+            }
+            else if(type.isArray())
+            {
+               ArrayValue value = (ArrayValue) prop.getValue();
+               for(Object n : value)
+               {
+                  if(name.equals(n.toString()))
+                  {
+                     matches = true;
+                     break;
+                  }
+               }
+            }
+         }
+      }
+      return matches;
+   }
+
+}

Modified: trunk/profileservice/src/resources/profileservice-jboss-beans.xml
===================================================================
--- trunk/profileservice/src/resources/profileservice-jboss-beans.xml	2008-11-17 07:24:17 UTC (rev 81158)
+++ trunk/profileservice/src/resources/profileservice-jboss-beans.xml	2008-11-17 08:15:39 UTC (rev 81159)
@@ -70,7 +70,7 @@
         <property name="profileService"><inject bean="ProfileService"/></property>
         <property name="locator"><inject bean="ConnectorMBean" property="invokerLocator"/></property>
         <property name="dispatcher"><inject bean="RuntimeComponentDispatcher"/></property>
-        
+        <property name="bootstrapManagedDeployments"><inject bean="ProfileServiceBootstrap" property="bootstrapMDs"/></property>
         <!-- Accept any implementor of DeploymentTemplate -->
         <incallback method="addTemplate"/>
         <uncallback method="removeTemplate"/>

Modified: trunk/server/src/etc/conf/default/jmx.xml
===================================================================
--- trunk/server/src/etc/conf/default/jmx.xml	2008-11-17 07:24:17 UTC (rev 81158)
+++ trunk/server/src/etc/conf/default/jmx.xml	2008-11-17 08:15:39 UTC (rev 81159)
@@ -17,10 +17,15 @@
       -->
    </classloader>
 
+   <bean name="ServerInfo" class="org.jboss.system.server.ServerInfo">
+      <alias>jboss.system:type=ServerInfo</alias>
+   </bean>
+
    <!-- The legacy JMX kernel -->
    <bean name="JMXKernel" class="org.jboss.system.server.jmx.JMXKernel">
       <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
       <property name="serverImpl"><inject bean="JBossServer"/></property>
+      <property name="serverInfo"><inject bean="ServerInfo"/></property>
    </bean>
    
 </deployment>

Modified: trunk/server/src/etc/conf/default/profile-repository.xml
===================================================================
--- trunk/server/src/etc/conf/default/profile-repository.xml	2008-11-17 07:24:17 UTC (rev 81158)
+++ trunk/server/src/etc/conf/default/profile-repository.xml	2008-11-17 08:15:39 UTC (rev 81159)
@@ -37,10 +37,13 @@
          -->
     </bean>
 
+   <!-- The Bootstrap implementation that loads the Profile from the ProfileService -->
    <bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
       <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
       <property name="mainDeployer"><inject bean="MainDeployer"/></property>
       <property name="profileService"><inject bean="ProfileService"/></property>
+      <property name="mof"><inject bean="ManagedObjectFactory"/></property>
+      <property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property>
    </bean>
 
    <!-- A filter for excluding files from the scanner -->

Modified: trunk/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java	2008-11-17 07:24:17 UTC (rev 81158)
+++ trunk/system/src/main/org/jboss/deployers/plugins/managed/BeanMetaDataICF.java	2008-11-17 08:15:39 UTC (rev 81159)
@@ -32,6 +32,7 @@
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.logging.Logger;
 import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ManagementObject;
 import org.jboss.managed.api.annotation.ManagementObjectClass;
 import org.jboss.managed.spi.factory.InstanceClassFactory;
 import org.jboss.metadata.spi.MetaData;
@@ -121,6 +122,13 @@
             // TODO: TCL may not be correct
             ClassLoader loader = getClassLoader(attachment);
             mocClass = loader.loadClass(beanClassName);
+            // Make sure it has an ManagementObject annotation
+            ManagementObject moAnn = mocClass.getAnnotation(ManagementObject.class);
+            if(moAnn == null)
+            {
+               // Revert back to the BeanMetaData class
+               mocClass = attachment.getClass();
+            }
             log.debug("Using bean class:, "+mocClass+" for bean: "+attachment);
          }
       }

Modified: trunk/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java	2008-11-17 07:24:17 UTC (rev 81158)
+++ trunk/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java	2008-11-17 08:15:39 UTC (rev 81159)
@@ -21,38 +21,58 @@
  */
 package org.jboss.deployers.plugins.managed;
 
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.jboss.beans.info.spi.PropertyInfo;
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.logging.Logger;
 import org.jboss.managed.api.Fields;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.api.ManagedProperty;
 import org.jboss.managed.api.MutableManagedObject;
+import org.jboss.managed.api.annotation.ManagementConstants;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementObjectRef;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ManagementRuntimeRef;
 import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.DefaultFieldsImpl;
+import org.jboss.managed.plugins.ManagedPropertyImpl;
+import org.jboss.managed.plugins.WritethroughManagedPropertyImpl;
 import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
+import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulator;
+import org.jboss.managed.spi.factory.ManagedPropertyConstraintsPopulatorFactory;
 import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.types.ArrayMetaType;
 import org.jboss.metatype.api.types.CollectionMetaType;
+import org.jboss.metatype.api.types.MetaType;
 import org.jboss.metatype.api.values.CollectionValueSupport;
 import org.jboss.metatype.api.values.GenericValue;
 import org.jboss.metatype.api.values.GenericValueSupport;
+import org.jboss.reflect.spi.AnnotatedInfo;
+import org.jboss.reflect.spi.TypeInfo;
 
 /**
  * ManagedObjectCreator for KernelDeployment
  * 
  * @author Scott.Stark at jboss.org
  * @author Ales.Justin at jboss.org
- * @version $Revision:$
+ * @version $Revision$
  */
 public class KernelDeploymentManagedObjectCreator implements ManagedObjectCreator
 {
+   private static Logger log = Logger.getLogger(KernelDeploymentManagedObjectCreator.class);
    private ManagedObjectFactory mof;
 
    public KernelDeploymentManagedObjectCreator(ManagedObjectFactory mof)
@@ -63,7 +83,8 @@
    }
 
    /**
-    * Build managed object.
+    * Called by the KernelDeploymentDeployer to update the ManagedObjects map
+    * created by the default ManagedObjectCreator. 
     *
     * @param unit the deployment unit
     * @param managedObjects map of managed objects
@@ -85,29 +106,75 @@
          deploymentMO = mof.createManagedObject(deployment.getClass());
          managedObjects.put(KernelDeployment.class.getName(), deploymentMO);
       }
-      // Update the beanFactories value to 
+
+      MetaData metaData = unit.getMetaData();
+      // Update the beanFactories value to a list of BeanMetaDataFactory with BeanMetaDatas
       ManagedProperty beanFactoriesMP = deploymentMO.getProperty("beanFactories");
-      List<GenericValue> tmp = new ArrayList<GenericValue>();
-      CollectionMetaType moType = new CollectionMetaType(BeanMetaDataFactory.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
+      List<GenericValue> tmpBFs = new ArrayList<GenericValue>();
+      CollectionMetaType beansFactoryType = new CollectionMetaType(BeanMetaDataFactory.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
       if(beanFactories != null)
       {
+         List<GenericValue> tmpBeans = new ArrayList<GenericValue>();
+         CollectionMetaType beansType = new CollectionMetaType(BeanMetaDataFactory.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
          for(BeanMetaDataFactory bmdf : beanFactories)
          {
-            // TODO - this is a hack ;-)
-            if((bmdf instanceof BeanMetaData) == false)
+            ManagedObject bmdfMO = mof.initManagedObject(bmdf, metaData);
+            if(bmdfMO == null)
                continue;
+            if((bmdfMO instanceof MutableManagedObject) == false)
+            {
+               // Just go with the default ManagedObject
+               GenericValueSupport gv = new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, bmdfMO);
+               tmpBFs.add(gv);
+               continue;
+            }
+            else
+            {
+               GenericValueSupport gv = new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, bmdfMO);
+               tmpBFs.add(gv);
+            }
+/*
+            MutableManagedObject bmdfMMO = (MutableManagedObject) bmdfMO;
+            Map<String, ManagedProperty> oldProps = bmdfMMO.getProperties();
+            ManagedProperty beansMPCheck = oldProps.get("beans");
+            // If there already is a beans property assume its correct
+            if(beansMPCheck != null)
+               continue;
 
-            BeanMetaData bmd = (BeanMetaData) bmdf;
-            DeploymentUnit compUnit = unit.getComponent(bmd.getName());
-            MetaData metaData = compUnit.getMetaData();
-            GenericValue gv = getManagedObjectValue(bmd, metaData, deploymentMO);
-            if(gv != null)
-               tmp.add(gv);
+            Map<String, ManagedProperty> newProps = new HashMap<String, ManagedProperty>(oldProps);
+            // Create a beans ManagedProperty, a list of BeanMetaData ManagedObjects
+            DefaultFieldsImpl fields = new DefaultFieldsImpl();
+            ManagedPropertyImpl beansMP = new ManagedPropertyImpl(bmdfMO, fields);
+            beansMP.setMetaType(beansType);
+            newProps.put("beans", beansMP);
+            
+            // Create a ManagedObject for each of the beans BeanMetaData
+            List<BeanMetaData> beans = bmdf.getBeans();
+            if(beans != null)
+            {
+               for(BeanMetaData bmd : beans)
+               {
+                  DeploymentUnit compUnit = unit.getComponent(bmd.getName());
+                  if(compUnit == null)
+                  {
+                     log.debug("Failed to find component for bean: "+bmd.getName());
+                  }
+                  MetaData compMetaData = compUnit.getMetaData();
+                  GenericValue gv = getManagedObjectValue(bmd, compMetaData, bmdfMO);
+                  if(gv != null)
+                     tmpBeans.add(gv);
+               }
+            }
+            GenericValue[] beanMOs = new GenericValue[tmpBeans.size()];
+            tmpBeans.toArray(beanMOs);
+            CollectionValueSupport values = new CollectionValueSupport(beansType, beanMOs);
+            beansMP.setValue(values);
+            */
          }
       }
-      GenericValue[] mos = new GenericValue[tmp.size()];
-      tmp.toArray(mos);
-      CollectionValueSupport values = new CollectionValueSupport(moType, mos);
+      GenericValue[] mos = new GenericValue[tmpBFs.size()];
+      tmpBFs.toArray(mos);
+      CollectionValueSupport values = new CollectionValueSupport(beansFactoryType, mos);
       // This bypasses the write through back to the metadata
       beanFactoriesMP.getFields().setField(Fields.VALUE, values);
    }
@@ -123,4 +190,5 @@
       }
       return new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, mo);
    }
+
 }


Property changes on: trunk/system/src/main/org/jboss/deployers/plugins/managed/KernelDeploymentManagedObjectCreator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision

Modified: trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java	2008-11-17 07:24:17 UTC (rev 81158)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/ManagementView.java	2008-11-17 08:15:39 UTC (rev 81159)
@@ -45,9 +45,11 @@
 {
    /**
     * Load and associate the given profile with the ManagementView
-    * for future operations.
+    * for future operations. This must be called before the other ManagementView
+    * operations may be used. Currently there can only be one actively loaded
+    * profile against which a client is performing management operations.
     * 
-    * @param key - the profile to load
+    * @param key - the profile key to load
     * @throws NoSuchProfileException
     */
    public void loadProfile(ProfileKey key)
@@ -69,13 +71,22 @@
    public Set<String> getDeploymentNamesForType(String type);
 
    /**
-    * Search for a deployment matching the regex expression.
+    * Search for all deployment names with a name matching the regex expression.
     * @param regex - the regex to query deployment name 
     * @return the deployment name.
     * @throws NoSuchDeploymentException if no matches are found 
     */
    public Set<String> getMatchingDeploymentName(String regex)
       throws NoSuchDeploymentException;
+   /**
+    * Search for all deployments matched by the matcher.
+    * @param name - the name to input to the matcher
+    * @param matcher - the matcher 
+    * @return a possibly empty set of ManagedDeployment accepted by the matcher
+    * @throws Exception
+    */
+   public Set<ManagedDeployment> getMatchingDeployments(String name, NameMatcher<ManagedDeployment> matcher)
+      throws NoSuchDeploymentException, Exception;
 
    /**
     * Get a deployment
@@ -89,6 +100,7 @@
    public ManagedDeployment getDeployment(String name, DeploymentPhase phase)
       throws NoSuchDeploymentException, Exception;
 
+
    /**
     * Get the deployments of a type.
     * @param type - the deployment or module type.
@@ -109,11 +121,27 @@
 
    /**
     * Obtain the ManagedComponent for the given name/type
+    * 
+    * @see #getComponent(String, ComponentType, NameMatcher)
+    * @param name - the ManagedComponent#getName value to match
+    * @param type - the component type
     * @return the possibly null ManagedComponent
     * @throws Exception
     */
    public ManagedComponent getComponent(String name, ComponentType type)
       throws Exception;
+   /**
+    * Obtain the ManagedComponents for the given name/type and matcher.
+    * 
+    * @param name - the ManagedComponent#getName value to match
+    * @param type - the component type
+    * @param matcher - a matcher that compares name to candidate ManagedComponent
+    * @return the possibly empty set of ManagedComponent matches.
+    * @throws Exception
+    */
+   public Set<ManagedComponent> getMatchingComponents(String name, ComponentType type,
+         NameMatcher<ManagedComponent> matcher)
+      throws Exception;
 
    /**
     * Update the given component. This takes the component ManagedDeployment,
@@ -174,4 +202,9 @@
     * @throws Exception
     */
    public void process() throws Exception;
+
+   /**
+    * Reload the current profiles managed deployments/objects.
+    */
+   public void reloadProfile() throws Exception;
 }

Added: trunk/system/src/main/org/jboss/deployers/spi/management/NameMatcher.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/NameMatcher.java	                        (rev 0)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/NameMatcher.java	2008-11-17 08:15:39 UTC (rev 81159)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.deployers.spi.management;
+
+import org.jboss.managed.api.ComponentType;
+
+/**
+ * An interface for matching a name against a managed element
+ * 
+ * @see ManagementView##getComponent(String, ComponentType, NameMatcher)
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface NameMatcher<T>
+{
+   /**
+    * 
+    * @param managed - the managed element whose name is to be matched
+    * @param name - the name input from the client
+    * @return
+    */
+   public boolean matches(T comp, String name);
+}

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2008-11-17 07:24:17 UTC (rev 81158)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java	2008-11-17 08:15:39 UTC (rev 81159)
@@ -21,10 +21,16 @@
  */
 package org.jboss.system.server.profileservice;
 
+import java.lang.annotation.Annotation;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.bootstrap.spi.Bootstrap;
 import org.jboss.bootstrap.spi.Server;
 import org.jboss.bootstrap.spi.microcontainer.MCServer;
@@ -32,13 +38,32 @@
 import org.jboss.deployers.client.spi.IncompleteDeploymentException;
 import org.jboss.deployers.client.spi.main.MainDeployer;
 import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.managed.ManagedDeploymentCreator;
+import org.jboss.deployers.spi.management.KnownComponentTypes;
 import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer.KernelDeploymentVisitor;
 import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.kernel.Kernel;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.deployment.KernelDeployment;
 import org.jboss.logging.Logger;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.MutableManagedObject;
 import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.DefaultFieldsImpl;
+import org.jboss.managed.plugins.ManagedComponentImpl;
+import org.jboss.managed.plugins.ManagedPropertyImpl;
+import org.jboss.metatype.api.types.ArrayMetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.ArrayValueSupport;
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileKey;
 import org.jboss.profileservice.spi.ProfileService;
@@ -66,7 +91,11 @@
 
    /** The kernel */
    protected Kernel kernel;
-   
+   /** The ManagedDeploymentCreator plugin */
+   private ManagedDeploymentCreator mgtDeploymentCreator = null;
+   private ManagedObjectFactory mof;
+   private Map<String, ManagedDeployment> bootstrapMDs = new HashMap<String, ManagedDeployment>();
+
    /** Whether we are shutdown */
    private AtomicBoolean shutdown = new AtomicBoolean(false);
    
@@ -125,6 +154,43 @@
       this.kernel = kernel;
    }
 
+   
+   public String getProfileName()
+   {
+      return profileName;
+   }
+   public void setProfileName(String profileName)
+   {
+      this.profileName = profileName;
+   }
+
+   public ManagedObjectFactory getMof()
+   {
+      return mof;
+   }
+   public void setMof(ManagedObjectFactory mof)
+   {
+      this.mof = mof;
+   }
+
+   public ManagedDeploymentCreator getMgtDeploymentCreator()
+   {
+      return mgtDeploymentCreator;
+   }
+   public void setMgtDeploymentCreator(ManagedDeploymentCreator mgtDeploymentCreator)
+   {
+      this.mgtDeploymentCreator = mgtDeploymentCreator;
+   }
+
+   public Map<String, ManagedDeployment> getBootstrapMDs()
+   {
+      return bootstrapMDs;
+   }
+   public void setBootstrapMDs(Map<String, ManagedDeployment> bootstrapMDs)
+   {
+      this.bootstrapMDs = bootstrapMDs;
+   }
+
    /**
     * 
     */
@@ -144,16 +210,12 @@
       mainDeployer.checkComplete();
 
       // TODO: JBAS-5689 Expose the bootstrap ManagedDeployments...
-      Map<String, KernelDeployment> serverDeployments = null;
-      if(server instanceof MCServer)
-      {
-         MCServer mcserver = MCServer.class.cast(server);
-         serverDeployments = mcserver.getDeployments();
-      }
+      initBootstrapMDs(server);
 
       // Load the profile beans
       try
       {
+         profileName = server.getConfig().getServerName();
          loadProfile(profileName);
       }
       catch (IncompleteDeploymentException e)
@@ -392,4 +454,83 @@
       }
       deployer.process();
    }
+
+   protected void initBootstrapMDs(Server server)
+   {
+      Map<String, KernelDeployment> serverDeployments = null;
+      if(server instanceof MCServer)
+      {
+         MCServer mcserver = MCServer.class.cast(server);
+         serverDeployments = mcserver.getDeployments();
+         for(KernelDeployment kd : serverDeployments.values())
+         {
+            ManagedObject kdMO = mof.initManagedObject(kd, null);
+            Map<String, ManagedObject> kdMOs = Collections.singletonMap(kd.getName(), kdMO);
+            BootstrapDeployment deploymentUnit = new BootstrapDeployment(kd);
+            KernelDeploymentVisitor visitor = new KernelDeploymentVisitor();
+            try
+            {
+               visitor.deploy(deploymentUnit, kd);
+            }
+            catch(DeploymentException e)
+            {
+               log.debug("Failed to build ManagedDeployment for: "+kd, e);
+               continue;
+            }
+            ManagedDeployment md = mgtDeploymentCreator.build(deploymentUnit, kdMOs, null);
+            for(DeploymentUnit compUnit : deploymentUnit.getComponents())
+            {
+               BeanMetaData bmd = compUnit.getAttachment(BeanMetaData.class);
+               ManagedObject bmdMO = mof.initManagedObject(bmd, compUnit.getMetaData());
+               if(bmdMO == null)
+                  continue;
+               // Reset the name to the bean name
+               if(bmdMO instanceof MutableManagedObject)
+               {
+                  MutableManagedObject mmo = (MutableManagedObject) bmdMO;
+                  mmo.setName(bmd.getName());
+                  mmo.setParent(kdMO);
+                  // Add an alias property
+                  Set<Object> bmdAliases = bmd.getAliases();
+                  if(bmdAliases != null && bmdAliases.size() > 0)
+                  {
+                     Map<String, ManagedProperty> oldProps = mmo.getProperties();
+                     Map<String, ManagedProperty> newProps = new HashMap<String, ManagedProperty>(oldProps);
+                     DefaultFieldsImpl fields = new DefaultFieldsImpl();
+                     fields.setName("alias");
+                     fields.setDescription("Aliases of the bean");
+                     fields.setMandatory(false);
+                     ArrayMetaType type = new ArrayMetaType(SimpleMetaType.STRING, false);
+                     fields.setMetaType(type);
+                     String[] aliases = new String[bmdAliases.size()];
+                     Iterator i = bmdAliases.iterator();
+                     for(int n = 0; i.hasNext(); n++)
+                     {
+                        aliases[n] = i.next().toString();
+                     }
+                     ArrayValueSupport value = new ArrayValueSupport(type, aliases);
+                     fields.setValue(value);
+                     ManagedPropertyImpl aliasesMP = new ManagedPropertyImpl(bmdMO, fields);
+                     newProps.put("alias", aliasesMP);
+                     mmo.setProperties(newProps);
+                  }
+               }
+               log.debug("Created ManagedObject: "+bmdMO+" for bean: "+bmd.getName());
+
+               ComponentType type = KnownComponentTypes.MCBean.Any.getType();
+               Map<String, Annotation> moAnns = bmdMO.getAnnotations();
+               ManagementComponent mc = (ManagementComponent) moAnns.get(ManagementComponent.class.getName());
+               if(mc != null)
+               {
+                  type = new ComponentType(mc.type(), mc.subtype());
+               }
+               ManagedComponentImpl comp = new ManagedComponentImpl(type, md, bmdMO);
+               md.addComponent(bmdMO.getName(), comp);
+               log.debug("Created ManagedComponent of type: "+type+" for bean: "+bmd.getName());
+            }
+            if(md != null)
+               bootstrapMDs.put(kd.getName(), md);
+         }
+      }
+   }
 }

Modified: trunk/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java	2008-11-17 07:24:17 UTC (rev 81158)
+++ trunk/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java	2008-11-17 08:15:39 UTC (rev 81159)
@@ -56,6 +56,7 @@
 import org.jboss.system.server.ServerConfigImpl;
 import org.jboss.system.server.ServerConfigImplMBean;
 import org.jboss.system.server.ServerImplMBean;
+import org.jboss.system.server.ServerInfoMBean;
 import org.jboss.util.JBossObject;
 import org.jboss.util.file.FileSuffixFilter;
 import org.jboss.virtual.VFS;
@@ -80,6 +81,7 @@
    private ServiceController controller;
    private ServerConfig serverConfig;
    private ServerConfigImplMBean serverConfigMBean;
+   private ServerInfoMBean serverInfo;
    /** The kernel */
    private Kernel kernel;
    /** The serverImpl cast as an emitter */
@@ -110,6 +112,15 @@
       return mbeanServer;
    }
 
+   public ServerInfoMBean getServerInfo()
+   {
+      return serverInfo;
+   }
+   public void setServerInfo(ServerInfoMBean serverInfo)
+   {
+      this.serverInfo = serverInfo;
+   }
+
    /**
     * Set the kernel.
     * 
@@ -181,10 +192,9 @@
       {
          Thread.currentThread().setContextClassLoader(cl);
    
-         // General Purpose Architecture information
-         createMBean("org.jboss.system.server.ServerInfo",
-            "jboss.system:type=ServerInfo");
-   
+         // General Purpose Architecture information -- 
+         mbeanServer.registerMBean(serverInfo, new ObjectName("jboss.system:type=ServerInfo"));
+
          // Service Controller
          controller = new ServiceController();
          controller.setKernel(kernel);
@@ -555,3 +565,4 @@
       return mbeanName;
    }
 }
+

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java	2008-11-17 07:24:17 UTC (rev 81158)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/SecurityManagedObjectsTestCase.java	2008-11-17 08:15:39 UTC (rev 81159)
@@ -52,6 +52,7 @@
       throws Exception
    {
       ManagementView mgtMview = getManagementView();
+      mgtMview.reloadProfile();
       ComponentType type = new ComponentType("MCBean", "Security");
       Set<ManagedComponent> mcs = mgtMview.getComponentsForType(type);
       assertTrue("There are MCBean,Security components", mcs.size() > 0);

Added: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java	2008-11-17 08:15:39 UTC (rev 81159)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt 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.test.profileservice.test;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+
+import org.jboss.deployers.spi.management.KnownComponentTypes;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.profileservice.management.matchers.AliasMatcher;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.test.JBossTestCase;
+import org.jboss.virtual.VFS;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ServerManagedObjectsTestCase
+   extends JBossTestCase
+{
+   protected ManagementView activeView;
+
+   public ServerManagedObjectsTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Validate the ServerInfo component
+    * @throws Exception
+    */
+   public void testServerInfo()
+      throws Exception
+   {
+      ManagementView mgtView = getManagementView();
+      ComponentType type = KnownComponentTypes.MCBean.Any.getType();
+      getLog().debug("MCBeans: "+mgtView.getComponentsForType(type));
+      ManagedComponent mc = mgtView.getComponent("ServerInfo", type);
+      assertNotNull(mc);
+      // Serach by alias for the jmx name
+      AliasMatcher matcher = new AliasMatcher();
+      Set<ManagedComponent> mcs = mgtView.getMatchingComponents("jboss.system:type=ServerInfo", type, matcher);
+      assertEquals("Found one MC for alias", 1, mcs.size());
+      Map<String, ManagedProperty> props = mc.getProperties();
+      getLog().info(props.keySet());
+      // , activeThreadGroupCount, hostAddress, OSVersion, javaVMName, totalMemory, activeThreadCount, alias, hostName, javaVMVendor, javaVendor, javaVMVersion, OSName, javaVersion
+      ManagedProperty maxMemory = props.get("maxMemory");
+      long maxMemoryValue = getLong(maxMemory);
+      assertTrue("maxMemory > 1MB", maxMemoryValue > 1024*1024);
+      ManagedProperty freeMemory = props.get("freeMemory");
+      long freeMemoryValue = getLong(freeMemory);
+      assertTrue("freeMemory > 1MB", freeMemoryValue > 1024*1024);
+      ManagedProperty availableProcessors = props.get("availableProcessors");
+      long availableProcessorsValue = getLong(availableProcessors);
+      assertTrue("availableProcessors > 0", availableProcessorsValue > 0);
+      
+   }
+
+   /**
+    * Obtain the ProfileService.ManagementView
+    * @return
+    * @throws Exception
+    */
+   protected ManagementView getManagementView()
+      throws Exception
+   {
+      if( activeView == null )
+      {
+         String profileName = "profileservice";
+         InitialContext ctx = getInitialContext();
+         ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
+         activeView = ps.getViewManager();
+         ProfileKey defaultKey = new ProfileKey(profileName);
+         activeView.loadProfile(defaultKey);
+         // Init the VFS to setup the vfs* protocol handlers
+         VFS.init();
+      }
+      return activeView;
+   }
+
+   private long getLong(ManagedProperty prop)
+   {
+      SimpleValue mv = (SimpleValue) prop.getValue();
+      Number value = (Number) mv.getValue();
+      return value.longValue();
+   }
+
+}




More information about the jboss-cvs-commits mailing list