[hornetq-commits] JBoss hornetq SVN: r8967 - in branches/Clebert_TMP: src/main/org/hornetq/jms/management/impl and 14 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Mar 26 01:08:40 EDT 2010
Author: clebert.suconic at jboss.com
Date: 2010-03-26 01:08:39 -0400 (Fri, 26 Mar 2010)
New Revision: 8967
Added:
branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedJNDI.java
branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedType.java
Modified:
branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java
branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/DestinationControl.java
branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java
branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSServerControl.java
branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java
branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java
branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java
branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/JMSStorageManager.java
branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedDestination.java
branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/journal/JournalJMSStorageManagerImpl.java
branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
branches/Clebert_TMP/src/main/org/hornetq/jms/server/JMSServerManager.java
branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
branches/Clebert_TMP/src/main/org/hornetq/jms/server/management/JMSManagementService.java
branches/Clebert_TMP/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
branches/Clebert_TMP/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java
branches/Clebert_TMP/tests/src/org/hornetq/tests/util/JMSTestBase.java
Log:
implementing jndi bindings & adding methods to the server manager
Modified: branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/ConnectionFactoryControl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -38,11 +38,6 @@
String getName();
/**
- * Returns the JNDI bindings associated to this connection factory.
- */
- List<String> getBindings();
-
- /**
* Returns the Client ID of this connection factory (or {@code null} if it is not set.
*/
String getClientID();
Modified: branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/DestinationControl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/DestinationControl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/DestinationControl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -33,11 +33,6 @@
String getName();
/**
- * Returns the JNDI binding of this destination.
- */
- String getJNDIBinding();
-
- /**
* Returns the HornetQ address corresponding to this destination.
*/
String getAddress();
Modified: branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -75,6 +75,12 @@
String getSelector();
// Operations ----------------------------------------------------
+
+ /**
+ * Add the JNDI binding to this destination
+ */
+ @Operation(desc = "Adds the queue to another binding")
+ void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception;
/**
* Lists all the JMS messages in this queue matching the specified filter.
Modified: branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSServerControl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSServerControl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/api/jms/management/JMSServerControl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -69,8 +69,7 @@
* @return {@code true} if the queue was created, {@code false} else
*/
@Operation(desc = "Create a JMS Queue", impact = MBeanOperationInfo.ACTION)
- boolean createQueue(@Parameter(name = "name", desc = "Name of the queue to create") String name,
- @Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndiBinding) throws Exception;
+ boolean createQueue(@Parameter(name = "name", desc = "Name of the queue to create") String name) throws Exception;
/**
* Destroys a JMS Queue with the specified name.
@@ -86,8 +85,7 @@
* @return {@code true} if the topic was created, {@code false} else
*/
@Operation(desc = "Create a JMS Topic", impact = MBeanOperationInfo.ACTION)
- boolean createTopic(@Parameter(name = "name", desc = "Name of the topic to create") String name,
- @Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndiBinding) throws Exception;
+ boolean createTopic(@Parameter(name = "name", desc = "Name of the topic to create") String name) throws Exception;
/**
* Destroys a JMS Topic with the specified name.
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSConnectionFactoryControlImpl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -21,10 +21,9 @@
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.ClientSessionFactory;
-import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.api.jms.management.ConnectionFactoryControl;
import org.hornetq.core.management.impl.MBeanInfoHelper;
+import org.hornetq.jms.client.HornetQConnectionFactory;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
@@ -40,8 +39,6 @@
private final HornetQConnectionFactory cf;
- private final List<String> bindings;
-
private final String name;
// Static --------------------------------------------------------
@@ -49,24 +46,17 @@
// Constructors --------------------------------------------------
public JMSConnectionFactoryControlImpl(final HornetQConnectionFactory cf,
- final String name,
- final List<String> bindings) throws NotCompliantMBeanException
+ final String name) throws NotCompliantMBeanException
{
super(ConnectionFactoryControl.class);
this.cf = cf;
this.name = name;
- this.bindings = bindings;
}
// Public --------------------------------------------------------
// ManagedConnectionFactoryMBean implementation ------------------
- public List<String> getBindings()
- {
- return bindings;
- }
-
public String getClientID()
{
return cf.getClientID();
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -30,6 +30,7 @@
import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.jms.client.HornetQMessage;
import org.hornetq.jms.client.SelectorTranslator;
+import org.hornetq.jms.server.JMSServerManager;
import org.hornetq.utils.json.JSONArray;
import org.hornetq.utils.json.JSONObject;
@@ -48,11 +49,11 @@
// Attributes ----------------------------------------------------
private final HornetQDestination managedQueue;
+
+ private final JMSServerManager jmsServerManager;
private final QueueControl coreQueueControl;
- private final String binding;
-
private final MessageCounter counter;
// Static --------------------------------------------------------
@@ -85,13 +86,13 @@
public JMSQueueControlImpl(final HornetQDestination managedQueue,
final QueueControl coreQueueControl,
- final String jndiBinding,
+ final JMSServerManager jmsServerManager,
final MessageCounter counter) throws Exception
{
super(JMSQueueControl.class);
this.managedQueue = managedQueue;
+ this.jmsServerManager = jmsServerManager;
this.coreQueueControl = coreQueueControl;
- binding = jndiBinding;
this.counter = counter;
}
@@ -144,11 +145,6 @@
return coreQueueControl.isDurable();
}
- public String getJNDIBinding()
- {
- return binding;
- }
-
public String getDeadLetterAddress()
{
return coreQueueControl.getDeadLetterAddress();
@@ -169,6 +165,16 @@
coreQueueControl.setExpiryAddress(expiryAddres);
}
+ /* (non-Javadoc)
+ * @see org.hornetq.api.jms.management.JMSQueueControl#addJNDI(java.lang.String)
+ */
+ public void addJNDI(String jndi) throws Exception
+ {
+ jmsServerManager.addQueueToJndi(managedQueue.getName(), jndi);
+ }
+
+
+
public boolean removeMessage(final String messageID) throws Exception
{
String filter = JMSQueueControlImpl.createFilterForJMSMessageID(messageID);
@@ -355,7 +361,7 @@
MBeanInfoHelper.getMBeanOperationsInfo(JMSQueueControl.class),
info.getNotifications());
}
-
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -227,9 +227,9 @@
}
- public boolean createQueue(final String name, final String jndiBinding) throws Exception
+ public boolean createQueue(final String name) throws Exception
{
- boolean created = server.createQueue(name, jndiBinding, null, true);
+ boolean created = server.createQueue(name, null, true);
if (created)
{
sendNotification(NotificationType.QUEUE_CREATED, name);
@@ -247,9 +247,9 @@
return destroyed;
}
- public boolean createTopic(final String topicName, final String jndiBinding) throws Exception
+ public boolean createTopic(final String topicName) throws Exception
{
- boolean created = server.createTopic(topicName, jndiBinding);
+ boolean created = server.createTopic(topicName);
if (created)
{
sendNotification(NotificationType.TOPIC_CREATED, topicName);
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/management/impl/JMSTopicControlImpl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -53,8 +53,6 @@
private final HornetQDestination managedTopic;
- private final String binding;
-
private final AddressControl addressControl;
private final ManagementService managementService;
@@ -71,13 +69,11 @@
public JMSTopicControlImpl(final HornetQDestination topic,
final AddressControl addressControl,
- final String jndiBinding,
final ManagementService managementService) throws Exception
{
super(TopicControl.class);
managedTopic = topic;
this.addressControl = addressControl;
- binding = jndiBinding;
this.managementService = managementService;
}
@@ -98,11 +94,6 @@
return managedTopic.getAddress();
}
- public String getJNDIBinding()
- {
- return binding;
- }
-
public int getMessageCount()
{
return getMessageCount(DurabilityType.ALL);
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/JMSStorageManager.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/JMSStorageManager.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/JMSStorageManager.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -16,7 +16,6 @@
import java.util.List;
import org.hornetq.core.server.HornetQComponent;
-import org.hornetq.jms.persistence.impl.PersistedJNDIBinding;
/**
* A JMSPersistence
@@ -40,7 +39,7 @@
void storeDestination(PersistedDestination destination) throws Exception;
- void deleteDestination(String name) throws Exception;
+ void deleteDestination(PersistedType type, String name) throws Exception;
List<PersistedDestination> recoverDestinations();
@@ -58,5 +57,11 @@
// Inner classes -------------------------------------------------
- void storeJndiBinding(PersistedJNDIBinding persistedJNDIBinding);
+ void addJNDI(PersistedType type, String name, String address) throws Exception;
+
+ List<PersistedJNDI> recoverPersistedJNDI() throws Exception;
+
+ void deleteJNDI(PersistedType type, String name, String address) throws Exception;
+
+ void deleteJNDI(PersistedType type, String name) throws Exception;
}
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedDestination.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedDestination.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedDestination.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -15,7 +15,6 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.journal.EncodingSupport;
-import org.hornetq.jms.persistence.impl.DestinationType;
import org.hornetq.utils.BufferHelper;
import org.hornetq.utils.DataConstants;
@@ -34,12 +33,10 @@
private long id;
- private DestinationType type;
+ private PersistedType type;
private String name;
- private String jndiBinding;
-
private String selector;
private boolean durable;
@@ -50,17 +47,16 @@
public PersistedDestination()
{
}
-
- public PersistedDestination(final DestinationType type, final String name, final String jndiBinding)
+
+ public PersistedDestination(final PersistedType type, final String name)
{
- this(type, name, jndiBinding, null, false);
+ this(type, name, null, true);
}
- public PersistedDestination(final DestinationType type, final String name, final String jndiBinding, final String selector, final boolean durable)
+ public PersistedDestination(final PersistedType type, final String name, final String selector, final boolean durable)
{
this.type = type;
this.name = name;
- this.jndiBinding = jndiBinding;
this.selector = selector;
this.durable = durable;
}
@@ -90,13 +86,8 @@
return name;
}
- public String getJndiBinding()
+ public PersistedType getType()
{
- return jndiBinding;
- }
-
- public DestinationType getType()
- {
return type;
}
@@ -112,27 +103,24 @@
public int getEncodeSize()
{
- return DataConstants.SIZE_INT +
+ return DataConstants.SIZE_BYTE +
BufferHelper.sizeOfSimpleString(name) +
- BufferHelper.sizeOfSimpleString(jndiBinding) +
BufferHelper.sizeOfNullableSimpleString(selector) +
DataConstants.SIZE_BOOLEAN;
}
public void encode(final HornetQBuffer buffer)
{
- buffer.writeInt(type.getType());
+ buffer.writeByte(type.getType());
buffer.writeString(name);
- buffer.writeString(jndiBinding);
buffer.writeNullableString(selector);
buffer.writeBoolean(durable);
}
public void decode(final HornetQBuffer buffer)
{
- type = DestinationType.getType(buffer.readInt());
+ type = PersistedType.getType(buffer.readByte());
name = buffer.readString();
- jndiBinding = buffer.readString();
selector = buffer.readNullableString();
durable = buffer.readBoolean();
}
Added: branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedJNDI.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedJNDI.java (rev 0)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedJNDI.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.jms.persistence;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hornetq.api.core.HornetQBuffer;
+import org.hornetq.core.journal.EncodingSupport;
+import org.hornetq.utils.BufferHelper;
+import org.hornetq.utils.DataConstants;
+
+/**
+ * A PersistedJNDI
+ *
+ * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class PersistedJNDI implements EncodingSupport
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private long id;
+
+ private PersistedType type;
+
+ private String name;
+
+ private ArrayList<String> jndi = new ArrayList<String>();
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public PersistedJNDI()
+ {
+ }
+
+ /**
+ * @param type
+ * @param name
+ */
+ public PersistedJNDI(PersistedType type, String name)
+ {
+ super();
+ this.type = type;
+ this.name = name;
+ }
+
+ // Public --------------------------------------------------------
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#decode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void decode(HornetQBuffer buffer)
+ {
+ type = PersistedType.getType(buffer.readByte());
+ name = buffer.readSimpleString().toString();
+ int jndiArraySize = buffer.readInt();
+ jndi = new ArrayList<String>(jndiArraySize);
+
+ for (int i = 0 ; i < jndiArraySize; i++)
+ {
+ jndi.add(buffer.readSimpleString().toString());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#encode(org.hornetq.api.core.HornetQBuffer)
+ */
+ public void encode(HornetQBuffer buffer)
+ {
+ buffer.writeByte(type.getType());
+ BufferHelper.writeAsSimpleString(buffer, name);
+ buffer.writeInt(jndi.size());
+ for (String jndiEl : jndi)
+ {
+ BufferHelper.writeAsSimpleString(buffer, jndiEl);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.journal.EncodingSupport#getEncodeSize()
+ */
+ public int getEncodeSize()
+ {
+ return DataConstants.SIZE_BYTE +
+ BufferHelper.sizeOfSimpleString(name) +
+ sizeOfJNDI();
+ }
+
+ private int sizeOfJNDI()
+ {
+ int size = DataConstants.SIZE_INT; // for the number of elements written
+
+ for (String str : jndi)
+ {
+ size += BufferHelper.sizeOfSimpleString(str);
+ }
+
+ return size;
+ }
+
+ /**
+ * @return the id
+ */
+ public long getId()
+ {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(long id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * @return the type
+ */
+ public PersistedType getType()
+ {
+ return type;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @return the jndi
+ */
+ public List<String> getJndi()
+ {
+ return jndi;
+ }
+
+ public void addJNDI(String address)
+ {
+ jndi.add(address);
+ }
+
+ public void deleteJNDI(String address)
+ {
+ jndi.remove(address);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedType.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedType.java (rev 0)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/PersistedType.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.jms.persistence;
+
+/**
+ * A PersistedType
+ *
+ * @author <mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public enum PersistedType
+{
+ ConnectionFactory, Topic, Queue;
+
+ public byte getType()
+ {
+ switch (this)
+ {
+ case ConnectionFactory: return 0;
+ case Topic: return 1;
+ case Queue: return 2;
+ default: return -1;
+ }
+ }
+
+ public static PersistedType getType(byte type)
+ {
+ switch (type)
+ {
+ case 0: return ConnectionFactory;
+ case 1: return Topic;
+ case 2: return Queue;
+ default: return null;
+ }
+ }
+}
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/journal/JournalJMSStorageManagerImpl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/journal/JournalJMSStorageManagerImpl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/journal/JournalJMSStorageManagerImpl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -21,6 +21,7 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
+import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.journal.Journal;
@@ -35,6 +36,8 @@
import org.hornetq.jms.persistence.JMSStorageManager;
import org.hornetq.jms.persistence.PersistedConnectionFactory;
import org.hornetq.jms.persistence.PersistedDestination;
+import org.hornetq.jms.persistence.PersistedJNDI;
+import org.hornetq.jms.persistence.PersistedType;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
import org.hornetq.utils.IDGenerator;
@@ -54,6 +57,8 @@
private final byte DESTINATION_RECORD = 2;
+ private final byte JNDI_RECORD = 3;
+
// Attributes ----------------------------------------------------
private final IDGenerator idGenerator;
@@ -68,7 +73,9 @@
private Map<String, PersistedConnectionFactory> mapFactories = new ConcurrentHashMap<String, PersistedConnectionFactory>();
- private Map<String, PersistedDestination> destinations = new ConcurrentHashMap<String, PersistedDestination>();
+ private Map<Pair<PersistedType, String>, PersistedDestination> destinations = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedDestination>();
+
+ private Map<Pair<PersistedType, String>, PersistedJNDI> mapJNDI = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedJNDI>();
// Static --------------------------------------------------------
@@ -162,20 +169,106 @@
*/
public void storeDestination(final PersistedDestination destination) throws Exception
{
- deleteDestination(destination.getName());
+ deleteDestination(destination.getType(), destination.getName());
long id = idGenerator.generateID();
destination.setId(id);
jmsJournal.appendAddRecord(id, DESTINATION_RECORD, destination, true);
- destinations.put(destination.getName(), destination);
+ destinations.put(new Pair<PersistedType, String>(destination.getType(), destination.getName()), destination);
}
+
+ public List<PersistedJNDI> recoverPersistedJNDI() throws Exception
+ {
+ ArrayList<PersistedJNDI> list = new ArrayList<PersistedJNDI>();
+
+ list.addAll(mapJNDI.values());
+
+ return list;
+ }
+
+ public void addJNDI(PersistedType type, String name, String address) throws Exception
+ {
+ Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
- public void deleteDestination(final String name) throws Exception
+ long tx = idGenerator.generateID();
+
+ PersistedJNDI currentJNDI = mapJNDI.get(key);
+ if (currentJNDI != null)
+ {
+ jmsJournal.appendDeleteRecordTransactional(tx, currentJNDI.getId());
+ }
+ else
+ {
+ currentJNDI = new PersistedJNDI(type, name);
+ }
+
+ currentJNDI.addJNDI(address);
+
+ long newId = idGenerator.generateID();
+
+ currentJNDI.setId(newId);
+
+ jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, currentJNDI);
+
+ jmsJournal.appendCommitRecord(tx, true);
+ }
+
+ public void deleteJNDI(PersistedType type, String name, String address) throws Exception
{
- PersistedDestination destination = destinations.get(name);
+ Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
+
+ long tx = idGenerator.generateID();
+
+ PersistedJNDI currentJNDI = mapJNDI.get(key);
+ if (currentJNDI == null)
+ {
+ return;
+ }
+ else
+ {
+ jmsJournal.appendDeleteRecordTransactional(tx, currentJNDI.getId());
+ }
+
+ currentJNDI.deleteJNDI(address);
+
+ if (currentJNDI.getJndi().size() == 0)
+ {
+ mapJNDI.remove(key);
+ }
+ else
+ {
+ long newId = idGenerator.generateID();
+ currentJNDI.setId(newId);
+ jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, currentJNDI);
+ }
+
+ jmsJournal.appendCommitRecord(tx, true);
+ }
+
+
+ public void deleteJNDI(PersistedType type, String name) throws Exception
+ {
+ Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
+
+ PersistedJNDI currentJNDI = mapJNDI.remove(key);
+
+ if (currentJNDI == null)
+ {
+ return;
+ }
+ else
+ {
+ jmsJournal.appendDeleteRecord(currentJNDI.getId(), true);
+ }
+ }
+
+ public void deleteDestination(final PersistedType type, final String name) throws Exception
+ {
+ PersistedDestination destination = destinations.get(new Pair<PersistedType, String>(type, name));
if(destination != null)
{
jmsJournal.appendDeleteRecord(destination.getId(), false);
}
+ deleteJNDI(type, name);
}
/* (non-Javadoc)
@@ -247,8 +340,16 @@
PersistedDestination destination = new PersistedDestination();
destination.decode(buffer);
destination.setId(id);
- destinations.put(destination.getName(), destination);
+ destinations.put(new Pair<PersistedType, String>(destination.getType(), destination.getName()), destination);
}
+ else if (rec == JNDI_RECORD)
+ {
+ PersistedJNDI jndi = new PersistedJNDI();
+ jndi.decode(buffer);
+ jndi.setId(id);
+ Pair<PersistedType, String> key = new Pair<PersistedType, String>(jndi.getType(), jndi.getName());
+ mapJNDI.put(key, jndi);
+ }
else
{
throw new IllegalStateException("Invalid record type " + rec);
@@ -278,6 +379,7 @@
}
}
+
// Inner classes -------------------------------------------------
}
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -19,6 +19,8 @@
import org.hornetq.jms.persistence.JMSStorageManager;
import org.hornetq.jms.persistence.PersistedConnectionFactory;
import org.hornetq.jms.persistence.PersistedDestination;
+import org.hornetq.jms.persistence.PersistedJNDI;
+import org.hornetq.jms.persistence.PersistedType;
/**
* A NullJMSStorageManagerImpl
@@ -98,6 +100,47 @@
{
}
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#addJNDI(org.hornetq.jms.persistence.PersistedType, java.lang.String, java.lang.String)
+ */
+ public void addJNDI(PersistedType type, String name, String address) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#deleteJNDI(org.hornetq.jms.persistence.PersistedType, java.lang.String, java.lang.String)
+ */
+ public void deleteJNDI(PersistedType type, String name, String address) throws Exception
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#deleteDestination(org.hornetq.jms.persistence.PersistedType, java.lang.String)
+ */
+ public void deleteDestination(PersistedType type, String name) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#deleteJNDI(org.hornetq.jms.persistence.PersistedType, java.lang.String)
+ */
+ public void deleteJNDI(PersistedType type, String name) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.persistence.JMSStorageManager#recoverPersistedJNDI()
+ */
+ public List<PersistedJNDI> recoverPersistedJNDI() throws Exception
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/server/JMSServerManager.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -49,8 +49,6 @@
*
* @param queueName
* The name of the queue to create
- * @param jndiBinding
- * the name of the binding for JNDI
* @param selectorString
* @param durable
* @return true if the queue is created or if it existed and was added to
@@ -58,7 +56,9 @@
* @throws Exception
* if problems were encountered creating the queue.
*/
- boolean createQueue(String queueName, String jndiBinding, String selectorString, boolean durable) throws Exception;
+ boolean createQueue(String queueName, String selectorString, boolean durable, String ...jndi) throws Exception;
+
+ boolean addQueueToJndi(final String queueName, final String jndiBinding) throws Exception;
/**
* Creates a JMS Topic
@@ -72,10 +72,10 @@
* @throws Exception
* if a problem occurred creating the topic
*/
- boolean createTopic(String topicName, String jndiBinding) throws Exception;
+ boolean createTopic(String topicName, String ... jndi) throws Exception;
/**
- * Remove the destination from JNDI.
+ * Remove the topic from JNDI.
* Calling this method does <em>not</em> destroy the destination.
*
* @param name
@@ -84,9 +84,45 @@
* @throws Exception
* if a problem occurred removing the destination
*/
- boolean undeployDestination(String name) throws Exception;
+ boolean removeTopicFromJNDI(String name, String jndi) throws Exception;
/**
+ * Remove the topic from JNDI.
+ * Calling this method does <em>not</em> destroy the destination.
+ *
+ * @param name
+ * the name of the destination to remove from JNDI
+ * @return true if removed
+ * @throws Exception
+ * if a problem occurred removing the destination
+ */
+ boolean removeTopicFromJNDI(String name) throws Exception;
+
+ /**
+ * Remove the queue from JNDI.
+ * Calling this method does <em>not</em> destroy the destination.
+ *
+ * @param name
+ * the name of the destination to remove from JNDI
+ * @return true if removed
+ * @throws Exception
+ * if a problem occurred removing the destination
+ */
+ boolean removeQueueFromJNDI(String name, String jndi) throws Exception;
+
+ /**
+ * Remove the queue from JNDI.
+ * Calling this method does <em>not</em> destroy the destination.
+ *
+ * @param name
+ * the name of the destination to remove from JNDI
+ * @return true if removed
+ * @throws Exception
+ * if a problem occurred removing the destination
+ */
+ boolean removeQueueFromJNDI(String name) throws Exception;
+
+ /**
* destroys a queue and removes it from JNDI
*
* @param name
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -13,8 +13,6 @@
package org.hornetq.jms.server.impl;
-import java.util.ArrayList;
-
import org.hornetq.core.config.Configuration;
import org.hornetq.core.deployers.DeploymentManager;
import org.hornetq.core.deployers.impl.XmlDeployer;
@@ -39,7 +37,7 @@
private final JMSServerConfigParser parser;
- private final JMSServerManager jmsServerControl;
+ private final JMSServerManager jmsServerManager;
protected static final String CONNECTOR_REF_ELEMENT = "connector-ref";
@@ -67,7 +65,7 @@
{
super(deploymentManager);
- jmsServerControl = jmsServerManager;
+ this.jmsServerManager = jmsServerManager;
configuration = config;
@@ -139,17 +137,17 @@
if (node.getNodeName().equals(JMSServerDeployer.CONNECTION_FACTORY_NODE_NAME))
{
String cfName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- jmsServerControl.destroyConnectionFactory(cfName);
+ jmsServerManager.destroyConnectionFactory(cfName);
}
else if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME))
{
String queueName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- jmsServerControl.undeployDestination(queueName);
+ jmsServerManager.removeQueueFromJNDI(queueName);
}
else if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME))
{
String topicName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue();
- jmsServerControl.undeployDestination(topicName);
+ jmsServerManager.removeTopicFromJNDI(topicName);
}
}
@@ -171,7 +169,7 @@
TopicConfiguration topicConfig = parser.parseTopicConfiguration(node);
for (String jndi : topicConfig.getBindings())
{
- jmsServerControl.createTopic(topicConfig.getName(), jndi);
+ jmsServerManager.createTopic(topicConfig.getName(), jndi);
}
}
@@ -182,10 +180,7 @@
private void deployQueue(final Node node) throws Exception
{
JMSQueueConfiguration queueconfig = parser.parseQueueConfiguration(node);
- for (String jndiName : queueconfig.getBindings())
- {
- jmsServerControl.createQueue(queueconfig.getName(), jndiName, queueconfig.getSelector(), queueconfig.isDurable());
- }
+ jmsServerManager.createQueue(queueconfig.getName(), queueconfig.getSelector(), queueconfig.isDurable(), queueconfig.getBindings());
}
/**
@@ -195,7 +190,7 @@
private void deployConnectionFactory(final Node node) throws Exception
{
ConnectionFactoryConfiguration cfConfig = parser.parseConnectionFactoryConfiguration(node);
- jmsServerControl.createConnectionFactory(cfConfig);
+ jmsServerManager.createConnectionFactory(cfConfig);
}
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -45,8 +45,8 @@
import org.hornetq.jms.persistence.JMSStorageManager;
import org.hornetq.jms.persistence.PersistedConnectionFactory;
import org.hornetq.jms.persistence.PersistedDestination;
-import org.hornetq.jms.persistence.impl.DestinationType;
-import org.hornetq.jms.persistence.impl.PersistedJNDIBinding;
+import org.hornetq.jms.persistence.PersistedJNDI;
+import org.hornetq.jms.persistence.PersistedType;
import org.hornetq.jms.persistence.impl.journal.JournalJMSStorageManagerImpl;
import org.hornetq.jms.persistence.impl.nullpm.NullJMSStorageManagerImpl;
import org.hornetq.jms.server.JMSServerManager;
@@ -85,14 +85,18 @@
*/
private Context context;
- private Map<String, HornetQDestination> destinations = new HashMap<String, HornetQDestination>();
+ private Map<String, HornetQDestination> queues = new HashMap<String, HornetQDestination>();
- private final Map<String, List<String>> destinationBindings = new HashMap<String, List<String>>();
+ private Map<String, HornetQDestination> topics = new HashMap<String, HornetQDestination>();
private final Map<String, HornetQConnectionFactory> connectionFactories = new HashMap<String, HornetQConnectionFactory>();
- private final Map<String, List<String>> connectionFactoryBindings = new HashMap<String, List<String>>();
+ private final Map<String, List<String>> queueJNDI = new HashMap<String, List<String>>();
+ private final Map<String, List<String>> topicJNDI = new HashMap<String, List<String>>();
+
+ private final Map<String, List<String>> connectionFactoryJNDI = new HashMap<String, List<String>>();
+
private final HornetQServer server;
private JMSManagementService jmsManagementService;
@@ -110,15 +114,15 @@
private boolean contextSet;
private JMSConfiguration config;
-
+
private Configuration coreConfig;
-
+
private JMSStorageManager storage;
public JMSServerManagerImpl(final HornetQServer server) throws Exception
{
this.server = server;
-
+
configFileName = null;
}
@@ -144,7 +148,7 @@
{
active = true;
- jmsManagementService = new JMSManagementServiceImpl(server.getManagementService());
+ jmsManagementService = new JMSManagementServiceImpl(server.getManagementService(), this);
try
{
@@ -171,7 +175,7 @@
{
deploy();
}
-
+
initJournal();
}
catch (Exception e)
@@ -220,19 +224,19 @@
deploymentManager.stop();
}
- for (String destination : destinationBindings.keySet())
- {
- undeployDestination(destination);
- }
+ // for (String destination : destinationBindings.keySet())
+ // {
+ // undeployDestination(destination);
+ // }
for (String connectionFactory : new HashSet<String>(connectionFactories.keySet()))
{
destroyConnectionFactory(connectionFactory);
}
- destinationBindings.clear();
+ // destinationBindings.clear();
connectionFactories.clear();
- connectionFactoryBindings.clear();
+ connectionFactoryJNDI.clear();
if (context != null)
{
@@ -294,112 +298,173 @@
return server.getHornetQServerControl().getVersion();
}
- public synchronized boolean createQueue(final String queueName,
- final String jndiBinding,
- final String selectorString,
- final boolean durable) throws Exception
+ public synchronized boolean createQueue(final String queueName, final String selectorString, final boolean durable, final String ... jndi) throws Exception
{
checkInitialised();
- boolean added = internalCreateQueue(queueName, jndiBinding, selectorString, durable);
+ boolean added = internalCreateQueue(queueName, selectorString, durable);
- storage.storeDestination(new PersistedDestination(DestinationType.QUEUE, queueName, jndiBinding, selectorString, durable));
+ storage.storeDestination(new PersistedDestination(PersistedType.Queue, queueName, selectorString, durable));
+
+ for (String jndiItem : jndi)
+ {
+ addQueueToJndi(queueName, jndiItem);
+ }
return added;
}
- public synchronized boolean createTopic(final String topicName, final String jndiBinding) throws Exception
+ public synchronized boolean createTopic(final String topicName, final String ... jndi) throws Exception
{
checkInitialised();
- boolean added = internalCreateTopic(topicName, jndiBinding);
+ boolean added = internalCreateTopic(topicName);
- storage.storeDestination(new PersistedDestination(DestinationType.TOPIC, topicName, jndiBinding));
+ storage.storeDestination(new PersistedDestination(PersistedType.Topic, topicName));
+
+ for (String jndiItem : jndi)
+ {
+ addQueueToJndi(topicName, jndiItem);
+ }
return added;
}
- public boolean addTopicToJndi(final String topicName, final String jndiBinding) throws NamingException
+ public boolean addTopicToJndi(final String topicName, final String jndiBinding) throws Exception
{
- HornetQDestination destination = destinations.get(topicName);
- if(destination == null)
+ checkInitialised();
+
+ HornetQDestination destination = topics.get(topicName);
+ if (destination == null)
{
throw new IllegalArgumentException("Topic does not exist");
}
- if(destination.getTopicName() == null)
+ if (destination.getTopicName() == null)
{
throw new IllegalArgumentException(topicName + " is not a topic");
}
boolean added = bindToJndi(jndiBinding, destination);
if (added)
{
- addToDestinationBindings(topicName, jndiBinding);
- storage.storeJndiBinding(new PersistedJNDIBinding(DestinationType.TOPIC, topicName, jndiBinding));
+ addToBindings(topicJNDI, topicName, jndiBinding);
+ storage.addJNDI(PersistedType.Topic, topicName, jndiBinding);
}
return added;
}
- public boolean addQueueToJndi(final String queueName, final String jndiBinding) throws NamingException
+ public boolean addQueueToJndi(final String queueName, final String jndiBinding) throws Exception
{
- HornetQDestination destination = destinations.get(queueName);
- if(destination == null)
+ checkInitialised();
+
+ HornetQDestination destination = queues.get(queueName);
+ if (destination == null)
{
throw new IllegalArgumentException("Queue does not exist");
}
- if(destination.getQueueName() == null)
+ if (destination.getQueueName() == null)
{
throw new IllegalArgumentException(queueName + " is not a queue");
}
boolean added = bindToJndi(jndiBinding, destination);
if (added)
{
- addToDestinationBindings(queueName, jndiBinding);
- storage.storeJndiBinding(new PersistedJNDIBinding(DestinationType.QUEUE, queueName, jndiBinding));
+ addToBindings(queueJNDI, queueName, jndiBinding);
+ storage.addJNDI(PersistedType.Queue, queueName, jndiBinding);
}
return added;
}
- public synchronized boolean undeployDestination(final String name) throws Exception
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.JMSServerManager#removeQueueFromJNDI(java.lang.String, java.lang.String)
+ */
+ public boolean removeQueueFromJNDI(String name, String jndi) throws Exception
{
checkInitialised();
- List<String> jndiBindings = destinationBindings.get(name);
- if (jndiBindings == null || jndiBindings.size() == 0)
- {
- return false;
- }
- if (context != null)
- {
- Iterator<String> iter = jndiBindings.iterator();
- while (iter.hasNext())
- {
- String jndiBinding = iter.next();
- context.unbind(jndiBinding);
- iter.remove();
- }
- }
+
+ removeFromJNDI(queueJNDI, name, jndi);
+
+ storage.deleteJNDI(PersistedType.Queue, name, jndi);
+
return true;
}
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.JMSServerManager#removeQueueFromJNDI(java.lang.String, java.lang.String)
+ */
+ public boolean removeQueueFromJNDI(String name) throws Exception
+ {
+ checkInitialised();
+
+ removeFromJNDI(queueJNDI, name);
+
+ storage.deleteJNDI(PersistedType.Queue, name);
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.JMSServerManager#removeTopicFromJNDI(java.lang.String, java.lang.String)
+ */
+ public boolean removeTopicFromJNDI(String name, String jndi) throws Exception
+ {
+ checkInitialised();
+
+ removeFromJNDI(topicJNDI, name, jndi);
+
+ storage.deleteJNDI(PersistedType.Topic, name, jndi);
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.jms.server.JMSServerManager#removeTopicFromJNDI(java.lang.String, java.lang.String)
+ */
+ public boolean removeTopicFromJNDI(String name) throws Exception
+ {
+ checkInitialised();
+
+ removeFromJNDI(topicJNDI, name);
+
+ storage.deleteJNDI(PersistedType.Topic, name);
+
+ return true;
+ }
+
+
public synchronized boolean destroyQueue(final String name) throws Exception
{
checkInitialised();
- undeployDestination(name);
+
+ removeFromJNDI(queueJNDI, name);
+
- destinationBindings.remove(name);
+ queues.remove(name);
+ queueJNDI.remove(name);
+
jmsManagementService.unregisterQueue(name);
+
server.getHornetQServerControl().destroyQueue(HornetQDestination.createQueueAddressFromName(name).toString());
- storage.deleteDestination(name);
+
+
+ storage.deleteDestination(PersistedType.Queue, name);
+
return true;
}
public synchronized boolean destroyTopic(final String name) throws Exception
{
checkInitialised();
- undeployDestination(name);
+
+ removeFromJNDI(topicJNDI, name);
- destinationBindings.remove(name);
+ topics.remove(name);
+ topicJNDI.remove(name);
+
jmsManagementService.unregisterTopic(name);
- AddressControl addressControl = (AddressControl)server.getManagementService().getResource(ResourceNames.CORE_ADDRESS + HornetQDestination.createTopicAddressFromName(name));
+
+ AddressControl addressControl = (AddressControl)server.getManagementService()
+ .getResource(ResourceNames.CORE_ADDRESS + HornetQDestination.createTopicAddressFromName(name));
if (addressControl != null)
{
for (String queueName : addressControl.getQueueNames())
@@ -407,10 +472,13 @@
Binding binding = server.getPostOffice().getBinding(new SimpleString(queueName));
if (binding == null)
{
- log.warn("Queue " + queueName + " doesn't exist on the topic " + name + ". It was deleted manually probably.");
+ log.warn("Queue " + queueName +
+ " doesn't exist on the topic " +
+ name +
+ ". It was deleted manually probably.");
continue;
}
-
+
// We can't remove the remote binding. As this would be the bridge associated with the topic on this case
if (binding.getType() != BindingType.REMOTE_QUEUE)
{
@@ -418,7 +486,7 @@
}
}
}
- storage.deleteDestination(name);
+ storage.deleteDestination(PersistedType.Topic, name);
return true;
}
@@ -634,12 +702,9 @@
storage.storeConnectionFactory(new PersistedConnectionFactory(cfConfig));
}
- private boolean internalCreateQueue(final String queueName,
- final String jndiBinding,
- final String selectorString,
- final boolean durable) throws Exception
+ private boolean internalCreateQueue(final String queueName, final String selectorString, final boolean durable) throws Exception
{
- HornetQDestination jBossQueue = HornetQDestination.createQueue(queueName);
+ HornetQDestination hqQueue = HornetQDestination.createQueue(queueName);
// Convert from JMS selector to core filter
String coreFilterString = null;
@@ -649,42 +714,42 @@
coreFilterString = SelectorTranslator.convertToHornetQFilterString(selectorString);
}
- server.getHornetQServerControl().deployQueue(jBossQueue.getAddress(),
- jBossQueue.getAddress(),
+ server.getHornetQServerControl().deployQueue(hqQueue.getAddress(),
+ hqQueue.getAddress(),
coreFilterString,
durable);
+
+ queues.put(queueName, hqQueue);
- boolean added = bindToJndi(jndiBinding, jBossQueue);
+ jmsManagementService.registerQueue(hqQueue);
- if (added)
- {
- addToDestinationBindings(queueName, jndiBinding);
- }
-
- jmsManagementService.registerQueue(jBossQueue, jndiBinding);
-
- return added;
+ return true;
}
- private boolean internalCreateTopic(final String topicName, final String jndiBinding) throws Exception
+ /**
+ * Performs the internal creation without activating any storage.
+ * The storage load will call this method
+ * @param topicName
+ * @return
+ * @throws Exception
+ */
+ private boolean internalCreateTopic(final String topicName) throws Exception
{
- HornetQDestination jBossTopic = HornetQDestination.createTopic(topicName);
+ HornetQDestination hqTopic = HornetQDestination.createTopic(topicName);
// We create a dummy subscription on the topic, that never receives messages - this is so we can perform JMS
// checks when routing messages to a topic that
// does not exist - otherwise we would not be able to distinguish from a non existent topic and one with no
// subscriptions - core has no notion of a topic
- server.getHornetQServerControl().deployQueue(jBossTopic.getAddress(),
- jBossTopic.getAddress(),
+ server.getHornetQServerControl().deployQueue(hqTopic.getAddress(),
+ hqTopic.getAddress(),
JMSServerManagerImpl.REJECT_FILTER,
true);
- boolean added = bindToJndi(jndiBinding, jBossTopic);
- if (added)
- {
- addToDestinationBindings(topicName, jndiBinding);
- }
- jmsManagementService.registerTopic(jBossTopic, jndiBinding);
- return added;
+ topics.put(topicName, hqTopic);
+
+ jmsManagementService.registerTopic(hqTopic);
+
+ return true;
}
/**
@@ -842,7 +907,7 @@
public synchronized boolean destroyConnectionFactory(final String name) throws Exception
{
checkInitialised();
- List<String> jndiBindings = connectionFactoryBindings.get(name);
+ List<String> jndiBindings = connectionFactoryJNDI.get(name);
if (jndiBindings == null || jndiBindings.size() == 0)
{
return false;
@@ -861,7 +926,7 @@
}
}
}
- connectionFactoryBindings.remove(name);
+ connectionFactoryJNDI.remove(name);
connectionFactories.remove(name);
jmsManagementService.unregisterConnectionFactory(name);
@@ -897,6 +962,7 @@
checkInitialised();
return server.getHornetQServerControl().listSessions(connectionID);
}
+
// Public --------------------------------------------------------
// Private -------------------------------------------------------
@@ -917,15 +983,22 @@
{
bindToJndi(jndiBinding, cf);
- if (connectionFactoryBindings.get(name) == null)
- {
- connectionFactoryBindings.put(name, new ArrayList<String>());
- }
- connectionFactoryBindings.get(name).add(jndiBinding);
+ addToBindings(connectionFactoryJNDI, name, jndiBinding);
}
- jmsManagementService.registerConnectionFactory(name, cf, jndiBindings);
+ jmsManagementService.registerConnectionFactory(name, cf);
}
+
+ private void addToBindings(Map<String, List<String>> map, String name, String jndi)
+ {
+ List<String> list = map.get(name);
+ if (list == null)
+ {
+ list = new ArrayList<String>();
+ map.put(name, list);
+ }
+ list.add(jndi);
+ }
private boolean bindToJndi(final String jndiName, final Object objectToBind) throws NamingException
{
@@ -992,15 +1065,6 @@
}
}
- private void addToDestinationBindings(final String destination, final String jndiBinding)
- {
- if (destinationBindings.get(destination) == null)
- {
- destinationBindings.put(destination, new ArrayList<String>());
- }
- destinationBindings.get(destination).add(jndiBinding);
- }
-
private void deploy() throws Exception
{
if (config == null)
@@ -1023,9 +1087,10 @@
for (JMSQueueConfiguration config : queueConfigs)
{
String[] bindings = config.getBindings();
+ createQueue(config.getName(), config.getSelector(), config.isDurable());
for (String binding : bindings)
{
- createQueue(config.getName(), binding, config.getSelector(), config.isDurable());
+ addQueueToJndi(config.getName(), binding);
}
}
@@ -1033,9 +1098,11 @@
for (TopicConfiguration config : topicConfigs)
{
String[] bindings = config.getBindings();
+ createTopic(config.getName());
+
for (String binding : bindings)
{
- createTopic(config.getName(), binding);
+ addTopicToJndi(config.getName(), binding);
}
}
}
@@ -1046,7 +1113,7 @@
private void initJournal() throws Exception
{
this.coreConfig = server.getConfiguration();
-
+
if (coreConfig.isPersistenceEnabled())
{
// TODO: replication
@@ -1056,12 +1123,11 @@
{
storage = new NullJMSStorageManagerImpl();
}
-
+
storage.start();
-
-
+
List<PersistedConnectionFactory> cfs = storage.recoverConnectionFactories();
-
+
for (PersistedConnectionFactory cf : cfs)
{
internalCreateCF(cf.getConfig());
@@ -1071,18 +1137,104 @@
for (PersistedDestination destination : destinations)
{
- if(destination.getType() == DestinationType.QUEUE)
+ if (destination.getType() == PersistedType.Queue)
{
- internalCreateQueue(destination.getName(), destination.getJndiBinding(), destination.getSelector(), destination.isDurable());
+ internalCreateQueue(destination.getName(),
+ destination.getSelector(),
+ destination.isDurable());
}
- else if(destination.getType() == DestinationType.TOPIC)
+ else if (destination.getType() == PersistedType.Topic)
{
- internalCreateTopic(destination.getName(), destination.getJndiBinding());
+ internalCreateTopic(destination.getName());
}
}
+
+ List<PersistedJNDI> jndiSpace = storage.recoverPersistedJNDI();
+ for (PersistedJNDI record : jndiSpace)
+ {
+ Map<String, List<String>> mapJNDI;
+ Map<String, ?> objects;
+
+ switch (record.getType())
+ {
+ case Queue:
+ mapJNDI = queueJNDI;
+ objects = queues;
+ break;
+ case Topic:
+ mapJNDI = topicJNDI;
+ objects = topics;
+ break;
+ default:
+ case ConnectionFactory:
+ mapJNDI = connectionFactoryJNDI;
+ objects = connectionFactories;
+ break;
+ }
+
+ Object objectToBind = objects.get(record.getName());
+
+ if (objectToBind == null)
+ {
+ continue;
+ }
+
+ List<String> jndiList = mapJNDI.get(record.getName());
+ if (jndiList == null)
+ {
+ jndiList = new ArrayList<String>();
+ mapJNDI.put(record.getName(), jndiList);
+ }
+
+
+ for (String jndi : record.getJndi())
+ {
+ jndiList.add(jndi);
+ bindToJndi(jndi, objectToBind);
+ }
+ }
}
-
-
+
+ private synchronized boolean removeFromJNDI(final Map<String, List<String>> jndiMap, final String name) throws Exception
+ {
+ checkInitialised();
+ List<String> jndiBindings = jndiMap.get(name);
+ if (jndiBindings == null || jndiBindings.size() == 0)
+ {
+ return false;
+ }
+ if (context != null)
+ {
+ Iterator<String> iter = jndiBindings.iterator();
+ while (iter.hasNext())
+ {
+ String jndiBinding = iter.next();
+ context.unbind(jndiBinding);
+ iter.remove();
+ }
+ }
+ return true;
+ }
+
+
+ private synchronized boolean removeFromJNDI(final Map<String, List<String>> jndiMap, final String name, final String jndi) throws Exception
+ {
+ checkInitialised();
+ List<String> jndiBindings = jndiMap.get(name);
+ if (jndiBindings == null || jndiBindings.size() == 0)
+ {
+ return false;
+ }
+ if (context != null)
+ {
+ if (jndiBindings.remove(jndi))
+ {
+ context.unbind(jndi);
+ }
+ }
+ return true;
+ }
+
/**
* @param cfConfig
* @return
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/server/management/JMSManagementService.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/server/management/JMSManagementService.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/server/management/JMSManagementService.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -13,8 +13,6 @@
package org.hornetq.jms.server.management;
-import java.util.List;
-
import org.hornetq.api.jms.management.JMSServerControl;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQDestination;
@@ -32,15 +30,15 @@
void unregisterJMSServer() throws Exception;
- void registerQueue(HornetQDestination queue, String jndiBinding) throws Exception;
+ void registerQueue(HornetQDestination queue) throws Exception;
void unregisterQueue(String name) throws Exception;
- void registerTopic(HornetQDestination topic, String jndiBinding) throws Exception;
+ void registerTopic(HornetQDestination topic) throws Exception;
void unregisterTopic(String name) throws Exception;
- void registerConnectionFactory(String name, HornetQConnectionFactory connectionFactory, List<String> bindings) throws Exception;
+ void registerConnectionFactory(String name, HornetQConnectionFactory connectionFactory) throws Exception;
void unregisterConnectionFactory(String name) throws Exception;
Modified: branches/Clebert_TMP/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
===================================================================
--- branches/Clebert_TMP/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -49,12 +49,15 @@
// Attributes ----------------------------------------------------
private final ManagementService managementService;
+
+ private final JMSServerManager jmsServerManager;
// Static --------------------------------------------------------
- public JMSManagementServiceImpl(final ManagementService managementService)
+ public JMSManagementServiceImpl(final ManagementService managementService, final JMSServerManager jmsServerManager)
{
this.managementService = managementService;
+ this.jmsServerManager = jmsServerManager;
}
// Public --------------------------------------------------------
@@ -77,7 +80,7 @@
managementService.unregisterFromRegistry(ResourceNames.JMS_SERVER);
}
- public synchronized void registerQueue(final HornetQDestination queue, final String jndiBinding) throws Exception
+ public synchronized void registerQueue(final HornetQDestination queue) throws Exception
{
QueueControl coreQueueControl = (QueueControl)managementService.getResource(ResourceNames.CORE_QUEUE + queue.getAddress());
MessageCounterManager messageCounterManager = managementService.getMessageCounterManager();
@@ -89,7 +92,7 @@
messageCounterManager.getMaxDayCount());
messageCounterManager.registerMessageCounter(queue.getName(), counter);
ObjectName objectName = managementService.getObjectNameBuilder().getJMSQueueObjectName(queue.getQueueName());
- JMSQueueControlImpl control = new JMSQueueControlImpl(queue, coreQueueControl, jndiBinding, counter);
+ JMSQueueControlImpl control = new JMSQueueControlImpl(queue, coreQueueControl, jmsServerManager, counter);
managementService.registerInJMX(objectName, control);
managementService.registerInRegistry(ResourceNames.JMS_QUEUE + queue.getQueueName(), control);
}
@@ -101,11 +104,11 @@
managementService.unregisterFromRegistry(ResourceNames.JMS_QUEUE + name);
}
- public synchronized void registerTopic(final HornetQDestination topic, final String jndiBinding) throws Exception
+ public synchronized void registerTopic(final HornetQDestination topic) throws Exception
{
ObjectName objectName = managementService.getObjectNameBuilder().getJMSTopicObjectName(topic.getTopicName());
AddressControl addressControl = (AddressControl)managementService.getResource(ResourceNames.CORE_ADDRESS + topic.getAddress());
- JMSTopicControlImpl control = new JMSTopicControlImpl(topic, addressControl, jndiBinding, managementService);
+ JMSTopicControlImpl control = new JMSTopicControlImpl(topic, addressControl, managementService);
managementService.registerInJMX(objectName, control);
managementService.registerInRegistry(ResourceNames.JMS_TOPIC + topic.getTopicName(), control);
}
@@ -118,11 +121,10 @@
}
public synchronized void registerConnectionFactory(final String name,
- final HornetQConnectionFactory connectionFactory,
- final List<String> bindings) throws Exception
+ final HornetQConnectionFactory connectionFactory) throws Exception
{
ObjectName objectName = managementService.getObjectNameBuilder().getConnectionFactoryObjectName(name);
- JMSConnectionFactoryControlImpl control = new JMSConnectionFactoryControlImpl(connectionFactory, name, bindings);
+ JMSConnectionFactoryControlImpl control = new JMSConnectionFactoryControlImpl(connectionFactory, name);
managementService.registerInJMX(objectName, control);
managementService.registerInRegistry(ResourceNames.JMS_CONNECTION_FACTORY + name, control);
}
Modified: branches/Clebert_TMP/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
===================================================================
--- branches/Clebert_TMP/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -210,7 +210,7 @@
public void createQueue(final String name, final String jndiName) throws Exception
{
- getJMSServerManager().createQueue(name, "/queue/" + (jndiName != null ? jndiName : name), null, true);
+ getJMSServerManager().createQueue(name, null, true, "/queue/" + (jndiName != null ? jndiName : name));
}
public void createTopic(final String name, final String jndiName) throws Exception
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -150,7 +150,7 @@
{
server = jmsServer1;
}
- server.createQueue(queueName, "/queue/" + queueName, null, true);
+ server.createQueue(queueName, null, true, "/queue/" + queueName);
}
@Override
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -199,7 +199,7 @@
JMSBridgeReconnectionTest.log.info("Restarting server");
jmsServer1.start();
- jmsServer1.createQueue("targetQueue", "queue/targetQueue", null, true);
+ jmsServer1.createQueue("targetQueue", null, true, "queue/targetQueue");
createQueue("targetQueue", 1);
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -69,7 +69,7 @@
jmsServer = new JMSServerManagerImpl(server);
jmsServer.setContext(new NullInitialContext());
jmsServer.start();
- jmsServer.createQueue(ExceptionListenerTest.Q_NAME, ExceptionListenerTest.Q_NAME, null, true);
+ jmsServer.createQueue(ExceptionListenerTest.Q_NAME, null, true, ExceptionListenerTest.Q_NAME);
cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactory(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
cf.setBlockOnDurableSend(true);
cf.setPreAcknowledge(true);
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/consumer/ConsumerTest.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -49,7 +49,7 @@
{
super.setUp();
- jmsServer.createQueue(ConsumerTest.Q_NAME, ConsumerTest.Q_NAME, null, true);
+ jmsServer.createQueue(ConsumerTest.Q_NAME, null, true, ConsumerTest.Q_NAME);
cf = HornetQJMSClient.createConnectionFactory(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
}
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -417,7 +417,7 @@
JMSQueueControl queueControl = createManagementControl();
String expiryQueueName = RandomUtil.randomString();
HornetQDestination expiryQueue = (HornetQDestination)HornetQJMSClient.createQueue(expiryQueueName);
- serverManager.createQueue(expiryQueueName, expiryQueueName, null, true);
+ serverManager.createQueue(expiryQueueName, null, true, expiryQueueName);
queueControl.setExpiryAddress(expiryQueue.getAddress());
JMSQueueControl expiryQueueControl = ManagementControlHelper.createJMSQueueControl(expiryQueue, mbeanServer);
@@ -544,7 +544,7 @@
public void testSendMessageToDeadLetterAddress() throws Exception
{
String deadLetterQueue = RandomUtil.randomString();
- serverManager.createQueue(deadLetterQueue, deadLetterQueue, null, true);
+ serverManager.createQueue(deadLetterQueue, null, true, deadLetterQueue);
HornetQDestination dlq = (HornetQDestination)HornetQJMSClient.createQueue(deadLetterQueue);
Connection conn = createConnection();
@@ -605,7 +605,7 @@
String filter = "key = " + matchingValue;
String deadLetterQueue = RandomUtil.randomString();
- serverManager.createQueue(deadLetterQueue, deadLetterQueue, null, true);
+ serverManager.createQueue(deadLetterQueue, null, true, deadLetterQueue);
HornetQDestination dlq = (HornetQDestination)HornetQJMSClient.createQueue(deadLetterQueue);
Connection conn = createConnection();
@@ -647,7 +647,7 @@
{
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, otherQueueName, null, true);
+ serverManager.createQueue(otherQueueName, null, true, otherQueueName);
HornetQDestination otherQueue = (HornetQDestination)HornetQJMSClient.createQueue(otherQueueName);
// send on queue
@@ -694,7 +694,7 @@
String filter = "key = " + matchingValue;
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, otherQueueName, null, true);
+ serverManager.createQueue(otherQueueName, null, true, otherQueueName);
HornetQDestination otherQueue = (HornetQDestination)HornetQJMSClient.createQueue(otherQueueName);
Connection connection = JMSUtil.createConnection(InVMConnectorFactory.class.getName());
@@ -729,7 +729,7 @@
{
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, otherQueueName, null, true);
+ serverManager.createQueue(otherQueueName, null, true, otherQueueName);
HornetQDestination otherQueue = (HornetQDestination)HornetQJMSClient.createQueue(otherQueueName);
String[] messageIDs = JMSUtil.sendMessages(queue, 1);
@@ -752,7 +752,7 @@
String unknownMessageID = RandomUtil.randomString();
String otherQueueName = RandomUtil.randomString();
- serverManager.createQueue(otherQueueName, otherQueueName, null, true);
+ serverManager.createQueue(otherQueueName, null, true, otherQueueName);
JMSQueueControl queueControl = createManagementControl();
Assert.assertEquals(0, queueControl.getMessageCount());
@@ -834,7 +834,7 @@
serverManager.activated();
String queueName = RandomUtil.randomString();
- serverManager.createQueue(queueName, queueName, null, true);
+ serverManager.createQueue(queueName, null, true, queueName);
queue = (HornetQDestination)HornetQJMSClient.createQueue(queueName);
}
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -270,6 +270,12 @@
{
return (String)proxy.retrieveAttributeValue("selector");
}
+
+ public void addJNDI(String jndi) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
};
}
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -115,7 +115,7 @@
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = createManagementControl();
- control.createQueue(queueName, queueJNDIBinding);
+ control.createQueue(queueName);
Object o = UnitTestCase.checkBinding(context, queueJNDIBinding);
Assert.assertTrue(o instanceof Queue);
@@ -134,7 +134,7 @@
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = createManagementControl();
- control.createQueue(queueName, queueJNDIBinding);
+ control.createQueue(queueName);
UnitTestCase.checkBinding(context, queueJNDIBinding);
checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
@@ -153,7 +153,7 @@
JMSServerControl control = createManagementControl();
Assert.assertEquals(0, control.getQueueNames().length);
- control.createQueue(queueName, queueJNDIBinding);
+ control.createQueue(queueName);
String[] names = control.getQueueNames();
Assert.assertEquals(1, names.length);
@@ -173,7 +173,7 @@
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
JMSServerControl control = createManagementControl();
- control.createTopic(topicName, topicJNDIBinding);
+ control.createTopic(topicName);
Object o = UnitTestCase.checkBinding(context, topicJNDIBinding);
Assert.assertTrue(o instanceof Topic);
@@ -191,7 +191,7 @@
checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
JMSServerControl control = createManagementControl();
- control.createTopic(topicName, topicJNDIBinding);
+ control.createTopic(topicName);
checkResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
Topic topic = (Topic)context.lookup(topicJNDIBinding);
@@ -224,7 +224,7 @@
JMSServerControl control = createManagementControl();
Assert.assertEquals(0, control.getTopicNames().length);
- control.createTopic(topicName, topicJNDIBinding);
+ control.createTopic(topicName);
String[] names = control.getTopicNames();
Assert.assertEquals(1, names.length);
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -168,14 +168,14 @@
return (Boolean)proxy.invokeOperation("closeConnectionsForAddress", ipAddress);
}
- public boolean createQueue(final String name, final String jndiBinding) throws Exception
+ public boolean createQueue(final String name) throws Exception
{
- return (Boolean)proxy.invokeOperation("createQueue", name, jndiBinding);
+ return (Boolean)proxy.invokeOperation("createQueue", name);
}
- public boolean createTopic(final String name, final String jndiBinding) throws Exception
+ public boolean createTopic(final String name) throws Exception
{
- return (Boolean)proxy.invokeOperation("createTopic", name, jndiBinding);
+ return (Boolean)proxy.invokeOperation("createTopic", name);
}
public void destroyConnectionFactory(final String name) throws Exception
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/integration/jms/server/management/TopicControlTest.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -76,7 +76,6 @@
Assert.assertEquals(topic.getTopicName(), topicControl.getName());
Assert.assertEquals(topic.getAddress(), topicControl.getAddress());
Assert.assertEquals(topic.isTemporary(), topicControl.isTemporary());
- Assert.assertEquals(topic.getName(), topicControl.getJNDIBinding());
}
public void testGetXXXSubscriptionsCount() throws Exception
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -533,8 +533,8 @@
jmsServer.setContext(context);
jmsServer.start();
- jmsServer.createQueue(JMSBridgeImplTest.SOURCE, "/queue/" + JMSBridgeImplTest.SOURCE, null, true);
- jmsServer.createQueue(JMSBridgeImplTest.TARGET, "/queue/" + JMSBridgeImplTest.TARGET, null, true);
+ jmsServer.createQueue(JMSBridgeImplTest.SOURCE, null, true, "/queue/" + JMSBridgeImplTest.SOURCE);
+ jmsServer.createQueue(JMSBridgeImplTest.TARGET, null, true, "/queue/" + JMSBridgeImplTest.TARGET);
}
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -90,8 +90,8 @@
*/
protected Queue createQueue(final String name) throws Exception, NamingException
{
- jmsServer2.createQueue(name, "/queue/" + name, null, true);
- jmsServer1.createQueue(name, "/queue/" + name, null, true);
+ jmsServer2.createQueue(name, null, true, "/queue/" + name);
+ jmsServer1.createQueue(name, null, true, "/queue/" + name);
return (Queue)context1.lookup("/queue/" + name);
}
Modified: branches/Clebert_TMP/tests/src/org/hornetq/tests/util/JMSTestBase.java
===================================================================
--- branches/Clebert_TMP/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-03-25 18:57:34 UTC (rev 8966)
+++ branches/Clebert_TMP/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-03-26 05:08:39 UTC (rev 8967)
@@ -85,7 +85,7 @@
*/
protected Queue createQueue(final String name) throws Exception, NamingException
{
- jmsServer.createQueue(name, "/jms/" + name, null, true);
+ jmsServer.createQueue(name, null, true, "/jms/" + name);
return (Queue)context.lookup("/jms/" + name);
}
More information about the hornetq-commits
mailing list