[jboss-cvs] JBoss Messaging SVN: r4743 - in branches/Branch_JBMESSAGING-1303: src/main/org/jboss/messaging/core/management and 12 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 29 09:25:21 EDT 2008
Author: jmesnil
Date: 2008-07-29 09:25:21 -0400 (Tue, 29 Jul 2008)
New Revision: 4743
Added:
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/ManagementService.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementService.java
branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementServiceImplTest.java
Removed:
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/ManagementRegistration.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementRegistrationImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementRegistration.java
branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementRegistrationImplTest.java
Modified:
branches/Branch_JBMESSAGING-1303/src/config/jbm-beans.xml
branches/Branch_JBMESSAGING-1303/src/config/jbm-standalone-beans.xml
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/StorageManager.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/PostOffice.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/MessagingServer.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java
branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/performance/persistence/fakes/FakePostOffice.java
branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/MessagingServerControlTest.java
branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/server/impl/MessagingServerImplTest.java
Log:
JBMESSAGING-1303: Revisit management interfaces
* renamed ManagementRegistration to ManagementService and inject it into MessagingServerImpl using JBoss Microcontainer
Modified: branches/Branch_JBMESSAGING-1303/src/config/jbm-beans.xml
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/config/jbm-beans.xml 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/config/jbm-beans.xml 2008-07-29 13:25:21 UTC (rev 4743)
@@ -49,6 +49,9 @@
<property name="securityManager">
<inject bean="JBMSecurityManager"/>
</property>
+ <property name="managementService">
+ <inject bean="ManagementService"/>
+ </property>
</bean>
<bean name="StorageManager" class="org.jboss.messaging.core.persistence.impl.journal.JournalStorageManager">
@@ -108,5 +111,18 @@
</parameter>
</constructor>
</bean>
+
+ <bean name="ManagementService" class="org.jboss.messaging.core.management.impl.ManagementServiceImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="MBeanServer" class="javax.management.MBeanServer">
+ <constructor factoryClass="java.lang.management.ManagementFactory"
+ factoryMethod="getPlatformMBeanServer"/>
+ </bean>
</deployment>
\ No newline at end of file
Modified: branches/Branch_JBMESSAGING-1303/src/config/jbm-standalone-beans.xml
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/config/jbm-standalone-beans.xml 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/config/jbm-standalone-beans.xml 2008-07-29 13:25:21 UTC (rev 4743)
@@ -67,6 +67,9 @@
</property>
<property name="securityManager">
<inject bean="JBMSecurityManager"/>
+ </property>
+ <property name="managementService">
+ <inject bean="ManagementService"/>
</property>
</bean>
@@ -128,4 +131,17 @@
</constructor>
</bean>
+ <bean name="ManagementService" class="org.jboss.messaging.core.management.impl.ManagementServiceImpl">
+ <constructor>
+ <parameter>
+ <inject bean="MBeanServer"/>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="MBeanServer" class="javax.management.MBeanServer">
+ <constructor factoryClass="java.lang.management.ManagementFactory"
+ factoryMethod="getPlatformMBeanServer"/>
+ </bean>
+
</deployment>
\ No newline at end of file
Deleted: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/ManagementRegistration.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/ManagementRegistration.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/ManagementRegistration.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -1,59 +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.messaging.core.management;
-
-import org.jboss.messaging.core.persistence.StorageManager;
-import org.jboss.messaging.core.postoffice.PostOffice;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.core.settings.impl.QueueSettings;
-import org.jboss.messaging.util.SimpleString;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public interface ManagementRegistration
-{
- void setPostOffice(PostOffice postOffice);
-
- void setQueueSettingsRepository(
- HierarchicalRepository<QueueSettings> queueSettingsRepository);
-
- void registerServer(MessagingServerManagement server)
- throws Exception;
-
- void unregisterServer() throws Exception;
-
- void registerAddress(String address) throws Exception;
-
- void unregisterAddress(String address) throws Exception;
-
- void registerQueue(Queue queue, SimpleString address, StorageManager storageManager)
- throws Exception;
-
- void unregisterQueue(SimpleString name, SimpleString address)
- throws Exception;
-}
Copied: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/ManagementService.java (from rev 4726, branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/ManagementRegistration.java)
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/ManagementService.java (rev 0)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/ManagementService.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -0,0 +1,59 @@
+/*
+ * 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.messaging.core.management;
+
+import org.jboss.messaging.core.persistence.StorageManager;
+import org.jboss.messaging.core.postoffice.PostOffice;
+import org.jboss.messaging.core.server.Queue;
+import org.jboss.messaging.core.settings.HierarchicalRepository;
+import org.jboss.messaging.core.settings.impl.QueueSettings;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public interface ManagementService
+{
+ void setPostOffice(PostOffice postOffice);
+
+ void setQueueSettingsRepository(
+ HierarchicalRepository<QueueSettings> queueSettingsRepository);
+
+ void registerServer(MessagingServerManagement server)
+ throws Exception;
+
+ void unregisterServer() throws Exception;
+
+ void registerAddress(String address) throws Exception;
+
+ void unregisterAddress(String address) throws Exception;
+
+ void registerQueue(Queue queue, SimpleString address, StorageManager storageManager)
+ throws Exception;
+
+ void unregisterQueue(SimpleString name, SimpleString address)
+ throws Exception;
+}
Property changes on: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/ManagementService.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementRegistrationImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementRegistrationImpl.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementRegistrationImpl.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -1,185 +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.messaging.core.management.impl;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.management.AddressControlMBean;
-import org.jboss.messaging.core.management.ManagementRegistration;
-import org.jboss.messaging.core.management.MessagingServerManagement;
-import org.jboss.messaging.core.management.QueueControlMBean;
-import org.jboss.messaging.core.persistence.StorageManager;
-import org.jboss.messaging.core.postoffice.PostOffice;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.core.settings.impl.QueueSettings;
-import org.jboss.messaging.util.SimpleString;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class ManagementRegistrationImpl implements ManagementRegistration
-{
- // Constants -----------------------------------------------------
-
- private static final Logger log = Logger
- .getLogger(ManagementRegistrationImpl.class);
- public static final String DOMAIN = "org.jboss.messaging";
-
- // Attributes ----------------------------------------------------
-
- private final MBeanServer mbeanServer;
- private MessagingServerManagement server;
- private PostOffice postOffice;
- private HierarchicalRepository<QueueSettings> queueSettingsRepository;
-
- // Static --------------------------------------------------------
-
- public static ObjectName getMessagingServerObjectName() throws Exception
- {
- return ObjectName.getInstance(DOMAIN + ":module=Core,type=Server");
- }
-
- public static ObjectName getAddressObjectName(String address)
- throws Exception
- {
- return ObjectName.getInstance(String.format(
- "%s:module=Core,type=Address,name=%s", DOMAIN, address));
- }
-
- public static ObjectName getQueueObjectName(SimpleString address,
- SimpleString name) throws Exception
- {
- return ObjectName.getInstance(String.format(
- "%s:module=Core,type=Queue,address=%s,name=%s", DOMAIN, address,
- name));
- }
-
- // Constructors --------------------------------------------------
-
- public ManagementRegistrationImpl(MBeanServer mbeanServer)
- {
- this.mbeanServer = mbeanServer;
- }
-
- // Public --------------------------------------------------------
-
- // ManagementRegistration implementation -------------------------
-
- public void setPostOffice(PostOffice postOffice)
- {
- this.postOffice = postOffice;
- }
-
- public void setQueueSettingsRepository(
- HierarchicalRepository<QueueSettings> queueSettingsRepository)
- {
- this.queueSettingsRepository = queueSettingsRepository;
- }
-
- public void registerServer(MessagingServerManagement server)
- throws Exception
- {
- ObjectName objectName = getMessagingServerObjectName();
- if (mbeanServer.isRegistered(objectName))
- {
- log.warn("Core server" + objectName
- + " is already registered. Unregister it");
- mbeanServer.unregisterMBean(objectName);
- this.server = null;
- }
- MessagingServerControl managedServer = new MessagingServerControl(server,
- server.getConfiguration());
- mbeanServer.registerMBean(managedServer, objectName);
- this.server = server;
- log.info("registered core server under " + objectName);
- }
-
- public void unregisterServer() throws Exception
- {
- ObjectName objectName = getMessagingServerObjectName();
- if (mbeanServer.isRegistered(objectName))
- {
- mbeanServer.unregisterMBean(getMessagingServerObjectName());
- }
- }
-
- public void registerAddress(String address) throws Exception
- {
- ObjectName objectName = getAddressObjectName(address);
- if (mbeanServer.isRegistered(objectName))
- {
- log.warn("address " + objectName
- + " is already registered. Unregister it");
- mbeanServer.unregisterMBean(objectName);
- }
- AddressControlMBean addressControl = new AddressControl(address, server);
- mbeanServer.registerMBean(addressControl, objectName);
- if (log.isDebugEnabled())
- {
- log.debug("registered address " + objectName);
- }
- }
-
- public void unregisterAddress(String address) throws Exception
- {
- mbeanServer.unregisterMBean(getAddressObjectName(address));
- }
-
- public void registerQueue(Queue queue, SimpleString address,
- StorageManager storageManager) throws Exception
- {
- ObjectName objectName = getQueueObjectName(address, queue.getName());
- if (mbeanServer.isRegistered(objectName))
- {
- log.warn("queue " + objectName
- + " is already registered. Unregister it");
- mbeanServer.unregisterMBean(objectName);
- }
- QueueControlMBean queueControl = new QueueControl(queue, storageManager, postOffice, queueSettingsRepository);
- mbeanServer.registerMBean(queueControl, objectName);
- if (log.isDebugEnabled())
- {
- log.debug("registered queue " + objectName);
- }
- }
-
- public void unregisterQueue(SimpleString name, SimpleString address)
- throws Exception
- {
- mbeanServer.unregisterMBean(getQueueObjectName(address, name));
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java (from rev 4726, branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementRegistrationImpl.java)
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java (rev 0)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -0,0 +1,193 @@
+/*
+ * 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.messaging.core.management.impl;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.management.AddressControlMBean;
+import org.jboss.messaging.core.management.ManagementService;
+import org.jboss.messaging.core.management.MessagingServerManagement;
+import org.jboss.messaging.core.management.QueueControlMBean;
+import org.jboss.messaging.core.persistence.StorageManager;
+import org.jboss.messaging.core.postoffice.PostOffice;
+import org.jboss.messaging.core.server.Queue;
+import org.jboss.messaging.core.settings.HierarchicalRepository;
+import org.jboss.messaging.core.settings.impl.QueueSettings;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class ManagementServiceImpl implements ManagementService
+{
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger
+ .getLogger(ManagementServiceImpl.class);
+ public static final String DOMAIN = "org.jboss.messaging";
+
+ // Attributes ----------------------------------------------------
+
+ private final MBeanServer mbeanServer;
+ private MessagingServerManagement server;
+ private PostOffice postOffice;
+ private HierarchicalRepository<QueueSettings> queueSettingsRepository;
+
+ // Static --------------------------------------------------------
+
+ public static ObjectName getMessagingServerObjectName() throws Exception
+ {
+ return ObjectName.getInstance(DOMAIN + ":module=Core,type=Server");
+ }
+
+ public static ObjectName getAddressObjectName(String address)
+ throws Exception
+ {
+ return ObjectName.getInstance(String.format(
+ "%s:module=Core,type=Address,name=%s", DOMAIN, address));
+ }
+
+ public static ObjectName getQueueObjectName(SimpleString address,
+ SimpleString name) throws Exception
+ {
+ return ObjectName.getInstance(String.format(
+ "%s:module=Core,type=Queue,address=%s,name=%s", DOMAIN, address,
+ name));
+ }
+
+ // Constructors --------------------------------------------------
+
+ public ManagementServiceImpl(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ // Public --------------------------------------------------------
+
+ // ManagementRegistration implementation -------------------------
+
+ public void setPostOffice(PostOffice postOffice)
+ {
+ this.postOffice = postOffice;
+ }
+
+ public void setQueueSettingsRepository(
+ HierarchicalRepository<QueueSettings> queueSettingsRepository)
+ {
+ this.queueSettingsRepository = queueSettingsRepository;
+ }
+
+ public void registerServer(MessagingServerManagement server)
+ throws Exception
+ {
+ ObjectName objectName = getMessagingServerObjectName();
+ if (mbeanServer.isRegistered(objectName))
+ {
+ log.warn("Core server" + objectName
+ + " is already registered. Unregister it");
+ mbeanServer.unregisterMBean(objectName);
+ this.server = null;
+ }
+ MessagingServerControl managedServer = new MessagingServerControl(server,
+ server.getConfiguration());
+ mbeanServer.registerMBean(managedServer, objectName);
+ this.server = server;
+ log.info("registered core server under " + objectName);
+ }
+
+ public void unregisterServer() throws Exception
+ {
+ ObjectName objectName = getMessagingServerObjectName();
+ if (mbeanServer.isRegistered(objectName))
+ {
+ mbeanServer.unregisterMBean(getMessagingServerObjectName());
+ }
+ }
+
+ public void registerAddress(String address) throws Exception
+ {
+ ObjectName objectName = getAddressObjectName(address);
+ if (mbeanServer.isRegistered(objectName))
+ {
+ log.warn("address " + objectName
+ + " is already registered. Unregister it");
+ mbeanServer.unregisterMBean(objectName);
+ }
+ AddressControlMBean addressControl = new AddressControl(address, server);
+ mbeanServer.registerMBean(addressControl, objectName);
+ if (log.isDebugEnabled())
+ {
+ log.debug("registered address " + objectName);
+ }
+ }
+
+ public void unregisterAddress(String address) throws Exception
+ {
+ ObjectName objectName = getAddressObjectName(address);
+ if (mbeanServer.isRegistered(objectName))
+ {
+ mbeanServer.unregisterMBean(objectName);
+ }
+ }
+
+ public void registerQueue(Queue queue, SimpleString address,
+ StorageManager storageManager) throws Exception
+ {
+ ObjectName objectName = getQueueObjectName(address, queue.getName());
+ if (mbeanServer.isRegistered(objectName))
+ {
+ log.warn("queue " + objectName
+ + " is already registered. Unregister it");
+ mbeanServer.unregisterMBean(objectName);
+ }
+ QueueControlMBean queueControl = new QueueControl(queue, storageManager, postOffice, queueSettingsRepository);
+ mbeanServer.registerMBean(queueControl, objectName);
+ if (log.isDebugEnabled())
+ {
+ log.debug("registered queue " + objectName);
+ }
+ }
+
+ public void unregisterQueue(SimpleString name, SimpleString address)
+ throws Exception
+ {
+ ObjectName objectName = getQueueObjectName(address, name);
+ if (mbeanServer.isRegistered(objectName))
+ {
+ mbeanServer.unregisterMBean(objectName);
+ }
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Property changes on: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementRegistration.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementRegistration.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementRegistration.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -1,101 +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.messaging.core.management.impl;
-
-import org.jboss.messaging.core.management.ManagementRegistration;
-import org.jboss.messaging.core.management.MessagingServerManagement;
-import org.jboss.messaging.core.persistence.StorageManager;
-import org.jboss.messaging.core.postoffice.PostOffice;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.core.settings.impl.QueueSettings;
-import org.jboss.messaging.util.SimpleString;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class NullManagementRegistration implements ManagementRegistration
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public NullManagementRegistration()
- {
- }
-
- // Public --------------------------------------------------------
-
- // ManagementRegistration implementation -------------------------
-
- public void setPostOffice(PostOffice postOffice)
- {
- }
-
- public void setQueueSettingsRepository(
- HierarchicalRepository<QueueSettings> queueSettingsRepository)
- {
- }
-
- public void registerServer(MessagingServerManagement server)
- throws Exception
- {
- }
-
- public void unregisterServer() throws Exception
- {
- }
-
- public void registerAddress(String address) throws Exception
- {
- }
-
- public void unregisterAddress(String address) throws Exception
- {
- }
-
- public void registerQueue(Queue queue, SimpleString address,
- StorageManager storageManager) throws Exception
- {
- }
-
- public void unregisterQueue(SimpleString name, SimpleString address)
- throws Exception
- {
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementService.java (from rev 4727, branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementRegistration.java)
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementService.java (rev 0)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementService.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -0,0 +1,101 @@
+/*
+ * 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.messaging.core.management.impl;
+
+import org.jboss.messaging.core.management.ManagementService;
+import org.jboss.messaging.core.management.MessagingServerManagement;
+import org.jboss.messaging.core.persistence.StorageManager;
+import org.jboss.messaging.core.postoffice.PostOffice;
+import org.jboss.messaging.core.server.Queue;
+import org.jboss.messaging.core.settings.HierarchicalRepository;
+import org.jboss.messaging.core.settings.impl.QueueSettings;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class NullManagementService implements ManagementService
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public NullManagementService()
+ {
+ }
+
+ // Public --------------------------------------------------------
+
+ // ManagementRegistration implementation -------------------------
+
+ public void setPostOffice(PostOffice postOffice)
+ {
+ }
+
+ public void setQueueSettingsRepository(
+ HierarchicalRepository<QueueSettings> queueSettingsRepository)
+ {
+ }
+
+ public void registerServer(MessagingServerManagement server)
+ throws Exception
+ {
+ }
+
+ public void unregisterServer() throws Exception
+ {
+ }
+
+ public void registerAddress(String address) throws Exception
+ {
+ }
+
+ public void unregisterAddress(String address) throws Exception
+ {
+ }
+
+ public void registerQueue(Queue queue, SimpleString address,
+ StorageManager storageManager) throws Exception
+ {
+ }
+
+ public void unregisterQueue(SimpleString name, SimpleString address)
+ throws Exception
+ {
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Property changes on: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementService.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/StorageManager.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/StorageManager.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/StorageManager.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -25,7 +25,7 @@
import java.util.List;
import java.util.Map;
-import org.jboss.messaging.core.management.ManagementRegistration;
+import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.server.MessageReference;
@@ -92,6 +92,6 @@
void loadBindings(QueueFactory queueFactory, List<Binding> bindings,
List<SimpleString> destinations) throws Exception;
- void setManagementRegistration(ManagementRegistration registration);
+ void setManagementService(ManagementService managementService);
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -47,8 +47,8 @@
import org.jboss.messaging.core.journal.impl.JournalImpl;
import org.jboss.messaging.core.journal.impl.NIOSequentialFileFactory;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.management.ManagementRegistration;
-import org.jboss.messaging.core.management.impl.NullManagementRegistration;
+import org.jboss.messaging.core.management.ManagementService;
+import org.jboss.messaging.core.management.impl.NullManagementService;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.postoffice.PostOffice;
@@ -112,7 +112,7 @@
private volatile boolean started;
- private ManagementRegistration managementRegistration = new NullManagementRegistration();
+ private ManagementService managementService = new NullManagementService();
public JournalStorageManager(final Configuration config)
{
@@ -528,7 +528,7 @@
Binding binding = new BindingImpl(address, queue);
- managementRegistration.registerQueue(queue, address, this);
+ managementService.registerQueue(queue, address, this);
bindings.add(binding);
}
@@ -555,9 +555,9 @@
bindingIDSequence.set(maxID + 1);
}
- public void setManagementRegistration(ManagementRegistration registration)
+ public void setManagementService(ManagementService managementService)
{
- this.managementRegistration = registration;
+ this.managementService = managementService;
}
// MessagingComponent implementation ------------------------------------------------------
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/nullpm/NullStorageManager.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -26,7 +26,7 @@
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
-import org.jboss.messaging.core.management.ManagementRegistration;
+import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.postoffice.PostOffice;
@@ -157,7 +157,7 @@
return started;
}
- public void setManagementRegistration(ManagementRegistration registration)
+ public void setManagementService(ManagementService managementService)
{
}
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/PostOffice.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/PostOffice.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/PostOffice.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -27,7 +27,7 @@
import java.util.Set;
import org.jboss.messaging.core.filter.Filter;
-import org.jboss.messaging.core.management.ManagementRegistration;
+import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.server.MessageReference;
import org.jboss.messaging.core.server.MessagingComponent;
import org.jboss.messaging.core.server.ServerMessage;
@@ -82,5 +82,5 @@
Set<SimpleString> listAllDestinations();
- void setManagementRegistration(ManagementRegistration registration);
+ void setManagementService(ManagementService managementService);
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -36,8 +36,8 @@
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.management.ManagementRegistration;
-import org.jboss.messaging.core.management.impl.NullManagementRegistration;
+import org.jboss.messaging.core.management.ManagementService;
+import org.jboss.messaging.core.management.impl.NullManagementService;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.postoffice.FlowController;
@@ -77,7 +77,7 @@
private volatile boolean started;
- private ManagementRegistration managementRegistration = new NullManagementRegistration();
+ private ManagementService managementService = new NullManagementService();
public PostOfficeImpl(final StorageManager storageManager,
final QueueFactory queueFactory, final boolean checkAllowable)
@@ -128,7 +128,7 @@
}
flowControllers.put(address, new FlowControllerImpl(address, this));
- managementRegistration.registerAddress(address.toString());
+ managementService.registerAddress(address.toString());
}
return added;
@@ -146,7 +146,7 @@
{
storageManager.deleteDestination(address);
}
- managementRegistration.unregisterAddress(address.toString());
+ managementService.unregisterAddress(address.toString());
}
return removed;
@@ -186,7 +186,7 @@
storageManager.deleteBinding(binding);
}
- managementRegistration.unregisterQueue(queueName, binding.getAddress());
+ managementService.unregisterQueue(queueName, binding.getAddress());
return binding;
}
@@ -277,9 +277,9 @@
return flowControllers.get(address);
}
- public void setManagementRegistration(ManagementRegistration registration)
+ public void setManagementService(ManagementService managementService)
{
- this.managementRegistration = registration;
+ this.managementService = managementService;
}
// Private -----------------------------------------------------------------
@@ -293,7 +293,7 @@
try
{
- managementRegistration.registerQueue(queue, address, storageManager);
+ managementService.registerQueue(queue, address, storageManager);
} catch (Exception e)
{
e.printStackTrace();
@@ -314,7 +314,7 @@
bindings = prevBindings;
} else
{
- managementRegistration.registerAddress(binding.getAddress().toString());
+ managementService.registerAddress(binding.getAddress().toString());
}
bindings.add(binding);
@@ -363,7 +363,7 @@
{
mappings.remove(binding.getAddress());
- managementRegistration.unregisterAddress(binding.getAddress().toString());
+ managementService.unregisterAddress(binding.getAddress().toString());
binding.getQueue().setFlowController(null);
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/MessagingServer.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/MessagingServer.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/MessagingServer.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -25,6 +25,7 @@
import java.util.Set;
import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.management.MessagingServerManagement;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.remoting.PacketReturner;
@@ -62,10 +63,14 @@
StorageManager getStorageManager();
- public JBMSecurityManager getSecurityManager();
+ JBMSecurityManager getSecurityManager();
void setSecurityManager(JBMSecurityManager securityManager);
+ void setManagementService(ManagementService managementService);
+
+ ManagementService getManagementService();
+
Version getVersion();
CreateConnectionResponse createConnection(String username, String password,
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -22,18 +22,29 @@
package org.jboss.messaging.core.server.impl;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
+
import org.jboss.messaging.core.client.RemotingSessionListener;
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.management.ManagementRegistration;
+import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.management.MessagingServerManagement;
-import org.jboss.messaging.core.management.impl.ManagementRegistrationImpl;
import org.jboss.messaging.core.management.impl.MessagingServerManagementImpl;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.postoffice.impl.PostOfficeImpl;
-import org.jboss.messaging.core.remoting.*;
+import org.jboss.messaging.core.remoting.ConnectorRegistryFactory;
+import org.jboss.messaging.core.remoting.Interceptor;
+import org.jboss.messaging.core.remoting.PacketDispatcher;
+import org.jboss.messaging.core.remoting.PacketReturner;
+import org.jboss.messaging.core.remoting.RemotingService;
import org.jboss.messaging.core.remoting.impl.wireformat.CreateConnectionResponse;
import org.jboss.messaging.core.security.JBMSecurityManager;
import org.jboss.messaging.core.security.Role;
@@ -53,12 +64,7 @@
import org.jboss.messaging.util.OrderedExecutorFactory;
import org.jboss.messaging.util.VersionLoader;
-import java.lang.management.ManagementFactory;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.*;
-
/**
* The messaging server implementation
*
@@ -97,7 +103,6 @@
private ResourceManager resourceManager;
private MessagingServerPacketHandler serverPacketHandler;
private MessagingServerManagement serverManagement;
- private ManagementRegistration managementRegistration;
private PacketDispatcher dispatcher;
// plugins
@@ -106,6 +111,7 @@
private RemotingService remotingService;
private JBMSecurityManager securityManager;
private Configuration configuration;
+ private ManagementService managementService;
// Constructors ---------------------------------------------------------------------------------
@@ -114,7 +120,6 @@
//We need to hard code the version information into a source file
version = VersionLoader.load();
- managementRegistration = new ManagementRegistrationImpl(ManagementFactory.getPlatformMBeanServer());
}
// lifecycle methods ----------------------------------------------------------------
@@ -128,7 +133,7 @@
/*
The following components are pluggable on the messaging server:
- Configuration, StorageManager, RemotingService and SecurityManager
+ Configuration, StorageManager, RemotingService, SecurityManager and ManagementRegistration
They must already be injected by the time the messaging server starts
It's up to the user to make sure the pluggable components are started - their
lifecycle will not be controlled here
@@ -144,7 +149,7 @@
{
throw new IllegalStateException("Must inject StorageManager before starting MessagingServer");
}
- storageManager.setManagementRegistration(managementRegistration);
+ storageManager.setManagementService(managementService);
if (remotingService == null)
{
@@ -156,6 +161,11 @@
throw new IllegalStateException("Must inject SecurityManager before starting MessagingServer");
}
+ if (managementService == null)
+ {
+ throw new IllegalStateException("Must inject ManagementRegistration before starting MessagingServer");
+ }
+
if (!storageManager.isStarted())
{
throw new IllegalStateException("StorageManager must be started before MessagingServer is started");
@@ -173,12 +183,12 @@
this.connectionManager = cm;
this.sessionListener = cm;
queueSettingsRepository.setDefault(new QueueSettings());
- managementRegistration.setQueueSettingsRepository(queueSettingsRepository);
+ managementService.setQueueSettingsRepository(queueSettingsRepository);
scheduledExecutor = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(), new JBMThreadFactory("JBM-scheduled-threads"));
queueFactory = new QueueFactoryImpl(scheduledExecutor, queueSettingsRepository);
postOffice = new PostOfficeImpl(storageManager, queueFactory, configuration.isRequireDestinations());
- postOffice.setManagementRegistration(managementRegistration);
- managementRegistration.setPostOffice(postOffice);
+ postOffice.setManagementService(managementService);
+ managementService.setPostOffice(postOffice);
threadPool = Executors.newFixedThreadPool(configuration.getThreadPoolMaxSize(), new JBMThreadFactory("JBM-session-threads"));
executorFactory = new OrderedExecutorFactory(threadPool);
securityRepository = new HierarchicalObjectRepository<Set<Role>>();
@@ -192,7 +202,7 @@
serverManagement = new MessagingServerManagementImpl(postOffice, storageManager, configuration,
connectionManager, securityRepository,
queueSettingsRepository, this);
- managementRegistration.registerServer(serverManagement);
+ managementService.registerServer(serverManagement);
postOffice.start();
serverPacketHandler = new MessagingServerPacketHandler(this);
@@ -224,7 +234,7 @@
dispatcher.unregister(serverPacketHandler.getID());
remotingService.removeRemotingSessionListener(sessionListener);
- managementRegistration.unregisterServer();
+ managementService.unregisterServer();
securityStore = null;
connectionManager = null;
@@ -309,6 +319,20 @@
return securityManager;
}
+ public void setManagementService(ManagementService managementService)
+ {
+ if (started)
+ {
+ throw new IllegalStateException("Cannot set management service when started");
+ }
+ this.managementService = managementService;
+ }
+
+ public ManagementService getManagementService()
+ {
+ return managementService;
+ }
+
//This is needed for the security deployer
public HierarchicalRepository<Set<Role>> getSecurityRepository()
{
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -23,6 +23,8 @@
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.management.ManagementService;
+import org.jboss.messaging.core.management.impl.NullManagementService;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.persistence.impl.nullpm.NullStorageManager;
import org.jboss.messaging.core.remoting.RemotingService;
@@ -52,6 +54,8 @@
JBMSecurityManager securityManager = new JBMSecurityManagerImpl(true);
+ ManagementService managementService = new NullManagementService();
+
MessagingServer server = new MessagingServerImpl();
server.setConfiguration(config);
@@ -62,6 +66,8 @@
server.setSecurityManager(securityManager);
+ server.setManagementService(managementService);
+
return new MessagingServiceImpl(server, storageManager, remotingService);
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -28,7 +28,7 @@
import javax.management.ObjectName;
import org.jboss.messaging.core.management.MessagingServerManagement;
-import org.jboss.messaging.core.management.impl.ManagementRegistrationImpl;
+import org.jboss.messaging.core.management.impl.ManagementServiceImpl;
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.JBossTopic;
@@ -55,26 +55,26 @@
public static ObjectName getJMSServerObjectName() throws Exception
{
- return ObjectName.getInstance(ManagementRegistrationImpl.DOMAIN
+ return ObjectName.getInstance(ManagementServiceImpl.DOMAIN
+ ":module=JMS,type=Server");
}
public static ObjectName getJMSQueueObjectName(String name) throws Exception
{
- return ObjectName.getInstance(ManagementRegistrationImpl.DOMAIN
+ return ObjectName.getInstance(ManagementServiceImpl.DOMAIN
+ ":module=JMS,type=Queue,name=" + name.toString());
}
public static ObjectName getJMSTopicObjectName(String name) throws Exception
{
- return ObjectName.getInstance(ManagementRegistrationImpl.DOMAIN
+ return ObjectName.getInstance(ManagementServiceImpl.DOMAIN
+ ":module=JMS,type=Topic,name=" + name.toString());
}
private ObjectName getConnectionFactoryObjectName(String name)
throws Exception
{
- return ObjectName.getInstance(ManagementRegistrationImpl.DOMAIN
+ return ObjectName.getInstance(ManagementServiceImpl.DOMAIN
+ ":module=JMS,type=ConnectionFactory,name=" + name);
}
Modified: branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/performance/persistence/fakes/FakePostOffice.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/performance/persistence/fakes/FakePostOffice.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/performance/persistence/fakes/FakePostOffice.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -28,7 +28,7 @@
import java.util.concurrent.ConcurrentHashMap;
import org.jboss.messaging.core.filter.Filter;
-import org.jboss.messaging.core.management.ManagementRegistration;
+import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.postoffice.FlowController;
import org.jboss.messaging.core.postoffice.PostOffice;
@@ -136,7 +136,7 @@
return null;
}
- public void setManagementRegistration(ManagementRegistration registration)
+ public void setManagementService(ManagementService managementService)
{
}
Deleted: branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementRegistrationImplTest.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementRegistrationImplTest.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementRegistrationImplTest.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -1,106 +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.messaging.tests.unit.core.management.impl;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import junit.framework.TestCase;
-
-import org.jboss.messaging.core.config.Configuration;
-import org.jboss.messaging.core.management.ManagementRegistration;
-import org.jboss.messaging.core.management.MessagingServerControlMBean;
-import org.jboss.messaging.core.management.MessagingServerManagement;
-import org.jboss.messaging.core.management.impl.ManagementRegistrationImpl;
-import org.jboss.messaging.core.management.impl.MessagingServerControl;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class ManagementRegistrationImplTest extends TestCase
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testRegisterMessagingServer() throws Exception
- {
- ObjectName objectName = ManagementRegistrationImpl.getMessagingServerObjectName();
- ObjectInstance objectInstance = new ObjectInstance(objectName, MessagingServerControl.class.getName());
-
- MBeanServer mbeanServer = createMock(MBeanServer.class);
- Configuration configuration = createMock(Configuration.class);
- MessagingServerManagement server = createMock(MessagingServerManagement.class);
- expect(server.getConfiguration()).andReturn(configuration);
- expect(mbeanServer.isRegistered(objectName)).andReturn(false);
- expect(mbeanServer.registerMBean(isA(MessagingServerControlMBean.class), eq(objectName))).andReturn(objectInstance);
-
- replay(mbeanServer, server);
-
- ManagementRegistration registration = new ManagementRegistrationImpl(mbeanServer );
- registration.registerServer(server);
-
- verify(mbeanServer, server);
- }
-
- public void testUnregisterMessagingServer() throws Exception
- {
- ObjectName objectName = ManagementRegistrationImpl.getMessagingServerObjectName();
-
- MBeanServer mbeanServer = createMock(MBeanServer.class);
- expect(mbeanServer.isRegistered(objectName)).andReturn(true);
- mbeanServer.unregisterMBean(objectName);
-
- replay(mbeanServer);
-
- ManagementRegistration registration = new ManagementRegistrationImpl(mbeanServer);
- registration.unregisterServer();
-
- verify(mbeanServer);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
Copied: branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementServiceImplTest.java (from rev 4686, branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementRegistrationImplTest.java)
===================================================================
--- branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementServiceImplTest.java (rev 0)
+++ branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementServiceImplTest.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -0,0 +1,111 @@
+/*
+ * 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.messaging.tests.unit.core.management.impl;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+
+import junit.framework.TestCase;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.management.ManagementService;
+import org.jboss.messaging.core.management.MessagingServerControlMBean;
+import org.jboss.messaging.core.management.MessagingServerManagement;
+import org.jboss.messaging.core.management.impl.ManagementServiceImpl;
+import org.jboss.messaging.core.management.impl.MessagingServerControl;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class ManagementServiceImplTest extends TestCase
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testRegisterMessagingServer() throws Exception
+ {
+ ObjectName objectName = ManagementServiceImpl
+ .getMessagingServerObjectName();
+ ObjectInstance objectInstance = new ObjectInstance(objectName,
+ MessagingServerControl.class.getName());
+
+ MBeanServer mbeanServer = createMock(MBeanServer.class);
+ Configuration configuration = createMock(Configuration.class);
+ MessagingServerManagement server = createMock(MessagingServerManagement.class);
+ expect(server.getConfiguration()).andReturn(configuration);
+ expect(mbeanServer.isRegistered(objectName)).andReturn(false);
+ expect(
+ mbeanServer.registerMBean(isA(MessagingServerControlMBean.class),
+ eq(objectName))).andReturn(objectInstance);
+
+ replay(mbeanServer, server);
+
+ ManagementService service = new ManagementServiceImpl(mbeanServer);
+ service.registerServer(server);
+
+ verify(mbeanServer, server);
+ }
+
+ public void testUnregisterMessagingServer() throws Exception
+ {
+ ObjectName objectName = ManagementServiceImpl
+ .getMessagingServerObjectName();
+
+ MBeanServer mbeanServer = createMock(MBeanServer.class);
+ expect(mbeanServer.isRegistered(objectName)).andReturn(true);
+ mbeanServer.unregisterMBean(objectName);
+
+ replay(mbeanServer);
+
+ ManagementService service = new ManagementServiceImpl(mbeanServer);
+ service.unregisterServer();
+
+ verify(mbeanServer);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Property changes on: branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/ManagementServiceImplTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/MessagingServerControlTest.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/MessagingServerControlTest.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/management/impl/MessagingServerControlTest.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -48,7 +48,7 @@
import org.jboss.messaging.core.client.impl.LocationImpl;
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.management.MessagingServerManagement;
-import org.jboss.messaging.core.management.impl.ManagementRegistrationImpl;
+import org.jboss.messaging.core.management.impl.ManagementServiceImpl;
import org.jboss.messaging.core.management.impl.MessagingServerControl;
import org.jboss.messaging.core.management.impl.MessagingServerControl.NotificationType;
import org.jboss.messaging.core.server.JournalType;
@@ -762,7 +762,7 @@
super.setUp();
mbeanServer = ManagementFactory.getPlatformMBeanServer();
- serverON = ManagementRegistrationImpl.getMessagingServerObjectName();
+ serverON = ManagementServiceImpl.getMessagingServerObjectName();
}
@Override
Modified: branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/server/impl/MessagingServerImplTest.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/server/impl/MessagingServerImplTest.java 2008-07-29 08:04:30 UTC (rev 4742)
+++ branches/Branch_JBMESSAGING-1303/tests/src/org/jboss/messaging/tests/unit/core/server/impl/MessagingServerImplTest.java 2008-07-29 13:25:21 UTC (rev 4743)
@@ -30,8 +30,10 @@
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
-import org.jboss.messaging.core.management.ManagementRegistration;
+import org.jboss.messaging.core.management.ManagementService;
+import org.jboss.messaging.core.management.MessagingServerManagement;
import org.jboss.messaging.core.persistence.StorageManager;
+import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.postoffice.impl.PostOfficeImpl;
import org.jboss.messaging.core.remoting.PacketDispatcher;
import org.jboss.messaging.core.remoting.PacketReturner;
@@ -46,6 +48,7 @@
import org.jboss.messaging.core.server.impl.MessagingServerPacketHandler;
import org.jboss.messaging.core.server.impl.QueueFactoryImpl;
import org.jboss.messaging.core.server.impl.ServerConnectionPacketHandler;
+import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.version.Version;
import org.jboss.messaging.tests.util.UnitTestCase;
import org.jboss.messaging.util.VersionLoader;
@@ -164,11 +167,25 @@
//Ok
}
- EasyMock.reset(sm, rs);
+ ManagementService mr = EasyMock.createMock(ManagementService.class);
+ server.setManagementService(mr);
+
+ try
+ {
+ server.start();
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //Ok
+ }
+
+ EasyMock.reset(sm, rs, mr);
+
EasyMock.expect(sm.isStarted()).andStubReturn(true);
EasyMock.expect(rs.isStarted()).andStubReturn(false);
- sm.setManagementRegistration(EasyMock.isA(ManagementRegistration.class));
+ sm.setManagementService(EasyMock.isA(ManagementService.class));
EasyMock.replay(sm, rs);
@@ -189,7 +206,7 @@
EasyMock.expect(sm.isStarted()).andStubReturn(true);
EasyMock.expect(rs.isStarted()).andStubReturn(true);
rs.addRemotingSessionListener(EasyMock.isA(ConnectionManagerImpl.class));
- sm.setManagementRegistration(EasyMock.isA(ManagementRegistration.class));
+ sm.setManagementService(EasyMock.isA(ManagementService.class));
sm.loadBindings(EasyMock.isA(QueueFactoryImpl.class), EasyMock.isA(ArrayList.class), EasyMock.isA(ArrayList.class));
sm.loadMessages(EasyMock.isA(PostOfficeImpl.class), EasyMock.isA(Map.class));
@@ -292,7 +309,7 @@
EasyMock.expect(sm.isStarted()).andStubReturn(true);
EasyMock.expect(rs.isStarted()).andStubReturn(true);
rs.addRemotingSessionListener(EasyMock.isA(ConnectionManagerImpl.class));
- sm.setManagementRegistration(EasyMock.isA(ManagementRegistration.class));
+ sm.setManagementService(EasyMock.isA(ManagementService.class));
sm.loadBindings(EasyMock.isA(QueueFactoryImpl.class), EasyMock.isA(ArrayList.class), EasyMock.isA(ArrayList.class));
sm.loadMessages(EasyMock.isA(PostOfficeImpl.class), EasyMock.isA(Map.class));
@@ -369,9 +386,15 @@
};
server.setSecurityManager(sem);
+
+ ManagementService mr = EasyMock.createMock(ManagementService.class);
+ mr.setQueueSettingsRepository(EasyMock.isA(HierarchicalRepository.class));
+ mr.setPostOffice(EasyMock.isA(PostOffice.class));
+ mr.registerServer(EasyMock.isA(MessagingServerManagement.class));
+ server.setManagementService(mr);
rs.addRemotingSessionListener(EasyMock.isA(ConnectionManagerImpl.class));
- sm.setManagementRegistration(EasyMock.isA(ManagementRegistration.class));
+ sm.setManagementService(EasyMock.isA(ManagementService.class));
sm.loadBindings(EasyMock.isA(QueueFactoryImpl.class), EasyMock.isA(ArrayList.class), EasyMock.isA(ArrayList.class));
sm.loadMessages(EasyMock.isA(PostOfficeImpl.class), EasyMock.isA(Map.class));
PacketDispatcher pd = EasyMock.createMock(PacketDispatcher.class);
@@ -380,11 +403,11 @@
EasyMock.expect(sm.isStarted()).andStubReturn(true);
EasyMock.expect(rs.isStarted()).andStubReturn(true);
- EasyMock.replay(rs, sm, pd);
+ EasyMock.replay(rs, sm, pd, mr);
server.start();
- EasyMock.verify(rs, sm, pd);
+ EasyMock.verify(rs, sm, pd, mr);
try
@@ -422,11 +445,17 @@
server.setSecurityManager(sem);
+ ManagementService mr = EasyMock.createMock(ManagementService.class);
+ mr.setQueueSettingsRepository(EasyMock.isA(HierarchicalRepository.class));
+ mr.setPostOffice(EasyMock.isA(PostOffice.class));
+ mr.registerServer(EasyMock.isA(MessagingServerManagement.class));
+ server.setManagementService(mr);
+
PacketDispatcher pd = EasyMock.createMock(PacketDispatcher.class);
EasyMock.expect(rs.getDispatcher()).andReturn(pd);
rs.addRemotingSessionListener(EasyMock.isA(ConnectionManagerImpl.class));
- sm.setManagementRegistration(EasyMock.isA(ManagementRegistration.class));
+ sm.setManagementService(EasyMock.isA(ManagementService.class));
sm.loadBindings(EasyMock.isA(QueueFactoryImpl.class), EasyMock.isA(ArrayList.class), EasyMock.isA(ArrayList.class));
sm.loadMessages(EasyMock.isA(PostOfficeImpl.class), EasyMock.isA(Map.class));
More information about the jboss-cvs-commits
mailing list