[jboss-cvs] JBossAS SVN: r82004 - in trunk/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
Wed Dec 3 04:12:57 EST 2008


Author: alesj
Date: 2008-12-03 04:12:57 -0500 (Wed, 03 Dec 2008)
New Revision: 82004

Added:
   trunk/messaging/src/main/org/jboss/jms/server/destination/QueueMODefinition.java
   trunk/messaging/src/main/org/jboss/jms/server/destination/TopicMODefinition.java
Removed:
   trunk/messaging/src/main/org/jboss/jms/server/destination/DestinationMOBuilder.java
Modified:
   trunk/messaging/src/etc/deploy/common/messaging-jboss-beans.xml
Log:
Make destinations builder more OO.

Modified: trunk/messaging/src/etc/deploy/common/messaging-jboss-beans.xml
===================================================================
--- trunk/messaging/src/etc/deploy/common/messaging-jboss-beans.xml	2008-12-03 09:04:44 UTC (rev 82003)
+++ trunk/messaging/src/etc/deploy/common/messaging-jboss-beans.xml	2008-12-03 09:12:57 UTC (rev 82004)
@@ -58,8 +58,16 @@
       </constructor>
    </bean>
 
-   <!-- A ManagedObjectBuilder for JMS destinations -->
-   <bean name="DestinationMOBuilder" class="org.jboss.jms.server.destination.DestinationMOBuilder">
-      <property name="factory"><inject bean="ManagedObjectFactory" /></property>
-   </bean>
+  <bean name="QueueMODefinition" class="org.jboss.jms.server.destination.QueueMODefinition">
+    <constructor>
+      <parameter><inject bean="ManagedObjectFactory" /></parameter>
+    </constructor>
+  </bean>
+
+  <bean name="TopicMODefinition" class="org.jboss.jms.server.destination.TopicMODefinition">
+    <constructor>
+      <parameter><inject bean="ManagedObjectFactory" /></parameter>
+    </constructor>
+  </bean>
+
 </deployment>

Deleted: trunk/messaging/src/main/org/jboss/jms/server/destination/DestinationMOBuilder.java
===================================================================
--- trunk/messaging/src/main/org/jboss/jms/server/destination/DestinationMOBuilder.java	2008-12-03 09:04:44 UTC (rev 82003)
+++ trunk/messaging/src/main/org/jboss/jms/server/destination/DestinationMOBuilder.java	2008-12-03 09:12:57 UTC (rev 82004)
@@ -1,96 +0,0 @@
-/*
- * 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;     
-   }
-}

Copied: trunk/messaging/src/main/org/jboss/jms/server/destination/QueueMODefinition.java (from rev 81999, trunk/messaging/src/main/org/jboss/jms/server/destination/DestinationMOBuilder.java)
===================================================================
--- trunk/messaging/src/main/org/jboss/jms/server/destination/QueueMODefinition.java	                        (rev 0)
+++ trunk/messaging/src/main/org/jboss/jms/server/destination/QueueMODefinition.java	2008-12-03 09:12:57 UTC (rev 82004)
@@ -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 QueueService 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 QueueMODefinition extends ManagedObjectDefinition
+{
+   private static Logger log = Logger.getLogger(QueueMODefinition.class);
+
+   public QueueMODefinition(ManagedObjectFactory factory)
+   {
+      super(QueueService.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;
+      }
+   }
+}


Property changes on: trunk/messaging/src/main/org/jboss/jms/server/destination/QueueMODefinition.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: trunk/messaging/src/main/org/jboss/jms/server/destination/TopicMODefinition.java
===================================================================
--- trunk/messaging/src/main/org/jboss/jms/server/destination/TopicMODefinition.java	                        (rev 0)
+++ trunk/messaging/src/main/org/jboss/jms/server/destination/TopicMODefinition.java	2008-12-03 09:12:57 UTC (rev 82004)
@@ -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 TopicService 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 TopicMODefinition extends ManagedObjectDefinition
+{
+   private static Logger log = Logger.getLogger(TopicMODefinition.class);
+
+   public TopicMODefinition(ManagedObjectFactory factory)
+   {
+      super(TopicService.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