[jboss-cvs] JBossAS SVN: r90916 - in branches/JBPAPP_5_0/messaging/src: main/org/jboss/jms/server/destination and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jul 7 21:42:01 EDT 2009


Author: scott.stark at jboss.org
Date: 2009-07-07 21:42:01 -0400 (Tue, 07 Jul 2009)
New Revision: 90916

Added:
   branches/JBPAPP_5_0/messaging/src/main/org/jboss/jms/server/destination/LegacyQueueMODefinition.java
   branches/JBPAPP_5_0/messaging/src/main/org/jboss/jms/server/destination/LegacyTopicMODefinition.java
Modified:
   branches/JBPAPP_5_0/messaging/src/etc/deployers/messaging-definitions-jboss-beans.xml
Log:
JBAS-7051, map the legacy org.jboss.mq.server.jmx.* destination classes onto the current jms destination MO interfaces.

Modified: branches/JBPAPP_5_0/messaging/src/etc/deployers/messaging-definitions-jboss-beans.xml
===================================================================
--- branches/JBPAPP_5_0/messaging/src/etc/deployers/messaging-definitions-jboss-beans.xml	2009-07-07 23:13:47 UTC (rev 90915)
+++ branches/JBPAPP_5_0/messaging/src/etc/deployers/messaging-definitions-jboss-beans.xml	2009-07-08 01:42:01 UTC (rev 90916)
@@ -1,23 +1,38 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
-	The messaging profileservice definitions. This beans need to be installed
-	in the deployers phase. 
+	Mappings for jms destinations to managed objects
+	$Id:$
 -->
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
+  <!-- MODefinition for the QueueService class -->
   <bean name="QueueMODefinition" class="org.jboss.jms.server.destination.QueueMODefinition">
     <constructor>
       <parameter><inject bean="ManagedObjectFactory" /></parameter>
     </constructor>
   </bean>
+  <!-- MODefinition for the legacy Queue class -->
+  <bean name="LegacyQueueMODefinition" class="org.jboss.jms.server.destination.LegacyQueueMODefinition">
+    <constructor>
+      <parameter><inject bean="ManagedObjectFactory" /></parameter>
+    </constructor>
+  </bean>
 
+  <!-- MODefinition for the TopicService class -->
   <bean name="TopicMODefinition" class="org.jboss.jms.server.destination.TopicMODefinition">
     <constructor>
       <parameter><inject bean="ManagedObjectFactory" /></parameter>
     </constructor>
   </bean>
+  <!-- MODefinition for the legacy Topic class -->
+  <bean name="LegacyTopicMODefinition" class="org.jboss.jms.server.destination.LegacyTopicMODefinition">
+    <constructor>
+      <parameter><inject bean="ManagedObjectFactory" /></parameter>
+    </constructor>
+  </bean>  
 
+  <!-- MODefinition for the ServerPeer class -->
   <bean name="ServerPeerMODefinition" class="org.jboss.jms.server.ServerPeerMODefinition">
     <constructor>
       <parameter><inject bean="ManagedObjectFactory" /></parameter>

Added: branches/JBPAPP_5_0/messaging/src/main/org/jboss/jms/server/destination/LegacyQueueMODefinition.java
===================================================================
--- branches/JBPAPP_5_0/messaging/src/main/org/jboss/jms/server/destination/LegacyQueueMODefinition.java	                        (rev 0)
+++ branches/JBPAPP_5_0/messaging/src/main/org/jboss/jms/server/destination/LegacyQueueMODefinition.java	2009-07-08 01:42:01 UTC (rev 90916)
@@ -0,0 +1,82 @@
+/*
+ * 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.api.factory.ManagedObjectDefinition;
+import org.jboss.managed.spi.factory.ManagedObjectBuilder;
+import org.jboss.metadata.spi.MetaData;
+
+/**
+ * A ManagedObjectBuilder that maps the Legacy Queue class to the QueueServiceMO
+ * for its ManagedObject skeleton.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class LegacyQueueMODefinition extends ManagedObjectDefinition
+{
+   private static Logger log = Logger.getLogger(QueueMODefinition.class);
+
+   public LegacyQueueMODefinition(ManagedObjectFactory factory)
+   {
+      super(org.jboss.mq.server.jmx.Queue.class, new QueueMOBuilder(factory));
+   }
+
+   private static class QueueMOBuilder implements ManagedObjectBuilder
+   {
+      private ManagedObjectFactory factory;
+
+      private QueueMOBuilder(ManagedObjectFactory factory)
+      {
+         this.factory = factory;
+      }
+
+      /**
+       * Create a ManagedObject from QueueService to QueueServiceMO.
+       *
+       * @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();
+         log.debug("Creating QueueServiceMO template for: " + clazz);
+         return mof.createManagedObject(QueueServiceMO.class, metaData);
+      }
+
+      /**
+       * Get MO factory.
+       *
+       * @return the MO factory
+       */
+      protected ManagedObjectFactory getMOFactory()
+      {
+         if (factory == null)
+            factory = ManagedObjectFactory.getInstance();
+
+         return factory;
+      }
+   }
+}

Added: branches/JBPAPP_5_0/messaging/src/main/org/jboss/jms/server/destination/LegacyTopicMODefinition.java
===================================================================
--- branches/JBPAPP_5_0/messaging/src/main/org/jboss/jms/server/destination/LegacyTopicMODefinition.java	                        (rev 0)
+++ branches/JBPAPP_5_0/messaging/src/main/org/jboss/jms/server/destination/LegacyTopicMODefinition.java	2009-07-08 01:42:01 UTC (rev 90916)
@@ -0,0 +1,82 @@
+/*
+ * 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.api.factory.ManagedObjectDefinition;
+import org.jboss.managed.spi.factory.ManagedObjectBuilder;
+import org.jboss.metadata.spi.MetaData;
+
+/**
+ * A ManagedObjectBuilder that maps the legacy Topic class to TopicServiceMO.
+ * for its ManagedObject skeleton.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class LegacyTopicMODefinition extends ManagedObjectDefinition
+{
+   private static Logger log = Logger.getLogger(TopicMODefinition.class);
+
+   public LegacyTopicMODefinition(ManagedObjectFactory factory)
+   {
+      super(org.jboss.mq.server.jmx.Topic.class, new TopicMOBuilder(factory));
+   }
+
+   private static class TopicMOBuilder implements ManagedObjectBuilder
+   {
+      private ManagedObjectFactory factory;
+
+      private TopicMOBuilder(ManagedObjectFactory factory)
+      {
+         this.factory = factory;
+      }
+
+      /**
+       * Create a ManagedObject from TopicService to TopicServiceMO.
+       *
+       * @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();
+         log.debug("Creating TopicServiceMO template for: " + clazz);
+         return mof.createManagedObject(TopicServiceMO.class, metaData);
+      }
+
+      /**
+       * Get MO factory.
+       *
+       * @return the MO factory
+       */
+      protected ManagedObjectFactory getMOFactory()
+      {
+         if (factory == null)
+            factory = ManagedObjectFactory.getInstance();
+
+         return factory;
+      }
+   }
+}




More information about the jboss-cvs-commits mailing list