[jboss-cvs] JBossAS SVN: r66469 - in trunk: cluster/src/main/org/jboss/ha/jmx and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 25 19:33:10 EDT 2007


Author: alesj
Date: 2007-10-25 19:33:09 -0400 (Thu, 25 Oct 2007)
New Revision: 66469

Added:
   trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java
Removed:
   trunk/profileservice/src/main/org/jboss/profileservice/management/BasicMetaDataNameProvider.java
   trunk/profileservice/src/main/org/jboss/profileservice/management/ControllerRuntimeComponentDispatcher.java
   trunk/system/src/main/org/jboss/deployers/spi/management/MetaDataNameProvider.java
Modified:
   trunk/build/build-thirdparty.xml
   trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java
   trunk/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java
   trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
   trunk/profileservice/src/resources/profileservice-beans.xml
   trunk/system-jmx/pom.xml
   trunk/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java
   trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java
   trunk/system-jmx/src/main/org/jboss/system/metadata/ServiceInjectionValueMetaData.java
   trunk/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaData.java
   trunk/system-jmx/src/main/org/jboss/system/microcontainer/ServiceControllerContext.java
   trunk/system-jmx/src/main/org/jboss/system/microcontainer/ServiceControllerContextAction.java
   trunk/system/pom.xml
   trunk/system/src/main/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
Moving the PS code to MC_beta5.

Modified: trunk/build/build-thirdparty.xml
===================================================================
--- trunk/build/build-thirdparty.xml	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/build/build-thirdparty.xml	2007-10-25 23:33:09 UTC (rev 66469)
@@ -104,7 +104,7 @@
     <componentref name="jboss/jms-integration-tests" version="1.0.1.GA"/>
     <componentref name="jboss/messaging" version="snapshot"/>
     <componentref name="jboss/metadata" version="1.0.0.snapshot"/>
-    <componentref name="jboss/microcontainer" version="2.0.0.Beta4"/>
+    <componentref name="jboss/microcontainer" version="2.0.0.Beta5"/>
     <componentref name="jboss/profiler/jvmti" version="1.0.0.CR5"/>
     <componentref name="jboss/remoting" version="2.2.2.SP2"/>
     <componentref name="jboss/serialization" version="1.0.3.GA"/>

Modified: trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -28,8 +28,8 @@
 import javax.management.Notification;
 import javax.management.ObjectName;
 
-import org.jboss.beans.metadata.plugins.annotations.FromContext;
-import org.jboss.beans.metadata.plugins.annotations.Inject;
+import org.jboss.beans.metadata.api.annotations.FromContext;
+import org.jboss.beans.metadata.api.annotations.Inject;
 import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
 import org.jboss.ha.framework.interfaces.DistributedState;
 import org.jboss.ha.framework.interfaces.HAPartition;

Added: trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java	                        (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractRuntimeComponentDispatcher.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -0,0 +1,97 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* 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;
+
+import org.jboss.deployers.spi.management.RuntimeComponentDispatcher;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+
+/**
+ * Abstract component dispatcher.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class AbstractRuntimeComponentDispatcher implements RuntimeComponentDispatcher
+{
+   private MetaValueFactory valueFactory;
+
+   protected AbstractRuntimeComponentDispatcher(MetaValueFactory valueFactory)
+   {
+      if (valueFactory == null)
+         valueFactory = MetaValueFactory.getInstance();
+      this.valueFactory = valueFactory;
+   }
+
+   /**
+    * Create meta value.
+    *
+    * @param value the value
+    * @return meta value instance
+    */
+   protected MetaValue create(Object value)
+   {
+      return valueFactory.create(value);
+   }
+
+   /**
+    * Unwrap meta value.
+    *
+    * @param metaValue the meta value
+    * @return unwrapped value
+    */
+   protected Object unwrap(MetaValue metaValue)
+   {
+      return valueFactory.unwrap(metaValue);
+   }
+
+   /**
+    * Get the arguments from meta values.
+    *
+    * @param param the meta value parameters
+    * @return unwrapped object array
+    */
+   protected Object[] toArguments(MetaValue... param)
+   {
+      Object[] args = new Object[param.length];
+      for(int i=0; i < param.length; i++)
+      {
+         args[i] = unwrap(param[i]);
+      }
+      return param;
+   }
+
+   /**
+    * Get the parameters signatures.
+    *
+    * @param param the parameters
+    * @return signatures
+    */
+   protected static String[] toSignature(MetaValue... param)
+   {
+      String[] signature = new String[param.length];
+      for(int i=0; i < param.length; i++)
+      {
+         signature[i] = param[i].getMetaType().getTypeName();
+      }
+      return signature;
+   }
+}

Deleted: trunk/profileservice/src/main/org/jboss/profileservice/management/BasicMetaDataNameProvider.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/BasicMetaDataNameProvider.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/BasicMetaDataNameProvider.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -1,51 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* 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;
-
-import java.io.Serializable;
-
-import org.jboss.deployers.spi.management.MetaDataNameProvider;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.system.metadata.ServiceMetaData;
-
-/**
- * Simple name provider.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class BasicMetaDataNameProvider implements MetaDataNameProvider
-{
-   public Object getRuntimeComponentName(Serializable attachment)
-   {
-      if (attachment instanceof BeanMetaData)
-      {
-         BeanMetaData beanMetaData = (BeanMetaData)attachment;
-         return beanMetaData.getName();
-      }
-      else if (attachment instanceof ServiceMetaData)
-      {
-         ServiceMetaData serviceMetaData = (ServiceMetaData)attachment;
-         return serviceMetaData.getObjectName().getCanonicalName();
-      }
-      throw new IllegalArgumentException("Cannot handle attachment of type: " + attachment.getClass());
-   }
-}

Deleted: trunk/profileservice/src/main/org/jboss/profileservice/management/ControllerRuntimeComponentDispatcher.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ControllerRuntimeComponentDispatcher.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ControllerRuntimeComponentDispatcher.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -1,104 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* 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;
-
-import java.io.Serializable;
-
-import org.jboss.deployers.spi.management.RuntimeComponentDispatcher;
-import org.jboss.deployers.spi.management.MetaDataNameProvider;
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValue;
-import org.jboss.beans.metadata.plugins.annotations.Constructor;
-import org.jboss.beans.metadata.plugins.annotations.Inject;
-import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
-
-/**
- * Microcontainer Controller runtime component dispatcher.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class ControllerRuntimeComponentDispatcher implements RuntimeComponentDispatcher
-{
-   private Controller controller;
-   private MetaDataNameProvider provider;
-
-   @Constructor
-   public ControllerRuntimeComponentDispatcher(@Inject(bean= KernelConstants.KERNEL_CONTROLLER_NAME) Controller controller)
-   {
-      if (controller == null)
-         throw new IllegalArgumentException("Null controller.");
-      this.controller = controller;
-      this.provider = new BasicMetaDataNameProvider();
-   }
-
-   public Object dispatch(Serializable attachment, String methodName, MetaValue... param)
-   {
-      Object name = provider.getRuntimeComponentName(attachment);
-      ControllerContext context = controller.getInstalledContext(name);
-      if (context != null)
-      {
-         if (context instanceof InvokeDispatchContext)
-         {
-            InvokeDispatchContext dispatchContext = (InvokeDispatchContext)context;
-            Object[] args = new Object[param.length];
-            String[] signature = new String[param.length];
-            for(int i=0; i < param.length; i++)
-            {
-               args[i] = value(param[i]);
-               signature[i] = param[i].getMetaType().getClassName();
-            }
-            try
-            {
-               return dispatchContext.invoke(methodName, args, signature);
-            }
-            catch (Throwable t)
-            {
-               throw new RuntimeException(t);
-            }
-         }
-         else
-            throw new IllegalArgumentException("Context is not invoke dispatchable: " + context);
-      }
-      else
-         throw new IllegalArgumentException("No such installed context: " + attachment);
-   }
-
-   private Object value(MetaValue value)
-   {
-      if (value instanceof SimpleValue == false)
-         throw new IllegalArgumentException("Cannot get value from non Simple value: " + value);
-      return ((SimpleValue)value).getValue();
-   }
-
-   public MetaDataNameProvider getNameProvider()
-   {
-      return provider;
-   }
-
-   public void setProvider(MetaDataNameProvider provider)
-   {
-      this.provider = provider;
-   }
-}

Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/KernelBusRuntimeComponentDispatcher.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -21,83 +21,67 @@
 */
 package org.jboss.profileservice.management;
 
+import java.lang.reflect.UndeclaredThrowableException;
+
+import org.jboss.kernel.spi.registry.KernelBus;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+
 /**
  * Microcontainer KernelBus runtime component dispatcher.
  *
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public class KernelBusRuntimeComponentDispatcher {}
-/*
-      implements RuntimeComponentDispatcher
+public class KernelBusRuntimeComponentDispatcher extends AbstractRuntimeComponentDispatcher
 {
    private KernelBus bus;
-   private MetaDataNameProvider provider;
 
-   @Constructor
-   public KernelBusRuntimeComponentDispatcher(@Inject(bean= KernelConstants.KERNEL_BUS_NAME) KernelBus bus)
+   public KernelBusRuntimeComponentDispatcher(KernelBus bus)
    {
+      this(bus, null);
+   }
+
+   public KernelBusRuntimeComponentDispatcher(KernelBus bus, MetaValueFactory valueFactory)
+   {
+      super(valueFactory);
       if (bus == null)
          throw new IllegalArgumentException("Null kernel bus.");
       this.bus = bus;
-      this.provider = new BasicMetaDataNameProvider();
    }
 
-   public Object dispatch(Serializable attachment, String methodName, MetaValue... param)
+   public MetaValue get(Object componentName, String propertyName)
    {
-      Object name = provider.getRuntimeComponentName(attachment);
       try
       {
-         return bus.invoke(name, new InvokeMetaValueJoinpoint(methodName, param));
+         return create(bus.get(componentName, propertyName));
       }
       catch (Throwable t)
       {
-         throw new RuntimeException(t);
+         throw new UndeclaredThrowableException(t);
       }
    }
 
-   public MetaDataNameProvider getNameProvider()
+   public void set(Object componentName, String propertyName, MetaValue value)
    {
-      return provider;
-   }
-
-   public void setProvider(MetaDataNameProvider provider)
-   {
-      this.provider = provider;
-   }
-
-   private static class InvokeMetaValueJoinpoint extends InvokeKernelRegistryEntryJoinpoint
-   {
-      public InvokeMetaValueJoinpoint(String string, MetaValue... param)
+      try
       {
-         super(string, toArguments(param), toSignature(param));
+         bus.set(componentName, propertyName, unwrap(value));
       }
-
-      private static Object value(MetaValue value)
+      catch (Throwable t)
       {
-         if (value instanceof SimpleValue == false)
-            throw new IllegalArgumentException("Cannot get value from non Simple value: " + value);
-         return ((SimpleValue)value).getValue();
+         throw new UndeclaredThrowableException(t);
       }
+   }
 
-      private static Object[] toArguments(MetaValue... param)
+   public Object invoke(Object componentName, String methodName, MetaValue... param)
+   {
+      try
       {
-         Object[] args = new Object[param.length];
-         for(int i=0; i < param.length; i++)
-         {
-            args[i] = value(param[i]);
-         }
-         return param;
+         return bus.invoke(componentName, methodName, toArguments(param), toSignature(param));
       }
-
-      private static String[] toSignature(MetaValue... param)
+      catch (Throwable t)
       {
-         String[] signature = new String[param.length];
-         for(int i=0; i < param.length; i++)
-         {
-            signature[i] = param[i].getMetaType().getClassName();
-         }
-         return signature;
+         throw new UndeclaredThrowableException(t);
       }
    }
 }
-*/

Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -70,6 +70,7 @@
 import org.jboss.metatype.api.values.GenericValue;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
 import org.jboss.profileservice.spi.AttachmentsSerializer;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.NoSuchProfileException;
@@ -84,10 +85,10 @@
  * 
  * @author Scott.Stark at jboss.org
  * @author adrian at jboss.org
+ * @author ales.justin at jboss.org
  * @version $Revision$
  */
-public class ManagementViewImpl
-   implements ManagementView
+public class ManagementViewImpl implements ManagementView
 {
    private static Logger log = Logger.getLogger(ManagementViewImpl.class);
    private static final String BUNDLE_NAME = "org.jboss.profileservice.management.messages"; //$NON-NLS-1$
@@ -114,8 +115,7 @@
    /** */
    private MessageFormat formatter = new MessageFormat("");
    /** An index of ManagedComponent by ComponentType */
-   private HashMap<ComponentType, Set<ManagedComponent>> compByCompType =
-      new HashMap<ComponentType, Set<ManagedComponent>>();
+   private HashMap<ComponentType, Set<ManagedComponent>> compByCompType = new HashMap<ComponentType, Set<ManagedComponent>>();
    /** id/type key to ManagedObject map */
    private Map<String, ManagedObject> moRegistry = new HashMap<String, ManagedObject>();
    /** The deployment name to ManagedDeployment map */
@@ -176,7 +176,6 @@
             log.warn("Failed to create ManagedDeployment for: "+name, e);
          }
       }
-
    }
    /**
     * 
@@ -252,13 +251,12 @@
          log.debug("Checking property: "+prop);
          // See if this is a ManagementObjectID
          Map<String, Annotation> pannotations = prop.getAnnotations();
-         if (pannotations != null)
+         if (pannotations != null && pannotations.isEmpty() == false)
          {
             ManagementObjectID id = (ManagementObjectID) pannotations.get(ManagementObjectID.class.getName());
             if (id != null)
             {
-               SimpleValue refValue = (SimpleValue) prop.getValue();
-               String refName = (String) refValue.getValue();
+               Object refName = getRefName(prop.getValue());
                if (refName == null)
                   refName = id.name();
                String propKey = refName + "/" + id.type();
@@ -272,8 +270,7 @@
             {
                // The reference key is the prop value + ref.type()
                log.debug("Property("+prop.getName()+") references: "+ref);
-               SimpleValue refValue = (SimpleValue) prop.getValue();
-               String refName = (String) refValue.getValue();
+               Object refName = getRefName(prop.getValue());
                if (refName == null)
                   refName = ref.name();
                String targetKey = refName + "/" + ref.type();
@@ -299,11 +296,7 @@
          MetaType propType = prop.getMetaType();
          if (propType == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
          {
-            GenericValue gv = (GenericValue) prop.getValue();
-            ManagedObject propMO = (ManagedObject) gv.getValue();
-            // TODO: a null is probably an error condition
-            if (propMO != null)
-               processManagedObject(propMO, md);
+            processGenericValue ((GenericValue)prop.getValue(), md);
          }
          else if (propType.isArray())
          {
@@ -314,18 +307,49 @@
                ArrayValue<GenericValue> avalue = (ArrayValue<GenericValue>) prop.getValue();
                int length = avalue != null ? avalue.getLength() : 0;
                for(int n = 0; n < length; n ++)
-               {
-                  GenericValue gv = (GenericValue) avalue.getValue(n);
-                  ManagedObject propMO = (ManagedObject) gv.getValue();
-                  // TODO: a null is probably an error condition
-                  if (propMO != null)
-                     processManagedObject(propMO, md);
-               }
+                  processGenericValue((GenericValue) avalue.getValue(n), md);
             }
          }
       }
    }
 
+   /**
+    * Get ref name.
+    *
+    * @param value property value
+    * @return plain value
+    */
+   protected Object getRefName(Object value)
+   {
+      if (value instanceof MetaValue)
+      {
+         MetaValue metaValue = (MetaValue)value;
+         if (metaValue.getMetaType().isSimple() == false)
+            throw new IllegalArgumentException("Can only get ref from simple value: " + value);
+         return ((SimpleValue)metaValue).getValue();
+      }
+      return value;
+   }
+
+   /**
+    * Process generic value.
+    *
+    * @param genericValue the generic value
+    * @param md the managed deployment
+    * @throws Exception for any error
+    */
+   protected void processGenericValue(GenericValue genericValue, ManagedDeployment md) throws Exception
+   {
+      // TODO: a null is probably an error condition
+      if (genericValue != null)
+      {
+         ManagedObject propMO = (ManagedObject) genericValue.getValue();
+         // TODO: a null is probably an error condition
+         if (propMO != null)
+            processManagedObject(propMO, md);
+      }
+   }
+
    public Map<String, Set<ManagedProperty>> getUnresolvedRefs()
    {
       return unresolvedRefs;
@@ -335,6 +359,7 @@
    {
       return ps;
    }
+
    public void setProfileService(ProfileService ps)
    {
       this.ps = ps;
@@ -345,6 +370,7 @@
    {
       return locator;
    }
+
    public void setLocator(InvokerLocator locator)
    {
       this.locator = locator;
@@ -364,6 +390,7 @@
    {
       return mainDeployer;
    }
+
    public void setMainDeployer(MainDeployer mainDeployer)
    {
       this.mainDeployer = mainDeployer;
@@ -382,24 +409,21 @@
 
    /**
     * Get the names of the deployment in the profile.
-    * @param key - the profile containing the deployment
     */
    public Set<String> getDeploymentNames()
    {
-      Set<String> names = activeProfile.getDeploymentNames();
-      return names;   
+      return activeProfile.getDeploymentNames();
    }
 
    /**
     * Get the names of the deployment in the profile that have the
     * given deployment type.
-    * @param key - the profile containing the deployment
+    * 
     * @param type - the deployment type
     */
    public Set<String> getDeploymentNamesForType(String type)
    {
-      Set<String> names = activeProfile.getDeploymentNamesForType(type);
-      return names;
+      return activeProfile.getDeploymentNamesForType(type);
    }
 
    public Set<String> getMatchingDeploymentName(String regex)
@@ -426,14 +450,15 @@
 
    public Set<String> getTemplateNames()
    {
-      HashSet<String> tmp = new HashSet<String>(templates.keySet());
-      return tmp;
+      return new HashSet<String>(templates.keySet());
    }
+
    public void addTemplate(DeploymentTemplate template)
    {
       this.templates.put(template.getInfo().getName(), template);
       log.debug("addTemplate: "+template);
    }
+
    public void removeTemplate(DeploymentTemplate template)
    {
       this.templates.remove(template.getInfo().getName());
@@ -486,8 +511,7 @@
    public Set<ManagedComponent> getComponentsForType(ComponentType type)
       throws Exception
    {
-      Set<ManagedComponent> mcs = compByCompType.get(type);
-      return mcs;
+      return compByCompType.get(type);
    }
 
    public DeploymentTemplateInfo getTemplate(String name)
@@ -507,8 +531,7 @@
       return info;
    }
 
-   public void applyTemplate(DeploymentPhase phase,
-      String deploymentBaseName, DeploymentTemplateInfo info)
+   public void applyTemplate(DeploymentPhase phase, String deploymentBaseName, DeploymentTemplateInfo info)
       throws Exception
    {
       DeploymentTemplate template = templates.get(info.getName());
@@ -564,7 +587,33 @@
             String msg = formatter.format(args);
             throw new IllegalArgumentException(msg);
          }
-         ctxProp.setValue((Serializable)prop.getValue());
+         // TODO - decide what is the type of value when we set it
+         // since currently get always returns MetaValue, but we see some cases
+         // where plain Serializable is enough
+         Serializable serializable;
+         MetaValue metaValue;
+         Object value = prop.getValue();
+         if (value instanceof MetaValue)
+         {
+            metaValue = (MetaValue)value;
+            MetaType metaType = metaValue.getMetaType();
+            if (metaType.isSimple())
+               serializable = ((SimpleValue)metaValue).getValue();
+            else if (metaType.isGeneric())
+               serializable = ((GenericValue)metaValue).getValue();
+            else
+               serializable = null;
+         }
+         else
+         {
+            serializable = (Serializable)value;
+            metaValue = SimpleValueSupport.wrap(serializable);
+         }
+         ctxProp.setValue(serializable);
+         // todo - should this also dispatch to runtime component?
+         Object componentName = getComponentName(ctxProp);
+         if (componentName != null)
+            dispatcher.set(componentName, ctxProp.getName(), metaValue);
       }
       log.info("Updated mo: "+mos);
    }
@@ -596,10 +645,6 @@
       mainDeployer.checkComplete();
    }
 
-   public void updateDeployment()
-   {
-      
-   }
    public void updateComponent(ManagedComponent comp)
       throws Exception
    {
@@ -643,10 +688,53 @@
             String msg = formatter.format(args);
             throw new IllegalArgumentException(msg);
          }
-         ctxProp.setValue((Serializable)prop.getValue());
+         // TODO - decide what is the type of value when we set it
+         // since currently get always returns MetaValue, but we see some cases
+         // where plain Serializable is enough
+         Serializable serializable;
+         MetaValue metaValue;
+         Object value = prop.getValue();
+         if (value instanceof MetaValue)
+         {
+            metaValue = (MetaValue)value;
+            MetaType metaType = metaValue.getMetaType();
+            if (metaType.isSimple())
+               serializable = ((SimpleValue)metaValue).getValue();
+            else if (metaType.isGeneric())
+               serializable = ((GenericValue)metaValue).getValue();
+            else
+               serializable = null;
+         }
+         else
+         {
+            serializable = (Serializable)value;
+            metaValue = SimpleValueSupport.wrap(serializable);
+         }
+         ctxProp.setValue(serializable);
+         Object componentName = getComponentName(ctxProp);
+         if (componentName != null)
+            dispatcher.set(componentName, ctxProp.getName(), metaValue);
       }
    }
 
+   /**
+    * Get the component name from managed property.
+    *
+    * @param property the managed property
+    * @return component name or null if no coresponding component
+    */
+   protected Object getComponentName(ManagedProperty property)
+   {
+      // first check target
+      ManagedObject targetObject = property.getTargetManagedObject();
+      if (targetObject != null)
+         return targetObject.getComponentName();
+
+      // check owner
+      targetObject = property.getManagedObject();
+      return targetObject != null ? targetObject.getComponentName() : null;
+   }
+
    protected void checkForReferences(String key, ManagedObject mo)
    {
       Set<ManagedProperty> referers =  unresolvedRefs.get(key);
@@ -692,12 +780,14 @@
    }
 
    /**
-    * TODO: An aspect that performs the operation dispatch is still needed
-    * 
-    * @param mo
-    * @param ops
-    * @return
-    * @throws Exception
+    * Create ManagedOperation wrapper to intercept
+    * its invocation, pushing the actual invocation
+    * to runtime component.
+    *
+    * @param mo the managed object
+    * @param ops the managed operations
+    * @return set of wrapped managed operations
+    * @throws Exception for any errot
     */
    protected Set<ManagedOperation> createOperationProxies(ManagedObject mo, Set<ManagedOperation> ops)
       throws Exception
@@ -717,7 +807,7 @@
       for (ManagedOperation op : ops)
       {
          String dispatchName = "ProfileService.ManagedOperation@"+System.identityHashCode(op);
-         Dispatcher.singleton.registerTarget(dispatchName, new ManagedOperationDelegate(op, mo.getAttachment()));
+         Dispatcher.singleton.registerTarget(dispatchName, new ManagedOperationDelegate(op, mo));
          ManagedOperation opProxy = (ManagedOperation) Remoting.createRemoteProxy(dispatchName,
                loader, ifaces, locator, interceptors, "ProfileService");
          opProxies.add(opProxy);
@@ -734,21 +824,25 @@
    public class ManagedOperationDelegate implements ManagedOperation
    {
       private ManagedOperation delegate;
-      private Serializable attachment;
+      private ManagedObject managedObject;
 
-      public ManagedOperationDelegate(ManagedOperation delegate, Serializable attachment)
+      public ManagedOperationDelegate(ManagedOperation delegate, ManagedObject managedObject)
       {
          if (delegate == null)
             throw new IllegalArgumentException("Null delegate.");
          this.delegate = delegate;
-         if (attachment == null)
-            throw new IllegalArgumentException("No attachment target for op: " + delegate);
-         this.attachment = attachment;
+         if (managedObject == null)
+            throw new IllegalArgumentException("Null managed object.");
+         this.managedObject = managedObject;
       }
 
       public Object invoke(MetaValue... metaValues)
       {
-         return dispatcher.dispatch(attachment, delegate.getName(), metaValues);
+         Object componentName = managedObject.getComponentName();
+         if (componentName != null)
+            return dispatcher.invoke(componentName, delegate.getName(), metaValues);
+
+         return null;
       }
 
       public String getDescription()

Modified: trunk/profileservice/src/resources/profileservice-beans.xml
===================================================================
--- trunk/profileservice/src/resources/profileservice-beans.xml	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/profileservice/src/resources/profileservice-beans.xml	2007-10-25 23:33:09 UTC (rev 66469)
@@ -32,9 +32,9 @@
         <property name="managementViewProxy"><inject bean="ProfileServiceProxyFactory" property="managementViewProxy"/></property>
     </bean>
 
-    <bean name="RuntimeComponentDispatcher" class="org.jboss.profileservice.management.ControllerRuntimeComponentDispatcher">
+    <bean name="RuntimeComponentDispatcher" class="org.jboss.profileservice.management.KernelBusRuntimeComponentDispatcher">
        <constructor>
-          <parameter><inject bean="jboss.kernel:service=KernelController"/></parameter>
+          <parameter><inject bean="jboss.kernel:service=KernelBus"/></parameter>
        </constructor>
     </bean>
 

Modified: trunk/system/pom.xml
===================================================================
--- trunk/system/pom.xml	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/system/pom.xml	2007-10-25 23:33:09 UTC (rev 66469)
@@ -16,11 +16,13 @@
 	<description>JBoss Application Server (system module)</description>
 	<build>
 		<sourceDirectory>src/main</sourceDirectory>
+<!--
 		<resources>
 			<resource>
 				<directory>src/resources</directory>
 			</resource>
 		</resources>
+-->
 	</build>
 	<dependencies>
 		<!-- Compile (global dependencies) -->

Deleted: trunk/system/src/main/org/jboss/deployers/spi/management/MetaDataNameProvider.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/MetaDataNameProvider.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/MetaDataNameProvider.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -1,40 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* 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 java.io.Serializable;
-
-/**
- * Extracts name of runtime component from attachment.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public interface MetaDataNameProvider
-{
-   /**
-    * Extract name from attachment.
-    *
-     * @param attachment the attachment
-    * @return runtime component's name
-    */
-   Object getRuntimeComponentName(Serializable attachment);
-}

Modified: trunk/system/src/main/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java
===================================================================
--- trunk/system/src/main/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/system/src/main/org/jboss/deployers/spi/management/RuntimeComponentDispatcher.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -21,8 +21,6 @@
 */
 package org.jboss.deployers.spi.management;
 
-import java.io.Serializable;
-
 import org.jboss.metatype.api.values.MetaValue;
 
 /**
@@ -34,19 +32,31 @@
 public interface RuntimeComponentDispatcher
 {
    /**
+    * Get value.
+    *
+    * @param componentName the runtime component name
+    * @param propertyName the property name
+    * @return the return meta value
+    */
+   MetaValue get(Object componentName, String propertyName);
+
+   /**
+    * Set the value.
+    *
+    * @param componentName the runtime component name
+    * @param propertyName the property name
+    * @param value the meta value
+    */
+   void set(Object componentName, String propertyName, MetaValue value);
+
+   /**
     * Dispatch ManagedOperation invocation
     * with param parameters to coresponding attachment.
     *
-    * @param attachment the attachment
+    * @param componentName the runtime component name
     * @param methodName the methodName
     * @param param the parameters
-    * @return runtime component's response
+    * @return runtime component's return value
     */
-   Object dispatch(Serializable attachment, String methodName, MetaValue... param);
-
-   /**
-    * Get the name provider - extracts name from attachment instance.
-    * @return
-    */
-   MetaDataNameProvider getNameProvider();
+   Object invoke(Object componentName, String methodName, MetaValue... param);
 }

Modified: trunk/system-jmx/pom.xml
===================================================================
--- trunk/system-jmx/pom.xml	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/system-jmx/pom.xml	2007-10-25 23:33:09 UTC (rev 66469)
@@ -16,11 +16,13 @@
 	<description>JBoss Application Server (system-jmx module)</description>
 	<build>
 		<sourceDirectory>src/main</sourceDirectory>
+<!--
 		<resources>
 			<resource>
 				<directory>src/resources</directory>
 			</resource>
 		</resources>
+-->
 	</build>
 	<dependencies>
 		<!-- Compile (global dependencies) -->

Modified: trunk/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/system-jmx/src/main/org/jboss/system/deployers/SARDeployer.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -77,6 +77,7 @@
    public void setIcf(ServiceMetaDataICF icf)
    {
       this.icf = icf;
+      // TODO - should we allow null to handle ICF removal?
       if (icf != null)
       {
          // Have the ServiceMetaData ManagedObject build from the code class

Modified: trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -25,6 +25,7 @@
 
 import javax.management.InstanceNotFoundException;
 import javax.management.MBeanServer;
+import javax.management.ObjectName;
 
 import org.jboss.beans.info.spi.BeanInfo;
 import org.jboss.beans.info.spi.PropertyInfo;
@@ -37,6 +38,7 @@
 import org.jboss.system.metadata.ServiceDependencyValueMetaData;
 import org.jboss.system.metadata.ServiceMetaData;
 import org.jboss.system.metadata.ServiceTextValueMetaData;
+import org.jboss.system.metadata.ServiceValueMetaData;
 
 /**
  * The InstanceClassFactory implementation for ServiceMetaData.
@@ -44,8 +46,7 @@
  * @author Scott.Stark at jboss.org
  * @version $Revision$
  */
-public class ServiceMetaDataICF
-   implements InstanceClassFactory
+public class ServiceMetaDataICF implements InstanceClassFactory<ServiceMetaData>
 {
    private static final Logger log = Logger.getLogger(ServiceMetaDataICF.class);
 
@@ -57,15 +58,15 @@
    {
       return mbeanServer;
    }
+
    public void setMbeanServer(MBeanServer mbeanServer)
    {
       this.mbeanServer = mbeanServer;
    }
 
-   public Class<? extends Serializable> getManagedObjectClass(Serializable instance)
+   public Class<? extends Serializable> getManagedObjectClass(ServiceMetaData md)
       throws ClassNotFoundException
    {
-      ServiceMetaData md = (ServiceMetaData) instance;
       try
       {
          ClassLoader loader = mbeanServer.getClassLoader(md.getClassLoaderName());
@@ -77,9 +78,9 @@
          throw new ClassNotFoundException("Failed to obtain mbean class loader", e);
       }
    }
-   public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, Serializable instance)
+
+   public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, ServiceMetaData md)
    {
-      ServiceMetaData md = (ServiceMetaData) instance;
       // First look to the mapped name
       String name = property.getMappedName();
       if (name == null)
@@ -93,6 +94,7 @@
          if (amd.getName().equalsIgnoreCase(name))
          {
             value = amd.getValue();
+            break;
          }
       }
       // Unwrap the ServiceValueMetaData types
@@ -109,12 +111,6 @@
       // TODO: unwrap other ServiceValueMetaData types
 
       PropertyInfo propertyInfo = beanInfo.getProperty(name);
-      if (propertyInfo == null)
-      {
-         throw new IllegalStateException("Unable to find property: " + name
-               + " for " + instance.getClass().getName());
-      }
-
       MetaValue mvalue;
       try
       {
@@ -129,4 +125,54 @@
       return mvalue;
    }
 
+   public void setValue(BeanInfo beanInfo, ManagedProperty property, ServiceMetaData md, MetaValue value)
+   {
+      // First look to the mapped name
+      String name = property.getMappedName();
+      if (name == null)
+         property.getName();
+
+      // Get the attribute value
+      ServiceValueMetaData attributeValue = null;
+      for (ServiceAttributeMetaData amd : md.getAttributes())
+      {
+         // The compare is case-insensitve due to the attribute/javabean case mismatch
+         if (amd.getName().equalsIgnoreCase(name))
+         {
+            attributeValue = amd.getValue();
+            break;
+         }
+      }
+      if (attributeValue != null)
+      {
+         PropertyInfo propertyInfo = beanInfo.getProperty(name);
+         Object plainValue = metaValueFactory.unwrap(value, propertyInfo.getType());
+
+         // Unwrap the ServiceValueMetaData types
+         if (attributeValue instanceof ServiceTextValueMetaData)
+         {
+            ServiceTextValueMetaData text = (ServiceTextValueMetaData) attributeValue;
+            text.setText(String.valueOf(plainValue));
+         }
+         else if (value instanceof ServiceDependencyValueMetaData)
+         {
+            ServiceDependencyValueMetaData depends = (ServiceDependencyValueMetaData) attributeValue;
+            depends.setDependency(String.valueOf(plainValue));
+         }
+         // TODO: unwrap other ServiceValueMetaData types
+      }
+      else
+         throw new IllegalArgumentException("No matching attribute found: " + name + "/" + md);
+   }
+
+   public Object getComponentName(BeanInfo beanInfo, ManagedProperty property, ServiceMetaData md, MetaValue value)
+   {
+      if (beanInfo == null || property == null || value == null)
+      {
+         ObjectName objectName = md.getObjectName();
+         if (objectName != null)
+            return objectName.getCanonicalName();
+      }
+      return null;
+   }
 }

Modified: trunk/system-jmx/src/main/org/jboss/system/metadata/ServiceInjectionValueMetaData.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/metadata/ServiceInjectionValueMetaData.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/system-jmx/src/main/org/jboss/system/metadata/ServiceInjectionValueMetaData.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -23,13 +23,11 @@
 
 import java.io.Serializable;
 
-import org.jboss.beans.info.spi.BeanInfo;
 import org.jboss.dependency.plugins.AbstractDependencyItem;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.joinpoint.spi.TargettedJoinpoint;
-import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.dependency.spi.dispatch.AttributeDispatchContext;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.system.microcontainer.ServiceControllerContext;
 
@@ -165,18 +163,21 @@
       if (state == null)
          state = ControllerState.INSTALLED;
 
-      ControllerContext context = controller.getContext(dependency, dependentState);
+      ControllerContext context = controller.getContext(dependency, state);
       if (context == null)
          throw new Error("Should not be here - dependency failed! " + this);
       Object result = context.getTarget();
-      if (result != null && property != null)
+      if (property != null)
       {
-         // TODO - move this code to AttributeDispatchContext notion
-         KernelConfigurator configurator = controller.getKernel().getConfigurator();
-         BeanInfo beanInfo = configurator.getBeanInfo(result.getClass());
-         TargettedJoinpoint joinpoint = configurator.getPropertyGetterJoinPoint(beanInfo, property);
-         joinpoint.setTarget(result);
-         return joinpoint.dispatch();
+         if (context instanceof AttributeDispatchContext)
+         {
+            AttributeDispatchContext adc = (AttributeDispatchContext)context;
+            result = adc.get(property);
+         }
+         else
+            throw new IllegalArgumentException(
+                  "Cannot use property attribute, context is not AttributeDispatchContext: " + context +
+                  ", metadata: " + this);
       }
       return result;
    }

Modified: trunk/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaData.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaData.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/system-jmx/src/main/org/jboss/system/metadata/ServiceMetaData.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -25,7 +25,6 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
-
 import javax.management.ObjectName;
 
 import org.jboss.dependency.spi.ControllerMode;

Modified: trunk/system-jmx/src/main/org/jboss/system/microcontainer/ServiceControllerContext.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/microcontainer/ServiceControllerContext.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/system-jmx/src/main/org/jboss/system/microcontainer/ServiceControllerContext.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -21,6 +21,13 @@
 */
 package org.jboss.system.microcontainer;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Iterator;
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
 import org.jboss.dependency.plugins.AbstractControllerContext;
 import org.jboss.dependency.spi.Controller;
 import org.jboss.dependency.spi.ControllerMode;
@@ -34,13 +41,6 @@
 import org.jboss.system.metadata.ServiceMetaDataVisitor;
 import org.jboss.system.metadata.ServiceMetaDataVisitorNode;
 
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import javax.management.Attribute;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Iterator;
-
 /**
  * ServiceControllerContext.
  * 
@@ -124,14 +124,30 @@
       return server;
    }
 
+   protected static String getAttributeName(String name)
+   {
+      if (name == null || name.length() == 0)
+         throw new IllegalArgumentException("Illegal name: " + name);
+
+      char firstCharacter = name.charAt(0);
+      if (Character.isLowerCase(firstCharacter))
+      {
+         String attributeName = String.valueOf(Character.toUpperCase(firstCharacter));
+         if (name.length() > 1)
+            attributeName += name.substring(1);
+         return attributeName;
+      }
+      return name;
+   }
+
    public Object get(String name) throws Throwable
    {
-      return getMBeanServer().getAttribute(objectName, name);
+      return getMBeanServer().getAttribute(objectName, getAttributeName(name));
    }
 
    public void set(String name, Object value) throws Throwable
    {
-      Attribute attribute = new Attribute(name, value);
+      Attribute attribute = new Attribute(getAttributeName(name), value);
       getMBeanServer().setAttribute(objectName, attribute);
    }
 

Modified: trunk/system-jmx/src/main/org/jboss/system/microcontainer/ServiceControllerContextAction.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/microcontainer/ServiceControllerContextAction.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/system-jmx/src/main/org/jboss/system/microcontainer/ServiceControllerContextAction.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -21,12 +21,7 @@
 */
 package org.jboss.system.microcontainer;
 
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.plugins.action.SimpleControllerContextAction;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.logging.Logger;
 
@@ -34,74 +29,23 @@
  * ServiceControllerContextAction.
  * 
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @version $Revision: 1.1 $
  */
-public class ServiceControllerContextAction implements ControllerContextAction
+public class ServiceControllerContextAction extends SimpleControllerContextAction<ServiceControllerContext>
 {
    protected Logger log = Logger.getLogger(getClass());
 
-   public void install(final ControllerContext context) throws Throwable
+   protected ServiceControllerContext contextCast(ControllerContext context)
    {
-      if (System.getSecurityManager() == null || context instanceof ServiceControllerContext == false)
-         installAction((ServiceControllerContext) context);
-      else
-      {
-         PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
-         {
-            public Object run() throws Exception
-            {
-               try
-               {
-                  installAction((ServiceControllerContext) context);
-                  return null;
-               }
-               catch (RuntimeException e)
-               {
-                  throw e;
-               }
-               catch (Exception e)
-               {
-                  throw e;
-               }
-               catch (Error e)
-               {
-                  throw e;
-               }
-               catch (Throwable t)
-               {
-                  throw new RuntimeException(t);
-               }
-            }
-         };
-         try
-         {
-            AccessController.doPrivileged(action);
-         }
-         catch (PrivilegedActionException e)
-         {
-            throw e.getCause();
-         }
-      }
+      return ServiceControllerContext.class.cast(context);
    }
 
-   public void uninstall(final ControllerContext context)
+   protected boolean validateContext(ControllerContext context)
    {
-      if (System.getSecurityManager() == null || context instanceof ServiceControllerContext == false)
-         uninstallAction((ServiceControllerContext) context);
-      else
-      {
-         PrivilegedAction<Object> action = new PrivilegedAction<Object>()
-         {
-            public Object run()
-            {
-               uninstallAction((ServiceControllerContext) context);
-               return null;
-            }
-         };
-         AccessController.doPrivileged(action);
-      }
+      return (context instanceof ServiceControllerContext);
    }
-   
+
    public void installAction(ServiceControllerContext context) throws Throwable
    {
    }

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2007-10-25 22:44:57 UTC (rev 66468)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2007-10-25 23:33:09 UTC (rev 66469)
@@ -86,7 +86,8 @@
       super(name);
    }
 
-   /** Basic test of accessing the ProfileService and checking the
+   /**
+    * Basic test of accessing the ProfileService and checking the
     * available profile keys.
     */
    public void testProfileKeys()
@@ -122,7 +123,7 @@
       // Validate some well known deployments
       String[] expectedNames = {
          "jboss-service.xml",
-    		"client-deployer-beans.xml",
+//    		"client-deployer-beans.xml",
          "jbossweb.deployer/",
     		"ear-deployer-beans.xml",
     		"jbossws.deployer/",
@@ -260,11 +261,15 @@
       assertEquals("idle-timeout-minutes", SimpleValueSupport.wrap(0), p.getValue());
       p = props.get("prepared-statement-cache-size");
       assertEquals("prepared-statement-cache-size", SimpleValueSupport.wrap(32), p.getValue());
+/*
+      TODO - Uncomment when Weston has ManagedConnectionFactoryDeploymentMetaData/DBMSMetaData done
       p = props.get("type-mapping");
       assertEquals("type-mapping", SimpleValueSupport.wrap("Hypersonic SQL"), p.getValue());
+*/
       p = props.get("security-domain");
       assertNotNull("security-domain", p);
       GenericValue sdGV = (GenericValue) p.getValue();
+      assertNotNull(sdGV);
       ManagedObject secDomain = (ManagedObject) sdGV.getValue();
       // TODO, this should be non-null:
       // assertNotNull("security-domain.MO", secDomain);
@@ -282,11 +287,13 @@
       ComponentType queueType = new ComponentType("JMSDestination", "Queue");
       Set<ManagedComponent> queues = mgtView.getComponentsForType(queueType);
       log.info("queues: "+queues);
+      assertNotNull("Null JMS queues", queues);
       assertTrue("queues.size", queues.size() > 0);
 
       ComponentType topicType = new ComponentType("JMSDestination", "Topic");
       Set<ManagedComponent> topics = mgtView.getComponentsForType(topicType);
       log.info("topics: "+topics);
+      assertNotNull(topics);
       assertTrue("topics.size", topics.size() > 0);
    }
 
@@ -312,7 +319,7 @@
       maxSize.setValue(new Integer(53));
 
       mgtView.updateComponent(hsqldb);
-      mgtView.process();
+//      mgtView.process();
    
       // TODO: Query the mbeans to validate the change
       // TODO: Query the profile service repository for the overriden data
@@ -399,7 +406,7 @@
    {
       if( activeView == null )
       {
-         InitialContext ctx = super.getInitialContext();
+         InitialContext ctx = getInitialContext();
          ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
          activeView = ps.getViewManager();
          ProfileKey defaultKey = new ProfileKey("default");




More information about the jboss-cvs-commits mailing list