[jboss-cvs] JBossAS SVN: r81998 - in trunk/messaging: src/etc/deploy/common and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 3 01:46:29 EST 2008


Author: scott.stark at jboss.org
Date: 2008-12-03 01:46:29 -0500 (Wed, 03 Dec 2008)
New Revision: 81998

Added:
   trunk/messaging/src/main/org/jboss/jms/server/destination/DestinationMOBuilder.java
Modified:
   trunk/messaging/build.xml
   trunk/messaging/src/etc/deploy/common/destinations-service.xml
   trunk/messaging/src/etc/deploy/common/messaging-jboss-beans.xml
Log:
JBAS-6225, create a ManagedObjectBuilder for jms destinations

Modified: trunk/messaging/build.xml
===================================================================
--- trunk/messaging/build.xml	2008-12-03 05:45:47 UTC (rev 81997)
+++ trunk/messaging/build.xml	2008-12-03 06:46:29 UTC (rev 81998)
@@ -88,6 +88,7 @@
       <path refid="jboss.server.classpath"/>      
       <path refid="jboss.systemjmx.classpath"/>      
       <path refid="jboss.jboss.man.classpath"/>      
+      <path refid="jboss.jboss.mdr.classpath"/>
       <path refid="jboss.microcontainer.classpath"/>      
       <path refid="jboss.jbosssx.classpath"/>      
       <path refid="jboss.jboss.jaspi.api.classpath"/>      

Modified: trunk/messaging/src/etc/deploy/common/destinations-service.xml
===================================================================
--- trunk/messaging/src/etc/deploy/common/destinations-service.xml	2008-12-03 05:45:47 UTC (rev 81997)
+++ trunk/messaging/src/etc/deploy/common/destinations-service.xml	2008-12-03 06:46:29 UTC (rev 81998)
@@ -15,7 +15,6 @@
    <mbean code="org.jboss.jms.server.destination.QueueService"
       name="jboss.messaging.destination:service=Queue,name=DLQ"
       xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>      
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.messaging:service=PostOffice</depends>
    </mbean>
@@ -27,7 +26,6 @@
    <mbean code="org.jboss.jms.server.destination.QueueService"
       name="jboss.messaging.destination:service=Queue,name=ExpiryQueue"
       xmbean-dd="xmdesc/Queue-xmbean.xml">
-      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>      
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.messaging:service=PostOffice</depends>
    </mbean>   

Modified: trunk/messaging/src/etc/deploy/common/messaging-jboss-beans.xml
===================================================================
--- trunk/messaging/src/etc/deploy/common/messaging-jboss-beans.xml	2008-12-03 05:45:47 UTC (rev 81997)
+++ trunk/messaging/src/etc/deploy/common/messaging-jboss-beans.xml	2008-12-03 06:46:29 UTC (rev 81998)
@@ -56,5 +56,10 @@
          <parameter>A template for JMS topic *-service.xml deployments</parameter>
          <parameter>topic</parameter>
       </constructor>
-   </bean>   
+   </bean>
+
+   <!-- A ManagedObjectBuilder for JMS destinations -->
+   <bean name="DestinationMOBuilder" class="org.jboss.jms.server.destination.DestinationMOBuilder">
+      <property name="factory"><inject bean="ManagedObjectFactory" /></property>
+   </bean>
 </deployment>

Added: trunk/messaging/src/main/org/jboss/jms/server/destination/DestinationMOBuilder.java
===================================================================
--- trunk/messaging/src/main/org/jboss/jms/server/destination/DestinationMOBuilder.java	                        (rev 0)
+++ trunk/messaging/src/main/org/jboss/jms/server/destination/DestinationMOBuilder.java	2008-12-03 06:46:29 UTC (rev 81998)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.server.destination;
+
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.spi.factory.ManagedObjectBuilder;
+import org.jboss.metadata.spi.MetaData;
+
+/**
+ * A ManagedObjectBuilder that maps the QueueService class to the QueueServiceMO
+ * for its ManagedObject skeleton and TopicService to TopicServiceMO
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class DestinationMOBuilder
+   implements ManagedObjectBuilder
+{
+   private static Logger log = Logger.getLogger(DestinationMOBuilder.class);
+   private ManagedObjectFactory factory;
+
+   public DestinationMOBuilder()
+   {
+   }
+
+   public ManagedObjectFactory getFactory()
+   {
+      return factory;
+   }
+   public void setFactory(ManagedObjectFactory factory)
+   {
+      this.factory = factory;
+   }
+
+   /**
+    * Create a ManagedObject from QueueServiceMO and TopicServiceMO for
+    * QueueService and TopicService classes respectively.
+    * @param clazz - the mbean class to create the ManagedObject for
+    * @param metaData - the MDR MetaData view
+    */
+   public ManagedObject buildManagedObject(Class<?> clazz, MetaData metaData)
+   {
+      ManagedObjectFactory mof = getMOFactory();
+      ManagedObject destMO = null;
+      if(QueueService.class.isAssignableFrom(clazz))
+      {
+         log.debug("Creating QueueServiceMO template for: "+clazz);
+         destMO = mof.createManagedObject(QueueServiceMO.class, metaData);
+      }
+      if(TopicService.class.isAssignableFrom(clazz))
+      {
+         log.debug("Creating TopicServiceMO template for: "+clazz);
+         destMO = mof.createManagedObject(TopicServiceMO.class, metaData);
+      }
+      return destMO;
+   }
+
+   public void start()
+   {
+      factory.setBuilder(QueueService.class, this);
+      factory.setBuilder(TopicService.class, this);
+   }
+   public void stop()
+   {
+      factory.setBuilder(QueueService.class, null);
+      factory.setBuilder(TopicService.class, null);
+   }
+
+   protected ManagedObjectFactory getMOFactory()
+   {
+      if (factory == null)
+         factory = ManagedObjectFactory.getInstance();
+
+      return factory;     
+   }
+}




More information about the jboss-cvs-commits mailing list