[jboss-cvs] JBoss Messaging SVN: r5531 - in trunk: src/main/org/jboss/messaging/core/client/impl and 18 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Dec 15 08:06:09 EST 2008
Author: jmesnil
Date: 2008-12-15 08:06:08 -0500 (Mon, 15 Dec 2008)
New Revision: 5531
Added:
trunk/src/main/org/jboss/messaging/core/management/AcceptorControlMBean.java
trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupControlMBean.java
trunk/src/main/org/jboss/messaging/core/management/DiscoveryGroupControlMBean.java
trunk/src/main/org/jboss/messaging/core/management/MessageFlowControlMBean.java
trunk/src/main/org/jboss/messaging/core/management/MessagingComponentControlMBean.java
trunk/src/main/org/jboss/messaging/core/management/impl/AcceptorControl.java
trunk/src/main/org/jboss/messaging/core/management/impl/BroadcastGroupControl.java
trunk/src/main/org/jboss/messaging/core/management/impl/DiscoveryGroupControl.java
trunk/src/main/org/jboss/messaging/core/management/impl/MessageFlowControl.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/MessageFlowControlTest.java
Removed:
trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupConfigurationInfo.java
trunk/src/main/org/jboss/messaging/core/management/DiscoveryGroupConfigurationInfo.java
trunk/src/main/org/jboss/messaging/core/management/MessageFlowConfigurationInfo.java
Modified:
trunk/src/config/jbm-beans.xml
trunk/src/config/jbm-standalone-beans.xml
trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java
trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java
trunk/src/main/org/jboss/messaging/core/config/TransportConfiguration.java
trunk/src/main/org/jboss/messaging/core/management/ManagementService.java
trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java
trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java
trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java
trunk/src/main/org/jboss/messaging/core/remoting/RemotingService.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java
trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java
trunk/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java
trunk/src/main/org/jboss/messaging/core/remoting/spi/Connector.java
trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java
trunk/src/main/org/jboss/messaging/core/server/cluster/MessageFlow.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/MessageFlowImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java
trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java
trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java
trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java
trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/DiscoveryTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java
Log:
exposed clustering resources (message flows, broadcast groups, discovery groups) as MBean
Modified: trunk/src/config/jbm-beans.xml
===================================================================
--- trunk/src/config/jbm-beans.xml 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/config/jbm-beans.xml 2008-12-15 13:06:08 UTC (rev 5531)
@@ -59,7 +59,10 @@
<parameter>
<inject bean="Configuration"/>
</parameter>
- </constructor>
+ <property name="managementService">
+ <inject bean="ManagementService"/>
+ </property>
+ </constructor>
</bean>
<bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
Modified: trunk/src/config/jbm-standalone-beans.xml
===================================================================
--- trunk/src/config/jbm-standalone-beans.xml 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/config/jbm-standalone-beans.xml 2008-12-15 13:06:08 UTC (rev 5531)
@@ -76,6 +76,9 @@
<inject bean="Configuration"/>
</parameter>
</constructor>
+ <property name="managementService">
+ <inject bean="ManagementService"/>
+ </property>
</bean>
<bean name="JMSServerManager" class="org.jboss.messaging.jms.server.impl.JMSServerManagerImpl">
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionFactoryImpl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -21,13 +21,13 @@
import org.jboss.messaging.core.client.ClientSession;
import org.jboss.messaging.core.client.ConnectionLoadBalancingPolicy;
+import org.jboss.messaging.core.cluster.DiscoveryGroup;
import org.jboss.messaging.core.cluster.DiscoveryListener;
+import org.jboss.messaging.core.cluster.impl.DiscoveryGroupImpl;
import org.jboss.messaging.core.config.TransportConfiguration;
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.cluster.DiscoveryGroup;
-import org.jboss.messaging.core.cluster.impl.DiscoveryGroupImpl;
import org.jboss.messaging.util.Pair;
/**
@@ -171,7 +171,7 @@
{
InetAddress groupAddress = InetAddress.getByName(discoveryGroupName);
- discoveryGroup = new DiscoveryGroupImpl(groupAddress, discoveryGroupPort, discoveryRefreshTimeout);
+ discoveryGroup = new DiscoveryGroupImpl(discoveryGroupName, groupAddress, discoveryGroupPort, discoveryRefreshTimeout);
discoveryGroup.registerListener(this);
@@ -229,7 +229,7 @@
{
InetAddress groupAddress = InetAddress.getByName(discoveryGroupName);
- discoveryGroup = new DiscoveryGroupImpl(groupAddress, discoveryGroupPort, discoveryRefreshTimeout);
+ discoveryGroup = new DiscoveryGroupImpl(discoveryGroupName, groupAddress, discoveryGroupPort, discoveryRefreshTimeout);
discoveryGroup.registerListener(this);
Modified: trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -26,6 +26,7 @@
import java.util.List;
import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.server.MessagingComponent;
import org.jboss.messaging.util.Pair;
/**
@@ -37,11 +38,9 @@
*
*
*/
-public interface DiscoveryGroup
+public interface DiscoveryGroup extends MessagingComponent
{
- void start() throws Exception;
-
- void stop() throws Exception;
+ String getName();
List<Pair<TransportConfiguration, TransportConfiguration>> getConnectors();
Modified: trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -58,6 +58,8 @@
private final List<DiscoveryListener> listeners = new ArrayList<DiscoveryListener>();
+ private final String name;
+
private final Thread thread;
private boolean received;
@@ -70,8 +72,10 @@
private volatile boolean started;
- public DiscoveryGroupImpl(final InetAddress groupAddress, final int groupPort, final long timeout) throws Exception
- {
+ public DiscoveryGroupImpl(final String name, final InetAddress groupAddress, final int groupPort, final long timeout) throws Exception
+ {
+ this.name = name;
+
socket = new MulticastSocket(groupPort);
socket.joinGroup(groupAddress);
@@ -124,6 +128,11 @@
{
return started;
}
+
+ public String getName()
+ {
+ return name;
+ }
public synchronized List<Pair<TransportConfiguration, TransportConfiguration>> getConnectors()
{
Modified: trunk/src/main/org/jboss/messaging/core/config/TransportConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/TransportConfiguration.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/config/TransportConfiguration.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -23,6 +23,7 @@
import java.io.Serializable;
import java.util.Map;
+import java.util.UUID;
/**
* A TransportConfiguration
@@ -51,12 +52,12 @@
public TransportConfiguration(final String className, final Map<String, Object> params)
{
- this(className, params, null);
+ this(className, params, UUID.randomUUID().toString());
}
public TransportConfiguration(final String className)
{
- this(className, null, null);
+ this(className, null, UUID.randomUUID().toString());
}
public String getName()
Added: trunk/src/main/org/jboss/messaging/core/management/AcceptorControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/AcceptorControlMBean.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/AcceptorControlMBean.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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 javax.management.openmbean.TabularData;
+
+/**
+ * A AcceptorMBean
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public interface AcceptorControlMBean extends MessagingComponentControlMBean
+{
+ String getName();
+
+ String getFactoryClassName();
+
+ TabularData getParameters();
+}
Deleted: trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupConfigurationInfo.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupConfigurationInfo.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupConfigurationInfo.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -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;
-
-import static javax.management.openmbean.SimpleType.INTEGER;
-import static javax.management.openmbean.SimpleType.LONG;
-import static javax.management.openmbean.SimpleType.STRING;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.TabularType;
-
-import org.jboss.messaging.core.config.cluster.BroadcastGroupConfiguration;
-import org.jboss.messaging.util.Pair;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class BroadcastGroupConfigurationInfo
-{
- // Constants -----------------------------------------------------
-
- public static final CompositeType TYPE;
-
- private static final String MESSAGE_TYPE_NAME = "BroadcastGroupConfigurationInfo";
-
- private static final String MESSAGE_TABULAR_TYPE_NAME = "BroadcastGroupConfigurationTabularInfo";
-
- private static final String[] ITEM_NAMES = new String[] { "name",
- "localBindAddress",
- "localBindPort",
- "groupAddress",
- "groupPort",
- "broadcastPeriod",
- "connectorInfos" };
-
- private static final String[] ITEM_DESCRIPTIONS = new String[] { "Name of the broadcast group",
- "Address of local bind",
- "port of local bind",
- "Address of the broadcast group",
- "Port of the broadcast group",
- "Period of broadcast",
- "Name of the connectors" };
-
- private static final OpenType[] TYPES;
-
- private static final TabularType TABULAR_TYPE;
-
- static
- {
- try
- {
- TYPES = new OpenType[] { STRING, STRING, INTEGER, STRING, INTEGER, LONG, PairsInfo.TABULAR_TYPE };
- TYPE = new CompositeType(MESSAGE_TYPE_NAME,
- "Information for a BroadcastGroupConfigurationInfo",
- ITEM_NAMES,
- ITEM_DESCRIPTIONS,
- TYPES);
- TABULAR_TYPE = new TabularType(MESSAGE_TABULAR_TYPE_NAME,
- "Information for tabular BroadcastGroupConfigurationInfo",
- TYPE,
- new String[] { "name" });
- }
- catch (OpenDataException e)
- {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- // Attributes ----------------------------------------------------
-
- private final BroadcastGroupConfiguration config;
-
- // Static --------------------------------------------------------
-
- public static TabularData toTabularData(final Collection<BroadcastGroupConfiguration> configs) throws OpenDataException
- {
- TabularData data = new TabularDataSupport(TABULAR_TYPE);
- for (BroadcastGroupConfiguration config : configs)
- {
- data.put(new BroadcastGroupConfigurationInfo(config).toCompositeData());
- }
- return data;
- }
-
- public static BroadcastGroupConfiguration[] from(TabularData msgs)
- {
- Collection values = msgs.values();
- List<BroadcastGroupConfiguration> infos = new ArrayList<BroadcastGroupConfiguration>();
- for (Object object : values)
- {
- CompositeData compositeData = (CompositeData)object;
- String name = (String)compositeData.get("name");
- String localBindAddress = (String)compositeData.get("localBindAddress");
- int localBindPort = (Integer)compositeData.get("localBindPort");
- String groupAddress = (String)compositeData.get("groupAddress");
- int groupPort = (Integer)compositeData.get("groupPort");
- long broadcastPeriod = (Long)compositeData.get("broadcastPeriod");
-
- TabularData connectorData = (TabularData)compositeData.get("connectorInfos");
- List<Pair<String, String>> connectorInfos = PairsInfo.from(connectorData);
- if (connectorInfos.size() == 0)
- {
- connectorInfos = null;
- }
-
- infos.add(new BroadcastGroupConfiguration(name,
- localBindAddress,
- localBindPort,
- groupAddress,
- groupPort,
- broadcastPeriod,
- connectorInfos));
- }
-
- return (BroadcastGroupConfiguration[])infos.toArray(new BroadcastGroupConfiguration[infos.size()]);
- }
-
- // Constructors --------------------------------------------------
-
- public BroadcastGroupConfigurationInfo(final BroadcastGroupConfiguration config)
- {
- this.config = config;
- }
-
- // Public --------------------------------------------------------
-
- public CompositeData toCompositeData()
- {
- try
- {
- return new CompositeDataSupport(TYPE, ITEM_NAMES, new Object[] { config.getName(),
- config.getLocalBindAddress(),
- config.getLocalBindPort(),
- config.getGroupAddress(),
- config.getGroupPort(),
- config.getBroadcastPeriod(),
- PairsInfo.toTabularData(config.getConnectorInfos()) });
- }
- catch (OpenDataException e)
- {
- e.printStackTrace();
- return null;
- }
- }
-
- @Override
- public String toString()
- {
- return "BroadcastGroupConfigurationInfo[config=" + config.toString() + "]";
- }
-}
Added: trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupControlMBean.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupControlMBean.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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 javax.management.openmbean.TabularData;
+
+/**
+ * A DiscoveryGroupControlMBean
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public interface BroadcastGroupControlMBean extends MessagingComponentControlMBean
+{
+ String getName();
+
+ String getLocalBindAddress();
+
+ int getLocalBindPort();
+
+ String getGroupAddress();
+
+ int getGroupPort();
+
+ long getBroadcastPeriod();
+
+ TabularData getConnectorInfos();
+}
Deleted: trunk/src/main/org/jboss/messaging/core/management/DiscoveryGroupConfigurationInfo.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/DiscoveryGroupConfigurationInfo.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/management/DiscoveryGroupConfigurationInfo.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -1,157 +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 static javax.management.openmbean.SimpleType.INTEGER;
-import static javax.management.openmbean.SimpleType.LONG;
-import static javax.management.openmbean.SimpleType.STRING;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.TabularType;
-
-import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class DiscoveryGroupConfigurationInfo
-{
- // Constants -----------------------------------------------------
-
- public static final CompositeType TYPE;
-
- private static final String MESSAGE_TYPE_NAME = "DiscoveryGroupConfigurationInfo";
-
- private static final String MESSAGE_TABULAR_TYPE_NAME = "DiscoveryGroupConfigurationTabularInfo";
-
- private static final String[] ITEM_NAMES = new String[] { "name", "groupAddress", "groupPort", "refreshTimeout" };
-
- private static final String[] ITEM_DESCRIPTIONS = new String[] { "Name of the discovery group",
- "Address of the discovery group",
- "Port of the discovery group",
- "Timeout to refresh" };
-
- private static final OpenType[] TYPES;
-
- private static final TabularType TABULAR_TYPE;
-
- static
- {
- try
- {
- TYPES = new OpenType[] { STRING, STRING, INTEGER, LONG };
- TYPE = new CompositeType(MESSAGE_TYPE_NAME,
- "Information for a DiscoveryGroupConfiguration",
- ITEM_NAMES,
- ITEM_DESCRIPTIONS,
- TYPES);
- TABULAR_TYPE = new TabularType(MESSAGE_TABULAR_TYPE_NAME,
- "Information for tabular DiscoveryGroupConfiguration",
- TYPE,
- new String[] { "name" });
- }
- catch (OpenDataException e)
- {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- // Attributes ----------------------------------------------------
-
- private final DiscoveryGroupConfiguration config;
-
- // Static --------------------------------------------------------
-
- public static TabularData toTabularData(final Collection<DiscoveryGroupConfiguration> configs) throws OpenDataException
- {
- TabularData data = new TabularDataSupport(TABULAR_TYPE);
- for (DiscoveryGroupConfiguration config : configs)
- {
- data.put(new DiscoveryGroupConfigurationInfo(config).toCompositeData());
- }
- return data;
- }
-
- public static DiscoveryGroupConfiguration[] from(TabularData msgs)
- {
- Collection values = msgs.values();
- List<DiscoveryGroupConfiguration> infos = new ArrayList<DiscoveryGroupConfiguration>();
- for (Object object : values)
- {
- CompositeData compositeData = (CompositeData)object;
- String name = (String)compositeData.get("name");
- String groupAddress = (String)compositeData.get("groupAddress");
- int groupPort = (Integer)compositeData.get("groupPort");
- long refreshTimeout = (Long)compositeData.get("refreshTimeout");
-
- infos.add(new DiscoveryGroupConfiguration(name, groupAddress, groupPort, refreshTimeout));
- }
-
- return (DiscoveryGroupConfiguration[])infos.toArray(new DiscoveryGroupConfiguration[infos.size()]);
- }
-
- // Constructors --------------------------------------------------
-
- public DiscoveryGroupConfigurationInfo(final DiscoveryGroupConfiguration config)
- {
- this.config = config;
- }
-
- // Public --------------------------------------------------------
-
- public CompositeData toCompositeData()
- {
- try
- {
- return new CompositeDataSupport(TYPE, ITEM_NAMES, new Object[] { config.getName(),
- config.getGroupAddress(),
- config.getGroupPort(),
- config.getRefreshTimeout() });
- }
- catch (OpenDataException e)
- {
- e.printStackTrace();
- return null;
- }
- }
-
- @Override
- public String toString()
- {
- return "DiscoveryGroupConfiguration[config=" + config.toString() + "]";
- }
-}
Added: trunk/src/main/org/jboss/messaging/core/management/DiscoveryGroupControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/DiscoveryGroupControlMBean.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/DiscoveryGroupControlMBean.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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;
+
+/**
+ * A DiscoveryGroupControlMBean
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public interface DiscoveryGroupControlMBean extends MessagingComponentControlMBean
+{
+ String getName();
+
+ String getGroupAddress();
+
+ int getGroupPort();
+
+ long getRefreshTimeout();
+}
Modified: trunk/src/main/org/jboss/messaging/core/management/ManagementService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/ManagementService.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/management/ManagementService.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -27,16 +27,23 @@
import javax.management.ObjectName;
import org.jboss.messaging.core.client.management.impl.ManagementHelper;
+import org.jboss.messaging.core.cluster.DiscoveryGroup;
import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.cluster.BroadcastGroupConfiguration;
+import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
+import org.jboss.messaging.core.config.cluster.MessageFlowConfiguration;
import org.jboss.messaging.core.message.Message;
import org.jboss.messaging.core.messagecounter.MessageCounterManager;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.remoting.RemotingService;
+import org.jboss.messaging.core.remoting.spi.Acceptor;
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.server.cluster.ClusterManager;
+import org.jboss.messaging.core.server.cluster.BroadcastGroup;
+import org.jboss.messaging.core.server.cluster.MessageFlow;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.QueueSettings;
import org.jboss.messaging.core.transaction.ResourceManager;
@@ -76,6 +83,22 @@
void unregisterQueue(SimpleString name, SimpleString address) throws Exception;
+ void registerAcceptor(Acceptor acceptor, TransportConfiguration configuration) throws Exception;
+
+ void unregisterAcceptor(String name) throws Exception;
+
+ void registerBroadcastGroup(BroadcastGroup broadcastGroup, BroadcastGroupConfiguration configuration) throws Exception;
+
+ void unregisterBroadcastGroup(String name) throws Exception;
+
+ void registerDiscoveryGroup(DiscoveryGroup discoveryGroup, DiscoveryGroupConfiguration configuration) throws Exception;
+
+ void unregisterDiscoveryGroup(String name) throws Exception;
+
+ void registerMessageFlow(MessageFlow messageFlow, MessageFlowConfiguration configuration) throws Exception;
+
+ void unregisterMessageFlow(String name) throws Exception;
+
void registerResource(ObjectName objectName, Object resource) throws Exception;
void unregisterResource(ObjectName objectName) throws Exception;
Deleted: trunk/src/main/org/jboss/messaging/core/management/MessageFlowConfigurationInfo.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/MessageFlowConfigurationInfo.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/management/MessageFlowConfigurationInfo.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -1,256 +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 static javax.management.openmbean.SimpleType.BOOLEAN;
-import static javax.management.openmbean.SimpleType.DOUBLE;
-import static javax.management.openmbean.SimpleType.INTEGER;
-import static javax.management.openmbean.SimpleType.LONG;
-import static javax.management.openmbean.SimpleType.STRING;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.TabularType;
-
-import org.jboss.messaging.core.config.cluster.MessageFlowConfiguration;
-import org.jboss.messaging.util.Pair;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- *
- */
-public class MessageFlowConfigurationInfo
-{
- // Constants -----------------------------------------------------
-
- public static final CompositeType TYPE;
-
- private static final String MESSAGE_TYPE_NAME = "MessageFlowConfigurationInfo";
-
- private static final String MESSAGE_TABULAR_TYPE_NAME = "MessageFlowConfigurationTabularInfo";
-
- private static final String[] ITEM_NAMES = new String[] { "name",
- "address",
- "filter",
- "fanout",
- "maxBatchSize",
- "maxBatchTime",
- "transformerClassName",
- "retryInterval",
- "retryIntervalMultiplier",
- "maxRetriesBeforeFailover",
- "maxRetriesAfterFailover",
- "useDuplicateDetection",
- "discoveryGroupName",
- "staticConnectorNamePairs" };
-
- private static final String[] ITEM_DESCRIPTIONS = new String[] { "Name",
- "Address",
- "Filter",
- "Does the flow fanout messages?",
- "Maximum size of a batch",
- "Maximum time before sending a batch",
- "Name of the Transformer class",
- "Interval to retry",
- "Multiplier of the interval to retry",
- "Maximum number of retries before a failover",
- "Maximum number of retries after a failover",
- "Use duplicate detection?",
- "Name of the discovery group",
- "Static pairs of connectors" };
-
- private static final OpenType[] TYPES;
-
- private static final TabularType TABULAR_TYPE;
-
- static
- {
- try
- {
- TYPES = new OpenType[] { STRING,
- STRING,
- STRING,
- BOOLEAN,
- INTEGER,
- LONG,
- STRING,
- LONG,
- DOUBLE,
- INTEGER,
- INTEGER,
- BOOLEAN,
- STRING,
- PairsInfo.TABULAR_TYPE };
- TYPE = new CompositeType(MESSAGE_TYPE_NAME,
- "Information for a MessageFlowConfiguration",
- ITEM_NAMES,
- ITEM_DESCRIPTIONS,
- TYPES);
- TABULAR_TYPE = new TabularType(MESSAGE_TABULAR_TYPE_NAME,
- "Information for tabular MessageFlowConfiguration",
- TYPE,
- new String[] { "name" });
- }
- catch (OpenDataException e)
- {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- // Attributes ----------------------------------------------------
-
- private MessageFlowConfiguration config;
-
- // Static --------------------------------------------------------
-
- public static TabularData toTabularData(final Collection<MessageFlowConfiguration> configs) throws OpenDataException
- {
- TabularData data = new TabularDataSupport(TABULAR_TYPE);
-
- for (MessageFlowConfiguration config : configs)
- {
- data.put(new MessageFlowConfigurationInfo(config).toCompositeData());
- }
- return data;
- }
-
- public static MessageFlowConfiguration[] from(TabularData msgs)
- {
- Collection values = msgs.values();
- List<MessageFlowConfiguration> infos = new ArrayList<MessageFlowConfiguration>();
- for (Object object : values)
- {
- CompositeData compositeData = (CompositeData)object;
- String name = (String)compositeData.get("name");
- String address = (String)compositeData.get("address");
- String filter = (String)compositeData.get("filter");
- boolean fanout = (Boolean)compositeData.get("fanout");
- int maxBatchSize = (Integer)compositeData.get("maxBatchSize");
- long maxBatchTime = (Long)compositeData.get("maxBatchTime");
- String transformerClassName = (String)compositeData.get("transformerClassName");
- long retryInterval = (Long)compositeData.get("retryInterval");
- double retryIntervalMultiplier = (Double)compositeData.get("retryIntervalMultiplier");
- int maxRetriesBeforeFailover = (Integer)compositeData.get("maxRetriesBeforeFailover");
- int maxRetriesAfterFailover = (Integer)compositeData.get("maxRetriesAfterFailover");
- boolean useDuplicateDetection = (Boolean)compositeData.get("useDuplicateDetection");
- String discoveryGroupName = (String)compositeData.get("discoveryGroupName");
-
- TabularData connectorData = (TabularData)compositeData.get("staticConnectorNamePairs");
- List<Pair<String, String>> connectorInfos = PairsInfo.from(connectorData);
- if (connectorInfos.size() == 0)
- {
- connectorInfos = null;
- }
-
- if (connectorInfos == null)
- {
- infos.add(new MessageFlowConfiguration(name,
- address,
- filter,
- fanout,
- maxBatchSize,
- maxBatchTime,
- transformerClassName,
- retryInterval,
- retryIntervalMultiplier,
- maxRetriesBeforeFailover,
- maxRetriesAfterFailover,
- useDuplicateDetection,
- discoveryGroupName));
- }
- else
- {
- infos.add(new MessageFlowConfiguration(name,
- address,
- filter,
- fanout,
- maxBatchSize,
- maxBatchTime,
- transformerClassName,
- retryInterval,
- retryIntervalMultiplier,
- maxRetriesBeforeFailover,
- maxRetriesAfterFailover,
- useDuplicateDetection,
- connectorInfos));
- }
- }
-
- return (MessageFlowConfiguration[])infos.toArray(new MessageFlowConfiguration[infos.size()]);
- }
-
- // Constructors --------------------------------------------------
-
- public MessageFlowConfigurationInfo(MessageFlowConfiguration config)
- {
- this.config = config;
- }
-
- // Public --------------------------------------------------------
-
- public CompositeData toCompositeData()
- {
- try
- {
- return new CompositeDataSupport(TYPE,
- ITEM_NAMES,
- new Object[] { config.getName(),
- config.getAddress(),
- config.getFilterString(),
- config.isFanout(),
- config.getMaxBatchSize(),
- config.getMaxBatchTime(),
- config.getTransformerClassName(),
- config.getRetryInterval(),
- config.getRetryIntervalMultiplier(),
- config.getMaxRetriesBeforeFailover(),
- config.getMaxRetriesAfterFailover(),
- config.isUseDuplicateDetection(),
- config.getDiscoveryGroupName(),
- PairsInfo.toTabularData(config.getConnectorNamePairs()) });
- }
- catch (OpenDataException e)
- {
- e.printStackTrace();
- return null;
- }
- }
-
- @Override
- public String toString()
- {
- return "MessageInfo[config=" + config.toString() + "]";
- }
-}
Added: trunk/src/main/org/jboss/messaging/core/management/MessageFlowControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/MessageFlowControlMBean.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/MessageFlowControlMBean.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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 javax.management.openmbean.TabularData;
+
+/**
+ * A AcceptorMBean
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public interface MessageFlowControlMBean
+{
+ boolean isStarted();
+
+ String getName();
+
+ void start() throws Exception;
+
+ void stop() throws Exception;
+
+ String getAddress();
+
+ String getFilterString();
+
+ boolean isFanout();
+
+ int getMaxBatchSize();
+
+ long getMaxBatchTime();
+
+ String getTransformerClassName();
+
+ TabularData getConnectorNamePairs();
+
+ String getDiscoveryGroupName();
+
+ long getRetryInterval();
+
+ double getRetryIntervalMultiplier();
+
+ int getMaxRetriesBeforeFailover();
+
+ int getMaxRetriesAfterFailover();
+
+ boolean isUseDuplicateDetection();
+}
Added: trunk/src/main/org/jboss/messaging/core/management/MessagingComponentControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/MessagingComponentControlMBean.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/MessagingComponentControlMBean.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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;
+
+/**
+ * A MessagingComponentControlMBean
+ *
+ * @author jmesnil
+ *
+ * Created 15 dc. 2008 11:31:28
+ *
+ *
+ */
+public interface MessagingComponentControlMBean
+{
+ boolean isStarted();
+
+ void start() throws Exception;
+
+ void stop() throws Exception;
+}
Modified: trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/management/MessagingServerControlMBean.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -41,8 +41,6 @@
public Map<String, Object> getBackupConnectorConfiguration();
- public Map<String, Map<String, Object>> getAcceptorConfigurations();
-
String getVersion();
int getConnectionCount();
@@ -168,13 +166,5 @@
@Operation(desc = "List the sessions for the given connectionID", impact = INFO)
String[] listSessions(@Parameter(desc = "a connection ID", name = "connectionID") String connectionID);
- TabularData getMessageFlows() throws Exception;
-
- TabularData getDiscoveryGroups() throws Exception;
-
- TabularData getBroadcastGroups() throws Exception;
-
- TabularData getAcceptors() throws Exception;
-
TabularData getConnectors() throws Exception;
}
Added: trunk/src/main/org/jboss/messaging/core/management/impl/AcceptorControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/AcceptorControl.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/AcceptorControl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.openmbean.TabularData;
+
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.management.AcceptorControlMBean;
+import org.jboss.messaging.core.management.PropertiesInfo;
+import org.jboss.messaging.core.remoting.spi.Acceptor;
+
+/**
+ * A AcceptorControl
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dc. 2008 17:09:04
+ */
+public class AcceptorControl implements AcceptorControlMBean
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final Acceptor acceptor;
+
+ private final TransportConfiguration configuration;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public AcceptorControl(final Acceptor acceptor, final TransportConfiguration configuration)
+ {
+ this.acceptor = acceptor;
+ this.configuration = configuration;
+ }
+
+ // AcceptorControlMBean implementation ---------------------------
+
+ public String getFactoryClassName()
+ {
+ return configuration.getFactoryClassName();
+ }
+
+ public String getName()
+ {
+ return configuration.getName();
+ }
+
+ public TabularData getParameters()
+ {
+ return PropertiesInfo.toTabularData(configuration.getParams());
+ }
+
+ public boolean isStarted()
+ {
+ return acceptor.isStarted();
+ }
+
+ public void start() throws Exception
+ {
+ acceptor.start();
+ }
+
+ public void stop() throws Exception
+ {
+ acceptor.stop();
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/src/main/org/jboss/messaging/core/management/impl/BroadcastGroupControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/BroadcastGroupControl.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/BroadcastGroupControl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.openmbean.TabularData;
+
+import org.jboss.messaging.core.config.cluster.BroadcastGroupConfiguration;
+import org.jboss.messaging.core.management.BroadcastGroupControlMBean;
+import org.jboss.messaging.core.management.PairsInfo;
+import org.jboss.messaging.core.server.cluster.BroadcastGroup;
+
+/**
+ * A BroadcastGroupControl
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dc. 2008 17:09:04
+ */
+public class BroadcastGroupControl implements BroadcastGroupControlMBean
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final BroadcastGroup broadcastGroup;
+
+ private final BroadcastGroupConfiguration configuration;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public BroadcastGroupControl(final BroadcastGroup acceptor, final BroadcastGroupConfiguration configuration)
+ {
+ this.broadcastGroup = acceptor;
+ this.configuration = configuration;
+ }
+
+ // BroadcastGroupControlMBean implementation ---------------------
+
+ public String getName()
+ {
+ return configuration.getName();
+ }
+
+ public long getBroadcastPeriod()
+ {
+ return configuration.getBroadcastPeriod();
+ }
+
+ public TabularData getConnectorInfos()
+ {
+ return PairsInfo.toTabularData(configuration.getConnectorInfos());
+ }
+
+ public String getGroupAddress()
+ {
+ return configuration.getGroupAddress();
+ }
+
+ public int getGroupPort()
+ {
+ return configuration.getGroupPort();
+ }
+
+ public String getLocalBindAddress()
+ {
+ return configuration.getLocalBindAddress();
+ }
+
+ public int getLocalBindPort()
+ {
+ return configuration.getLocalBindPort();
+ }
+
+ // MessagingComponentControlMBean implementation -----------------
+
+ public boolean isStarted()
+ {
+ return broadcastGroup.isStarted();
+ }
+
+ public void start() throws Exception
+ {
+ broadcastGroup.start();
+ }
+
+ public void stop() throws Exception
+ {
+ broadcastGroup.stop();
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/src/main/org/jboss/messaging/core/management/impl/DiscoveryGroupControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/DiscoveryGroupControl.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/DiscoveryGroupControl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.openmbean.TabularData;
+
+import org.jboss.messaging.core.cluster.DiscoveryGroup;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
+import org.jboss.messaging.core.management.AcceptorControlMBean;
+import org.jboss.messaging.core.management.DiscoveryGroupControlMBean;
+import org.jboss.messaging.core.management.PropertiesInfo;
+import org.jboss.messaging.core.remoting.spi.Acceptor;
+
+/**
+ * A AcceptorControl
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dc. 2008 17:09:04
+ */
+public class DiscoveryGroupControl implements DiscoveryGroupControlMBean
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final DiscoveryGroup discoveryGroup;
+
+ private final DiscoveryGroupConfiguration configuration;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public DiscoveryGroupControl(final DiscoveryGroup acceptor, final DiscoveryGroupConfiguration configuration)
+ {
+ this.discoveryGroup = acceptor;
+ this.configuration = configuration;
+ }
+
+ // DiscoveryGroupControlMBean implementation ---------------------------
+
+ public String getName()
+ {
+ return configuration.getName();
+ }
+
+ public String getGroupAddress()
+ {
+ return configuration.getGroupAddress();
+ }
+
+ public int getGroupPort()
+ {
+ return configuration.getGroupPort();
+ }
+
+ public long getRefreshTimeout()
+ {
+ return configuration.getRefreshTimeout();
+ }
+
+ public boolean isStarted()
+ {
+ return discoveryGroup.isStarted();
+ }
+
+ public void start() throws Exception
+ {
+ discoveryGroup.start();
+ }
+
+ public void stop() throws Exception
+ {
+ discoveryGroup.stop();
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -38,11 +38,21 @@
import javax.management.MBeanServer;
import javax.management.NotificationBroadcasterSupport;
import javax.management.ObjectName;
+import javax.management.StandardMBean;
import org.jboss.messaging.core.client.management.impl.ManagementHelper;
+import org.jboss.messaging.core.cluster.DiscoveryGroup;
import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.cluster.BroadcastGroupConfiguration;
+import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
+import org.jboss.messaging.core.config.cluster.MessageFlowConfiguration;
import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.management.AcceptorControlMBean;
+import org.jboss.messaging.core.management.BroadcastGroupControlMBean;
+import org.jboss.messaging.core.management.DiscoveryGroupControlMBean;
import org.jboss.messaging.core.management.ManagementService;
+import org.jboss.messaging.core.management.MessageFlowControlMBean;
import org.jboss.messaging.core.management.MessagingServerControlMBean;
import org.jboss.messaging.core.management.NotificationType;
import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareAddressControlWrapper;
@@ -56,11 +66,14 @@
import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.remoting.RemotingService;
import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
+import org.jboss.messaging.core.remoting.spi.Acceptor;
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.server.MessageReference;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.core.server.cluster.BroadcastGroup;
+import org.jboss.messaging.core.server.cluster.MessageFlow;
import org.jboss.messaging.core.server.impl.ServerMessageImpl;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.QueueSettings;
@@ -132,7 +145,35 @@
quote(address.toString()),
quote(name.toString())));
}
+
+ public static ObjectName getAcceptorObjectName(final String name) throws Exception
+ {
+ return ObjectName.getInstance(String.format("%s:module=Core,type=Acceptor,name=%s",
+ DOMAIN,
+ quote(name)));
+ }
+
+ public static ObjectName getBroadcastGroupObjectName(final String name) throws Exception
+ {
+ return ObjectName.getInstance(String.format("%s:module=Core,type=BroadcastGroup,name=%s",
+ DOMAIN,
+ quote(name)));
+ }
+
+ public static ObjectName getMessageFlowObjectName(final String name) throws Exception
+ {
+ return ObjectName.getInstance(String.format("%s:module=Core,type=MessageFlow,name=%s",
+ DOMAIN,
+ quote(name)));
+ }
+ public static ObjectName getDiscoveryGroupObjectName(final String name) throws Exception
+ {
+ return ObjectName.getInstance(String.format("%s:module=Core,type=DiscoveryGroup,name=%s",
+ DOMAIN,
+ quote(name)));
+ }
+
// Constructors --------------------------------------------------
public ManagementServiceImpl(final MBeanServer mbeanServer, final boolean jmxManagementEnabled)
@@ -243,6 +284,62 @@
sendNotification(NotificationType.QUEUE_DESTROYED, name.toString());
}
+ public void registerAcceptor(final Acceptor acceptor, final TransportConfiguration configuration) throws Exception
+ {
+ ObjectName objectName = getAcceptorObjectName(configuration.getName());
+ AcceptorControlMBean control = new AcceptorControl(acceptor, configuration);
+ registerInJMX(objectName, new StandardMBean(control, AcceptorControlMBean.class));
+ registerInRegistry(objectName, control);
+ }
+
+ public void unregisterAcceptor(final String name) throws Exception
+ {
+ ObjectName objectName = getAcceptorObjectName(name);
+ unregisterResource(objectName);
+ }
+
+ public void registerBroadcastGroup(BroadcastGroup broadcastGroup, BroadcastGroupConfiguration configuration) throws Exception
+ {
+ ObjectName objectName = getBroadcastGroupObjectName(configuration.getName());
+ BroadcastGroupControlMBean control = new BroadcastGroupControl(broadcastGroup, configuration);
+ registerInJMX(objectName, new StandardMBean(control, BroadcastGroupControlMBean.class));
+ registerInRegistry(objectName, control);
+ }
+
+ public void unregisterBroadcastGroup(String name) throws Exception
+ {
+ ObjectName objectName = getBroadcastGroupObjectName(name);
+ unregisterResource(objectName);
+ }
+
+ public void registerDiscoveryGroup(DiscoveryGroup discoveryGroup, DiscoveryGroupConfiguration configuration) throws Exception
+ {
+ ObjectName objectName = getDiscoveryGroupObjectName(configuration.getName());
+ DiscoveryGroupControlMBean control = new DiscoveryGroupControl(discoveryGroup, configuration);
+ registerInJMX(objectName, new StandardMBean(control, DiscoveryGroupControlMBean.class));
+ registerInRegistry(objectName, control);
+ }
+
+ public void unregisterDiscoveryGroup(String name) throws Exception
+ {
+ ObjectName objectName = getDiscoveryGroupObjectName(name);
+ unregisterResource(objectName);
+ }
+
+ public void registerMessageFlow(MessageFlow messageFlow, MessageFlowConfiguration configuration) throws Exception
+ {
+ ObjectName objectName = getMessageFlowObjectName(configuration.getName());
+ MessageFlowControlMBean control = new MessageFlowControl(messageFlow, configuration);
+ registerInJMX(objectName, new StandardMBean(control, MessageFlowControlMBean.class));
+ registerInRegistry(objectName, control);
+ }
+
+ public void unregisterMessageFlow(String name) throws Exception
+ {
+ ObjectName objectName = getMessageFlowObjectName(name);
+ unregisterResource(objectName);
+ }
+
public void handleMessage(final Message message)
{
SimpleString objectName = (SimpleString)message.getProperty(ManagementHelper.HDR_JMX_OBJECTNAME);
Added: trunk/src/main/org/jboss/messaging/core/management/impl/MessageFlowControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/MessageFlowControl.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/MessageFlowControl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.openmbean.TabularData;
+
+import org.jboss.messaging.core.config.cluster.MessageFlowConfiguration;
+import org.jboss.messaging.core.management.MessageFlowControlMBean;
+import org.jboss.messaging.core.management.PairsInfo;
+import org.jboss.messaging.core.server.cluster.MessageFlow;
+
+/**
+ * A MessageFlowControl
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dc. 2008 17:09:04
+ */
+public class MessageFlowControl implements MessageFlowControlMBean
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final MessageFlow messageFlow;
+
+ private final MessageFlowConfiguration configuration;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public MessageFlowControl(final MessageFlow messageFlow, final MessageFlowConfiguration configuration)
+ {
+ this.messageFlow = messageFlow;
+ this.configuration = configuration;
+ }
+
+ // MessageFlowControlMBean implementation ---------------------------
+
+ public String getAddress()
+ {
+ return configuration.getAddress();
+ }
+
+ public TabularData getConnectorNamePairs()
+ {
+ return PairsInfo.toTabularData(configuration.getConnectorNamePairs());
+ }
+
+ public String getDiscoveryGroupName()
+ {
+ return configuration.getDiscoveryGroupName();
+ }
+
+ public String getFilterString()
+ {
+ return configuration.getFilterString();
+ }
+
+ public int getMaxBatchSize()
+ {
+ return configuration.getMaxBatchSize();
+ }
+
+ public long getMaxBatchTime()
+ {
+ return configuration.getMaxBatchTime();
+ }
+
+ public int getMaxRetriesAfterFailover()
+ {
+ return configuration.getMaxRetriesAfterFailover();
+ }
+
+ public int getMaxRetriesBeforeFailover()
+ {
+ return configuration.getMaxRetriesBeforeFailover();
+ }
+
+ public String getName()
+ {
+ return configuration.getName();
+ }
+
+ public long getRetryInterval()
+ {
+ return configuration.getRetryInterval();
+ }
+
+ public double getRetryIntervalMultiplier()
+ {
+ return configuration.getRetryIntervalMultiplier();
+ }
+
+ public String getTransformerClassName()
+ {
+ return configuration.getTransformerClassName();
+ }
+
+ public boolean isFanout()
+ {
+ return configuration.isFanout();
+ }
+
+ public boolean isStarted()
+ {
+ return messageFlow.isStarted();
+ }
+
+ public boolean isUseDuplicateDetection()
+ {
+ return configuration.isUseDuplicateDetection();
+ }
+
+ public void start() throws Exception
+ {
+ messageFlow.start();
+ }
+
+ public void stop() throws Exception
+ {
+ messageFlow.stop();
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -28,7 +28,6 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -45,15 +44,9 @@
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.config.cluster.BroadcastGroupConfiguration;
-import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
-import org.jboss.messaging.core.config.cluster.MessageFlowConfiguration;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.filter.impl.FilterImpl;
-import org.jboss.messaging.core.management.BroadcastGroupConfigurationInfo;
-import org.jboss.messaging.core.management.DiscoveryGroupConfigurationInfo;
-import org.jboss.messaging.core.management.MessageFlowConfigurationInfo;
import org.jboss.messaging.core.management.MessagingServerControlMBean;
import org.jboss.messaging.core.management.NotificationType;
import org.jboss.messaging.core.management.TransportConfigurationInfo;
@@ -67,7 +60,6 @@
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.server.ServerSession;
-import org.jboss.messaging.core.server.cluster.ClusterManager;
import org.jboss.messaging.core.server.impl.ServerSessionImpl;
import org.jboss.messaging.core.settings.HierarchicalRepository;
import org.jboss.messaging.core.settings.impl.QueueSettings;
@@ -172,35 +164,7 @@
// MessagingServerControlMBean implementation --------------------
- //FIXME
-
- public Map<String, Object> getBackupConnectorConfiguration()
- {
-// TransportConfiguration backupConf = configuration.getBackupConnectorConfiguration();
-// if (backupConf != null)
-// {
-// return backupConf.getParams();
-// }
-// else
-// {
-// return Collections.emptyMap();
-// }
- return Collections.emptyMap();
- }
- //FIXME
- public Map<String, Map<String, Object>> getAcceptorConfigurations()
- {
- Map<String, Map<String, Object>> result = new HashMap<String, Map<String, Object>>();
- Set<TransportConfiguration> acceptorConfs = configuration.getAcceptorConfigurations();
-
- for (TransportConfiguration acceptorConf : acceptorConfs)
- {
- result.put(acceptorConf.getFactoryClassName(), acceptorConf.getParams());
- }
- return result;
- }
-
public boolean isStarted()
{
return server.isStarted();
@@ -216,6 +180,13 @@
return configuration.isBackup();
}
+ //FIXME
+ public Map<String, Object> getBackupConnectorConfiguration()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
public String getBindingsDirectory()
{
return configuration.getBindingsDirectory();
@@ -555,31 +526,7 @@
}
return sessionIDs;
}
-
- public TabularData getMessageFlows() throws Exception
- {
- Set<MessageFlowConfiguration> messageFlowConfigurations = configuration.getMessageFlowConfigurations();
- return MessageFlowConfigurationInfo.toTabularData(messageFlowConfigurations);
- }
-
- public TabularData getDiscoveryGroups() throws Exception
- {
- Collection<DiscoveryGroupConfiguration> discoveryGroupConfigurations = configuration.getDiscoveryGroupConfigurations().values();
- return DiscoveryGroupConfigurationInfo.toTabularData(discoveryGroupConfigurations);
- }
-
- public TabularData getBroadcastGroups() throws Exception
- {
- Set<BroadcastGroupConfiguration> broadcastGroupConfigurations = configuration.getBroadcastGroupConfigurations();
- return BroadcastGroupConfigurationInfo.toTabularData(broadcastGroupConfigurations);
- }
- public TabularData getAcceptors() throws Exception
- {
- Set<TransportConfiguration> acceptorConfigurations = configuration.getAcceptorConfigurations();
- return TransportConfigurationInfo.toTabularData(acceptorConfigurations);
- }
-
public TabularData getConnectors() throws Exception
{
Collection<TransportConfiguration> connectorConfigurations = configuration.getConnectorConfigurations().values();
Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -64,11 +64,6 @@
// MessagingServerControlMBean implementation ------------------------------
- public Map<String, Map<String, Object>> getAcceptorConfigurations()
- {
- return localControl.getAcceptorConfigurations();
- }
-
public Map<String, Object> getBackupConnectorConfiguration()
{
return localControl.getBackupConnectorConfiguration();
@@ -239,26 +234,6 @@
return localControl.listSessions(connectionID);
}
- public TabularData getMessageFlows() throws Exception
- {
- return localControl.getMessageFlows();
- }
-
- public TabularData getDiscoveryGroups() throws Exception
- {
- return localControl.getDiscoveryGroups();
- }
-
- public TabularData getBroadcastGroups() throws Exception
- {
- return localControl.getBroadcastGroups();
- }
-
- public TabularData getAcceptors() throws Exception
- {
- return localControl.getAcceptors();
- }
-
public TabularData getConnectors() throws Exception
{
return localControl.getConnectors();
Modified: trunk/src/main/org/jboss/messaging/core/remoting/RemotingService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/RemotingService.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/remoting/RemotingService.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -24,6 +24,7 @@
import java.util.Set;
+import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.server.MessagingComponent;
import org.jboss.messaging.core.server.MessagingServer;
@@ -46,4 +47,6 @@
boolean removeInterceptor(Interceptor interceptor);
void setBackup(boolean backup);
+
+ void setManagementService(ManagementService managementService);
}
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/RemotingServiceImpl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -13,6 +13,7 @@
package org.jboss.messaging.core.remoting.impl;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -25,6 +26,7 @@
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.exception.MessagingException;
import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.remoting.Channel;
import org.jboss.messaging.core.remoting.ChannelHandler;
import org.jboss.messaging.core.remoting.Interceptor;
@@ -80,6 +82,8 @@
private volatile MessagingServer server;
+ private ManagementService managementService;
+
// Static --------------------------------------------------------
@@ -114,6 +118,11 @@
// RemotingService implementation -------------------------------
+ public void setManagementService(final ManagementService managementService)
+ {
+ this.managementService = managementService;
+ }
+
public synchronized void start() throws Exception
{
if (started)
@@ -136,7 +145,7 @@
}
if (!invmAcceptorConfigured)
{
- transportConfigs.add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+ transportConfigs.add(new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap<String, Object>(), "in-vm"));
}
}
@@ -153,6 +162,11 @@
Acceptor acceptor = factory.createAcceptor(info.getParams(), bufferHandler, this);
acceptors.add(acceptor);
+
+ if (managementService != null)
+ {
+ managementService.registerAcceptor(acceptor, info);
+ }
}
catch (Exception e)
{
@@ -205,11 +219,6 @@
return started;
}
- public Set<Acceptor> getAcceptors()
- {
- return acceptors;
- }
-
public RemotingConnection getConnection(final Object remotingConnectionID)
{
return connections.get(remotingConnectionID);
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMAcceptor.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -93,6 +93,11 @@
started = true;
}
+ public boolean isStarted()
+ {
+ return started;
+ }
+
public BufferHandler getHandler()
{
if (!started)
Modified: trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/remoting/impl/invm/InVMConnector.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -110,6 +110,11 @@
started = false;
}
+
+ public boolean isStarted()
+ {
+ return started;
+ }
public Connection createConnection()
{
Modified: trunk/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/remoting/spi/Acceptor.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -22,6 +22,8 @@
package org.jboss.messaging.core.remoting.spi;
+import org.jboss.messaging.core.server.MessagingComponent;
+
/**
* An Acceptor is used tby the Remoting Service to allow clients to connect. It should take care of dispatchin client requests
* to the Remoting Service's Dispatcher.
@@ -29,9 +31,7 @@
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
* @author <a href="tim.fox at jboss.com">Tim Fox</a>
*/
-public interface Acceptor
+public interface Acceptor extends MessagingComponent
{
- void start() throws Exception;
-
void stop();
}
Modified: trunk/src/main/org/jboss/messaging/core/remoting/spi/Connector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/remoting/spi/Connector.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/remoting/spi/Connector.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -34,6 +34,8 @@
void close();
+ boolean isStarted();
+
/**
* Create and return a connection from this connector.
*
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -38,6 +38,8 @@
*/
public interface BroadcastGroup extends MessagingComponent
{
+ String getName();
+
void addConnectorPair(Pair<TransportConfiguration, TransportConfiguration> connectorPair);
void removeConnectorPair(Pair<TransportConfiguration, TransportConfiguration> connectorPair);
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/MessageFlow.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/MessageFlow.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/MessageFlow.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -26,6 +26,7 @@
import java.util.Set;
import org.jboss.messaging.core.server.MessagingComponent;
+import org.jboss.messaging.util.SimpleString;
/**
* A MessageFlow
@@ -38,5 +39,7 @@
*/
public interface MessageFlow extends MessagingComponent
{
+ SimpleString getName();
+
Set<Forwarder> getForwarders();
}
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -48,6 +48,8 @@
{
private static final Logger log = Logger.getLogger(BroadcastGroupImpl.class);
+ private final String name;
+
private final InetAddress localBindAddress;
private final int localPort;
@@ -64,11 +66,14 @@
private ScheduledFuture<?> future;
- public BroadcastGroupImpl(final InetAddress localBindAddress,
+ public BroadcastGroupImpl(final String name,
+ final InetAddress localBindAddress,
final int localPort,
final InetAddress groupAddress,
final int groupPort) throws Exception
{
+ this.name = name;
+
this.localBindAddress = localBindAddress;
this.localPort = localPort;
@@ -116,6 +121,11 @@
return started;
}
+ public String getName()
+ {
+ return name;
+ }
+
public synchronized void addConnectorPair(final Pair<TransportConfiguration, TransportConfiguration> connectorPair)
{
connectorPairs.add(connectorPair);
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -40,6 +40,7 @@
import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
import org.jboss.messaging.core.config.cluster.MessageFlowConfiguration;
import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.server.cluster.BroadcastGroup;
@@ -81,15 +82,18 @@
private final ScheduledExecutorService scheduledExecutor;
+ private final ManagementService managementService;
+
private final Configuration configuration;
private volatile boolean started;
-
+
public ClusterManagerImpl(final ExecutorFactory executorFactory,
final StorageManager storageManager,
final PostOffice postOffice,
final HierarchicalRepository<QueueSettings> queueSettingsRepository,
final ScheduledExecutorService scheduledExecutor,
+ final ManagementService managementService,
final Configuration configuration)
{
this.executorFactory = executorFactory;
@@ -102,6 +106,8 @@
this.scheduledExecutor = scheduledExecutor;
+ this.managementService = managementService;
+
this.configuration = configuration;
}
@@ -140,16 +146,19 @@
for (BroadcastGroup group : broadcastGroups.values())
{
group.stop();
+ managementService.unregisterBroadcastGroup(group.getName());
}
for (DiscoveryGroup group : discoveryGroups.values())
{
group.stop();
+ managementService.unregisterDiscoveryGroup(group.getName());
}
for (MessageFlow flow : this.messageFlows.values())
{
flow.stop();
+ managementService.unregisterMessageFlow(flow.getName().toString());
}
broadcastGroups.clear();
@@ -185,7 +194,8 @@
InetAddress groupAddress = InetAddress.getByName(config.getGroupAddress());
- BroadcastGroupImpl group = new BroadcastGroupImpl(localBindAddress,
+ BroadcastGroupImpl group = new BroadcastGroupImpl(config.getName(),
+ localBindAddress,
config.getLocalBindPort(),
groupAddress,
config.getGroupPort());
@@ -226,6 +236,8 @@
group.setScheduledFuture(future);
broadcastGroups.put(config.getName(), group);
+
+ managementService.registerBroadcastGroup(group, config);
group.start();
}
@@ -250,10 +262,12 @@
InetAddress groupAddress = InetAddress.getByName(config.getGroupAddress());
- DiscoveryGroup group = new DiscoveryGroupImpl(groupAddress, config.getGroupPort(), config.getRefreshTimeout());
+ DiscoveryGroup group = new DiscoveryGroupImpl(config.getName(), groupAddress, config.getGroupPort(), config.getRefreshTimeout());
discoveryGroups.put(config.getName(), group);
+ managementService.registerDiscoveryGroup(group, config);
+
group.start();
}
@@ -407,6 +421,7 @@
}
messageFlows.put(config.getName(), flow);
+ managementService.registerMessageFlow(flow, config);
flow.start();
}
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/MessageFlowImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/MessageFlowImpl.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/MessageFlowImpl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -264,6 +264,13 @@
return started;
}
+ // MessageFlow implementation ------------------------------------
+
+ public SimpleString getName()
+ {
+ return name;
+ }
+
//For testing only
public Set<Forwarder> getForwarders()
{
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -292,6 +292,7 @@
postOffice,
queueSettingsRepository,
scheduledExecutor,
+ managementService,
configuration);
clusterManager.start();
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServiceImpl.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -25,10 +25,6 @@
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.journal.Journal;
-import org.jboss.messaging.core.journal.SequentialFileFactory;
-import org.jboss.messaging.core.journal.impl.JournalImpl;
-import org.jboss.messaging.core.journal.impl.NIOSequentialFileFactory;
import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.management.impl.ManagementServiceImpl;
import org.jboss.messaging.core.persistence.StorageManager;
@@ -64,7 +60,9 @@
ManagementService managementService = new ManagementServiceImpl(ManagementFactory.getPlatformMBeanServer(),
config.isJMXManagementEnabled());
-
+
+ remotingService.setManagementService(managementService);
+
MessagingServer server = new MessagingServerImpl();
server.setConfiguration(config);
@@ -90,6 +88,8 @@
ManagementService managementService = new ManagementServiceImpl(ManagementFactory.getPlatformMBeanServer(), false);
+ remotingService.setManagementService(managementService);
+
MessagingServer server = new MessagingServerImpl();
server.setConfiguration(config);
Modified: trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaAcceptor.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -185,6 +185,11 @@
acceptor = null;
}
+ public boolean isStarted()
+ {
+ return (acceptor != null);
+ }
+
public DefaultIoFilterChainBuilder getFilterChain()
{
return acceptor.getFilterChain();
Modified: trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/integration/transports/mina/MinaConnector.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -183,8 +183,14 @@
if (connector != null)
{
connector.dispose();
+ connector = null;
}
}
+
+ public boolean isStarted()
+ {
+ return (connector != null);
+ }
public Connection createConnection()
{
Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyAcceptor.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -22,6 +22,17 @@
package org.jboss.messaging.integration.transports.netty;
+import static org.jboss.netty.channel.Channels.pipeline;
+
+import java.net.InetSocketAddress;
+import java.util.Map;
+import java.util.Timer;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import javax.net.ssl.SSLContext;
+
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.remoting.impl.ssl.SSLSupport;
import org.jboss.messaging.core.remoting.spi.Acceptor;
@@ -40,22 +51,12 @@
import org.jboss.netty.channel.ChannelPipelineCoverage;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.ChannelStateEvent;
-import static org.jboss.netty.channel.Channels.pipeline;
-import static org.jboss.netty.channel.Channels.write;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory;
import org.jboss.netty.handler.codec.http.HttpRequestDecoder;
import org.jboss.netty.handler.codec.http.HttpResponseEncoder;
import org.jboss.netty.handler.ssl.SslHandler;
-import javax.net.ssl.SSLContext;
-import java.net.InetSocketAddress;
-import java.util.Map;
-import java.util.Timer;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
/**
* A Netty TCP Acceptor that supports SSL
*
@@ -304,6 +305,11 @@
}
channelFactory = null;
}
+
+ public boolean isStarted()
+ {
+ return (channelFactory != null);
+ }
// Inner classes -----------------------------------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java
===================================================================
--- trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/src/main/org/jboss/messaging/integration/transports/netty/NettyConnector.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -305,6 +305,11 @@
}
}
}
+
+ public boolean isStarted()
+ {
+ return (channelFactory != null);
+ }
public Connection createConnection()
{
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/DiscoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/DiscoveryTest.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/distribution/DiscoveryTest.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -23,6 +23,8 @@
package org.jboss.messaging.tests.integration.cluster.distribution;
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
+
import java.net.InetAddress;
import java.util.HashMap;
import java.util.List;
@@ -60,7 +62,7 @@
final int groupPort = 6745;
final int timeout = 500;
- BroadcastGroup bg = new BroadcastGroupImpl(null, -1, groupAddress, groupPort);
+ BroadcastGroup bg = new BroadcastGroupImpl(randomString(), null, -1, groupAddress, groupPort);
bg.start();
@@ -73,7 +75,7 @@
bg.addConnectorPair(connectorPair);
- DiscoveryGroup dg = new DiscoveryGroupImpl(groupAddress, groupPort, timeout);
+ DiscoveryGroup dg = new DiscoveryGroupImpl(randomString(), groupAddress, groupPort, timeout);
dg.start();
@@ -105,7 +107,7 @@
final int groupPort = 6745;
final int timeout = 500;
- BroadcastGroup bg = new BroadcastGroupImpl(null, -1, groupAddress, groupPort);
+ BroadcastGroup bg = new BroadcastGroupImpl(randomString(), null, -1, groupAddress, groupPort);
bg.start();
@@ -120,7 +122,7 @@
final InetAddress groupAddress2 = InetAddress.getByName("230.1.2.4");
- DiscoveryGroup dg = new DiscoveryGroupImpl(groupAddress2, groupPort, timeout);
+ DiscoveryGroup dg = new DiscoveryGroupImpl(randomString(), groupAddress2, groupPort, timeout);
dg.start();
@@ -141,7 +143,7 @@
final int groupPort = 6745;
final int timeout = 500;
- BroadcastGroup bg = new BroadcastGroupImpl(null, -1, groupAddress, groupPort);
+ BroadcastGroup bg = new BroadcastGroupImpl(randomString(), null, -1, groupAddress, groupPort);
bg.start();
@@ -156,7 +158,7 @@
final int port2 = 6746;
- DiscoveryGroup dg = new DiscoveryGroupImpl(groupAddress, port2, timeout);
+ DiscoveryGroup dg = new DiscoveryGroupImpl(randomString(), groupAddress, port2, timeout);
dg.start();
@@ -177,7 +179,7 @@
final int groupPort = 6745;
final int timeout = 500;
- BroadcastGroup bg = new BroadcastGroupImpl(null, -1, groupAddress, groupPort);
+ BroadcastGroup bg = new BroadcastGroupImpl(randomString(), null, -1, groupAddress, groupPort);
bg.start();
@@ -193,7 +195,7 @@
final InetAddress groupAddress2 = InetAddress.getByName("230.1.2.4");
final int port2 = 6746;
- DiscoveryGroup dg = new DiscoveryGroupImpl(groupAddress2, port2, timeout);
+ DiscoveryGroup dg = new DiscoveryGroupImpl(randomString(), groupAddress2, port2, timeout);
dg.start();
@@ -221,13 +223,13 @@
final int timeout = 500;
- BroadcastGroup bg1 = new BroadcastGroupImpl(null, -1, groupAddress1, groupPort1);
+ BroadcastGroup bg1 = new BroadcastGroupImpl(randomString(), null, -1, groupAddress1, groupPort1);
bg1.start();
- BroadcastGroup bg2 = new BroadcastGroupImpl(null, -1, groupAddress2, groupPort2);
+ BroadcastGroup bg2 = new BroadcastGroupImpl(randomString(), null, -1, groupAddress2, groupPort2);
bg2.start();
- BroadcastGroup bg3 = new BroadcastGroupImpl(null, -1, groupAddress3, groupPort3);
+ BroadcastGroup bg3 = new BroadcastGroupImpl(randomString(), null, -1, groupAddress3, groupPort3);
bg3.start();
TransportConfiguration live1 = generateTC();
@@ -252,13 +254,13 @@
bg2.addConnectorPair(connectorPair2);
bg3.addConnectorPair(connectorPair3);
- DiscoveryGroup dg1 = new DiscoveryGroupImpl(groupAddress1, groupPort1, timeout);
+ DiscoveryGroup dg1 = new DiscoveryGroupImpl(randomString(), groupAddress1, groupPort1, timeout);
dg1.start();
- DiscoveryGroup dg2 = new DiscoveryGroupImpl(groupAddress2, groupPort2, timeout);
+ DiscoveryGroup dg2 = new DiscoveryGroupImpl(randomString(), groupAddress2, groupPort2, timeout);
dg2.start();
- DiscoveryGroup dg3 = new DiscoveryGroupImpl(groupAddress3, groupPort3, timeout);
+ DiscoveryGroup dg3 = new DiscoveryGroupImpl(randomString(), groupAddress3, groupPort3, timeout);
dg3.start();
bg1.broadcastConnectors();
@@ -306,7 +308,7 @@
final int groupPort = 6745;
final int timeout = 500;
- BroadcastGroup bg = new BroadcastGroupImpl(null, -1, groupAddress, groupPort);
+ BroadcastGroup bg = new BroadcastGroupImpl(randomString(), null, -1, groupAddress, groupPort);
bg.start();
@@ -317,7 +319,7 @@
bg.addConnectorPair(connectorPair);
- DiscoveryGroup dg = new DiscoveryGroupImpl(groupAddress, groupPort, timeout);
+ DiscoveryGroup dg = new DiscoveryGroupImpl(randomString(), groupAddress, groupPort, timeout);
dg.start();
@@ -349,7 +351,7 @@
final int groupPort = 6745;
final int timeout = 500;
- BroadcastGroup bg = new BroadcastGroupImpl(null, -1, groupAddress, groupPort);
+ BroadcastGroup bg = new BroadcastGroupImpl(randomString(), null, -1, groupAddress, groupPort);
bg.start();
@@ -360,7 +362,7 @@
bg.addConnectorPair(connectorPair);
- DiscoveryGroup dg = new DiscoveryGroupImpl(groupAddress, groupPort, timeout);
+ DiscoveryGroup dg = new DiscoveryGroupImpl(randomString(), groupAddress, groupPort, timeout);
MyListener listener1 = new MyListener();
MyListener listener2 = new MyListener();
@@ -461,13 +463,13 @@
final int groupPort = 6745;
final int timeout = 500;
- BroadcastGroup bg1 = new BroadcastGroupImpl(null, -1, groupAddress, groupPort);
+ BroadcastGroup bg1 = new BroadcastGroupImpl(randomString(), null, -1, groupAddress, groupPort);
bg1.start();
- BroadcastGroup bg2 = new BroadcastGroupImpl(null, -1, groupAddress, groupPort);
+ BroadcastGroup bg2 = new BroadcastGroupImpl(randomString(), null, -1, groupAddress, groupPort);
bg2.start();
- BroadcastGroup bg3 = new BroadcastGroupImpl(null, -1, groupAddress, groupPort);
+ BroadcastGroup bg3 = new BroadcastGroupImpl(randomString(), null, -1, groupAddress, groupPort);
bg3.start();
TransportConfiguration live1 = generateTC();
@@ -488,7 +490,7 @@
new Pair<TransportConfiguration, TransportConfiguration>(live3, backup3);
bg3.addConnectorPair(connectorPair3);
- DiscoveryGroup dg = new DiscoveryGroupImpl(groupAddress, groupPort, timeout);
+ DiscoveryGroup dg = new DiscoveryGroupImpl(randomString(), groupAddress, groupPort, timeout);
MyListener listener1 = new MyListener();
dg.registerListener(listener1);
@@ -701,7 +703,7 @@
final int groupPort = 6745;
final int timeout = 500;
- BroadcastGroup bg = new BroadcastGroupImpl(null, -1, groupAddress, groupPort);
+ BroadcastGroup bg = new BroadcastGroupImpl(randomString(), null, -1, groupAddress, groupPort);
bg.start();
@@ -713,11 +715,11 @@
bg.addConnectorPair(connectorPair1);
- DiscoveryGroup dg1 = new DiscoveryGroupImpl(groupAddress, groupPort, timeout);
+ DiscoveryGroup dg1 = new DiscoveryGroupImpl(randomString(), groupAddress, groupPort, timeout);
- DiscoveryGroup dg2 = new DiscoveryGroupImpl(groupAddress, groupPort, timeout);
+ DiscoveryGroup dg2 = new DiscoveryGroupImpl(randomString(), groupAddress, groupPort, timeout);
- DiscoveryGroup dg3 = new DiscoveryGroupImpl(groupAddress, groupPort, timeout);
+ DiscoveryGroup dg3 = new DiscoveryGroupImpl(randomString(), groupAddress, groupPort, timeout);
dg1.start();
dg2.start();
Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/AcceptorControlTest.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.integration.management;
+
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
+
+import java.lang.management.ManagementFactory;
+import java.util.HashMap;
+
+import javax.management.MBeanServerInvocationHandler;
+
+import junit.framework.TestCase;
+
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.management.AcceptorControlMBean;
+import org.jboss.messaging.core.management.impl.ManagementServiceImpl;
+import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
+import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
+
+/**
+ * A AcceptorControlTest
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dc. 2008 17:38:58
+ *
+ *
+ */
+public class AcceptorControlTest extends TestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private MessagingService service;
+
+ // Static --------------------------------------------------------
+
+ private static AcceptorControlMBean createControl(String name) throws Exception
+ {
+ AcceptorControlMBean control = (AcceptorControlMBean)MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
+ ManagementServiceImpl.getAcceptorObjectName(name),
+ AcceptorControlMBean.class,
+ false);
+ return control;
+ }
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testAttributes() throws Exception
+ {
+ TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(),
+ new HashMap<String, Object>(),
+ randomString());
+
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.getAcceptorConfigurations().add(acceptorConfig);
+ service = MessagingServiceImpl.newNullStorageMessagingService(conf);
+ service.start();
+
+ AcceptorControlMBean acceptorControl = createControl(acceptorConfig.getName());
+ assertEquals(acceptorConfig.getName(), acceptorControl.getName());
+ assertEquals(acceptorConfig.getFactoryClassName(), acceptorControl.getFactoryClassName());
+ }
+
+ public void testStartStop() throws Exception
+ {
+ TransportConfiguration acceptorConfig = new TransportConfiguration(NettyAcceptorFactory.class.getName(),
+ new HashMap<String, Object>(),
+ randomString());
+
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.getAcceptorConfigurations().add(acceptorConfig);
+ service = MessagingServiceImpl.newNullStorageMessagingService(conf);
+ service.start();
+
+ AcceptorControlMBean acceptorControl = createControl(acceptorConfig.getName());
+ // started by the service
+ assertTrue(acceptorControl.isStarted());
+
+ ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(NettyConnectorFactory.class.getName()));
+ ClientSession session = sf.createSession(false, true, true);
+ assertNotNull(session);
+ session.close();
+
+ acceptorControl.stop();
+
+ assertFalse(acceptorControl.isStarted());
+ try
+ {
+ sf.createSession(false, true, true);
+ fail("acceptor must not accept connections when stopped");
+ }
+ catch (Exception e)
+ {
+ }
+
+ acceptorControl.start();
+
+ assertTrue(acceptorControl.isStarted());
+ session = sf.createSession(false, true, true);
+ assertNotNull(session);
+ session.close();
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ if (service != null)
+ {
+ service.stop();
+ }
+
+ super.tearDown();
+ }
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.integration.management;
+
+import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveInt;
+import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveLong;
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
+
+import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.management.MBeanServerInvocationHandler;
+
+import junit.framework.TestCase;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.cluster.BroadcastGroupConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.management.BroadcastGroupControlMBean;
+import org.jboss.messaging.core.management.impl.ManagementServiceImpl;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
+import org.jboss.messaging.util.Pair;
+
+/**
+ * A AcceptorControlTest
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dc. 2008 17:38:58
+ *
+ *
+ */
+public class BroadcastGroupControlTest extends TestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private MessagingService service;
+
+ // Static --------------------------------------------------------
+
+ private static BroadcastGroupControlMBean createControl(String name) throws Exception
+ {
+ BroadcastGroupControlMBean control = (BroadcastGroupControlMBean)MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
+ ManagementServiceImpl.getBroadcastGroupObjectName(name),
+ BroadcastGroupControlMBean.class,
+ false);
+ return control;
+ }
+
+ public static BroadcastGroupConfiguration randomBroadcastGroupConfiguration(List<Pair<String, String>> connectorInfos)
+ {
+ return new BroadcastGroupConfiguration(randomString(),
+ "localhost",
+ randomPositiveInt(),
+ "231.7.7.7",
+ randomPositiveInt(),
+ randomPositiveLong(),
+ connectorInfos);
+ }
+
+ public static Pair<String, String> randomPair()
+ {
+ return new Pair<String, String>(randomString(), randomString());
+ }
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testAttributes() throws Exception
+ {
+ TransportConfiguration connectorConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName());
+ List<Pair<String, String>> connectorInfos = new ArrayList<Pair<String,String>>();
+ connectorInfos.add(new Pair<String, String>(connectorConfiguration.getName(), null));
+ BroadcastGroupConfiguration broadcastGroupConfig = randomBroadcastGroupConfiguration(connectorInfos);
+
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.setClustered(true);
+ conf.getConnectorConfigurations().put(connectorConfiguration.getName(), connectorConfiguration);
+ conf.getBroadcastGroupConfigurations().add(broadcastGroupConfig);
+ service = MessagingServiceImpl.newNullStorageMessagingService(conf);
+ service.start();
+
+ BroadcastGroupControlMBean broadcastGroupControl = createControl(broadcastGroupConfig.getName());
+
+ assertEquals(broadcastGroupConfig.getName(), broadcastGroupControl.getName());
+ assertEquals(broadcastGroupConfig.getGroupAddress(), broadcastGroupControl.getGroupAddress());
+ assertEquals(broadcastGroupConfig.getGroupPort(), broadcastGroupControl.getGroupPort());
+ assertEquals(broadcastGroupConfig.getLocalBindAddress(), broadcastGroupControl.getLocalBindAddress());
+ assertEquals(broadcastGroupConfig.getLocalBindPort(), broadcastGroupControl.getLocalBindPort());
+ }
+
+ public void testStartStop() throws Exception
+ {
+ TransportConfiguration connectorConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName());
+ List<Pair<String, String>> connectorInfos = new ArrayList<Pair<String,String>>();
+ connectorInfos.add(new Pair<String, String>(connectorConfiguration.getName(), null));
+ BroadcastGroupConfiguration broadcastGroupConfig = randomBroadcastGroupConfiguration(connectorInfos);
+
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.setClustered(true);
+ conf.getConnectorConfigurations().put(connectorConfiguration.getName(), connectorConfiguration);
+ conf.getBroadcastGroupConfigurations().add(broadcastGroupConfig);
+ service = MessagingServiceImpl.newNullStorageMessagingService(conf);
+ service.start();
+
+ BroadcastGroupControlMBean broadcastGroupControl = createControl(broadcastGroupConfig.getName());
+
+ // started by the service
+ assertTrue(broadcastGroupControl.isStarted());
+
+ broadcastGroupControl.stop();
+ assertFalse(broadcastGroupControl.isStarted());
+
+ broadcastGroupControl.start();
+ assertTrue(broadcastGroupControl.isStarted());
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ if (service != null)
+ {
+ service.stop();
+ }
+
+ super.tearDown();
+ }
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/DiscoveryGroupControlTest.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.integration.management;
+
+import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveLong;
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
+
+import java.lang.management.ManagementFactory;
+
+import javax.management.MBeanServerInvocationHandler;
+
+import junit.framework.TestCase;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.management.DiscoveryGroupControlMBean;
+import org.jboss.messaging.core.management.impl.ManagementServiceImpl;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+
+/**
+ * A AcceptorControlTest
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dc. 2008 17:38:58
+ *
+ *
+ */
+public class DiscoveryGroupControlTest extends TestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private MessagingService service;
+
+ // Static --------------------------------------------------------
+
+ private static DiscoveryGroupControlMBean createControl(String name) throws Exception
+ {
+ DiscoveryGroupControlMBean control = (DiscoveryGroupControlMBean)MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
+ ManagementServiceImpl.getDiscoveryGroupObjectName(name),
+ DiscoveryGroupControlMBean.class,
+ false);
+ return control;
+ }
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testAttributes() throws Exception
+ {
+ DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(randomString(), "231.7.7.7", 2000, randomPositiveLong());
+
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.setClustered(true);
+ conf.getDiscoveryGroupConfigurations().put(discoveryGroupConfig.getName(), discoveryGroupConfig);
+ service = MessagingServiceImpl.newNullStorageMessagingService(conf);
+ service.start();
+
+ DiscoveryGroupControlMBean discoveryGroupControl = createControl(discoveryGroupConfig.getName());
+
+ assertEquals(discoveryGroupConfig.getName(), discoveryGroupControl.getName());
+ assertEquals(discoveryGroupConfig.getGroupAddress(), discoveryGroupControl.getGroupAddress());
+ assertEquals(discoveryGroupConfig.getGroupPort(), discoveryGroupControl.getGroupPort());
+ assertEquals(discoveryGroupConfig.getRefreshTimeout(), discoveryGroupControl.getRefreshTimeout());
+ }
+
+ public void testStartStop() throws Exception
+ {
+ DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(randomString(), "231.7.7.7", 2000, randomPositiveLong());
+
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.setClustered(true);
+ conf.getDiscoveryGroupConfigurations().put(discoveryGroupConfig.getName(), discoveryGroupConfig);
+ service = MessagingServiceImpl.newNullStorageMessagingService(conf);
+ service.start();
+
+ DiscoveryGroupControlMBean discoveryGroupControl = createControl(discoveryGroupConfig.getName());
+ // started by the service
+ assertTrue(discoveryGroupControl.isStarted());
+
+ discoveryGroupControl.stop();
+ assertFalse(discoveryGroupControl.isStarted());
+ }
+
+ public void testStoppedDiscoveryGroupCanNotBeRestarted() throws Exception
+ {
+ DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(randomString(), "231.7.7.7", 2000, randomPositiveLong());
+
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.setClustered(true);
+ conf.getDiscoveryGroupConfigurations().put(discoveryGroupConfig.getName(), discoveryGroupConfig);
+ service = MessagingServiceImpl.newNullStorageMessagingService(conf);
+ service.start();
+
+ DiscoveryGroupControlMBean discoveryGroupControl = createControl(discoveryGroupConfig.getName());
+ // started by the service
+ assertTrue(discoveryGroupControl.isStarted());
+
+ discoveryGroupControl.stop();
+ assertFalse(discoveryGroupControl.isStarted());
+
+ try
+ {
+ discoveryGroupControl.start();
+ fail("once stopped, a discovery group can not be restarted");
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ if (service != null)
+ {
+ service.stop();
+ }
+
+ super.tearDown();
+ }
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/MessageFlowControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/MessageFlowControlTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/MessageFlowControlTest.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.integration.management;
+
+import static org.jboss.messaging.tests.util.RandomUtil.randomBoolean;
+import static org.jboss.messaging.tests.util.RandomUtil.randomDouble;
+import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveInt;
+import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveLong;
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
+
+import java.lang.management.ManagementFactory;
+import java.util.HashMap;
+
+import javax.management.MBeanServerInvocationHandler;
+
+import junit.framework.TestCase;
+
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
+import org.jboss.messaging.core.config.cluster.MessageFlowConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.management.AcceptorControlMBean;
+import org.jboss.messaging.core.management.MessageFlowControlMBean;
+import org.jboss.messaging.core.management.impl.ManagementServiceImpl;
+import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.integration.transports.netty.NettyAcceptorFactory;
+import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
+import org.jboss.messaging.tests.util.RandomUtil;
+
+/**
+ * A AcceptorControlTest
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dc. 2008 17:38:58
+ *
+ *
+ */
+public class MessageFlowControlTest extends TestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private MessagingService service;
+
+ // Static --------------------------------------------------------
+
+ private static MessageFlowControlMBean createControl(String name) throws Exception
+ {
+ MessageFlowControlMBean control = (MessageFlowControlMBean)MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
+ ManagementServiceImpl.getMessageFlowObjectName(name),
+ MessageFlowControlMBean.class,
+ false);
+ return control;
+ }
+
+ public static MessageFlowConfiguration randomMessageFlowConfigurationWithDiscoveryGroup(String discoveryGroupName)
+ {
+ return new MessageFlowConfiguration(randomString(),
+ randomString(),
+ null,
+ randomBoolean(),
+ randomPositiveInt(),
+ randomPositiveLong(),
+ null,
+ randomPositiveLong(),
+ randomDouble(),
+ randomPositiveInt(),
+ randomPositiveInt(),
+ randomBoolean(),
+ discoveryGroupName);
+ }
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testAttributes() throws Exception
+ {
+ DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(randomString(), "231.7.7.7", 2000, randomPositiveLong());
+ MessageFlowConfiguration messageFlowConfig = randomMessageFlowConfigurationWithDiscoveryGroup(discoveryGroupConfig.getName());
+
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.setClustered(true);
+ conf.getDiscoveryGroupConfigurations().put(discoveryGroupConfig.getName(), discoveryGroupConfig);
+ conf.getMessageFlowConfigurations().add(messageFlowConfig);
+ service = MessagingServiceImpl.newNullStorageMessagingService(conf);
+ service.start();
+
+ MessageFlowControlMBean messageFlowControl = createControl(messageFlowConfig.getName());
+ assertEquals(messageFlowConfig.getName(), messageFlowControl.getName());
+ assertEquals(messageFlowConfig.getDiscoveryGroupName(), messageFlowControl.getDiscoveryGroupName());
+ }
+
+ public void testStartStop() throws Exception
+ {
+ DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(randomString(), "231.7.7.7", 2000, randomPositiveLong());
+ MessageFlowConfiguration messageFlowConfig = randomMessageFlowConfigurationWithDiscoveryGroup(discoveryGroupConfig.getName());
+
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.setClustered(true);
+ conf.getDiscoveryGroupConfigurations().put(discoveryGroupConfig.getName(), discoveryGroupConfig);
+ conf.getMessageFlowConfigurations().add(messageFlowConfig);
+ service = MessagingServiceImpl.newNullStorageMessagingService(conf);
+ service.start();
+
+ MessageFlowControlMBean messageFlowControl = createControl(messageFlowConfig.getName());
+ // started by the service
+ assertTrue(messageFlowControl.isStarted());
+
+ messageFlowControl.stop();
+ assertFalse(messageFlowControl.isStarted());
+
+ messageFlowControl.start();
+ assertTrue(messageFlowControl.isStarted());
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ if (service != null)
+ {
+ service.stop();
+ }
+
+ super.tearDown();
+ }
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/MessagingServerControlTest.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -22,14 +22,9 @@
package org.jboss.messaging.tests.integration.management;
-import static org.jboss.messaging.tests.util.RandomUtil.randomBoolean;
-import static org.jboss.messaging.tests.util.RandomUtil.randomDouble;
-import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveInt;
-import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveLong;
import static org.jboss.messaging.tests.util.RandomUtil.randomString;
import java.lang.management.ManagementFactory;
-import java.util.ArrayList;
import java.util.HashMap;
import javax.management.MBeanServerInvocationHandler;
@@ -39,21 +34,13 @@
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.config.cluster.BroadcastGroupConfiguration;
-import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
-import org.jboss.messaging.core.config.cluster.MessageFlowConfiguration;
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.management.BroadcastGroupConfigurationInfo;
-import org.jboss.messaging.core.management.DiscoveryGroupConfigurationInfo;
-import org.jboss.messaging.core.management.MessageFlowConfigurationInfo;
import org.jboss.messaging.core.management.MessagingServerControlMBean;
import org.jboss.messaging.core.management.TransportConfigurationInfo;
import org.jboss.messaging.core.management.impl.ManagementServiceImpl;
-import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
-import org.jboss.messaging.util.Pair;
/**
* A QueueControlTest
@@ -84,177 +71,10 @@
return control;
}
- public static MessageFlowConfiguration randomMessageFlowConfigurationWithStaticConnectors()
- {
- ArrayList<Pair<String, String>> connectorInfos = new ArrayList<Pair<String, String>>();
- connectorInfos.add(randomPair());
- connectorInfos.add(randomPair());
-
- return new MessageFlowConfiguration(randomString(),
- randomString(),
- randomString(),
- randomBoolean(),
- randomPositiveInt(),
- randomPositiveLong(),
- randomString(),
- randomPositiveLong(),
- randomDouble(),
- randomPositiveInt(),
- randomPositiveInt(),
- randomBoolean(),
- connectorInfos);
- }
-
- public static MessageFlowConfiguration randomMessageFlowConfigurationWithDiscoveryGroup()
- {
- String discoveryGroupName = randomString();
-
- return new MessageFlowConfiguration(randomString(),
- randomString(),
- randomString(),
- randomBoolean(),
- randomPositiveInt(),
- randomPositiveLong(),
- randomString(),
- randomPositiveLong(),
- randomDouble(),
- randomPositiveInt(),
- randomPositiveInt(),
- randomBoolean(),
- discoveryGroupName);
- }
-
- public static DiscoveryGroupConfiguration randomDiscoveryGroupConfiguration()
- {
- return new DiscoveryGroupConfiguration(randomString(), randomString(), randomPositiveInt(), randomPositiveLong());
- }
-
- public static BroadcastGroupConfiguration randomBroadcastGroupConfiguration()
- {
- ArrayList<Pair<String, String>> connectorInfos = new ArrayList<Pair<String, String>>();
- connectorInfos.add(randomPair());
- connectorInfos.add(randomPair());
-
- return new BroadcastGroupConfiguration(randomString(),
- randomString(),
- randomPositiveInt(),
- randomString(),
- randomPositiveInt(),
- randomPositiveLong(),
- connectorInfos);
- }
-
- public static Pair<String, String> randomPair()
- {
- return new Pair<String, String>(randomString(), randomString());
- }
-
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
- public void testGetMessageFlows() throws Exception
- {
- MessageFlowConfiguration flowConfig_1 = randomMessageFlowConfigurationWithDiscoveryGroup();
- MessageFlowConfiguration flowConfig_2 = randomMessageFlowConfigurationWithStaticConnectors();
-
- Configuration conf = new ConfigurationImpl();
- conf.setSecurityEnabled(false);
- conf.setJMXManagementEnabled(true);
- conf.getMessageFlowConfigurations().add(flowConfig_1);
- conf.getMessageFlowConfigurations().add(flowConfig_2);
-
- service = MessagingServiceImpl.newNullStorageMessagingService(conf);
- service.start();
-
- MessagingServerControlMBean serverControl = createServerControl();
- TabularData messageFlowData = serverControl.getMessageFlows();
- assertNotNull(messageFlowData);
- assertEquals(2, messageFlowData.size());
-
- MessageFlowConfiguration[] messageFlowConfigurations = MessageFlowConfigurationInfo.from(messageFlowData);
- assertEquals(2, messageFlowConfigurations.length);
- if (flowConfig_1.getName().equals(messageFlowConfigurations[0].getName()))
- {
- assertEquals(flowConfig_2.getName(), messageFlowConfigurations[1].getName());
- }
- else if (flowConfig_1.getName().equals(messageFlowConfigurations[1].getName()))
- {
- assertEquals(flowConfig_2.getName(), messageFlowConfigurations[0].getName());
- }
- else
- {
- fail("configuration is not identical");
- }
- }
-
- public void testGetDiscoveryGroups() throws Exception
- {
- DiscoveryGroupConfiguration discoveryGroupConfig = randomDiscoveryGroupConfiguration();
-
- Configuration conf = new ConfigurationImpl();
- conf.setSecurityEnabled(false);
- conf.setJMXManagementEnabled(true);
- conf.getDiscoveryGroupConfigurations().put(discoveryGroupConfig.getName(), discoveryGroupConfig);
- service = MessagingServiceImpl.newNullStorageMessagingService(conf);
- service.start();
-
- MessagingServerControlMBean serverControl = createServerControl();
- TabularData discoveryGroupData = serverControl.getDiscoveryGroups();
- assertNotNull(discoveryGroupData);
- assertEquals(1, discoveryGroupData.size());
-
- DiscoveryGroupConfiguration[] discoveryGroupConfigurations = DiscoveryGroupConfigurationInfo.from(discoveryGroupData);
- assertEquals(1, discoveryGroupConfigurations.length);
- assertEquals(discoveryGroupConfig.getName(), discoveryGroupConfigurations[0].getName());
- }
-
- public void testGetBroadcastGroups() throws Exception
- {
- BroadcastGroupConfiguration broadcastGroupConfig = randomBroadcastGroupConfiguration();
-
- Configuration conf = new ConfigurationImpl();
- conf.setSecurityEnabled(false);
- conf.setJMXManagementEnabled(true);
- conf.getBroadcastGroupConfigurations().add(broadcastGroupConfig);
- service = MessagingServiceImpl.newNullStorageMessagingService(conf);
- service.start();
-
- MessagingServerControlMBean serverControl = createServerControl();
- TabularData broadcastGroupData = serverControl.getBroadcastGroups();
- assertNotNull(broadcastGroupData);
- assertEquals(1, broadcastGroupData.size());
-
- BroadcastGroupConfiguration[] broadcastGroupConfigurations = BroadcastGroupConfigurationInfo.from(broadcastGroupData);
- assertEquals(1, broadcastGroupConfigurations.length);
-
- assertEquals(broadcastGroupConfig.getName(), broadcastGroupConfigurations[0].getName());
- }
-
- public void testGetAcceptors() throws Exception
- {
- TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(),
- new HashMap<String, Object>(),
- randomString());
-
- Configuration conf = new ConfigurationImpl();
- conf.setSecurityEnabled(false);
- conf.setJMXManagementEnabled(true);
- conf.getAcceptorConfigurations().add(acceptorConfig);
- service = MessagingServiceImpl.newNullStorageMessagingService(conf);
- service.start();
-
- MessagingServerControlMBean serverControl = createServerControl();
- TabularData acceptorData = serverControl.getAcceptors();
- assertNotNull(acceptorData);
- assertEquals(1, acceptorData.size());
-
- TransportConfiguration[] acceptorConfigurations = TransportConfigurationInfo.from(acceptorData);
- assertEquals(1, acceptorConfigurations.length);
-
- assertEquals(acceptorConfig.getName(), acceptorConfigurations[0].getName());
- }
-
public void testGetConnectors() throws Exception
{
TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(),
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory1.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -55,6 +55,10 @@
{
}
+ public boolean isStarted()
+ {
+ return false;
+ }
}
}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory2.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -55,6 +55,11 @@
{
}
+ public boolean isStarted()
+ {
+ return false;
+ }
+
}
}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java 2008-12-15 09:50:19 UTC (rev 5530)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/remoting/impl/AcceptorFactory3.java 2008-12-15 13:06:08 UTC (rev 5531)
@@ -55,6 +55,11 @@
{
}
+ public boolean isStarted()
+ {
+ return false;
+ }
+
}
}
More information about the jboss-cvs-commits
mailing list