[jboss-cvs] JBossAS SVN: r101325 - in branches/Branch_Hornet_Temporary_2/hornetq-int: src and 15 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 23 07:36:04 EST 2010


Author: emuckenhuber
Date: 2010-02-23 07:36:03 -0500 (Tue, 23 Feb 2010)
New Revision: 101325

Added:
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/AbstractHornetQControlReferenceDeployment.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/HornetQControlRuntimeDispatchPlugin.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/HornetQManagedObjectCreator.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/ConnectionFactoryConfigurationMO.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/ConnectionFactoryControlMO.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSConfigurationICF.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSConfigurationMO.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSQueueConfigurationMO.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSQueueControlMO.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/MessageListMapper.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/TopicConfigurationMO.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/TopicControlMO.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/hornetq/
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/hornetq/integration/
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/hornetq/integration/test/
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/hornetq/integration/test/AbstractManagementTestBase.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/hornetq/integration/test/BasicJMSConfigurationMOUnitTestCase.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/resources/
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/resources/log4j.properties
Modified:
   branches/Branch_Hornet_Temporary_2/hornetq-int/.classpath
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/DestinationFactoryDeployerPlugin.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSParserDeployer.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSRealDeployer.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQConnectionFactoryDeployment.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQJMSDeployment.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQQueueDeployment.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQTopicDeployment.java
   branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/hornetq-deployers-jboss-beans.xml
Log:
initial ProfileService integration prototype.

Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/.classpath
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/.classpath	2010-02-23 09:19:35 UTC (rev 101324)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/.classpath	2010-02-23 12:36:03 UTC (rev 101325)
@@ -2,6 +2,8 @@
 <classpath>
 	<classpathentry excluding="**" kind="src" output="target/classes" path="src/resources"/>
 	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="src" path="src/test/java"/>
+	<classpathentry kind="src" path="src/test/resources"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>

Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/DestinationFactoryDeployerPlugin.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/DestinationFactoryDeployerPlugin.java	2010-02-23 09:19:35 UTC (rev 101324)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/DestinationFactoryDeployerPlugin.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -1,5 +1,8 @@
 package org.jboss.as.integration.hornetq.deployers;
 
+import java.util.HashSet;
+import java.util.Set;
+
 import javax.jms.Queue;
 import javax.jms.Topic;
 
@@ -85,6 +88,14 @@
 			return false;
 		}
 
+		Set<String> mdbDependencies = mdb.getDepends();
+		if(mdbDependencies == null)
+		{
+		   mdbDependencies = new HashSet<String>();
+		   mdb.setDepends(mdbDependencies);
+		}
+	    // FIXME add dependency
+		// This would be the name of the installed Bean (BeanMetaData)
 
 		unit.addAttachment(JMSConfiguration.class, config);
 		

Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSParserDeployer.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSParserDeployer.java	2010-02-23 09:19:35 UTC (rev 101324)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSParserDeployer.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -1,13 +1,19 @@
 package org.jboss.as.integration.hornetq.deployers;
 
 import java.io.InputStream;
+import java.util.Map;
+import java.util.Set;
 
 import org.hornetq.jms.server.JMSServerConfigParser;
 import org.hornetq.jms.server.config.JMSConfiguration;
 import org.hornetq.jms.server.impl.JMSServerConfigParserImpl;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
 import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedObject;
 import org.jboss.virtual.VirtualFile;
 
 /**
@@ -23,7 +29,7 @@
  * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
  * 
  */
-public class HornetQJMSParserDeployer extends AbstractVFSParsingDeployer<JMSConfiguration>
+public class HornetQJMSParserDeployer extends AbstractVFSParsingDeployer<JMSConfiguration> implements ManagedObjectCreator
 {
 
     private static final Logger log = Logger.getLogger(HornetQJMSParserDeployer.class);
@@ -32,6 +38,9 @@
 
     private final JMSServerConfigParser jmsConfigParser;
 
+    /** The mgt object creator delegate. */
+    private ManagedObjectCreator mgtObjectCreator;
+
     public HornetQJMSParserDeployer()
     {
         super(JMSConfiguration.class);
@@ -39,8 +48,21 @@
         this.jmsConfigParser = new JMSServerConfigParserImpl();
         
         setSuffix(FILENAME);
+        
+        // We build managed objects
+        setBuildManagedObject(true);
     }
 
+   public ManagedObjectCreator getMgtObjectCreator()
+   {
+      return mgtObjectCreator;
+   }
+    
+   public void setMgtObjectCreator(ManagedObjectCreator mgtObjectCreator)
+   {
+      this.mgtObjectCreator = mgtObjectCreator;
+   }
+    
     @Override
     protected JMSConfiguration parse(VFSDeploymentUnit unit, VirtualFile file, JMSConfiguration root) throws Exception
     {
@@ -64,4 +86,18 @@
             }
         }
     }
+    
+   /**
+    * {@inheritDoc}
+    */
+   public void build(DeploymentUnit unit, Set<String> attachmentNames, Map<String, ManagedObject> managedObjects)
+         throws DeploymentException
+   {
+      if(isBuildManagedObject())
+      {
+         // delegate
+         mgtObjectCreator.build(unit, attachmentNames, managedObjects);
+      }
+   }
+    
 }

Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSRealDeployer.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSRealDeployer.java	2010-02-23 09:19:35 UTC (rev 101324)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/HornetQJMSRealDeployer.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -1,7 +1,5 @@
 package org.jboss.as.integration.hornetq.deployers;
 
-import java.util.concurrent.atomic.AtomicInteger;
-
 import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
 import org.hornetq.jms.server.config.JMSConfiguration;
 import org.hornetq.jms.server.config.JMSQueueConfiguration;
@@ -15,6 +13,7 @@
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
 
 /**
  * In a regular flow HornetQJMSParserDeployer will parer hornetq-jms.xml and it
@@ -52,7 +51,7 @@
 
       for (TopicConfiguration config : mainConfig.getTopicConfigurations())
       {
-         String name = "org.hornetq:module=JMS,name=\"" + config.getName() + "\",type=DeployedQueue";
+         String name = "org.hornetq:module=JMS,name=\"" + config.getName() + "\",type=DeployedTopic";
 
          unit.addAttachment(name, createBasicBean(HornetQTopicDeployment.class.getName(), name, config));
       }
@@ -78,6 +77,10 @@
       
       builder.addPropertyMetaData("config", config);
       
+      // runtime control registry
+      builder.addPropertyMetaData("kernel", builder.createInject(KernelConstants.KERNEL_NAME));
+      builder.addPropertyMetaData("mbeanServer", builder.createInject("MBeanServer"));
+      
       return builder.getBeanMetaData();
    }
 

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/AbstractHornetQControlReferenceDeployment.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/AbstractHornetQControlReferenceDeployment.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/AbstractHornetQControlReferenceDeployment.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,108 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat 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.as.integration.hornetq.deployers.pojo;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.as.integration.hornetq.management.HornetQControlRuntimeDispatchPlugin;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.logging.Logger;
+
+/**
+ * The abstract control reference deployment. This registers a {@code KernelRegistryEntry}
+ * based on the deployment name, which is used to handle runtime dispatching from the 
+ * ProfileService {@code RuntimeComponentDispatcher}.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at SuppressWarnings("deprecation")
+public class AbstractHornetQControlReferenceDeployment
+{
+
+   /** The logger. */
+   private static final Logger log = Logger.getLogger("org.jboss.as.integration.hornetq.management");
+   
+   /** The jboss kernel. */
+   private Kernel kernel;
+   
+   /** The mbean server. */
+   private MBeanServer mbeanServer;
+   
+   public Kernel getKernel()
+   {
+      return kernel;
+   }
+   
+   public void setKernel(Kernel kernel)
+   {
+      this.kernel = kernel;
+   }
+   
+   public MBeanServer getMbeanServer()
+   {
+      return mbeanServer;
+   }
+   
+   public void setMbeanServer(MBeanServer mbeanServer)
+   {
+      this.mbeanServer = mbeanServer;
+   }
+   
+   protected void registerControlReference(ObjectName objectName)
+   {
+      try
+      {
+         getKernelRegistry().registerEntry(objectName, 
+               new HornetQControlRuntimeDispatchPlugin(objectName, mbeanServer));
+      }
+      catch(Exception e)
+      {
+         log.debug("failed to register hornetQ control runtime dispatcher plugin", e);
+      }
+   }
+   
+   protected void unregisterControlReference(ObjectName objectName)
+   {
+      try
+      {
+         getKernelRegistry().unregisterEntry(objectName);
+      }
+      catch(Exception e)
+      {
+         log.debug("failed to unregister hornetQ control runtime dispatcher plugin", e);
+      }
+   }
+   
+   protected KernelRegistry getKernelRegistry()
+   {
+      if(kernel == null)
+      {
+         throw new IllegalStateException("null kernel");
+      }
+      return kernel.getRegistry();
+   }
+   
+}
+

Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQConnectionFactoryDeployment.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQConnectionFactoryDeployment.java	2010-02-23 09:19:35 UTC (rev 101324)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQConnectionFactoryDeployment.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -1,5 +1,7 @@
 package org.jboss.as.integration.hornetq.deployers.pojo;
 
+import javax.management.ObjectName;
+
 import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
 import org.jboss.logging.Logger;
 
@@ -14,6 +16,10 @@
       try
       {
          jmsServer.createConnectionFactory(config);
+         
+         // Register the Control MBean in MC
+         registerControlReference(new ObjectName("org.hornetq:module=JMS,name=\"" + config.getName() + "\",type=ConnectionFactory"));
+         
       } catch (Exception e)
       {
          log.warn("Error deploying ConnectionFactory: " + config.getName(), e);
@@ -27,8 +33,11 @@
       log.info("Destroying ConnectionFactory " + config.getName());
       try
       {
+         unregisterControlReference(new ObjectName("org.hornetq:module=JMS,name=\"" + config.getName() + "\",type=ConnectionFactory"));
+         
          jmsServer.destroyConnectionFactory(config.getName());
-      } catch (Exception e)
+      } 
+      catch (Exception e)
       {
          log.warn("Error destroying ConnectionFactory: " + config.getName(), e);
       }

Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQJMSDeployment.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQJMSDeployment.java	2010-02-23 09:19:35 UTC (rev 101324)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQJMSDeployment.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -11,7 +11,7 @@
  * 
  * @see HornetQJMSRealDeployer
  * */
-public abstract class HornetQJMSDeployment<T>
+public abstract class HornetQJMSDeployment<T> extends AbstractHornetQControlReferenceDeployment
 {
 
    private static final Logger log = Logger.getLogger(HornetQJMSDeployment.class);

Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQQueueDeployment.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQQueueDeployment.java	2010-02-23 09:19:35 UTC (rev 101324)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQQueueDeployment.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -1,5 +1,7 @@
 package org.jboss.as.integration.hornetq.deployers.pojo;
 
+import javax.management.ObjectName;
+
 import org.hornetq.jms.server.config.JMSQueueConfiguration;
 import org.jboss.logging.Logger;
 
@@ -17,6 +19,10 @@
             log.info("Deploying Queue " + config.getName() + " on jndiName " + jndiBinding);
             jmsServer.createQueue(config.getName(), jndiBinding, config.getSelector(), config.isDurable());
          }
+         
+         // Register the Control MBean in MC
+         registerControlReference(new ObjectName("org.hornetq:module=JMS,name=\"" + config.getName() + "\",type=Queue"));
+         
       } catch (Exception e)
       {
          log.warn("Error deploying Queue: " + config.getName(), e);
@@ -28,6 +34,9 @@
    public void stop() throws Exception
    {
       log.info("Undeploying queue " + config.getName());
+      
+      unregisterControlReference(new ObjectName("org.hornetq:module=JMS,name=\"" + config.getName() + "\",type=Queue"));
+      
       jmsServer.undeployDestination(config.getName());
    }
 

Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQTopicDeployment.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQTopicDeployment.java	2010-02-23 09:19:35 UTC (rev 101324)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/pojo/HornetQTopicDeployment.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -1,5 +1,7 @@
 package org.jboss.as.integration.hornetq.deployers.pojo;
 
+import javax.management.ObjectName;
+
 import org.hornetq.jms.server.config.TopicConfiguration;
 import org.jboss.logging.Logger;
 
@@ -17,7 +19,10 @@
             log.info("Deploying Topic " + config.getName() + " on jndiName " + jndiBinding);
             jmsServer.createTopic(config.getName(), jndiBinding);
          }
-      } catch (Exception e)
+         //
+         registerControlReference(new ObjectName("org.hornetq:module=JMS,name=\"" + config.getName() + "\",type=Topic"));
+      }
+      catch (Exception e)
       {
          log.warn("Error deploying Topic: " + config.getName(), e);
          throw e;
@@ -30,8 +35,11 @@
       log.info("Undeploying Topic " + config.getName());
       try
       {
+         unregisterControlReference(new ObjectName("org.hornetq:module=JMS,name=\"" + config.getName() + "\",type=Topic"));
+         
          jmsServer.undeployDestination(config.getName());
-      } catch (Exception e)
+      }
+      catch (Exception e)
       {
          log.warn("Error destroying Topic: " + config.getName(), e);
       }

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/HornetQControlRuntimeDispatchPlugin.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/HornetQControlRuntimeDispatchPlugin.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/HornetQControlRuntimeDispatchPlugin.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,221 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat 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.as.integration.hornetq.management;
+
+import java.util.Collections;
+import java.util.Set;
+
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.dependency.plugins.AbstractScopeInfo;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.ErrorHandlingMode;
+import org.jboss.dependency.spi.ScopeInfo;
+import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+import org.jboss.util.NotImplementedException;
+
+/**
+ * A runtime dispatcher plugin, used to delegate requests from the ProfileService
+ * {@code RuntimeComponentDispatcher} to the MBeanServer. This is a needed when
+ * MBeans are directly installed using the MBeanServer, not using the mc-jmx-int. 
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class HornetQControlRuntimeDispatchPlugin extends JBossObject implements KernelRegistryEntry, InvokeDispatchContext
+{
+   
+   /** The object name. */
+   private final ObjectName objectName;
+   
+   /** The mbean server. */
+   private final MBeanServer mbeanServer;
+
+   public HornetQControlRuntimeDispatchPlugin(ObjectName objectName, MBeanServer mbeanServer)
+   {
+      if(objectName == null)
+      {
+         throw new IllegalArgumentException("null object name");
+      }
+      if(mbeanServer == null)
+      {
+         throw new IllegalArgumentException("null mbean server");
+      }
+      this.objectName = objectName;
+      this.mbeanServer = mbeanServer;
+   }
+   
+   public Object get(String name) throws Throwable
+   {
+      return mbeanServer.getAttribute(objectName, getAttributeName(name));
+   }
+   
+   public void set(String name, Object value) throws Throwable
+   {
+      Attribute attribute = new Attribute(getAttributeName(name), value);
+      mbeanServer.setAttribute(objectName, attribute);
+   }
+   
+   public Object invoke(String name, Object[] parameters, String[] signature) throws Throwable
+   {
+      return mbeanServer.invoke(objectName, name, parameters, signature);
+   }
+
+   public ClassLoader getClassLoader() throws Throwable
+   {
+      return mbeanServer.getClassLoader(objectName);
+   }
+   
+   public Object getName()
+   {
+      return this.objectName;
+   }
+   
+   public void setName(Object name)
+   {
+      // 
+   }
+
+   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 Set<Object> getAliases()
+   {
+      return Collections.emptySet();
+   }
+   
+   public Controller getController()
+   {
+      throw new NotImplementedException("getController");
+   }
+
+   public DependencyInfo getDependencyInfo()
+   {
+      return null;
+   }
+
+   public ScopeInfo getScopeInfo()
+   {
+      return new AbstractScopeInfo(getName(), null);
+   }
+   
+   public Object getTarget()
+   {
+      return null;
+   }
+   
+   public Throwable getError()
+   {
+      throw new NotImplementedException("getError");
+   }
+
+   public ControllerState getState()
+   {
+      // Specify this for the runtime state mapping
+      boolean registered = mbeanServer.isRegistered(objectName);
+      return registered ? ControllerState.INSTALLED : ControllerState.NOT_INSTALLED;
+   }
+   
+   public void setState(ControllerState state)
+   {
+      throw new org.jboss.util.NotImplementedException("setState");
+   }
+
+   public ControllerState getRequiredState()
+   {
+      // Specify this for the runtime state mapping
+      return ControllerState.INSTALLED;
+   }
+
+   public void setRequiredState(ControllerState state)
+   {
+      throw new NotImplementedException("setRequiredState");
+   }
+   
+   public ControllerMode getMode()
+   {
+      return ControllerMode.MANUAL;
+   }
+   
+   public void setMode(ControllerMode mode)
+   {
+      throw new NotImplementedException("setMode");
+   }
+
+   public ErrorHandlingMode getErrorHandlingMode()
+   {
+      return ErrorHandlingMode.DISCARD;
+   }
+
+   public void install(ControllerState fromState, ControllerState toState) throws Throwable
+   {
+      throw new NotImplementedException("install");
+   }
+
+   public void setController(Controller controller)
+   {
+      throw new NotImplementedException("setController");
+   }
+
+   public void setError(Throwable error)
+   {
+      throw new NotImplementedException("NYI setError");
+   }
+
+   public void uninstall(ControllerState fromState, ControllerState toState)
+   {
+      throw new NotImplementedException("uninstall");
+   }
+
+   public void toString(JBossStringBuilder buffer)
+   {
+      buffer.append("target=").append(objectName);
+   }
+   
+   public void toShortString(JBossStringBuilder buffer)
+   {
+      buffer.append(objectName);
+   }
+   
+}
+

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/HornetQManagedObjectCreator.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/HornetQManagedObjectCreator.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/HornetQManagedObjectCreator.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,185 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat 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.as.integration.hornetq.management;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.JMSConfiguration;
+import org.hornetq.jms.server.config.JMSQueueConfiguration;
+import org.hornetq.jms.server.config.TopicConfiguration;
+import org.jboss.as.integration.hornetq.management.jms.ConnectionFactoryControlMO;
+import org.jboss.as.integration.hornetq.management.jms.JMSConfigurationICF;
+import org.jboss.as.integration.hornetq.management.jms.JMSConfigurationMO;
+import org.jboss.as.integration.hornetq.management.jms.JMSQueueControlMO;
+import org.jboss.as.integration.hornetq.management.jms.TopicControlMO;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.managed.ManagedObjectCreator;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.MutableManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.spi.factory.ManagedObjectBuilder;
+import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+
+/**
+ * The HornetQ ManagedObject creator. This overrides the default creation of managed objects
+ * for the {@code JMSConfiguration} and adds additional runtime managed objects which
+ * reference the {@code DestinationControl} MBeans. To make the runtime dispatching work, those
+ * MBeans have to registered in MC {@see HornetQControlRuntimeDispatchPlugin}
+ * 
+ * This gets injected into the {@code HornetQJMSParserDeployer}.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class HornetQManagedObjectCreator implements ManagedObjectCreator
+{
+
+   /** The logger. */
+   private static final Logger log = Logger.getLogger("org.jboss.as.integration.hornetq.management");
+   
+   /** The configuration meta data. */
+   private static final MetaData configurationMetaData;
+
+   /** The managed object factory. */
+   private final ManagedObjectFactory managedObjectFactory;
+
+   static
+   {
+      // Create the meta data loader, to override the annotations of the JMSConfiguration
+      AnnotatedElementMetaDataLoader configurationLoader = new AnnotatedElementMetaDataLoader(JMSConfigurationMO.class);
+      configurationMetaData = new MetaDataRetrievalToMetaDataBridge(configurationLoader);
+   }
+
+   public HornetQManagedObjectCreator(ManagedObjectFactory managedObjectFactory)
+   {
+      if(managedObjectFactory == null)
+      {
+         throw new IllegalArgumentException("null managed object factory");
+      }
+      this.managedObjectFactory = managedObjectFactory;
+   }
+   
+   public void start()
+   {
+      // Register the instance class factory
+      managedObjectFactory.addInstanceClassFactory(new JMSConfigurationICF(managedObjectFactory));
+   }
+   
+   public void stop()
+   {
+      // Remove instance class factory
+      managedObjectFactory.setInstanceClassFactory(JMSConfiguration.class, null);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void build(DeploymentUnit unit, Set<String> attachmentNames, Map<String, ManagedObject> managedObjects)
+         throws DeploymentException
+   {
+      // Get the configuration
+      JMSConfiguration configuration = unit.getAttachment(JMSConfiguration.class);
+      if (configuration != null)
+      {
+         // Create and populate the management object
+         // Use the JMSConfiguration.class to reference the ICF and override the annotations using MDR
+         ManagedObject mo = managedObjectFactory.initManagedObject(configuration, JMSConfiguration.class,
+               configurationMetaData, JMSConfiguration.class.getName(), null);
+         if (mo != null)
+         {
+            managedObjects.put(JMSConfiguration.class.getName(), mo);
+         }
+         
+         // Create some fake runtime managed objects referencing the Control MBeans
+         for (JMSQueueConfiguration config : configuration.getQueueConfigurations())
+         {
+            // Build the actual ObjectName
+            String name = "org.hornetq:module=JMS,name=\"" + config.getName() + "\",type=Queue";
+            managedObjects.put(name, createManagedObject(config.getName(), name, JMSQueueControlMO.class));
+         }
+         for (TopicConfiguration config : configuration.getTopicConfigurations())
+         {
+            // Build the actual ObjectName
+            String name = "org.hornetq:module=JMS,name=\"" + config.getName() + "\",type=Topic";
+            managedObjects.put(name, createManagedObject(config.getName(), name, TopicControlMO.class));
+         }
+         for (ConnectionFactoryConfiguration config : configuration.getConnectionFactoryConfigurations())
+         {
+            // Build the actual ObjectName
+            String name = "org.hornetq:module=JMS,name=\"" + config.getName() + "\",type=ConnectionFactory";
+            managedObjects.put(name, createManagedObject(config.getName(), name, ConnectionFactoryControlMO.class));
+         }
+      }
+   }
+   
+   /**
+    * Create a {@code ManagedObject} skeleton for the runtime objects only, since all properties and operations 
+    * are getting dispatched to JMX via the {@code HornetQControlRuntimeDispatchPlugin}.
+    * 
+    * The most important thing is that the runtimeMO.name is the same as the one from the attachment meta data 
+    * created in the parsing deployer.
+    * 
+    * @param moName the managed object name
+    * @param runtimeName the actual runtime component name
+    * @param instanceType the template class we create the MO from
+    * @return the managed object
+    */
+   protected ManagedObject createManagedObject(String moName, String runtimeName, Class<?> instanceType)
+   {
+      ManagedObject mo = null;
+      try
+      {
+         final ObjectName objectName = new ObjectName(runtimeName);
+
+         // Just build the MO skeleton
+         // We don't need the MetaData here, since we are directly using the annotated interfaces
+         mo = ManagedObjectBuilder.class.cast(managedObjectFactory).buildManagedObject(instanceType, null);
+         
+         // Populate needed values
+         if(mo != null && mo instanceof MutableManagedObject)
+         {
+            MutableManagedObject mu = MutableManagedObject.class.cast(mo);
+            // Set the managed object name
+            mu.setName(moName);
+            // Set the runtime component name
+            mu.setComponentName(objectName);
+            // Set the name property, so that merging works
+            mo.getProperty("name").setValue(SimpleValueSupport.wrap(moName));
+         }
+      }
+      catch(Exception e)
+      {
+         log.debug("failed to create the ManagedObject for " + runtimeName, e);
+      }
+      return mo;
+   }
+
+}

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/ConnectionFactoryConfigurationMO.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/ConnectionFactoryConfigurationMO.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/ConnectionFactoryConfigurationMO.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,57 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat 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.as.integration.hornetq.management.jms;
+
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+
+/**
+ * The connection factory {@code ManagedObject} template.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject( componentType = @ManagementComponent(type = "JMSDestination", subtype = "ConnectionFactory"),
+      properties = ManagementProperties.EXPLICIT)
+// TODO more management properties
+// TODO change component type names
+public interface ConnectionFactoryConfigurationMO extends ConnectionFactoryConfiguration
+{
+
+   @ManagementProperty(name = "name", 
+         use = ViewUse.CONFIGURATION,
+         description = "The connection factory name")
+   @ManagementObjectID(type = "ConnectionFactory")
+   public String getName();
+   
+   @ManagementProperty(name = "binding",
+         use = ViewUse.CONFIGURATION,
+         description = "The connection factory bindings")
+   public String[] getBindings();
+
+}
+

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/ConnectionFactoryControlMO.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/ConnectionFactoryControlMO.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/ConnectionFactoryControlMO.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,57 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat 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.as.integration.hornetq.management.jms;
+
+import org.hornetq.api.jms.management.ConnectionFactoryControl;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+
+/**
+ * The connection factory control {@code ManagementObject} template.
+ * 
+ * All properties should have {@code ViewUse.STATISTIC} since they are only
+ * fetched during runtime using the {@code HornetQControlRuntimeDispatchPlugin}.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject(isRuntime = true, properties = ManagementProperties.EXPLICIT)
+// TODO more management properties (use = ViewUse.STATISTIC) and operations
+public interface ConnectionFactoryControlMO extends ConnectionFactoryControl
+{
+
+   @ManagementProperty(name = "name", 
+         use = ViewUse.CONFIGURATION,
+         description = "The connection factory name")
+   @ManagementObjectID(type = "ConnectionFactory")
+   // Name has to match ConnectionFactoryConfigurationMO.getName(); The actual objectName is irrelevant
+   public String getName();
+   
+   @ManagementProperty(description = "The connection factory client id",
+         use = ViewUse.STATISTIC, readOnly = true)
+   public String getClientID();
+   
+}
+

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSConfigurationICF.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSConfigurationICF.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSConfigurationICF.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,120 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat 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.as.integration.hornetq.management.jms;
+
+import org.hornetq.jms.server.config.JMSConfiguration;
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.MutableManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
+import org.jboss.managed.plugins.factory.AbstractManagedObjectFactory;
+import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.GenericValueSupport;
+
+/**
+ * The JMSConfiguration InstanceClassFactory. This ICF is bound to the {@code JMSConfiguration}
+ * class and therefore this needs to be specified when initializing the {@code ManagementObject}.
+ * 
+ * The main purpose of this ICF is to override the annotations of the configurations.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class JMSConfigurationICF extends AbstractInstanceClassFactory<JMSConfiguration>
+{
+
+   /** The {@code QueueConfiguration} meta data. */
+   private static final MetaData queueConfigurationMetaData;
+
+   /** The {@code TopicConfiguration} meta data. */
+   private static final MetaData topicConfiguratiomMetaData;
+   
+   /** The {@code ConnectionFactoryConfiguration} meta data. */
+   private static final MetaData factoryConfigurationMetaData;
+   
+   static
+   {
+      // Create the meta data loaders
+      AnnotatedElementMetaDataLoader queueLoader = new AnnotatedElementMetaDataLoader(JMSQueueConfigurationMO.class);
+      queueConfigurationMetaData = new MetaDataRetrievalToMetaDataBridge(queueLoader);
+      AnnotatedElementMetaDataLoader topicLoader = new AnnotatedElementMetaDataLoader(TopicConfigurationMO.class);
+      topicConfiguratiomMetaData = new MetaDataRetrievalToMetaDataBridge(topicLoader);
+      AnnotatedElementMetaDataLoader factoryLoader = new AnnotatedElementMetaDataLoader(ConnectionFactoryConfigurationMO.class);
+      factoryConfigurationMetaData = new MetaDataRetrievalToMetaDataBridge(factoryLoader);
+   }
+
+   public JMSConfigurationICF(ManagedObjectFactory factory)
+   {
+      super(factory);
+   }
+   
+   @Override
+   public Class<JMSConfiguration> getType()
+   {
+      return JMSConfiguration.class;
+   }
+   
+   /**
+    * Override the creation of nested managed objects, since we have to overlay the actual deployment
+    * metadata with the annotated ManagedObject template.
+    * 
+    */
+   protected GenericValue getManagedObjectValue(BeanInfo beanInfo, ManagedProperty property, MetaData metaData,
+         Object value)
+   {
+      // Override the annotations for connection-factories, queues and topics
+      // NOTE those objects are nested in a collection 
+      ManagedObject mo = null;
+      if("connection-factory-configurations".equals(property.getName()))
+      {
+         mo = getMof().initManagedObject(value, factoryConfigurationMetaData);
+      }
+      else if("queue-configurations".equals(property.getName()))
+      {
+         mo = getMof().initManagedObject(value, queueConfigurationMetaData);
+      }
+      else if("topic-configurations".equals(property.getName()))
+      {
+         mo = getMof().initManagedObject(value, topicConfiguratiomMetaData);
+      }
+      if(mo != null)
+      {
+         // Set the parent ManagedObject
+         ManagedObject parentMO = property.getManagedObject();
+         if(parentMO != null && mo instanceof MutableManagedObject)
+         {
+            MutableManagedObject mmo = (MutableManagedObject) mo;
+            mmo.setParent(parentMO);
+         }
+         return new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, mo);
+      }
+      // else
+      return super.getManagedObjectValue(beanInfo, property, metaData, value);
+   }
+   
+}
+

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSConfigurationMO.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSConfigurationMO.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSConfigurationMO.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat 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.as.integration.hornetq.management.jms;
+
+import java.util.List;
+
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.JMSConfiguration;
+import org.hornetq.jms.server.config.JMSQueueConfiguration;
+import org.hornetq.jms.server.config.TopicConfiguration;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * ProfileService JMS configuration {@code ManagedObject} template.
+ * 
+ * This is a indirection layer so that HornetQ does not need to depend
+ * on the the jboss-man annotations directly.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject(properties = ManagementProperties.EXPLICIT)
+public interface JMSConfigurationMO extends JMSConfiguration
+{
+
+   @ManagementProperty(name = "connection-factory-configurations",
+         description = "The connection factory configurations",
+         managed = true)
+   public List<ConnectionFactoryConfiguration> getConnectionFactoryConfigurations();
+
+   @ManagementProperty(name = "queue-configurations",
+         description = "The queue configurations",
+         managed = true)
+   public List<JMSQueueConfiguration> getQueueConfigurations();
+
+   @ManagementProperty(name = "topic-configurations",
+         description = "The topic configurations",
+         managed = true)
+   public List<TopicConfiguration> getTopicConfigurations();
+
+}
+

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSQueueConfigurationMO.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSQueueConfigurationMO.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSQueueConfigurationMO.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat 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.as.integration.hornetq.management.jms;
+
+import org.hornetq.jms.server.config.JMSQueueConfiguration;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * The queue configuration {@code ManagementObject} template.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject( componentType = @ManagementComponent(type = "JMSDestination", subtype = "Queue"),
+      properties = ManagementProperties.EXPLICIT)
+public interface JMSQueueConfigurationMO extends JMSQueueConfiguration
+{
+
+   @ManagementProperty(name = "name", description = "The queue name")
+   @ManagementObjectID(type = "Queue")
+   public String getName();
+   
+   @ManagementProperty(name = "bindings", description = "The queue bindings")
+   public String[] getBindings();
+   
+   @ManagementProperty(name = "selector", description = "The queue selector")
+   public String getSelector();
+   
+}
+

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSQueueControlMO.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSQueueControlMO.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/JMSQueueControlMO.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,94 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat 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.as.integration.hornetq.management.jms;
+
+import org.hornetq.api.jms.management.JMSQueueControl;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+
+/**
+ * The jms queue control {@code ManagedObject} template.
+ * 
+ * All properties should have {@code ViewUse.STATISTIC} since they are only
+ * fetched during runtime using the {@code HornetQControlRuntimeDispatchPlugin}. 
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject(isRuntime = true, properties = ManagementProperties.EXPLICIT)
+// TODO more management properties (use = ViewUse.STATISTIC) and operations
+public interface JMSQueueControlMO extends JMSQueueControl
+{
+
+   @ManagementProperty(name = "name",
+         use = ViewUse.CONFIGURATION,
+         description = "The queue name")
+   @ManagementObjectID( type = "Queue")
+   // Name has to match JMSQueueConfigurationMO.getName(); The actual objectName is irrelevant
+   public String getName();
+
+   @ManagementProperty(description = "The queue address",
+         use = ViewUse.STATISTIC, readOnly = true)
+   public String getAddress();
+   
+   @ManagementProperty(description = "The queue dead letter address",
+         use = ViewUse.STATISTIC, readOnly = true)
+   public String getDeadLetterAddress();
+   
+   @ManagementProperty(description = "The queue expiry address",
+         use = ViewUse.STATISTIC, readOnly = true)
+   public String getExpiryAddress();
+   
+   @ManagementProperty(description = "The queue jndi binding",
+         use = ViewUse.STATISTIC, readOnly = true)
+   public String getJNDIBinding();
+   
+   @ManagementProperty(description = "The queue consumer count",
+         use = ViewUse.STATISTIC, readOnly = true)
+   public int getConsumerCount();
+   
+   @ManagementProperty(description = "The queue delivering count",
+         use = ViewUse.STATISTIC, readOnly = true)
+   public int getDeliveringCount();
+   
+   @ManagementProperty(description = "The queue message count",
+         use = ViewUse.STATISTIC, readOnly = true)
+   public int getMessageCount() throws Exception;
+   
+   @ManagementProperty(description = "The queue messages added",
+         use = ViewUse.STATISTIC, readOnly = true)
+   public int getMessagesAdded();
+   
+   @ManagementProperty(description = "The queue scheduled count",
+         use = ViewUse.STATISTIC, readOnly = true)
+   public long getScheduledCount();
+ 
+   @ManagementOperation
+   public void resetMessageCounter() throws Exception;
+   
+   
+}
+

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/MessageListMapper.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/MessageListMapper.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/MessageListMapper.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.as.integration.hornetq.management.jms;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.Message;
+
+import org.jboss.logging.Logger;
+import org.jboss.metatype.api.types.CollectionMetaType;
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.ImmutableCompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CollectionValueSupport;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+/**
+ * Maps a List<JBossMessage> into a CollectMetaType of CompositeValues.
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 90349 $
+ */
+public class MessageListMapper extends MetaMapper<List<Message>>
+{
+   private static final Logger log = Logger.getLogger(MessageListMapper.class);
+   public static final CollectionMetaType TYPE;
+   public static final CompositeMetaType MSG_TYPE;
+
+   static
+   {
+      String[] itemNames = {
+            "JMSMessageID",
+            "JMSTimestamp",
+            "JMSCorrelationID"
+      };
+      String[] itemDescriptions = {
+            "JMSMessageID",
+            "JMSTimestamp",
+            "JMSCorrelationID"
+      };
+      MetaType[] itemTypes = {
+            SimpleMetaType.STRING,
+            SimpleMetaType.LONG_PRIMITIVE,
+            SimpleMetaType.STRING
+      };
+      MSG_TYPE = new ImmutableCompositeMetaType("javax.jms.Message", "JMS Message",
+            itemNames, itemDescriptions, itemTypes);
+      TYPE = new CollectionMetaType("java.util.List", MSG_TYPE);
+   }
+
+   @Override
+   public MetaValue createMetaValue(MetaType metaType, List<Message> object)
+   {
+      ArrayList<MetaValue> tmp = new ArrayList<MetaValue>();
+      if(object != null)
+      {
+         for(Message m : object)
+         {
+            try
+            {
+               CompositeValueSupport cvs = new CompositeValueSupport(MSG_TYPE);
+               cvs.set("JMSCorrelationID", SimpleValueSupport.wrap(m.getJMSCorrelationID()));
+               cvs.set("JMSTimestamp", SimpleValueSupport.wrap(m.getJMSTimestamp()));
+               cvs.set("JMSMessageID", SimpleValueSupport.wrap(m.getJMSMessageID()));
+               tmp.add(cvs);
+            }
+            catch(Exception e)
+            {
+               log.warn("Skipping msg: "+m, e);
+            }
+         }
+      }
+      MetaValue[] elements = new MetaValue[tmp.size()];
+      tmp.toArray(elements);
+      CollectionValueSupport msgs = new CollectionValueSupport(TYPE, elements);
+      return msgs;
+   }
+
+   @Override
+   public MetaType getMetaType()
+   {
+      return TYPE;
+   }
+
+   @Override
+   public Type mapToType()
+   {
+      return List.class;
+   }
+
+   /**
+    * This always returns null as Messages cannot be created from a meta value
+    */
+   @Override
+   public List<Message> unwrapMetaValue(MetaValue metaValue)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+}

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/TopicConfigurationMO.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/TopicConfigurationMO.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/TopicConfigurationMO.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,55 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat 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.as.integration.hornetq.management.jms;
+
+import org.hornetq.jms.server.config.TopicConfiguration;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+
+/**
+ * The topic configuration {@code ManagedObject} template.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject( componentType = @ManagementComponent(type = "JMSDestination", subtype = "Topic"),
+      properties = ManagementProperties.EXPLICIT)
+public interface TopicConfigurationMO extends TopicConfiguration  
+{
+
+   @ManagementProperty(name = "name",
+         use = ViewUse.CONFIGURATION,
+         description = "The topic name")
+   @ManagementObjectID(type = "Topic")
+   public String getName();
+   
+   @ManagementProperty(name = "bindings", 
+         use = ViewUse.CONFIGURATION,
+         description = "The topic bindings")
+   public String[] getBindings();
+   
+}
+

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/TopicControlMO.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/TopicControlMO.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/management/jms/TopicControlMO.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat 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.as.integration.hornetq.management.jms;
+
+import org.hornetq.api.jms.management.TopicControl;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+
+/**
+ * The topic control {@code ManagedObject} template.
+ * 
+ * All properties should have {@code ViewUse.STATISTIC} since they are only
+ * fetched during runtime using the {@code HornetQControlRuntimeDispatchPlugin}.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at ManagementObject(isRuntime = true, properties = ManagementProperties.EXPLICIT)
+// TODO more management properties (use = ViewUse.STATISTIC) and operations
+public interface TopicControlMO extends TopicControl
+{
+
+   @ManagementProperty(name = "name",
+         use = ViewUse.CONFIGURATION,
+         description = "The topic name")
+   @ManagementObjectID(type = "Topic")
+   // Name has to match TopicConfigurationMO.getName(); The actual objectName is irrelevant
+   public String getName();
+ 
+   @ManagementOperation
+   public void dropAllSubscriptions() throws Exception;
+   
+   
+}
+

Modified: branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/hornetq-deployers-jboss-beans.xml
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/hornetq-deployers-jboss-beans.xml	2010-02-23 09:19:35 UTC (rev 101324)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/resources/hornetq-deployers-jboss-beans.xml	2010-02-23 12:36:03 UTC (rev 101325)
@@ -15,11 +15,12 @@
    
    <bean name="HornetQCoreConfigRealDeployer" class="org.jboss.as.integration.hornetq.deployers.HornetQCoreConfigRealDeployer"/>
 
-   <bean name="HornetQJMSParserDeployer" class="org.jboss.as.integration.hornetq.deployers.HornetQJMSParserDeployer"/>
+   <bean name="HornetQJMSParserDeployer" class="org.jboss.as.integration.hornetq.deployers.HornetQJMSParserDeployer">
+      <property name="mgtObjectCreator"><inject bean="HornetQManagedObjectCreator" /></property>
+   </bean>
    
    <bean name="HornetQJMSRealDeployer" class="org.jboss.as.integration.hornetq.deployers.HornetQJMSRealDeployer"/>
 
-
    <!-- Destination creator for HornetQ
         This gets "automagically" injected into CreateDestinationDeployer Bean at ejb-deployer-jboss.xml through incallback and uncallback
     -->
@@ -38,4 +39,8 @@
       </property>
    </bean>
 
+	<bean name="HornetQManagedObjectCreator" class="org.jboss.as.integration.hornetq.management.HornetQManagedObjectCreator">
+		<constructor><parameter><inject bean="ManagedObjectFactory" /></parameter></constructor>
+	</bean>
+
 </deployment>
\ No newline at end of file

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/hornetq/integration/test/AbstractManagementTestBase.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/hornetq/integration/test/AbstractManagementTestBase.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/hornetq/integration/test/AbstractManagementTestBase.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,84 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat 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.test.hornetq.integration.test;
+
+import org.jboss.as.integration.hornetq.management.jms.JMSConfigurationICF;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.ManagedObjectFactoryBuilder;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metatype.api.types.MetaTypeFactory;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.plugins.types.MetaTypeFactoryBuilder;
+import org.jboss.metatype.plugins.values.MetaValueFactoryBuilder;
+import org.jboss.test.BaseTestCase;
+
+/**
+ * The abstract management object unit test base.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractManagementTestBase extends BaseTestCase
+{
+
+   /** The managed object factory. */
+   private static final ManagedObjectFactory mof = ManagedObjectFactoryBuilder.create();
+   
+   /** The meta type factory. */
+   private static final MetaTypeFactory typeFactory = MetaTypeFactoryBuilder.create(); 
+   
+   /** The meta value factory. */
+   private static final MetaValueFactory valueFactory = MetaValueFactoryBuilder.create();
+   
+   static
+   {
+      mof.addInstanceClassFactory(new JMSConfigurationICF(mof));
+   }
+   
+   public AbstractManagementTestBase(String name)
+   {
+      super(name);
+   }
+   
+   public ManagedObjectFactory getMof()
+   {
+      return mof;
+   }
+   
+   public MetaTypeFactory getTypefactory()
+   {
+      return typeFactory;
+   }
+   
+   public MetaValueFactory getValuefactory()
+   {
+      return valueFactory;
+   }
+   
+   ManagedObject initManagedObject(Object instance, Class<?> instanceType, MetaData metaData)
+   {
+      return getMof().initManagedObject(instance, instanceType, metaData, null, null);
+   }
+   
+}
+

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/hornetq/integration/test/BasicJMSConfigurationMOUnitTestCase.java
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/hornetq/integration/test/BasicJMSConfigurationMOUnitTestCase.java	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/java/org/jboss/test/hornetq/integration/test/BasicJMSConfigurationMOUnitTestCase.java	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,166 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat 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.test.hornetq.integration.test;
+
+import java.util.Collections;
+
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.JMSConfiguration;
+import org.hornetq.jms.server.config.JMSQueueConfiguration;
+import org.hornetq.jms.server.config.TopicConfiguration;
+import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
+import org.hornetq.jms.server.config.impl.JMSConfigurationImpl;
+import org.hornetq.jms.server.config.impl.JMSQueueConfigurationImpl;
+import org.hornetq.jms.server.config.impl.TopicConfigurationImpl;
+import org.jboss.as.integration.hornetq.management.jms.JMSConfigurationMO;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge;
+import org.jboss.metatype.api.values.CollectionValue;
+import org.jboss.metatype.api.values.GenericValue;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+
+/**
+ * Basic test case for the {@code JMSConfiguration} managed object.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicJMSConfigurationMOUnitTestCase extends AbstractManagementTestBase
+{
+
+   /** The jms configuration meta data. */
+   private static final MetaData configurationMetaData;
+   
+   static
+   {
+      AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(JMSConfigurationMO.class);
+      configurationMetaData = new MetaDataRetrievalToMetaDataBridge(loader);      
+   }
+   
+   public BasicJMSConfigurationMOUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testJMSConfiguration()
+   {
+      ManagedObject mo = initJMSConfigurationMO();
+      
+      ManagedProperty queues = mo.getProperty("queue-configurations");
+      assertNotNull(queues);
+      assertTrue(queues.getMetaType().isCollection());
+
+      ManagedProperty topics = mo.getProperty("topic-configurations");
+      assertNotNull(topics);
+      assertTrue(topics.getMetaType().isCollection());
+      
+      ManagedProperty factories = mo.getProperty("connection-factory-configurations");
+      assertNotNull(factories);
+      assertTrue(factories.getMetaType().isCollection());
+      
+   }
+   
+   public void testConnectionFactories()
+   {
+      ManagedObject mo = initJMSConfigurationMO();
+
+      // Get the nested connection factory 
+      ManagedObject cf = getNestedManagedObject(mo.getProperty("connection-factory-configurations"));
+      assertNotNull(cf.getProperty("name"));
+      assertEquals("cf1", ((SimpleValue)cf.getProperty("name").getValue()).getValue());
+      assertTrue(cf.getParent() == mo);
+   }
+   
+   public void testQueue()
+   {
+      ManagedObject mo = initJMSConfigurationMO();
+
+      // Get the nested queue 
+      ManagedObject queue = getNestedManagedObject(mo.getProperty("queue-configurations"));
+      assertNotNull(queue.getProperty("name"));
+      assertEquals("queue1", ((SimpleValue)queue.getProperty("name").getValue()).getValue());
+      
+      assertTrue(queue.getParent() == mo);
+   }
+   
+   public void testTopic()
+   {
+      ManagedObject mo = initJMSConfigurationMO();
+
+      // Get the nested topic 
+      ManagedObject topic = getNestedManagedObject(mo.getProperty("topic-configurations"));
+      assertNotNull(topic.getProperty("name"));
+      assertEquals("topic1", ((SimpleValue)topic.getProperty("name").getValue()).getValue());
+      assertTrue(topic.getParent() == mo);
+   }
+ 
+   ManagedObject initJMSConfigurationMO()
+   {
+      JMSConfiguration configuration = createTestMetaData();
+      ManagedObject mo = initManagedObject(configuration, JMSConfiguration.class, configurationMetaData);
+      assertNotNull(mo);
+      return mo;
+   }
+   
+   ManagedObject getNestedManagedObject(ManagedProperty property)
+   {
+      MetaValue value = property.getValue();
+      assertNotNull(property.getName(), value);
+      return getNestedManagedObject(value);
+   }
+   
+   ManagedObject getNestedManagedObject(MetaValue value)
+   {
+      assertTrue(value.getMetaType().isCollection());
+      GenericValue generic = GenericValue.class.cast(((CollectionValue)value).getElements()[0]);
+      return ManagedObject.class.cast(generic.getValue());
+   }
+   
+   JMSConfiguration createTestMetaData()
+   {
+      return new JMSConfigurationImpl(
+            Collections.singletonList(createConnectionFactoryMetaData()),
+            Collections.singletonList(createQueueMetaData()),
+            Collections.singletonList(createTopicConfiguration()));
+   }
+   
+   JMSQueueConfiguration createQueueMetaData()
+   {
+      return new JMSQueueConfigurationImpl("queue1", "selector", true, "binding1");
+   }
+   
+   TopicConfiguration createTopicConfiguration()
+   {
+      return new TopicConfigurationImpl("topic1", "binding1");
+   }
+   
+   ConnectionFactoryConfiguration createConnectionFactoryMetaData()
+   {
+      return new ConnectionFactoryConfigurationImpl("cf1", "binding1");
+   }
+   
+}
+

Added: branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/resources/log4j.properties
===================================================================
--- branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/resources/log4j.properties	                        (rev 0)
+++ branches/Branch_Hornet_Temporary_2/hornetq-int/src/test/resources/log4j.properties	2010-02-23 12:36:03 UTC (rev 101325)
@@ -0,0 +1,17 @@
+### ====================================================================== ###
+##                                                                          ##
+##  JBoss Bootstrap Log4j Configuration                                     ##
+##                                                                          ##
+### ====================================================================== ###
+
+### $Id: log4j.properties 71868 2008-04-10 02:14:32Z scott.stark at jboss.org $ ###
+
+log4j.rootCategory=DEBUG, CONSOLE
+log4j.org.jboss.util=TRACE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=DEBUG
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
+log4j.appender.CONSOLE.org.jboss.xb.binding.parser.sax=INFO




More information about the jboss-cvs-commits mailing list