[jboss-cvs] JBoss Messaging SVN: r4697 - in branches/Branch_JBMESSAGING-1303: src/main/org/jboss/messaging/jms/client and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 21 09:32:00 EDT 2008
Author: jmesnil
Date: 2008-07-21 09:32:00 -0400 (Mon, 21 Jul 2008)
New Revision: 4697
Added:
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java
Modified:
branches/Branch_JBMESSAGING-1303/examples/jms/src/org/jboss/jms/example/QueueExample.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/DestinationControlMBean.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSManagementRegistration.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java
branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java
branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java
Log:
JBMESSAGING-1303: Revisit management interfaces
* added mbean to manage JMS ConnectionFactory
* added removeAllMessages() operation to JMS DestinationMBean
Modified: branches/Branch_JBMESSAGING-1303/examples/jms/src/org/jboss/jms/example/QueueExample.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/examples/jms/src/org/jboss/jms/example/QueueExample.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/examples/jms/src/org/jboss/jms/example/QueueExample.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -57,15 +57,17 @@
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(queue);
Message message = session.createTextMessage("This is a text message!");
+ message.setBooleanProperty("foo", true);
+ message.setFloatProperty("bar", 1.0f);
log.info("sending message to queue");
producer.send(message);
- MessageConsumer messageConsumer = session.createConsumer(queue);
- connection.start();
- TextMessage message2 = (TextMessage) messageConsumer.receive(5000);
- log.info("message received from queue");
- log.info("message = " + message2.getText());
+// MessageConsumer messageConsumer = session.createConsumer(queue);
+// connection.start();
+// TextMessage message2 = (TextMessage) messageConsumer.receive(5000);
+// log.info("message received from queue");
+// log.info("message = " + message2.getText());
}
catch (Exception e)
{
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -236,6 +236,16 @@
// Public ---------------------------------------------------------------------------------------
+ public String getClientID()
+ {
+ return clientID;
+ }
+
+ public int getDupsOKBatchSize()
+ {
+ return dupsOKBatchSize;
+ }
+
public String toString()
{
return "JBossConnectionFactory->" + connectionFactory;
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -25,7 +25,9 @@
import java.io.Serializable;
import java.util.List;
+import org.jboss.messaging.jms.JBossDestination;
+
/**
* The JMS Management interface.
*
@@ -204,18 +206,12 @@
// // void removeMessageFromTopic(String topic, String messageId) throws Exception;
/**
- * removes all messages from a particular queue
- * @param queue the name of the queue
+ * removes all messages from a particular destination
+ * @param queue the destination
* @throws Exception if a problem occurred
*/
- void removeAllMessagesForQueue(String queue) throws Exception;
+ void removeAllMessages(JBossDestination destination) throws Exception;
- /**
- * removes all the messages from a topic
- * @param topic the name of the topic
- * @throws Exception if a problem occurred
- */
- void removeAllMessagesForTopic(String topic) throws Exception;
//
// /**
// * moves a message from one queue to another
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerDeployer.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -22,6 +22,9 @@
package org.jboss.messaging.jms.server.impl;
+import java.util.ArrayList;
+import java.util.List;
+
import org.jboss.messaging.core.deployers.DeploymentManager;
import org.jboss.messaging.core.deployers.impl.XmlDeployer;
import org.jboss.messaging.core.logging.Logger;
@@ -148,6 +151,8 @@
}
NodeList children = node.getChildNodes();
+ String name = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
+ List<String> jndiBindings = new ArrayList<String>();
for (int i = 0; i < children.getLength(); i++)
{
Node child = children.item(i);
@@ -155,13 +160,14 @@
if (ENTRY_NODE_NAME.equalsIgnoreCase(children.item(i).getNodeName()))
{
String jndiName = child.getAttributes().getNamedItem("name").getNodeValue();
- String name = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- jmsServerManager.createConnectionFactory(name, clientID, dupsOKBatchSize,
- consumerWindowSize, consumerMaxRate, producerWindowSize, producerMaxRate,
- blockOnAcknowledge, sendNonPersistentMessagesSynchronously,
- sendPersistentMessagesSynchronously, jndiName);
+ jndiBindings.add(jndiName);
}
}
+
+ jmsServerManager.createConnectionFactory(name, clientID, dupsOKBatchSize,
+ consumerWindowSize, consumerMaxRate, producerWindowSize, producerMaxRate,
+ blockOnAcknowledge, sendNonPersistentMessagesSynchronously,
+ sendPersistentMessagesSynchronously, jndiBindings);
}
else if (node.getNodeName().equals(QUEUE_NODE_NAME))
{
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -35,6 +35,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.management.MessagingServerManagement;
import org.jboss.messaging.core.server.Queue;
+import org.jboss.messaging.jms.JBossDestination;
import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.JBossTopic;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
@@ -144,7 +145,7 @@
{
addToDestinationBindings(queueName, jndiBinding);
}
- managementRegistration.registerQueue(jBossQueue, messagingServerManagement.getQueue(jBossQueue.getSimpleAddress()));
+ managementRegistration.registerQueue(jBossQueue, messagingServerManagement.getQueue(jBossQueue.getSimpleAddress()), jndiBinding, this);
return added;
}
@@ -157,7 +158,7 @@
{
addToDestinationBindings(topicName, jndiBinding);
}
- managementRegistration.registerTopic(jBossTopic, messagingServerManagement);
+ managementRegistration.registerTopic(jBossTopic, messagingServerManagement, jndiBinding);
return added;
}
@@ -262,6 +263,7 @@
defaultSendNonPersistentMessagesBlocking,
defaultSendPersistentMessagesBlocking
);
+ connectionFactories.put(name, cf);
}
if (!bindToJndi(jndiBinding, cf))
{
@@ -272,6 +274,11 @@
connectionFactoryBindings.put(name, new ArrayList<String>());
}
connectionFactoryBindings.get(name).add(jndiBinding);
+
+ List<String> bindings = new ArrayList<String>();
+ bindings.add(jndiBinding);
+
+ managementRegistration.registerConnectionFactory(name, cf, bindings);
return true;
}
@@ -303,6 +310,9 @@
}
connectionFactoryBindings.get(name).add(jndiBinding);
}
+
+ managementRegistration.registerConnectionFactory(name, cf, jndiBindings);
+
return true;
}
@@ -319,6 +329,9 @@
}
connectionFactoryBindings.remove(name);
connectionFactories.remove(name);
+
+ managementRegistration.unregisterConnectionFactory(name);
+
return true;
}
@@ -352,18 +365,12 @@
//// {
//// messagingServerManagement.removeMessageForAddress(new JBossTopic(topicName).getAddress(), new FilterImpl("JMSMessageID='" + messageId + "'"));
//// }
-
- public void removeAllMessagesForQueue(String queueName) throws Exception
+
+ public void removeAllMessages(JBossDestination destination) throws Exception
{
- JBossQueue jBossQueue = new JBossQueue(queueName);
- removeAllMessages(jBossQueue);
+ messagingServerManagement.removeAllMessagesForAddress(destination.getSimpleAddress());
}
-
- public void removeAllMessagesForTopic(String topicName) throws Exception
- {
- JBossTopic jBossTopic = new JBossTopic(topicName);
- removeAllMessages(jBossTopic);
- }
+
//
//// public void moveMessage(String fromQueue, String toQueue, String messageId) throws Exception
//// {
@@ -609,16 +616,7 @@
// }
//
//
- private void removeAllMessages(JBossQueue queue) throws Exception
- {
- messagingServerManagement.removeAllMessagesForAddress(queue.getSimpleAddress());
- }
-
- private void removeAllMessages(JBossTopic topic) throws Exception
- {
- messagingServerManagement.removeAllMessagesForAddress(topic.getSimpleAddress());
- }
-
+
private int getMessageCount(JBossQueue queue) throws Exception
{
return messagingServerManagement.getMessageCountForQueue(queue.getSimpleAddress());
Added: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java (rev 0)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -0,0 +1,58 @@
+/*
+ * 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.jms.server.management;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public interface ConnectionFactoryControlMBean
+{
+
+ String getURL();
+
+ List<String> getBindings();
+
+ String getClientID();
+
+ int getDupsOKBatchSize();
+
+ int getDefaultConsumerMaxRate();
+
+ int getDefaultConsumerWindowSize();
+
+ int getDefaultProducerMaxRate();
+
+ int getDefaultProducerWindowSize();
+
+ boolean isDefaultBlockOnAcknowledge();
+
+ boolean isDefaultBlockOnPersistentSend();
+
+ boolean isDefaultBlockOnNonPersistentSend();
+
+}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/DestinationControlMBean.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/DestinationControlMBean.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/DestinationControlMBean.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -30,11 +30,20 @@
*/
public interface DestinationControlMBean
{
+ // Attributes ----------------------------------------------------
+
String getName();
+ String getJNDIBinding();
+
String getAddress();
boolean isTemporary();
int getMessageCount() throws Exception;
+
+ // Operations ----------------------------------------------------
+
+ public void removeAllMessages() throws Exception;
+
}
\ No newline at end of file
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSManagementRegistration.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSManagementRegistration.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSManagementRegistration.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -22,11 +22,15 @@
package org.jboss.messaging.jms.server.management;
+import java.util.List;
+
import org.jboss.messaging.core.management.MessagingServerManagement;
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.JBossTopic;
+import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.jms.server.JMSServerManager;
+import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
@@ -40,11 +44,15 @@
void unregisterJMSServer();
- void registerQueue(JBossQueue queue, Queue coreQueue) throws Exception;
+ void registerQueue(JBossQueue queue, Queue coreQueue, String jndiBinding, JMSServerManager server) throws Exception;
void unregisterQueue(String name) throws Exception;
- void registerTopic(JBossTopic topic, MessagingServerManagement serverManagement) throws Exception;
+ void registerTopic(JBossTopic topic, MessagingServerManagement serverManagement, String jndiBinding) throws Exception;
void unregisterTopic(String name) throws Exception;
+
+ void registerConnectionFactory(String name, JBossConnectionFactory connectionFactory, List<String> bindings) throws Exception;
+
+ void unregisterConnectionFactory(String name) throws Exception;
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -24,8 +24,6 @@
import static javax.management.MBeanOperationInfo.ACTION;
-import java.util.List;
-
import org.jboss.messaging.core.management.Operation;
import org.jboss.messaging.core.management.Parameter;
@@ -141,36 +139,6 @@
throws Exception;
/**
- * Creates a connection factory
- *
- * @param name
- * the name of this connection factory
- * @param clientID
- * the client id
- * @param dupsOKBatchSize
- * the bath size
- * @param consumerWindowSize
- * The consumer window size
- * @param consumerMaxRate
- * the Consumer max rate
- * @param producerWindowSize
- * the producer window size
- * @param producerMaxRate
- * the producer max rate
- * @param jndiBindings
- * the binding names for JNDI
- * @throws Exception
- * if a problem occurred creating the connection factory
- */
- void createConnectionFactory(String name, String clientID,
- int dupsOKBatchSize, int consumerWindowSize, int consumerMaxRate,
- int producerWindowSize, int producerMaxRate,
- boolean blockOnAcknowledge,
- boolean defaultSendNonPersistentMessagesBlocking,
- boolean defaultSendPersistentMessagesBlocking,
- List<String> jndiBindings) throws Exception;
-
- /**
* destroys a connection factory.
*
* @param name
Added: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java (rev 0)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -0,0 +1,129 @@
+/*
+ * 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.jms.server.management.impl;
+
+import java.util.List;
+
+import javax.management.NotCompliantMBeanException;
+import javax.management.StandardMBean;
+
+import org.jboss.messaging.jms.client.JBossConnectionFactory;
+import org.jboss.messaging.jms.server.management.ConnectionFactoryControlMBean;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class ConnectionFactoryControl extends StandardMBean implements
+ ConnectionFactoryControlMBean
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final JBossConnectionFactory managedCF;
+ private final List<String> bindings;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ConnectionFactoryControl(JBossConnectionFactory cf, List<String> bindings)
+ throws NotCompliantMBeanException
+ {
+ super(ConnectionFactoryControlMBean.class);
+ this.managedCF = cf;
+ this.bindings = bindings;
+ }
+
+ // Public --------------------------------------------------------
+
+ // ManagedConnectionFactoryMBean implementation ------------------
+
+ public String getURL()
+ {
+ return managedCF.getCoreConnection().getLocation().toString();
+ }
+
+ public List<String> getBindings()
+ {
+ return bindings;
+ }
+
+ public String getClientID()
+ {
+ return managedCF.getClientID();
+ }
+
+ public int getDefaultConsumerMaxRate()
+ {
+ return managedCF.getCoreConnection().getDefaultConsumerMaxRate();
+ }
+
+ public int getDefaultConsumerWindowSize()
+ {
+ return managedCF.getCoreConnection().getDefaultConsumerWindowSize();
+ }
+
+ public int getDefaultProducerMaxRate()
+ {
+ return managedCF.getCoreConnection().getDefaultProducerMaxRate();
+ }
+
+ public int getDefaultProducerWindowSize()
+ {
+ return managedCF.getCoreConnection().getDefaultProducerWindowSize();
+ }
+
+ public int getDupsOKBatchSize()
+ {
+ return managedCF.getDupsOKBatchSize();
+ }
+
+ public boolean isDefaultBlockOnAcknowledge()
+ {
+ return managedCF.getCoreConnection().isDefaultBlockOnAcknowledge();
+ }
+
+ public boolean isDefaultBlockOnNonPersistentSend()
+ {
+ return managedCF.getCoreConnection().isDefaultBlockOnNonPersistentSend();
+ }
+
+ public boolean isDefaultBlockOnPersistentSend()
+ {
+ return managedCF.getCoreConnection().isDefaultBlockOnPersistentSend();
+ }
+
+
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -22,6 +22,8 @@
package org.jboss.messaging.jms.server.management.impl;
+import java.util.List;
+
import javax.management.MBeanServer;
import javax.management.ObjectName;
@@ -30,6 +32,7 @@
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.jms.JBossQueue;
import org.jboss.messaging.jms.JBossTopic;
+import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.jms.server.JMSServerManager;
import org.jboss.messaging.jms.server.management.JMSManagementRegistration;
@@ -47,7 +50,6 @@
// Attributes ----------------------------------------------------
public MBeanServer mbeanServer;
- private JMSServerManager jmsServer;
// Static --------------------------------------------------------
@@ -69,6 +71,13 @@
+ ":module=JMS,type=Topic,name=" + name.toString());
}
+ private ObjectName getConnectionFactoryObjectName(String name)
+ throws Exception
+ {
+ return ObjectName.getInstance(ManagementRegistrationImpl.DOMAIN
+ + ":module=JMS,type=ConnectionFactory,name=" + name);
+ }
+
// Constructors --------------------------------------------------
public JMSManagementRegistrationImpl(MBeanServer mbeanServer)
@@ -87,7 +96,6 @@
{
mbeanServer.unregisterMBean(objectName);
}
- this.jmsServer = server;
mbeanServer.registerMBean(new JMSServerControl(server), objectName);
}
@@ -96,17 +104,17 @@
// TODO Auto-generated method stub
}
-
- public void registerQueue(JBossQueue queue, Queue coreQueue)
- throws Exception
+
+ public void registerQueue(JBossQueue queue, Queue coreQueue,
+ String jndiBinding, JMSServerManager server) throws Exception
{
ObjectName objectName = getJMSQueueObjectName(queue.getQueueName());
if (mbeanServer.isRegistered(objectName))
{
mbeanServer.unregisterMBean(objectName);
}
- mbeanServer.registerMBean(new JMSQueueControl(queue, coreQueue),
- getJMSQueueObjectName(queue.getQueueName()));
+ mbeanServer.registerMBean(new JMSQueueControl(queue, coreQueue,
+ jndiBinding, server), getJMSQueueObjectName(queue.getQueueName()));
}
public void unregisterQueue(String name) throws Exception
@@ -115,14 +123,16 @@
}
public void registerTopic(JBossTopic topic,
- MessagingServerManagement serverManagement) throws Exception
+ MessagingServerManagement serverManagement, String jndiBinding)
+ throws Exception
{
ObjectName objectName = getJMSTopicObjectName(topic.getTopicName());
if (mbeanServer.isRegistered(objectName))
{
mbeanServer.unregisterMBean(objectName);
}
- mbeanServer.registerMBean(new TopicControl(topic, serverManagement), objectName);
+ mbeanServer.registerMBean(new TopicControl(topic, serverManagement,
+ jndiBinding), objectName);
}
public void unregisterTopic(String name) throws Exception
@@ -130,6 +140,21 @@
mbeanServer.unregisterMBean(getJMSTopicObjectName(name));
}
+ public void registerConnectionFactory(String name,
+ JBossConnectionFactory connectionFactory, List<String> bindings)
+ throws Exception
+ {
+ ObjectName objectName = getConnectionFactoryObjectName(name);
+ mbeanServer.registerMBean(new ConnectionFactoryControl(connectionFactory,
+ bindings), objectName);
+ }
+
+ public void unregisterConnectionFactory(String name) throws Exception
+ {
+ ObjectName objectName = getConnectionFactoryObjectName(name);
+ mbeanServer.unregisterMBean(objectName);
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -27,6 +27,7 @@
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.jms.JBossQueue;
+import org.jboss.messaging.jms.server.JMSServerManager;
import org.jboss.messaging.jms.server.management.JMSQueueControlMBean;
/**
@@ -44,16 +45,20 @@
private final JBossQueue managedQueue;
private Queue coreQueue;
+ private final String binding;
+ private JMSServerManager server;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public JMSQueueControl(JBossQueue queue, Queue coreQueue) throws NotCompliantMBeanException
+ public JMSQueueControl(JBossQueue queue, Queue coreQueue, String jndiBinding, JMSServerManager server) throws NotCompliantMBeanException
{
super(JMSQueueControlMBean.class);
this.managedQueue = queue;
this.coreQueue = coreQueue;
+ this.binding = jndiBinding;
+ this.server = server;
}
// Public --------------------------------------------------------
@@ -79,7 +84,17 @@
{
return coreQueue.getMessageCount();
}
+
+ public String getJNDIBinding()
+ {
+ return binding;
+ }
+ public void removeAllMessages() throws Exception
+ {
+ server.removeAllMessages(managedQueue);
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -22,6 +22,7 @@
package org.jboss.messaging.jms.server.management.impl;
+import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
@@ -82,18 +83,20 @@
boolean defaultSendPersistentMessagesBlocking, String jndiBinding)
throws Exception
{
+ List<String> bindings = new ArrayList<String>();
+ bindings.add(jndiBinding);
+
+ boolean created = server.createConnectionFactory(name, clientID, dupsOKBatchSize,
+ consumerWindowSize, consumerMaxRate, producerWindowSize,
+ producerMaxRate, blockOnAcknowledge,
+ defaultSendNonPersistentMessagesBlocking,
+ defaultSendPersistentMessagesBlocking, bindings);
+ if (created)
+ {
+ sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
+ }
}
- public void createConnectionFactory(String name, String clientID,
- int dupsOKBatchSize, int consumerWindowSize, int consumerMaxRate,
- int producerWindowSize, int producerMaxRate,
- boolean blockOnAcknowledge,
- boolean defaultSendNonPersistentMessagesBlocking,
- boolean defaultSendPersistentMessagesBlocking,
- List<String> jndiBindings) throws Exception
- {
- }
-
public boolean createQueue(String name, String jndiBinding) throws Exception
{
boolean created = server.createQueue(name, jndiBinding);
@@ -137,7 +140,11 @@
public void destroyConnectionFactory(String name) throws Exception
{
- // TODO Auto-generated method stub
+ boolean destroyed = server.destroyConnectionFactory(name);
+ if (destroyed)
+ {
+ sendNotification(NotificationType.CONNECTION_FACTORY_DESTROYED, name);
+ }
}
public boolean isStarted()
@@ -216,6 +223,6 @@
private enum NotificationType
{
- QUEUE_CREATED, QUEUE_DESTROYED, TOPIC_CREATED, TOPIC_DESTROYED;
+ QUEUE_CREATED, QUEUE_DESTROYED, TOPIC_CREATED, TOPIC_DESTROYED, CONNECTION_FACTORY_CREATED, CONNECTION_FACTORY_DESTROYED;
}
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -55,17 +55,19 @@
private final JBossTopic managedTopic;
private final MessagingServerManagement server;
+ private final String binding;
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- public TopicControl(JBossTopic topic, MessagingServerManagement server)
+ public TopicControl(JBossTopic topic, MessagingServerManagement server, String jndiBinding)
throws NotCompliantMBeanException
{
super(TopicControlMBean.class);
this.managedTopic = topic;
this.server = server;
+ this.binding = jndiBinding;
}
// Public --------------------------------------------------------
@@ -105,6 +107,11 @@
return managedTopic.getAddress();
}
+ public String getJNDIBinding()
+ {
+ return binding;
+ }
+
public int getMessageCount()
{
return getMessageCount(DurabilityType.ALL);
@@ -165,6 +172,11 @@
return listSubscribersInfos(DurabilityType.NON_DURABLE);
}
+ public void removeAllMessages() throws Exception
+ {
+ server.removeAllMessagesForAddress(managedTopic.getSimpleAddress());
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/JBMServerTestCase.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -38,11 +38,11 @@
import javax.transaction.TransactionManager;
import org.jboss.messaging.core.security.Role;
-import org.jboss.messaging.core.server.ConnectionManager;
import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.jms.JBossQueue;
+import org.jboss.messaging.jms.JBossTopic;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.jms.server.JMSServerManager;
-import org.jboss.messaging.microcontainer.JBMBootstrapServer;
import org.jboss.test.messaging.tools.ServerManagement;
import org.jboss.test.messaging.tools.container.DatabaseClearer;
import org.jboss.test.messaging.tools.container.Server;
@@ -586,11 +586,11 @@
{
if (isQueue)
{
- servers.get(server).removeAllMessagesForQueue(destName);
+ servers.get(server).removeAllMessages(new JBossQueue(destName));
}
else
{
- servers.get(server).removeAllMessagesForTopic(destName);
+ servers.get(server).removeAllMessages(new JBossTopic(destName));
}
}
Modified: branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -43,6 +43,9 @@
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.settings.impl.QueueSettings;
+import org.jboss.messaging.jms.JBossDestination;
+import org.jboss.messaging.jms.JBossQueue;
+import org.jboss.messaging.jms.JBossTopic;
import org.jboss.messaging.jms.server.JMSServerManager;
import org.jboss.messaging.microcontainer.JBMBootstrapServer;
import org.jboss.messaging.util.SimpleString;
@@ -633,17 +636,11 @@
return getJMSServerManager().getMessageCountForQueue(queueName);
}
- public void removeAllMessagesForQueue(String destName) throws Exception
+ public void removeAllMessages(JBossDestination destination) throws Exception
{
- getJMSServerManager().removeAllMessagesForQueue(destName);
+ getJMSServerManager().removeAllMessages(destination);
}
- public void removeAllMessagesForTopic(String destName) throws Exception
- {
- getJMSServerManager().removeAllMessagesForTopic(destName);
- }
-
-
public List listAllSubscriptionsForTopic(String s) throws Exception
{
return getJMSServerManager().listSubscriptions(s);
Modified: branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -40,6 +40,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.jms.JBossDestination;
import org.jboss.messaging.jms.server.JMSServerManager;
/**
@@ -450,17 +451,11 @@
return server.getJMSServerManager();
}
- public void removeAllMessagesForQueue(String destName) throws Exception
+ public void removeAllMessages(JBossDestination destination) throws Exception
{
- server.removeAllMessagesForQueue(destName);
+ server.removeAllMessages(destination);
}
- public void removeAllMessagesForTopic(String destName) throws Exception
- {
- server.removeAllMessagesForTopic(destName);
- }
-
-
public Integer getMessageCountForQueue(String queueName) throws Exception
{
return getJMSServerManager().getMessageCountForQueue(queueName);
Modified: branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java 2008-07-21 13:24:13 UTC (rev 4696)
+++ branches/Branch_JBMESSAGING-1303/tests/jms-tests/src/org/jboss/test/messaging/tools/container/Server.java 2008-07-21 13:32:00 UTC (rev 4697)
@@ -34,6 +34,7 @@
import org.jboss.kernel.spi.deployment.KernelDeployment;
import org.jboss.messaging.core.security.Role;
import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.jms.JBossDestination;
import org.jboss.messaging.jms.server.JMSServerManager;
/**
@@ -254,10 +255,8 @@
InitialContext getInitialContext() throws Exception;
- void removeAllMessagesForQueue(String destName) throws Exception;
+ void removeAllMessages(JBossDestination destination) throws Exception;
- void removeAllMessagesForTopic(String destName) throws Exception;
-
Integer getMessageCountForQueue(String queueName) throws Exception;
List listAllSubscriptionsForTopic(String s) throws Exception;
More information about the jboss-cvs-commits
mailing list