From 251461128592193fd957708fec0c4e694bb528f2 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Thu, 18 Dec 2014 08:22:54 +0000 Subject: [PATCH] ACTIVEMQ6-14 - more JNDI removal https://issues.apache.org/jira/browse/ACTIVEMQ6-14 cleaned up more remaining server JNDI code and fixed some abstraction and naming around JNDI and bindings --- .../management/ConnectionFactoryControl.java | 16 +- .../api/jms/management/JMSQueueControl.java | 10 +- .../api/jms/management/TopicControl.java | 12 +- .../impl/JMSConnectionFactoryControlImpl.java | 12 +- .../management/impl/JMSQueueControlImpl.java | 12 +- .../management/impl/JMSServerControlImpl.java | 36 +- .../management/impl/JMSTopicControlImpl.java | 8 +- .../jms/persistence/JMSStorageManager.java | 10 +- ...sistedJNDI.java => PersistedBindings.java} | 44 +-- .../journal/JMSJournalStorageManagerImpl.java | 66 ++-- .../nullpm/NullJMSStorageManagerImpl.java | 10 +- .../jms/server/ActiveMQJMSServerBundle.java | 4 +- .../jms/server/ActiveMQJMSServerLogger.java | 4 +- .../activemq/jms/server/JMSServerManager.java | 64 ++- .../jms/server/config/JMSConfiguration.java | 6 - .../config/impl/JMSConfigurationImpl.java | 15 - .../jms/server/impl/JMSServerDeployer.java | 4 +- .../jms/server/impl/JMSServerManagerImpl.java | 368 ++++++++---------- .../ServletContextBindingRegistry.java | 10 - .../core/registry/JndiBindingRegistry.java | 16 - .../core/registry/MapBindingRegistry.java | 11 - .../spi/core/naming/BindingRegistry.java | 11 - .../activemq/tools/XmlDataExporter.java | 18 +- .../spring/SpringBindingRegistry.java | 12 - .../byteman/tests/StartStopDeadlockTest.java | 3 +- .../client/FailureDeadlockTest.java | 3 +- .../integration/client/PagingOrderTest.java | 9 +- .../integration/jms/FloodServerTest.java | 3 +- .../ManualReconnectionToSingleServerTest.java | 8 +- .../jms/bridge/BridgeTestBase.java | 5 +- .../jms/bridge/ClusteredBridgeTestBase.java | 5 +- .../client/RemoteConnectionStressTest.java | 3 +- .../jms/client/StoreConfigTest.java | 26 +- .../jms/cluster/JMSFailoverListenerTest.java | 5 +- .../jms/cluster/JMSFailoverTest.java | 5 +- .../cluster/ReplicatedJMSFailoverTest.java | 5 +- .../jms/connection/ExceptionListenerTest.java | 3 +- .../jms/server/JMSServerDeployerTest.java | 3 +- .../jms/server/JMSServerStartStopTest.java | 2 +- .../server/config/JMSConfigurationTest.java | 4 +- .../ConnectionFactoryControlTest.java | 3 +- .../management/JMSQueueControlTest.java | 11 +- .../JMSQueueControlUsingJMSTest.java | 6 +- .../management/JMSServerControl2Test.java | 3 +- .../JMSServerControlRestartTest.java | 3 +- .../management/JMSServerControlTest.java | 21 +- .../server/management/TopicControlTest.java | 5 +- .../management/TopicControlUsingJMSTest.java | 6 +- .../management/ManagementActivationTest.java | 7 +- .../openwire/OpenWireTestBase.java | 3 +- .../persistence/JMSDynamicConfigTest.java | 2 +- .../persistence/JMSStorageManagerTest.java | 12 +- .../persistence/XmlImportExportTest.java | 3 +- .../integration/stomp/ExtraStompTest.java | 5 +- .../integration/stomp/StompTestBase.java | 3 +- .../integration/stomp/StompWebSocketTest.java | 2 +- .../stomp/v11/StompV11TestBase.java | 3 +- .../tests/util/JMSClusteredTestBase.java | 5 +- .../activemq/tests/util/JMSTestBase.java | 5 +- .../jms/tests/ActiveMQServerTestCase.java | 1 - .../tools/container/LocalTestServer.java | 2 + .../jms/bridge/impl/JMSBridgeImplTest.java | 3 +- 62 files changed, 451 insertions(+), 534 deletions(-) rename activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/config/{PersistedJNDI.java => PersistedBindings.java} (77%) diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/ConnectionFactoryControl.java b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/ConnectionFactoryControl.java index 3ae395baed..83283be833 100644 --- a/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/ConnectionFactoryControl.java +++ b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/ConnectionFactoryControl.java @@ -39,9 +39,9 @@ public interface ConnectionFactoryControl String getName(); /** - * Returns the JNDI bindings associated to this connection factory. + * Returns the Registry bindings associated to this connection factory. */ - String[] getJNDIBindings(); + String[] getRegistryBindings(); /** * does ths cf support HA @@ -380,14 +380,14 @@ public interface ConnectionFactoryControl DiscoveryGroupConfiguration getDiscoveryGroupConfiguration(); /** - * Add the JNDI binding to this destination + * Add the Registry binding to this destination */ - @Operation(desc = "Adds the factory to another JNDI binding") - void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception; + @Operation(desc = "Adds the factory to another Registry binding") + void addBinding(@Parameter(name = "binding", desc = "the name of the binding for the Registry") String binding) throws Exception; /** - * Remove a JNDI binding + * Remove a Registry binding */ - @Operation(desc = "Remove an existing JNDI binding") - void removeJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception; + @Operation(desc = "Remove an existing Registry binding") + void removeBinding(@Parameter(name = "binding", desc = "the name of the binding for Registry") String binding) throws Exception; } diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/JMSQueueControl.java b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/JMSQueueControl.java index aa4aebf0b3..6eac841a9b 100644 --- a/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/JMSQueueControl.java +++ b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/JMSQueueControl.java @@ -74,16 +74,16 @@ public interface JMSQueueControl extends DestinationControl // Operations ---------------------------------------------------- /** - * Returns the JNDI bindings associated to this connection factory. + * Returns the Registry bindings associated to this connection factory. */ - @Operation(desc = "Returns the list of JNDI bindings associated") - String[] getJNDIBindings(); + @Operation(desc = "Returns the list of Registry bindings associated") + String[] getRegistryBindings(); /** * Add the JNDI binding to this destination */ - @Operation(desc = "Adds the queue to another JNDI binding") - void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception; + @Operation(desc = "Adds the queue to another Registry binding") + void addBinding(@Parameter(name = "binding", desc = "the name of the binding for the registry") String binding) throws Exception; /** * Lists all the JMS messages in this queue matching the specified filter. diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/TopicControl.java b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/TopicControl.java index cd26e21164..145f764ff6 100644 --- a/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/TopicControl.java +++ b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/management/TopicControl.java @@ -57,16 +57,16 @@ public interface TopicControl extends DestinationControl int getNonDurableMessageCount(); /** - * Returns the JNDI bindings associated to this connection factory. + * Returns the Registry bindings associated to this connection factory. */ - @Operation(desc = "Returns the list of JNDI bindings associated") - String[] getJNDIBindings(); + @Operation(desc = "Returns the list of Registry bindings associated") + String[] getRegistryBindings(); /** - * Add the JNDI binding to this destination + * Add the Registry binding to this destination */ - @Operation(desc = "Adds the queue to another JNDI binding") - void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception; + @Operation(desc = "Adds the queue to another Registry binding") + void addBinding(@Parameter(name = "binding", desc = "the name of the binding for Registry") String binding) throws Exception; diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSConnectionFactoryControlImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSConnectionFactoryControlImpl.java index 050eab2520..27063ab23e 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSConnectionFactoryControlImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSConnectionFactoryControlImpl.java @@ -66,9 +66,9 @@ public class JMSConnectionFactoryControlImpl extends StandardMBean implements Co // ManagedConnectionFactoryMBean implementation ------------------ - public String[] getJNDIBindings() + public String[] getRegistryBindings() { - return jmsManager.getJNDIOnConnectionFactory(name); + return jmsManager.getBindingsOnConnectionFactory(name); } public boolean isCompressLargeMessages() @@ -331,14 +331,14 @@ public class JMSConnectionFactoryControlImpl extends StandardMBean implements Co return cf.getDiscoveryGroupConfiguration(); } - public void addJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception + public void addBinding(@Parameter(name = "binding", desc = "the name of the binding for the Registry") String binding) throws Exception { - jmsManager.addConnectionFactoryToJNDI(name, jndi); + jmsManager.addConnectionFactoryToBindingRegistry(name, binding); } - public void removeJNDI(@Parameter(name = "jndiBinding", desc = "the name of the binding for JNDI") String jndi) throws Exception + public void removeBinding(@Parameter(name = "binding", desc = "the name of the binding for the Registry") String binding) throws Exception { - jmsManager.removeConnectionFactoryFromJNDI(name, jndi); + jmsManager.removeConnectionFactoryFromBindingRegistry(name, binding); } public long getCallTimeout() diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSQueueControlImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSQueueControlImpl.java index 161c9379f1..7c85e8cadc 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSQueueControlImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSQueueControlImpl.java @@ -159,19 +159,19 @@ public class JMSQueueControlImpl extends StandardMBean implements JMSQueueContro } @Override - public void addJNDI(String jndi) throws Exception + public void addBinding(String binding) throws Exception { - jmsServerManager.addQueueToJndi(managedQueue.getName(), jndi); + jmsServerManager.addQueueToBindingRegistry(managedQueue.getName(), binding); } - public void removeJNDI(String jndi) throws Exception + public void removeBinding(String binding) throws Exception { - jmsServerManager.removeQueueFromJNDI(managedQueue.getName(), jndi); + jmsServerManager.removeQueueFromBindingRegistry(managedQueue.getName(), binding); } - public String[] getJNDIBindings() + public String[] getRegistryBindings() { - return jmsServerManager.getJNDIOnQueue(managedQueue.getName()); + return jmsServerManager.getBindingsOnQueue(managedQueue.getName()); } public boolean removeMessage(final String messageID) throws Exception diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSServerControlImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSServerControlImpl.java index c04735a96a..2fb73c4502 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSServerControlImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSServerControlImpl.java @@ -76,14 +76,14 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo // Static -------------------------------------------------------- - private static String[] convert(final Object[] jndiBindings) + private static String[] convert(final Object[] bindings) { - String[] bindings = new String[jndiBindings.length]; - for (int i = 0, jndiBindingsLength = jndiBindings.length; i < jndiBindingsLength; i++) + String[] theBindings = new String[bindings.length]; + for (int i = 0, bindingsLength = bindings.length; i < bindingsLength; i++) { - bindings[i] = jndiBindings[i].toString().trim(); + theBindings[i] = bindings[i].toString().trim(); } - return bindings; + return theBindings; } private static String[] toArray(final String commaSeparatedString) @@ -217,7 +217,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo boolean useDiscovery, int cfType, String connectors, - String jndiBindings, + String bindings, String clientID, long clientFailureCheckPeriod, long connectionTTL, @@ -253,7 +253,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo useDiscovery, cfType, toArray(connectors), - toArray(jndiBindings), + toArray(bindings), clientID, clientFailureCheckPeriod, connectionTTL, @@ -392,16 +392,16 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo /** * Create a JMS ConnectionFactory with the specified name connected to a single live-backup pair of servers. *
- * The ConnectionFactory is bound to JNDI for all the specified bindings Strings. + * The ConnectionFactory is bound to the Registry for all the specified bindings Strings. */ public void createConnectionFactory(String name, boolean ha, boolean useDiscovery, int cfType, String connectors, - String jndiBindings) throws Exception + String bindings) throws Exception { - createConnectionFactory(name, ha, useDiscovery, cfType, toArray(connectors), toArray(jndiBindings)); + createConnectionFactory(name, ha, useDiscovery, cfType, toArray(connectors), toArray(bindings)); } public boolean createQueue(final String name) throws Exception @@ -409,19 +409,19 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo return createQueue(name, null, null, true); } - public boolean createQueue(final String name, final String jndiBindings) throws Exception + public boolean createQueue(final String name, final String bindings) throws Exception { - return createQueue(name, jndiBindings, null, true); + return createQueue(name, bindings, null, true); } @Override - public boolean createQueue(String name, String jndiBindings, String selector) throws Exception + public boolean createQueue(String name, String bindings, String selector) throws Exception { - return createQueue(name, jndiBindings, selector, true); + return createQueue(name, bindings, selector, true); } public boolean createQueue(@Parameter(name = "name", desc = "Name of the queue to create") String name, - @Parameter(name = "jndiBindings", desc = "comma-separated list of JNDI bindings (use ',' if u need to use commas in your jndi name)") String jndiBindings, + @Parameter(name = "bindings", desc = "comma-separated list of Registry bindings (use ',' if u need to use commas in your bindings name)") String bindings, @Parameter(name = "selector", desc = "the jms selector") String selector, @Parameter(name = "durable", desc = "is the queue persistent and resilient to restart") boolean durable) throws Exception { @@ -432,7 +432,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo try { return server.createQueue(true, name, selector, durable, - JMSServerControlImpl.toArray(jndiBindings)); + JMSServerControlImpl.toArray(bindings)); } finally { @@ -466,7 +466,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo return createTopic(name, null); } - public boolean createTopic(final String topicName, final String jndiBindings) throws Exception + public boolean createTopic(final String topicName, final String bindings) throws Exception { checkStarted(); @@ -474,7 +474,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo try { - return server.createTopic(true, topicName, JMSServerControlImpl.toArray(jndiBindings)); + return server.createTopic(true, topicName, JMSServerControlImpl.toArray(bindings)); } finally { diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSTopicControlImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSTopicControlImpl.java index e957a0d5d7..9867b72735 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSTopicControlImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/management/impl/JMSTopicControlImpl.java @@ -80,14 +80,14 @@ public class JMSTopicControlImpl extends StandardMBean implements TopicControl // TopicControlMBean implementation ------------------------------ @Override - public void addJNDI(String jndi) throws Exception + public void addBinding(String binding) throws Exception { - jmsServerManager.addTopicToJndi(managedTopic.getName(), jndi); + jmsServerManager.addTopicToBindingRegistry(managedTopic.getName(), binding); } - public String[] getJNDIBindings() + public String[] getRegistryBindings() { - return jmsServerManager.getJNDIOnTopic(managedTopic.getName()); + return jmsServerManager.getBindingsOnTopic(managedTopic.getName()); } public String getName() diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/JMSStorageManager.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/JMSStorageManager.java index 908c048136..13741cb28d 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/JMSStorageManager.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/JMSStorageManager.java @@ -21,7 +21,7 @@ import java.util.List; import org.apache.activemq.core.server.ActiveMQComponent; import org.apache.activemq.jms.persistence.config.PersistedConnectionFactory; import org.apache.activemq.jms.persistence.config.PersistedDestination; -import org.apache.activemq.jms.persistence.config.PersistedJNDI; +import org.apache.activemq.jms.persistence.config.PersistedBindings; import org.apache.activemq.jms.persistence.config.PersistedType; /** @@ -48,11 +48,11 @@ public interface JMSStorageManager extends ActiveMQComponent List recoverConnectionFactories(); - void addJNDI(PersistedType type, String name, String ... address) throws Exception; + void addBindings(PersistedType type, String name, String... address) throws Exception; - List recoverPersistedJNDI() throws Exception; + List recoverPersistedBindings() throws Exception; - void deleteJNDI(PersistedType type, String name, String address) throws Exception; + void deleteBindings(PersistedType type, String name, String address) throws Exception; - void deleteJNDI(PersistedType type, String name) throws Exception; + void deleteBindings(PersistedType type, String name) throws Exception; } diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/config/PersistedJNDI.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/config/PersistedBindings.java similarity index 77% rename from activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/config/PersistedJNDI.java rename to activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/config/PersistedBindings.java index 451dbe4ed4..58aa0983dc 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/config/PersistedJNDI.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/config/PersistedBindings.java @@ -25,11 +25,11 @@ import org.apache.activemq.utils.BufferHelper; import org.apache.activemq.utils.DataConstants; /** - * A PersistedJNDI + * A PersistedBinding * * @author Clebert Suconic */ -public class PersistedJNDI implements EncodingSupport +public class PersistedBindings implements EncodingSupport { // Constants ----------------------------------------------------- @@ -42,13 +42,13 @@ public class PersistedJNDI implements EncodingSupport private String name; - private ArrayList jndi = new ArrayList(); + private ArrayList bindings = new ArrayList(); // Static -------------------------------------------------------- // Constructors -------------------------------------------------- - public PersistedJNDI() + public PersistedBindings() { } @@ -56,7 +56,7 @@ public class PersistedJNDI implements EncodingSupport * @param type * @param name */ - public PersistedJNDI(PersistedType type, String name) + public PersistedBindings(PersistedType type, String name) { super(); this.type = type; @@ -69,12 +69,12 @@ public class PersistedJNDI implements EncodingSupport { type = PersistedType.getType(buffer.readByte()); name = buffer.readSimpleString().toString(); - int jndiArraySize = buffer.readInt(); - jndi = new ArrayList(jndiArraySize); + int bindingArraySize = buffer.readInt(); + bindings = new ArrayList(bindingArraySize); - for (int i = 0; i < jndiArraySize; i++) + for (int i = 0; i < bindingArraySize; i++) { - jndi.add(buffer.readSimpleString().toString()); + bindings.add(buffer.readSimpleString().toString()); } } @@ -83,10 +83,10 @@ public class PersistedJNDI implements EncodingSupport { buffer.writeByte(type.getType()); BufferHelper.writeAsSimpleString(buffer, name); - buffer.writeInt(jndi.size()); - for (String jndiEl : jndi) + buffer.writeInt(bindings.size()); + for (String bindingsEl : bindings) { - BufferHelper.writeAsSimpleString(buffer, jndiEl); + BufferHelper.writeAsSimpleString(buffer, bindingsEl); } } @@ -95,14 +95,14 @@ public class PersistedJNDI implements EncodingSupport { return DataConstants.SIZE_BYTE + BufferHelper.sizeOfSimpleString(name) + - sizeOfJNDI(); + sizeOfBindings(); } - private int sizeOfJNDI() + private int sizeOfBindings() { int size = DataConstants.SIZE_INT; // for the number of elements written - for (String str : jndi) + for (String str : bindings) { size += BufferHelper.sizeOfSimpleString(str); } @@ -143,21 +143,21 @@ public class PersistedJNDI implements EncodingSupport } /** - * @return the jndi + * @return the bindings */ - public List getJndi() + public List getBindings() { - return jndi; + return bindings; } - public void addJNDI(String address) + public void addBinding(String address) { - jndi.add(address); + bindings.add(address); } - public void deleteJNDI(String address) + public void deleteBinding(String address) { - jndi.remove(address); + bindings.remove(address); } // Package protected --------------------------------------------- diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java index b78bc96e7a..0642c3aaa0 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java @@ -38,7 +38,7 @@ import org.apache.activemq.core.server.JournalType; import org.apache.activemq.jms.persistence.JMSStorageManager; import org.apache.activemq.jms.persistence.config.PersistedConnectionFactory; import org.apache.activemq.jms.persistence.config.PersistedDestination; -import org.apache.activemq.jms.persistence.config.PersistedJNDI; +import org.apache.activemq.jms.persistence.config.PersistedBindings; import org.apache.activemq.jms.persistence.config.PersistedType; import org.apache.activemq.utils.IDGenerator; @@ -56,7 +56,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager public static final byte DESTINATION_RECORD = 2; - public static final byte JNDI_RECORD = 3; + public static final byte BINDING_RECORD = 3; // Attributes ---------------------------------------------------- @@ -74,7 +74,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager private final Map, PersistedDestination> destinations = new ConcurrentHashMap, PersistedDestination>(); - private final Map, PersistedJNDI> mapJNDI = new ConcurrentHashMap, PersistedJNDI>(); + private final Map, PersistedBindings> mapBindings = new ConcurrentHashMap, PersistedBindings>(); // Static -------------------------------------------------------- @@ -166,87 +166,87 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager destinations.put(new Pair(destination.getType(), destination.getName()), destination); } - public List recoverPersistedJNDI() throws Exception + public List recoverPersistedBindings() throws Exception { - ArrayList list = new ArrayList(mapJNDI.values()); + ArrayList list = new ArrayList(mapBindings.values()); return list; } - public void addJNDI(PersistedType type, String name, String... address) throws Exception + public void addBindings(PersistedType type, String name, String... address) throws Exception { Pair key = new Pair(type, name); long tx = idGenerator.generateID(); - PersistedJNDI currentJNDI = mapJNDI.get(key); - if (currentJNDI != null) + PersistedBindings currentBindings = mapBindings.get(key); + if (currentBindings != null) { - jmsJournal.appendDeleteRecordTransactional(tx, currentJNDI.getId()); + jmsJournal.appendDeleteRecordTransactional(tx, currentBindings.getId()); } else { - currentJNDI = new PersistedJNDI(type, name); + currentBindings = new PersistedBindings(type, name); } - mapJNDI.put(key, currentJNDI); + mapBindings.put(key, currentBindings); for (String adItem : address) { - currentJNDI.addJNDI(adItem); + currentBindings.addBinding(adItem); } long newId = idGenerator.generateID(); - currentJNDI.setId(newId); + currentBindings.setId(newId); - jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, currentJNDI); + jmsJournal.appendAddRecordTransactional(tx, newId, BINDING_RECORD, currentBindings); jmsJournal.appendCommitRecord(tx, true); } - public void deleteJNDI(PersistedType type, String name, String address) throws Exception + public void deleteBindings(PersistedType type, String name, String address) throws Exception { Pair key = new Pair(type, name); long tx = idGenerator.generateID(); - PersistedJNDI currentJNDI = mapJNDI.get(key); - if (currentJNDI == null) + PersistedBindings currentBindings = mapBindings.get(key); + if (currentBindings == null) { return; } else { - jmsJournal.appendDeleteRecordTransactional(tx, currentJNDI.getId()); + jmsJournal.appendDeleteRecordTransactional(tx, currentBindings.getId()); } - currentJNDI.deleteJNDI(address); + currentBindings.deleteBinding(address); - if (currentJNDI.getJndi().size() == 0) + if (currentBindings.getBindings().size() == 0) { - mapJNDI.remove(key); + mapBindings.remove(key); } else { long newId = idGenerator.generateID(); - currentJNDI.setId(newId); - jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, currentJNDI); + currentBindings.setId(newId); + jmsJournal.appendAddRecordTransactional(tx, newId, BINDING_RECORD, currentBindings); } jmsJournal.appendCommitRecord(tx, true); } - public void deleteJNDI(PersistedType type, String name) throws Exception + public void deleteBindings(PersistedType type, String name) throws Exception { Pair key = new Pair(type, name); - PersistedJNDI currentJNDI = mapJNDI.remove(key); + PersistedBindings currentBindings = mapBindings.remove(key); - if (currentJNDI != null) + if (currentBindings != null) { - jmsJournal.appendDeleteRecord(currentJNDI.getId(), true); + jmsJournal.appendDeleteRecord(currentBindings.getId(), true); } } @@ -316,13 +316,13 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager destination.setId(id); destinations.put(new Pair(destination.getType(), destination.getName()), destination); } - else if (rec == JNDI_RECORD) + else if (rec == BINDING_RECORD) { - PersistedJNDI jndi = new PersistedJNDI(); - jndi.decode(buffer); - jndi.setId(id); - Pair key = new Pair(jndi.getType(), jndi.getName()); - mapJNDI.put(key, jndi); + PersistedBindings bindings = new PersistedBindings(); + bindings.decode(buffer); + bindings.setId(id); + Pair key = new Pair(bindings.getType(), bindings.getName()); + mapBindings.put(key, bindings); } else { diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java index 5ad4678c68..f4d2f9d390 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java @@ -22,7 +22,7 @@ import java.util.List; import org.apache.activemq.jms.persistence.JMSStorageManager; import org.apache.activemq.jms.persistence.config.PersistedConnectionFactory; import org.apache.activemq.jms.persistence.config.PersistedDestination; -import org.apache.activemq.jms.persistence.config.PersistedJNDI; +import org.apache.activemq.jms.persistence.config.PersistedBindings; import org.apache.activemq.jms.persistence.config.PersistedType; /** @@ -80,12 +80,12 @@ public class NullJMSStorageManagerImpl implements JMSStorageManager } @Override - public void addJNDI(PersistedType type, String name, String ... address) throws Exception + public void addBindings(PersistedType type, String name, String... address) throws Exception { } @Override - public void deleteJNDI(PersistedType type, String name, String address) throws Exception + public void deleteBindings(PersistedType type, String name, String address) throws Exception { } @@ -95,12 +95,12 @@ public class NullJMSStorageManagerImpl implements JMSStorageManager } @Override - public void deleteJNDI(PersistedType type, String name) throws Exception + public void deleteBindings(PersistedType type, String name) throws Exception { } @Override - public List recoverPersistedJNDI() throws Exception + public List recoverPersistedBindings() throws Exception { return Collections.emptyList(); } diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/ActiveMQJMSServerBundle.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/ActiveMQJMSServerBundle.java index 8c97a41f49..bbec81500d 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/ActiveMQJMSServerBundle.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/ActiveMQJMSServerBundle.java @@ -58,8 +58,8 @@ public interface ActiveMQJMSServerBundle @Message(id = 129005, value = "Connector ''{0}'' not found on the main configuration file" , format = Message.Format.MESSAGE_FORMAT) ActiveMQIllegalStateException noConnectorNameConfiguredOnCF(String name); - @Message(id = 129006, value = "JNDI {0} is already being used by another connection factory", format = Message.Format.MESSAGE_FORMAT) - ActiveMQAddressExistsException cfJndiExists(String name); + @Message(id = 129006, value = "Binding {0} is already being used by another connection factory", format = Message.Format.MESSAGE_FORMAT) + ActiveMQAddressExistsException cfBindingsExists(String name); @Message(id = 129007, value = "Error decoding password using codec instance", format = Message.Format.MESSAGE_FORMAT) ActiveMQIllegalStateException errorDecodingPassword(@Cause Exception e); diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/ActiveMQJMSServerLogger.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/ActiveMQJMSServerLogger.java index eb97abb99d..ab205bf10b 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/ActiveMQJMSServerLogger.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/ActiveMQJMSServerLogger.java @@ -73,8 +73,8 @@ public interface ActiveMQJMSServerLogger extends BasicLogger void recoveryConnectFailed(String s); @LogMessage(level = Logger.Level.WARN) - @Message(id = 122011, value = "error unbinding {0} from JNDI" , format = Message.Format.MESSAGE_FORMAT) - void jndiUnbindError(@Cause Exception e, String key); + @Message(id = 122011, value = "error unbinding {0} from Registry" , format = Message.Format.MESSAGE_FORMAT) + void bindingsUnbindError(@Cause Exception e, String key); @LogMessage(level = Logger.Level.WARN) @Message(id = 122012, value = "JMS Server Manager error" , format = Message.Format.MESSAGE_FORMAT) diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerManager.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerManager.java index 28e124a0c9..e67e38fd47 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerManager.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/JMSServerManager.java @@ -19,8 +19,6 @@ package org.apache.activemq.jms.server; import java.util.List; import java.util.Set; -import javax.naming.Context; - import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.core.security.Role; import org.apache.activemq.core.server.ActiveMQComponent; @@ -56,17 +54,17 @@ public interface JMSServerManager extends ActiveMQComponent * @param selectorString * @param durable * @return true if the queue is created or if it existed and was added to - * JNDI + * the Binding Registry * @throws Exception * if problems were encountered creating the queue. */ boolean createQueue(boolean storeConfig, String queueName, String selectorString, boolean durable, String ...bindings) throws Exception; - boolean addTopicToJndi(final String topicName, final String binding) throws Exception; + boolean addTopicToBindingRegistry(final String topicName, final String binding) throws Exception; - boolean addQueueToJndi(final String queueName, final String binding) throws Exception; + boolean addQueueToBindingRegistry(final String queueName, final String binding) throws Exception; - boolean addConnectionFactoryToJNDI(final String name, final String binding) throws Exception; + boolean addConnectionFactoryToBindingRegistry(final String name, final String binding) throws Exception; /** * Creates a JMS Topic @@ -74,68 +72,68 @@ public interface JMSServerManager extends ActiveMQComponent * @param topicName * the name of the topic * @param bindings - * the names of the binding for JNDI or BindingRegistry + * the names of the binding for the Binding Registry or BindingRegistry * @return true if the topic was created or if it existed and was added to - * JNDI + * the Binding Registry * @throws Exception * if a problem occurred creating the topic */ boolean createTopic(boolean storeConfig, String topicName, String ... bindings) throws Exception; /** - * Remove the topic from JNDI or BindingRegistry. + * Remove the topic from the Binding Registry or BindingRegistry. * Calling this method does not destroy the destination. * * @param name - * the name of the destination to remove from JNDI or BindingRegistry + * the name of the destination to remove from the BindingRegistry * @return true if removed * @throws Exception * if a problem occurred removing the destination */ - boolean removeTopicFromJNDI(String name, String binding) throws Exception; + boolean removeTopicFromBindingRegistry(String name, String binding) throws Exception; /** - * Remove the topic from JNDI or BindingRegistry. + * Remove the topic from the BindingRegistry. * Calling this method does not destroy the destination. * * @param name - * the name of the destination to remove from JNDI or BindingRegistry + * the name of the destination to remove from the BindingRegistry * @return true if removed * @throws Exception * if a problem occurred removing the destination */ - boolean removeTopicFromJNDI(String name) throws Exception; + boolean removeTopicFromBindingRegistry(String name) throws Exception; /** - * Remove the queue from JNDI or BindingRegistry. + * Remove the queue from the BindingRegistry. * Calling this method does not destroy the destination. * * @param name - * the name of the destination to remove from JNDI or BindingRegistry + * the name of the destination to remove from the BindingRegistry * @return true if removed * @throws Exception * if a problem occurred removing the destination */ - boolean removeQueueFromJNDI(String name, String binding) throws Exception; + boolean removeQueueFromBindingRegistry(String name, String binding) throws Exception; /** - * Remove the queue from JNDI or BindingRegistry. + * Remove the queue from the BindingRegistry. * Calling this method does not destroy the destination. * * @param name - * the name of the destination to remove from JNDI or BindingRegistry + * the name of the destination to remove from the BindingRegistry * @return true if removed * @throws Exception * if a problem occurred removing the destination */ - boolean removeQueueFromJNDI(String name) throws Exception; + boolean removeQueueFromBindingRegistry(String name) throws Exception; - boolean removeConnectionFactoryFromJNDI(String name, String binding) throws Exception; + boolean removeConnectionFactoryFromBindingRegistry(String name, String binding) throws Exception; - boolean removeConnectionFactoryFromJNDI(String name) throws Exception; + boolean removeConnectionFactoryFromBindingRegistry(String name) throws Exception; /** - * destroys a queue and removes it from JNDI or BindingRegistry + * destroys a queue and removes it from the BindingRegistry * * @param name * the name of the queue to destroy @@ -146,7 +144,7 @@ public interface JMSServerManager extends ActiveMQComponent boolean destroyQueue(String name) throws Exception; /** - * destroys a queue and removes it from JNDI or BindingRegistry. + * destroys a queue and removes it from the BindingRegistry. * disconnects any consumers connected to the queue. * * @param name @@ -157,14 +155,14 @@ public interface JMSServerManager extends ActiveMQComponent */ boolean destroyQueue(String name, boolean removeConsumers) throws Exception; - String[] getJNDIOnQueue(String queue); + String[] getBindingsOnQueue(String queue); - String[] getJNDIOnTopic(String topic); + String[] getBindingsOnTopic(String topic); - String[] getJNDIOnConnectionFactory(String factoryName); + String[] getBindingsOnConnectionFactory(String factoryName); /** - * destroys a topic and removes it from JNDI or BindingRegistry + * destroys a topic and removes it from the BindingRegistry * * @param name * the name of the topic to destroy @@ -175,7 +173,7 @@ public interface JMSServerManager extends ActiveMQComponent boolean destroyTopic(String name, boolean removeConsumers) throws Exception; /** - * destroys a topic and removes it from JNDI or BindingRegistry + * destroys a topic and removes it from theBindingRegistry * * @param name * the name of the topic to destroy @@ -185,11 +183,11 @@ public interface JMSServerManager extends ActiveMQComponent */ boolean destroyTopic(String name) throws Exception; - /** Call this method to have a CF rebound to JNDI and stored on the Journal + /** Call this method to have a CF rebound to the Binding Registry and stored on the Journal * @throws Exception */ ActiveMQConnectionFactory recreateCF(String name, ConnectionFactoryConfiguration cf) throws Exception; - void createConnectionFactory(String name, boolean ha, JMSFactoryType cfType, String discoveryGroupName, String ... jndiBindings) throws Exception; + void createConnectionFactory(String name, boolean ha, JMSFactoryType cfType, String discoveryGroupName, String ... bindings) throws Exception; void createConnectionFactory(String name, boolean ha, @@ -300,8 +298,6 @@ public interface JMSServerManager extends ActiveMQComponent String listPreparedTransactionDetailsAsHTML() throws Exception; - void setContext(final Context context); - ActiveMQServer getActiveMQServer(); void addAddressSettings(String address, AddressSettings addressSettings); @@ -315,7 +311,7 @@ public interface JMSServerManager extends ActiveMQComponent BindingRegistry getRegistry(); /** - * Set this property if you want something other than JNDI for your registry + * Set this property if you want JMS resources bound to a registry * * @param registry */ diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/config/JMSConfiguration.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/config/JMSConfiguration.java index 170e54c817..7b47cb6ef6 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/config/JMSConfiguration.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/config/JMSConfiguration.java @@ -18,8 +18,6 @@ package org.apache.activemq.jms.server.config; import java.util.List; -import javax.naming.Context; - /** * A JMSConfiguration * @@ -29,10 +27,6 @@ import javax.naming.Context; */ public interface JMSConfiguration { - JMSConfiguration setContext(Context context); - - Context getContext(); - List getQueueConfigurations(); JMSConfiguration setQueueConfigurations(List queueConfigurations); diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/config/impl/JMSConfigurationImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/config/impl/JMSConfigurationImpl.java index ae4ca7f4ce..25de05a409 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/config/impl/JMSConfigurationImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/config/impl/JMSConfigurationImpl.java @@ -19,8 +19,6 @@ package org.apache.activemq.jms.server.config.impl; import java.util.ArrayList; import java.util.List; -import javax.naming.Context; - import org.apache.activemq.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration; import org.apache.activemq.jms.server.config.JMSConfiguration; @@ -42,8 +40,6 @@ public class JMSConfigurationImpl implements JMSConfiguration private String domain = ActiveMQDefaultConfiguration.getDefaultJmxDomain(); - private Context context = null; - // JMSConfiguration implementation ------------------------------- public JMSConfigurationImpl() @@ -83,17 +79,6 @@ public class JMSConfigurationImpl implements JMSConfiguration return this; } - public Context getContext() - { - return context; - } - - public JMSConfigurationImpl setContext(final Context context) - { - this.context = context; - return this; - } - public String getDomain() { return domain; diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java index eab54a6869..7d3d5681ec 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerDeployer.java @@ -115,12 +115,12 @@ public class JMSServerDeployer extends XmlDeployer if (node.getNodeName().equals(JMSServerDeployer.QUEUE_NODE_NAME)) { String queueName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue(); - jmsServerManager.removeQueueFromJNDI(queueName); + jmsServerManager.removeQueueFromBindingRegistry(queueName); } else if (node.getNodeName().equals(JMSServerDeployer.TOPIC_NODE_NAME)) { String topicName = node.getAttributes().getNamedItem(getKeyAttribute()).getNodeValue(); - jmsServerManager.removeTopicFromJNDI(topicName); + jmsServerManager.removeTopicFromBindingRegistry(topicName); } } diff --git a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java index 85e7032767..5e9fa43955 100644 --- a/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java +++ b/activemq-jms-server/src/main/java/org/apache/activemq/jms/server/impl/JMSServerManagerImpl.java @@ -16,8 +16,6 @@ */ package org.apache.activemq.jms.server.impl; -import javax.naming.Context; -import javax.naming.InitialContext; import javax.naming.NamingException; import javax.transaction.xa.Xid; @@ -49,7 +47,6 @@ import org.apache.activemq.core.deployers.impl.FileDeploymentManager; import org.apache.activemq.core.deployers.impl.XmlDeployer; import org.apache.activemq.core.postoffice.Binding; import org.apache.activemq.core.postoffice.BindingType; -import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory; import org.apache.activemq.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.core.security.Role; @@ -70,7 +67,7 @@ import org.apache.activemq.jms.client.SelectorTranslator; import org.apache.activemq.jms.persistence.JMSStorageManager; import org.apache.activemq.jms.persistence.config.PersistedConnectionFactory; import org.apache.activemq.jms.persistence.config.PersistedDestination; -import org.apache.activemq.jms.persistence.config.PersistedJNDI; +import org.apache.activemq.jms.persistence.config.PersistedBindings; import org.apache.activemq.jms.persistence.config.PersistedType; import org.apache.activemq.jms.persistence.impl.journal.JMSJournalStorageManagerImpl; import org.apache.activemq.jms.persistence.impl.nullpm.NullJMSStorageManagerImpl; @@ -93,7 +90,7 @@ import org.apache.activemq.utils.json.JSONArray; import org.apache.activemq.utils.json.JSONObject; /** - * A Deployer used to create and add to JNDI queues, topics and connection + * A Deployer used to create and add to Bindings queues, topics and connection * factories. Typically this would only be used in an app server env. *

* JMS Connection Factories and Destinations can be configured either @@ -120,11 +117,11 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback private final Map connectionFactories = new HashMap(); - private final Map> queueJNDI = new HashMap>(); + private final Map> queueBindings = new HashMap>(); - private final Map> topicJNDI = new HashMap>(); + private final Map> topicBindings = new HashMap>(); - private final Map> connectionFactoryJNDI = new HashMap>(); + private final Map> connectionFactoryBindings = new HashMap>(); // We keep things cached if objects are created while the JMS is not active private final List cachedCommands = new ArrayList(); @@ -143,15 +140,13 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback private final String configFileName; - private boolean contextSet; - private JMSConfiguration config; private Configuration coreConfig; private JMSStorageManager storage; - private final Map> unRecoveredJndi = new HashMap>(); + private final Map> unRecoveredBindings = new HashMap>(); public JMSServerManagerImpl(final ActiveMQServer server) throws Exception { @@ -269,7 +264,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback // do not clear the cachedCommands - HORNETQ-1047 - recoverJndiBindings(); + recoverBindings(); } catch (Exception e) { @@ -306,11 +301,11 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback storage.stop(); } - unbindJNDI(queueJNDI); + unbindBindings(queueBindings); - unbindJNDI(topicJNDI); + unbindBindings(topicBindings); - unbindJNDI(connectionFactoryJNDI); + unbindBindings(connectionFactoryBindings); for (String connectionFactory : new HashSet(connectionFactories.keySet())) { @@ -318,12 +313,12 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } connectionFactories.clear(); - connectionFactoryJNDI.clear(); + connectionFactoryBindings.clear(); - queueJNDI.clear(); + queueBindings.clear(); queues.clear(); - topicJNDI.clear(); + topicBindings.clear(); topics.clear(); // it could be null if a backup @@ -352,102 +347,102 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } - public void recoverJndiBindings(String name, PersistedType type) throws NamingException + public void recoverregistryBindings(String name, PersistedType type) throws NamingException { - List bindings = unRecoveredJndi.get(name); + List bindings = unRecoveredBindings.get(name); if ((bindings != null) && (bindings.size() > 0)) { - Map> mapJNDI; + Map> mapBindings; Map objects; switch (type) { case Queue: - mapJNDI = queueJNDI; + mapBindings = queueBindings; objects = queues; break; case Topic: - mapJNDI = topicJNDI; + mapBindings = topicBindings; objects = topics; break; default: case ConnectionFactory: - mapJNDI = connectionFactoryJNDI; + mapBindings = connectionFactoryBindings; objects = connectionFactories; break; } Object objectToBind = objects.get(name); - List jndiList = mapJNDI.get(name); + List bindingsList = mapBindings.get(name); if (objectToBind == null) { return; } - if (jndiList == null) + if (bindingsList == null) { - jndiList = new ArrayList(); - mapJNDI.put(name, jndiList); + bindingsList = new ArrayList(); + mapBindings.put(name, bindingsList); } - for (String jndi : bindings) + for (String binding : bindings) { - jndiList.add(jndi); - bindToJndi(jndi, objectToBind); + bindingsList.add(binding); + bindToBindings(binding, objectToBind); } - unRecoveredJndi.remove(name); + unRecoveredBindings.remove(name); } } - private void recoverJndiBindings() throws Exception + private void recoverBindings() throws Exception { //now its time to add journal recovered stuff - List jndiSpace = storage.recoverPersistedJNDI(); + List bindingsSpace = storage.recoverPersistedBindings(); - for (PersistedJNDI record : jndiSpace) + for (PersistedBindings record : bindingsSpace) { - Map> mapJNDI; + Map> mapBindings; Map objects; switch (record.getType()) { case Queue: - mapJNDI = queueJNDI; + mapBindings = queueBindings; objects = queues; break; case Topic: - mapJNDI = topicJNDI; + mapBindings = topicBindings; objects = topics; break; default: case ConnectionFactory: - mapJNDI = connectionFactoryJNDI; + mapBindings = connectionFactoryBindings; objects = connectionFactories; break; } Object objectToBind = objects.get(record.getName()); - List jndiList = mapJNDI.get(record.getName()); + List bindingsList = mapBindings.get(record.getName()); if (objectToBind == null) { - unRecoveredJndi.put(record.getName(), record.getJndi()); + unRecoveredBindings.put(record.getName(), record.getBindings()); continue; } - if (jndiList == null) + if (bindingsList == null) { - jndiList = new ArrayList(); - mapJNDI.put(record.getName(), jndiList); + bindingsList = new ArrayList(); + mapBindings.put(record.getName(), bindingsList); } - for (String jndi : record.getJndi()) + for (String bindings : record.getBindings()) { - jndiList.add(jndi); - bindToJndi(jndi, objectToBind); + bindingsList.add(bindings); + bindToBindings(bindings, objectToBind); } } @@ -477,17 +472,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback return; } - if (registry == null) - { - if (!contextSet) - { - if (System.getProperty(Context.INITIAL_CONTEXT_FACTORY) != null) - { - registry = new JndiBindingRegistry(new InitialContext()); - } - } - } - deploymentManager = new FileDeploymentManager(server.getConfiguration().getFileDeployerScanPeriod()); server.registerActivateCallback(this); /** @@ -567,17 +551,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback return server.getSecurityRepository().getMatch(addressMatch); } - public synchronized void setContext(final Context context) - { - if (registry == null || registry instanceof JndiBindingRegistry) - { - registry = new JndiBindingRegistry(context); - registry.setContext(context); - } - - contextSet = true; - } - public synchronized String getVersion() { checkInitialised(); @@ -589,7 +562,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback final String queueName, final String selectorString, final boolean durable, - final String... jndi) throws Exception + final String... bindings) throws Exception { if (active && queues.get(queueName) != null) @@ -608,7 +581,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback @Override public void runException() throws Exception { - checkJNDI(jndi); + checkBindings(bindings); if (internalCreateQueue(queueName, selectorString, durable)) { @@ -620,22 +593,22 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback throw new IllegalArgumentException("Queue does not exist"); } - String[] usedJNDI = null; + String[] usedBindings = null; - if (jndi != null) + if (bindings != null) { - ArrayList bindings = new ArrayList(); + ArrayList bindingsToAdd = new ArrayList(); - for (String jndiItem : jndi) + for (String bindingsItem : bindings) { - if (bindToJndi(jndiItem, destination)) + if (bindToBindings(bindingsItem, destination)) { - bindings.add(jndiItem); + bindingsToAdd.add(bindingsItem); } } - usedJNDI = bindings.toArray(new String[bindings.size()]); - addToBindings(queueJNDI, queueName, usedJNDI); + usedBindings = bindingsToAdd.toArray(new String[bindingsToAdd.size()]); + addToBindings(queueBindings, queueName, usedBindings); } if (storeConfig && durable) @@ -644,9 +617,9 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback queueName, selectorString, durable)); - if (usedJNDI != null) + if (usedBindings != null) { - storage.addJNDI(PersistedType.Queue, queueName, usedJNDI); + storage.addBindings(PersistedType.Queue, queueName, usedBindings); } } } @@ -657,7 +630,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback return true; } - public synchronized boolean createTopic(final boolean storeConfig, final String topicName, final String... jndi) throws Exception + public synchronized boolean createTopic(final boolean storeConfig, final String topicName, final String... bindings) throws Exception { if (active && topics.get(topicName) != null) { @@ -675,7 +648,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback @Override public void runException() throws Exception { - checkJNDI(jndi); + checkBindings(bindings); if (internalCreateTopic(topicName)) { @@ -687,23 +660,23 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback throw new IllegalArgumentException("Queue does not exist"); } - ArrayList bindings = new ArrayList(); + ArrayList bindingsToAdd = new ArrayList(); - for (String jndiItem : jndi) + for (String bindingsItem : bindings) { - if (bindToJndi(jndiItem, destination)) + if (bindToBindings(bindingsItem, destination)) { - bindings.add(jndiItem); + bindingsToAdd.add(bindingsItem); } } - String[] usedJNDI = bindings.toArray(new String[bindings.size()]); - addToBindings(topicJNDI, topicName, usedJNDI); + String[] usedBindings = bindingsToAdd.toArray(new String[bindingsToAdd.size()]); + addToBindings(topicBindings, topicName, usedBindings); if (storeConfig) { storage.storeDestination(new PersistedDestination(PersistedType.Topic, topicName)); - storage.addJNDI(PersistedType.Topic, topicName, usedJNDI); + storage.addBindings(PersistedType.Topic, topicName, usedBindings); } } } @@ -714,11 +687,11 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } - public boolean addTopicToJndi(final String topicName, final String jndiBinding) throws Exception + public boolean addTopicToBindingRegistry(final String topicName, final String registryBinding) throws Exception { checkInitialised(); - checkJNDI(jndiBinding); + checkBindings(registryBinding); ActiveMQTopic destination = topics.get(topicName); if (destination == null) @@ -729,36 +702,36 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback { throw new IllegalArgumentException(topicName + " is not a topic"); } - boolean added = bindToJndi(jndiBinding, destination); + boolean added = bindToBindings(registryBinding, destination); if (added) { - addToBindings(topicJNDI, topicName, jndiBinding); - storage.addJNDI(PersistedType.Topic, topicName, jndiBinding); + addToBindings(topicBindings, topicName, registryBinding); + storage.addBindings(PersistedType.Topic, topicName, registryBinding); } return added; } - public String[] getJNDIOnQueue(String queue) + public String[] getBindingsOnQueue(String queue) { - return getJNDIList(queueJNDI, queue); + return getBindingsList(queueBindings, queue); } - public String[] getJNDIOnTopic(String topic) + public String[] getBindingsOnTopic(String topic) { - return getJNDIList(topicJNDI, topic); + return getBindingsList(topicBindings, topic); } - public String[] getJNDIOnConnectionFactory(String factoryName) + public String[] getBindingsOnConnectionFactory(String factoryName) { - return getJNDIList(connectionFactoryJNDI, factoryName); + return getBindingsList(connectionFactoryBindings, factoryName); } - public boolean addQueueToJndi(final String queueName, final String jndiBinding) throws Exception + public boolean addQueueToBindingRegistry(final String queueName, final String registryBinding) throws Exception { checkInitialised(); - checkJNDI(jndiBinding); + checkBindings(registryBinding); ActiveMQQueue destination = queues.get(queueName); if (destination == null) @@ -769,56 +742,56 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback { throw new IllegalArgumentException(queueName + " is not a queue"); } - boolean added = bindToJndi(jndiBinding, destination); + boolean added = bindToBindings(registryBinding, destination); if (added) { - addToBindings(queueJNDI, queueName, jndiBinding); - storage.addJNDI(PersistedType.Queue, queueName, jndiBinding); + addToBindings(queueBindings, queueName, registryBinding); + storage.addBindings(PersistedType.Queue, queueName, registryBinding); } return added; } - public boolean addConnectionFactoryToJNDI(final String name, final String jndiBinding) throws Exception + public boolean addConnectionFactoryToBindingRegistry(final String name, final String registryBinding) throws Exception { checkInitialised(); - checkJNDI(jndiBinding); + checkBindings(registryBinding); ActiveMQConnectionFactory factory = connectionFactories.get(name); if (factory == null) { throw new IllegalArgumentException("Factory does not exist"); } - if (registry.lookup(jndiBinding) != null) + if (registry.lookup(registryBinding) != null) { - throw ActiveMQJMSServerBundle.BUNDLE.cfJndiExists(name); + throw ActiveMQJMSServerBundle.BUNDLE.cfBindingsExists(name); } - boolean added = bindToJndi(jndiBinding, factory); + boolean added = bindToBindings(registryBinding, factory); if (added) { - addToBindings(connectionFactoryJNDI, name, jndiBinding); - storage.addJNDI(PersistedType.ConnectionFactory, name, jndiBinding); + addToBindings(connectionFactoryBindings, name, registryBinding); + storage.addBindings(PersistedType.ConnectionFactory, name, registryBinding); } return added; } @Override - public boolean removeQueueFromJNDI(String name, String jndi) throws Exception + public boolean removeQueueFromBindingRegistry(String name, String bindings) throws Exception { checkInitialised(); - boolean removed = removeFromJNDI(queueJNDI, name, jndi); + boolean removed = removeFromBindings(queueBindings, name, bindings); if (removed) { - storage.deleteJNDI(PersistedType.Queue, name, jndi); + storage.deleteBindings(PersistedType.Queue, name, bindings); } return removed; } @Override - public boolean removeQueueFromJNDI(final String name) throws Exception + public boolean removeQueueFromBindingRegistry(final String name) throws Exception { final AtomicBoolean valueReturn = new AtomicBoolean(false); @@ -828,7 +801,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback @Override public String toString() { - return "removeQueueFromJNDI for " + name; + return "removeQueueFromBindings for " + name; } @Override @@ -836,7 +809,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback { checkInitialised(); - if (removeFromJNDI(queues, queueJNDI, name)) + if (removeFromBindings(queues, queueBindings, name)) { storage.deleteDestination(PersistedType.Queue, name); valueReturn.set(true); @@ -848,13 +821,13 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } @Override - public boolean removeTopicFromJNDI(String name, String jndi) throws Exception + public boolean removeTopicFromBindingRegistry(String name, String bindings) throws Exception { checkInitialised(); - if (removeFromJNDI(topicJNDI, name, jndi)) + if (removeFromBindings(topicBindings, name, bindings)) { - storage.deleteJNDI(PersistedType.Topic, name, jndi); + storage.deleteBindings(PersistedType.Topic, name, bindings); return true; } else @@ -864,9 +837,9 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } /* (non-Javadoc) - * @see org.apache.activemq.jms.server.JMSServerManager#removeTopicFromJNDI(java.lang.String, java.lang.String) + * @see org.apache.activemq.jms.server.JMSServerManager#removeTopicFromBindings(java.lang.String, java.lang.String) */ - public boolean removeTopicFromJNDI(final String name) throws Exception + public boolean removeTopicFromBindingRegistry(final String name) throws Exception { final AtomicBoolean valueReturn = new AtomicBoolean(false); @@ -876,7 +849,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback @Override public String toString() { - return "removeTopicFromJNDI for " + name; + return "removeTopicFromBindings for " + name; } @Override @@ -884,7 +857,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback { checkInitialised(); - if (removeFromJNDI(topics, topicJNDI, name)) + if (removeFromBindings(topics, topicBindings, name)) { storage.deleteDestination(PersistedType.Topic, name); valueReturn.set(true); @@ -896,23 +869,23 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } @Override - public boolean removeConnectionFactoryFromJNDI(String name, String jndi) throws Exception + public boolean removeConnectionFactoryFromBindingRegistry(String name, String bindings) throws Exception { checkInitialised(); - removeFromJNDI(connectionFactoryJNDI, name, jndi); + removeFromBindings(connectionFactoryBindings, name, bindings); - storage.deleteJNDI(PersistedType.ConnectionFactory, name, jndi); + storage.deleteBindings(PersistedType.ConnectionFactory, name, bindings); return true; } @Override - public boolean removeConnectionFactoryFromJNDI(String name) throws Exception + public boolean removeConnectionFactoryFromBindingRegistry(String name) throws Exception { checkInitialised(); - removeFromJNDI(connectionFactories, connectionFactoryJNDI, name); + removeFromBindings(connectionFactories, connectionFactoryBindings, name); storage.deleteConnectionFactory(name); @@ -931,13 +904,13 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback server.destroyQueue(ActiveMQDestination.createQueueAddressFromName(name), null, !removeConsumers, removeConsumers); // if the queue has consumers and 'removeConsumers' is false then the queue won't actually be removed - // therefore only remove the queue from JNDI, etc. if the queue is actually removed + // therefore only remove the queue from Bindings, etc. if the queue is actually removed if (this.server.getPostOffice().getBinding(ActiveMQDestination.createQueueAddressFromName(name)) == null) { - removeFromJNDI(queues, queueJNDI, name); + removeFromBindings(queues, queueBindings, name); queues.remove(name); - queueJNDI.remove(name); + queueBindings.remove(name); jmsManagementService.unregisterQueue(name); @@ -982,10 +955,10 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback if (addressControl.getQueueNames().length == 0) { - removeFromJNDI(topics, topicJNDI, name); + removeFromBindings(topics, topicBindings, name); topics.remove(name); - topicJNDI.remove(name); + topicBindings.remove(name); jmsManagementService.unregisterTopic(name); @@ -1009,7 +982,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback final boolean ha, final JMSFactoryType cfType, final List connectorNames, - String... jndiBindings) throws Exception + String... registryBindings) throws Exception { checkInitialised(); ActiveMQConnectionFactory cf = connectionFactories.get(name); @@ -1021,7 +994,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback .setConnectorNames(connectorNames) .setFactoryType(cfType); - createConnectionFactory(true, configuration, jndiBindings); + createConnectionFactory(true, configuration, registryBindings); } } @@ -1059,7 +1032,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback final int reconnectAttempts, final boolean failoverOnInitialConnection, final String groupId, - String... jndiBindings) throws Exception + String... registryBindings) throws Exception { checkInitialised(); ActiveMQConnectionFactory cf = connectionFactories.get(name); @@ -1100,7 +1073,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback .setFailoverOnInitialConnection(failoverOnInitialConnection) .setGroupID(groupId); - createConnectionFactory(true, configuration, jndiBindings); + createConnectionFactory(true, configuration, registryBindings); } } @@ -1138,7 +1111,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback final int reconnectAttempts, final boolean failoverOnInitialConnection, final String groupId, - final String... jndiBindings) throws Exception + final String... registryBindings) throws Exception { checkInitialised(); ActiveMQConnectionFactory cf = connectionFactories.get(name); @@ -1147,7 +1120,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl() .setName(name) .setHA(ha) - .setBindings(jndiBindings) + .setBindings(registryBindings) .setDiscoveryGroupName(discoveryGroupName) .setFactoryType(cfType) .setClientID(clientID) @@ -1179,7 +1152,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback .setMaxRetryInterval(maxRetryInterval) .setReconnectAttempts(reconnectAttempts) .setFailoverOnInitialConnection(failoverOnInitialConnection); - createConnectionFactory(true, configuration, jndiBindings); + createConnectionFactory(true, configuration, registryBindings); } } @@ -1187,7 +1160,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback final boolean ha, final JMSFactoryType cfType, final String discoveryGroupName, - final String... jndiBindings) throws Exception + final String... registryBindings) throws Exception { checkInitialised(); ActiveMQConnectionFactory cf = connectionFactories.get(name); @@ -1196,34 +1169,34 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl() .setName(name) .setHA(ha) - .setBindings(jndiBindings) + .setBindings(registryBindings) .setDiscoveryGroupName(discoveryGroupName); - createConnectionFactory(true, configuration, jndiBindings); + createConnectionFactory(true, configuration, registryBindings); } } public synchronized ActiveMQConnectionFactory recreateCF(String name, ConnectionFactoryConfiguration cf) throws Exception { - List jndi = connectionFactoryJNDI.get(name); + List bindings = connectionFactoryBindings.get(name); - if (jndi == null) + if (bindings == null) { throw ActiveMQJMSServerBundle.BUNDLE.cfDoesntExist(name); } - String[] usedJNDI = jndi.toArray(new String[jndi.size()]); + String[] usedBindings = bindings.toArray(new String[bindings.size()]); ActiveMQConnectionFactory realCF = internalCreateCFPOJO(cf); if (cf.isPersisted()) { storage.storeConnectionFactory(new PersistedConnectionFactory(cf)); - storage.addJNDI(PersistedType.ConnectionFactory, cf.getName(), usedJNDI); + storage.addBindings(PersistedType.ConnectionFactory, cf.getName(), usedBindings); } - for (String jndiElement : usedJNDI) + for (String bindingsElement : usedBindings) { - this.bindToJndi(jndiElement, realCF); + this.bindToBindings(bindingsElement, realCF); } return realCF; @@ -1231,7 +1204,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback public synchronized void createConnectionFactory(final boolean storeConfig, final ConnectionFactoryConfiguration cfConfig, - final String... jndi) throws Exception + final String... bindings) throws Exception { runAfterActive(new WrappedRunnable() { @@ -1245,30 +1218,30 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback @Override public void runException() throws Exception { - checkJNDI(jndi); + checkBindings(bindings); ActiveMQConnectionFactory cf = internalCreateCF(storeConfig, cfConfig); - ArrayList bindings = new ArrayList(); + ArrayList bindingsToAdd = new ArrayList(); - for (String jndiItem : jndi) + for (String bindingsItem : bindings) { - if (bindToJndi(jndiItem, cf)) + if (bindToBindings(bindingsItem, cf)) { - bindings.add(jndiItem); + bindingsToAdd.add(bindingsItem); } } - String[] usedJNDI = bindings.toArray(new String[bindings.size()]); - addToBindings(connectionFactoryJNDI, cfConfig.getName(), usedJNDI); + String[] usedBindings = bindingsToAdd.toArray(new String[bindingsToAdd.size()]); + addToBindings(connectionFactoryBindings, cfConfig.getName(), usedBindings); if (storeConfig) { storage.storeConnectionFactory(new PersistedConnectionFactory(cfConfig)); - storage.addJNDI(PersistedType.ConnectionFactory, cfConfig.getName(), usedJNDI); + storage.addBindings(PersistedType.ConnectionFactory, cfConfig.getName(), usedBindings); } - JMSServerManagerImpl.this.recoverJndiBindings(cfConfig.getName(), PersistedType.ConnectionFactory); + JMSServerManagerImpl.this.recoverregistryBindings(cfConfig.getName(), PersistedType.ConnectionFactory); sendNotification(JMSNotificationType.CONNECTION_FACTORY_CREATED, cfConfig.getName()); } }); @@ -1300,7 +1273,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback this.storage = newStorage; } - private String[] getJNDIList(final Map> map, final String name) + private String[] getBindingsList(final Map> map, final String name) { List result = map.get(name); if (result == null) @@ -1341,7 +1314,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback queues.put(queueName, activeMQQueue); - this.recoverJndiBindings(queueName, PersistedType.Queue); + this.recoverregistryBindings(queueName, PersistedType.Queue); jmsManagementService.registerQueue(activeMQQueue, queue); @@ -1379,7 +1352,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback topics.put(topicName, activeMQTopic); - this.recoverJndiBindings(topicName, PersistedType.Topic); + this.recoverregistryBindings(topicName, PersistedType.Topic); jmsManagementService.registerTopic(activeMQTopic); @@ -1541,17 +1514,17 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback protected boolean shutdownConnectionFactory(final String name) throws Exception { checkInitialised(); - List jndiBindings = connectionFactoryJNDI.get(name); + List registryBindings = connectionFactoryBindings.get(name); if (registry != null) { - for (String jndiBinding : jndiBindings) + for (String registryBinding : registryBindings) { - registry.unbind(jndiBinding); + registry.unbind(registryBinding); } } - connectionFactoryJNDI.remove(name); + connectionFactoryBindings.remove(name); connectionFactories.remove(name); jmsManagementService.unregisterConnectionFactory(name); @@ -1726,7 +1699,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } } - private void addToBindings(Map> map, String name, String... jndi) + private void addToBindings(Map> map, String name, String... bindings) { List list = map.get(name); if (list == null) @@ -1734,32 +1707,32 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback list = new ArrayList(); map.put(name, list); } - for (String jndiItem : jndi) + for (String bindingsItem : bindings) { - list.add(jndiItem); + list.add(bindingsItem); } } - private void checkJNDI(final String... jndiNames) throws NamingException + private void checkBindings(final String... bindingsNames) throws NamingException { - if (jndiNames != null) + if (bindingsNames != null) { - for (String jndiName : jndiNames) + for (String bindingsName : bindingsNames) { - if (registry != null && registry.lookup(jndiName) != null) + if (registry != null && registry.lookup(bindingsName) != null) { - throw new NamingException(jndiName + " already has an object bound"); + throw new NamingException(bindingsName + " already has an object bound"); } } } } - private boolean bindToJndi(final String jndiName, final Object objectToBind) throws NamingException + private boolean bindToBindings(final String bindingsName, final Object objectToBind) throws NamingException { if (registry != null) { - registry.unbind(jndiName); - registry.bind(jndiName, objectToBind); + registry.unbind(bindingsName); + registry.bind(bindingsName, objectToBind); } return true; } @@ -1771,11 +1744,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback return; } - if (config.getContext() != null) - { - setContext(config.getContext()); - } - List connectionFactoryConfigurations = config.getConnectionFactoryConfigurations(); for (ConnectionFactoryConfiguration cfConfig : connectionFactoryConfigurations) { @@ -1798,7 +1766,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback /** * @param param */ - private void unbindJNDI(Map> param) + private void unbindBindings(Map> param) { if (registry != null) { @@ -1812,7 +1780,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } catch (Exception e) { - ActiveMQJMSServerLogger.LOGGER.jndiUnbindError(e, key); + ActiveMQJMSServerLogger.LOGGER.bindingsUnbindError(e, key); } } } @@ -1881,13 +1849,13 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback storage.start(); } - private synchronized boolean removeFromJNDI(final Map keys, - final Map> jndiMap, + private synchronized boolean removeFromBindings(final Map keys, + final Map> bindingsMap, final String name) throws Exception { checkInitialised(); - List jndiBindings = jndiMap.remove(name); - if (jndiBindings == null || jndiBindings.size() == 0) + List registryBindings = bindingsMap.remove(name); + if (registryBindings == null || registryBindings.size() == 0) { return false; } @@ -1897,31 +1865,31 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } if (registry != null) { - Iterator iter = jndiBindings.iterator(); + Iterator iter = registryBindings.iterator(); while (iter.hasNext()) { - String jndiBinding = iter.next(); - registry.unbind(jndiBinding); + String registryBinding = iter.next(); + registry.unbind(registryBinding); iter.remove(); } } return true; } - private synchronized boolean removeFromJNDI(final Map> jndiMap, + private synchronized boolean removeFromBindings(final Map> bindingsMap, final String name, - final String jndi) throws Exception + final String bindings) throws Exception { checkInitialised(); - List jndiBindings = jndiMap.get(name); - if (jndiBindings == null || jndiBindings.size() == 0) + List registryBindings = bindingsMap.get(name); + if (registryBindings == null || registryBindings.size() == 0) { return false; } - if (jndiBindings.remove(jndi)) + if (registryBindings.remove(bindings)) { - registry.unbind(jndi); + registry.unbind(bindings); return true; } else diff --git a/activemq-rest/src/main/java/org/apache/activemq/rest/integration/ServletContextBindingRegistry.java b/activemq-rest/src/main/java/org/apache/activemq/rest/integration/ServletContextBindingRegistry.java index 83fe4ee06d..4eb69aa574 100644 --- a/activemq-rest/src/main/java/org/apache/activemq/rest/integration/ServletContextBindingRegistry.java +++ b/activemq-rest/src/main/java/org/apache/activemq/rest/integration/ServletContextBindingRegistry.java @@ -52,14 +52,4 @@ public class ServletContextBindingRegistry implements BindingRegistry public void close() { } - - public Object getContext() - { - return servletContext; - } - - public void setContext(Object o) - { - servletContext = (ServletContext)o; - } } diff --git a/activemq-server/src/main/java/org/apache/activemq/core/registry/JndiBindingRegistry.java b/activemq-server/src/main/java/org/apache/activemq/core/registry/JndiBindingRegistry.java index a61e7a6d33..7e2382d96d 100644 --- a/activemq-server/src/main/java/org/apache/activemq/core/registry/JndiBindingRegistry.java +++ b/activemq-server/src/main/java/org/apache/activemq/core/registry/JndiBindingRegistry.java @@ -30,22 +30,6 @@ public class JndiBindingRegistry implements BindingRegistry { private Context context; - /** - * @return the context - */ - public Object getContext() - { - return context; - } - - /** - * @param context the context to set - */ - public void setContext(Object context) - { - this.context = (Context)context; - } - public JndiBindingRegistry(Context context) { this.context = context; diff --git a/activemq-server/src/main/java/org/apache/activemq/core/registry/MapBindingRegistry.java b/activemq-server/src/main/java/org/apache/activemq/core/registry/MapBindingRegistry.java index 62c0bb6d83..8acb371c4a 100644 --- a/activemq-server/src/main/java/org/apache/activemq/core/registry/MapBindingRegistry.java +++ b/activemq-server/src/main/java/org/apache/activemq/core/registry/MapBindingRegistry.java @@ -47,15 +47,4 @@ public class MapBindingRegistry implements BindingRegistry public void close() { } - - public Object getContext() - { - return registry; - } - - @Override - public void setContext(Object ctx) - { - registry = (ConcurrentMap)ctx; - } } diff --git a/activemq-server/src/main/java/org/apache/activemq/spi/core/naming/BindingRegistry.java b/activemq-server/src/main/java/org/apache/activemq/spi/core/naming/BindingRegistry.java index d727fd3aad..5fee3594b6 100644 --- a/activemq-server/src/main/java/org/apache/activemq/spi/core/naming/BindingRegistry.java +++ b/activemq-server/src/main/java/org/apache/activemq/spi/core/naming/BindingRegistry.java @@ -24,17 +24,6 @@ package org.apache.activemq.spi.core.naming; */ public interface BindingRegistry { - /** The context used by the registry. - * This may be used to setup the JNDI Context on the JNDI Registry. - * We keep it as an object here as the interface needs to be generic - * as this could be reused by others Registries (e.g set/get the Map on MapRegistry) - * @return - */ - // XXX Unused? - Object getContext(); - - void setContext(Object ctx); - Object lookup(String name); boolean bind(String name, Object obj); diff --git a/activemq-tools/src/main/java/org/apache/activemq/tools/XmlDataExporter.java b/activemq-tools/src/main/java/org/apache/activemq/tools/XmlDataExporter.java index b6b1b628b0..16b90e5422 100644 --- a/activemq-tools/src/main/java/org/apache/activemq/tools/XmlDataExporter.java +++ b/activemq-tools/src/main/java/org/apache/activemq/tools/XmlDataExporter.java @@ -81,7 +81,7 @@ import org.apache.activemq.core.settings.impl.AddressSettings; import org.apache.activemq.core.settings.impl.HierarchicalObjectRepository; import org.apache.activemq.jms.persistence.config.PersistedConnectionFactory; import org.apache.activemq.jms.persistence.config.PersistedDestination; -import org.apache.activemq.jms.persistence.config.PersistedJNDI; +import org.apache.activemq.jms.persistence.config.PersistedBindings; import org.apache.activemq.jms.persistence.config.PersistedType; import org.apache.activemq.jms.persistence.impl.journal.JMSJournalStorageManagerImpl; import org.apache.activemq.utils.Base64; @@ -124,7 +124,7 @@ public final class XmlDataExporter private final Map, PersistedDestination> jmsDestinations = new ConcurrentHashMap<>(); - private final Map, PersistedJNDI> jmsJNDI = new ConcurrentHashMap<>(); + private final Map, PersistedBindings> jmsJNDI = new ConcurrentHashMap<>(); long messagesPrinted = 0L; @@ -392,14 +392,14 @@ public final class XmlDataExporter ActiveMQServerLogger.LOGGER.info("Found JMS destination: " + destination.getName()); jmsDestinations.put(new Pair<>(destination.getType(), destination.getName()), destination); } - else if (rec == JMSJournalStorageManagerImpl.JNDI_RECORD) + else if (rec == JMSJournalStorageManagerImpl.BINDING_RECORD) { - PersistedJNDI jndi = new PersistedJNDI(); + PersistedBindings jndi = new PersistedBindings(); jndi.decode(buffer); jndi.setId(id); Pair key = new Pair<>(jndi.getType(), jndi.getName()); StringBuilder builder = new StringBuilder(); - for (String binding : jndi.getJndi()) + for (String binding : jndi.getBindings()) { builder.append(binding).append(" "); } @@ -680,8 +680,8 @@ public final class XmlDataExporter xmlWriter.writeEndElement(); xmlWriter.writeStartElement(XmlDataConstants.JMS_JNDI_ENTRIES); - PersistedJNDI jndi = jmsJNDI.get(new Pair<>(PersistedType.ConnectionFactory, jmsConnectionFactory.getName())); - for (String jndiEntry : jndi.getJndi()) + PersistedBindings jndi = jmsJNDI.get(new Pair<>(PersistedType.ConnectionFactory, jmsConnectionFactory.getName())); + for (String jndiEntry : jndi.getBindings()) { xmlWriter.writeStartElement(XmlDataConstants.JMS_JNDI_ENTRY); xmlWriter.writeCharacters(jndiEntry); @@ -719,8 +719,8 @@ public final class XmlDataExporter xmlWriter.writeStartElement(XmlDataConstants.JMS_JNDI_ENTRIES); - PersistedJNDI jndi = jmsJNDI.get(new Pair<>(jmsDestination.getType(), jmsDestination.getName())); - for (String jndiEntry : jndi.getJndi()) + PersistedBindings jndi = jmsJNDI.get(new Pair<>(jmsDestination.getType(), jmsDestination.getName())); + for (String jndiEntry : jndi.getBindings()) { xmlWriter.writeStartElement(XmlDataConstants.JMS_JNDI_ENTRY); xmlWriter.writeCharacters(jndiEntry); diff --git a/integration/activemq-spring-integration/src/main/java/org/apache/activemq/integration/spring/SpringBindingRegistry.java b/integration/activemq-spring-integration/src/main/java/org/apache/activemq/integration/spring/SpringBindingRegistry.java index f7e9a02770..a5365bf984 100644 --- a/integration/activemq-spring-integration/src/main/java/org/apache/activemq/integration/spring/SpringBindingRegistry.java +++ b/integration/activemq-spring-integration/src/main/java/org/apache/activemq/integration/spring/SpringBindingRegistry.java @@ -60,16 +60,4 @@ public class SpringBindingRegistry implements BindingRegistry public void close() { } - - @Override - public Object getContext() - { - return this.factory; - } - - @Override - public void setContext(Object ctx) - { - this.factory = (ConfigurableBeanFactory) ctx; - } } diff --git a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/StartStopDeadlockTest.java b/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/StartStopDeadlockTest.java index e33729b2d9..409c811079 100644 --- a/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/StartStopDeadlockTest.java +++ b/tests/byteman-tests/src/test/java/org/apache/activemq/byteman/tests/StartStopDeadlockTest.java @@ -23,6 +23,7 @@ import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.core.config.Configuration; import org.apache.activemq.core.config.ha.SharedStoreMasterPolicyConfiguration; import org.apache.activemq.core.config.ha.SharedStoreSlavePolicyConfiguration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.core.server.ActiveMQServers; import org.apache.activemq.jms.server.impl.JMSServerManagerImpl; @@ -101,7 +102,7 @@ public class StartStopDeadlockTest extends ServiceTestBase final JMSServerManagerImpl jmsServer = new JMSServerManagerImpl(server); final InVMNamingContext context = new InVMNamingContext(); - jmsServer.setContext(context); + jmsServer.setRegistry(new JndiBindingRegistry(context)); jmsServer.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/FailureDeadlockTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/FailureDeadlockTest.java index af09ef805a..28579690ff 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/FailureDeadlockTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/FailureDeadlockTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.tests.integration.client; import org.apache.activemq.api.core.ActiveMQNotConnectedException; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.junit.Before; import org.junit.After; @@ -71,7 +72,7 @@ public class FailureDeadlockTest extends ServiceTestBase .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY)); server = createServer(false, conf); jmsServer = new JMSServerManagerImpl(server); - jmsServer.setContext(new NullInitialContext()); + jmsServer.setRegistry(new JndiBindingRegistry(new NullInitialContext())); jmsServer.start(); cf1 = diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/PagingOrderTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/PagingOrderTest.java index 85f76f143e..a77ee945ba 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/PagingOrderTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/PagingOrderTest.java @@ -43,6 +43,7 @@ import org.apache.activemq.core.paging.PagingStore; import org.apache.activemq.core.postoffice.Binding; import org.apache.activemq.core.postoffice.Bindings; import org.apache.activemq.core.postoffice.impl.LocalQueueBinding; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.core.server.Queue; import org.apache.activemq.core.server.impl.QueueImpl; @@ -726,7 +727,7 @@ public class PagingOrderTest extends ServiceTestBase JMSServerManagerImpl jmsServer = new JMSServerManagerImpl(server); InVMNamingContext context = new InVMNamingContext(); - jmsServer.setContext(context); + jmsServer.setRegistry(new JndiBindingRegistry(context)); jmsServer.start(); jmsServer.createTopic(true, "tt", "/topic/TT"); @@ -775,7 +776,7 @@ public class PagingOrderTest extends ServiceTestBase jmsServer = new JMSServerManagerImpl(server); context = new InVMNamingContext(); - jmsServer.setContext(context); + jmsServer.setRegistry(new JndiBindingRegistry(context)); jmsServer.start(); AddressSettings settings = server.getAddressSettingsRepository().getMatch("jms.topic.TT"); @@ -803,7 +804,7 @@ public class PagingOrderTest extends ServiceTestBase JMSServerManagerImpl jmsServer = new JMSServerManagerImpl(server); InVMNamingContext context = new InVMNamingContext(); - jmsServer.setContext(context); + jmsServer.setRegistry(new JndiBindingRegistry(context)); jmsServer.start(); server.getActiveMQServerControl().addAddressSettings("jms.queue.Q1", @@ -858,7 +859,7 @@ public class PagingOrderTest extends ServiceTestBase jmsServer = new JMSServerManagerImpl(server); context = new InVMNamingContext(); - jmsServer.setContext(context); + jmsServer.setRegistry(new JndiBindingRegistry(context)); jmsServer.start(); AddressSettings settings = server.getAddressSettingsRepository().getMatch("jms.queue.Q1"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/FloodServerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/FloodServerTest.java index 87e6a57367..4b2d9c278d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/FloodServerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/FloodServerTest.java @@ -15,6 +15,7 @@ * limitations under the License. */ package org.apache.activemq.tests.integration.jms; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.junit.Before; import org.junit.After; @@ -95,7 +96,7 @@ public class FloodServerTest extends UnitTestCase serverManager = new JMSServerManagerImpl(server); initialContext = new InVMNamingContext(); - serverManager.setContext(initialContext); + serverManager.setRegistry(new JndiBindingRegistry(initialContext)); serverManager.start(); serverManager.activated(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/ManualReconnectionToSingleServerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/ManualReconnectionToSingleServerTest.java index f28733cb94..e7a8853c6e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/ManualReconnectionToSingleServerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/ManualReconnectionToSingleServerTest.java @@ -15,6 +15,7 @@ * limitations under the License. */ package org.apache.activemq.tests.integration.jms; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.junit.Before; import org.junit.After; @@ -160,7 +161,9 @@ public class ManualReconnectionToSingleServerTest extends ServiceTestBase server = createServer(false, conf); JMSConfiguration configuration = new JMSConfigurationImpl(); - configuration.setContext(context); + serverManager = new JMSServerManagerImpl(server, configuration); + serverManager.setRegistry(new JndiBindingRegistry(context)); + configuration.getQueueConfigurations().add(new JMSQueueConfigurationImpl().setName(QUEUE_NAME).setBindings(QUEUE_NAME)); ArrayList configs = new ArrayList(); @@ -169,10 +172,9 @@ public class ManualReconnectionToSingleServerTest extends ServiceTestBase .setName("cf") .setConnectorNames(registerConnectors(server, configs)) .setBindings("/cf") - .setRetryInterval(1000) + .setRetryInterval(1000) .setReconnectAttempts(-1); configuration.getConnectionFactoryConfigurations().add(cfConfig); - serverManager = new JMSServerManagerImpl(server, configuration); serverManager.start(); listener = new Listener(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/BridgeTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/BridgeTestBase.java index d6ac6edef9..d5dfa9c531 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/BridgeTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/BridgeTestBase.java @@ -44,6 +44,7 @@ import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.api.jms.management.JMSQueueControl; import org.apache.activemq.api.jms.management.TopicControl; import org.apache.activemq.core.config.Configuration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.TransportConstants; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.core.server.ActiveMQServers; @@ -122,7 +123,7 @@ public abstract class BridgeTestBase extends UnitTestCase context0 = new InVMNamingContext(); jmsServer0 = new JMSServerManagerImpl(server0); - jmsServer0.setContext(context0); + jmsServer0.setRegistry(new JndiBindingRegistry(context0)); jmsServer0.start(); params1 = new HashMap(); @@ -138,7 +139,7 @@ public abstract class BridgeTestBase extends UnitTestCase context1 = new InVMNamingContext(); jmsServer1 = new JMSServerManagerImpl(server1); - jmsServer1.setContext(context1); + jmsServer1.setRegistry(new JndiBindingRegistry(context1)); jmsServer1.start(); createQueue("sourceQueue", 0); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/ClusteredBridgeTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/ClusteredBridgeTestBase.java index 4d9aecf2e2..31a094a945 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/ClusteredBridgeTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/bridge/ClusteredBridgeTestBase.java @@ -43,6 +43,7 @@ import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.core.config.Configuration; import org.apache.activemq.core.config.ha.ReplicaPolicyConfiguration; import org.apache.activemq.core.config.ha.ReplicatedPolicyConfiguration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.TransportConstants; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.core.server.ActiveMQServers; @@ -168,7 +169,7 @@ public abstract class ClusteredBridgeTestBase extends ServiceTestBase liveContext = new InVMContext(); liveNode = new JMSServerManagerImpl(server0); - liveNode.setContext(liveContext); + liveNode.setRegistry(new JndiBindingRegistry(liveContext)); //backup Configuration conf = createBasicConfig() @@ -185,7 +186,7 @@ public abstract class ClusteredBridgeTestBase extends ServiceTestBase Context context = new InVMContext(); backupNode = new JMSServerManagerImpl(backup); - backupNode.setContext(context); + backupNode.setRegistry(new JndiBindingRegistry(context)); } public void start() throws Exception diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/client/RemoteConnectionStressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/client/RemoteConnectionStressTest.java index ab7471680f..d0bbbc9e7e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/client/RemoteConnectionStressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/client/RemoteConnectionStressTest.java @@ -28,6 +28,7 @@ import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.api.jms.ActiveMQJMSClient; import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.core.config.Configuration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.core.server.ActiveMQServers; import org.apache.activemq.jms.client.ActiveMQConnectionFactory; @@ -64,7 +65,7 @@ public class RemoteConnectionStressTest extends ServiceTestBase InVMNamingContext namingContext = new InVMNamingContext(); jmsServer = new JMSServerManagerImpl(server); - jmsServer.setContext(namingContext); + jmsServer.setRegistry(new JndiBindingRegistry(namingContext)); jmsServer.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/client/StoreConfigTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/client/StoreConfigTest.java index 2e5e89b5ae..1823db7fb4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/client/StoreConfigTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/client/StoreConfigTest.java @@ -75,7 +75,7 @@ public class StoreConfigTest extends JMSTestBase try { - jmsServer.addConnectionFactoryToJNDI("np", "/someCF"); + jmsServer.addConnectionFactoryToBindingRegistry("np", "/someCF"); fail("Failure expected and the API let duplicates"); } catch (NamingException expected) @@ -100,10 +100,10 @@ public class StoreConfigTest extends JMSTestBase jmsServer.start(); - jmsServer.addConnectionFactoryToJNDI("tst", "/newJNDI"); + jmsServer.addConnectionFactoryToBindingRegistry("tst", "/newJNDI"); try { - jmsServer.addConnectionFactoryToJNDI("tst", "/newJNDI"); + jmsServer.addConnectionFactoryToBindingRegistry("tst", "/newJNDI"); fail("Failure expected and the API let duplicates"); } catch (NamingException expected) @@ -176,7 +176,7 @@ public class StoreConfigTest extends JMSTestBase assertNullJNDI("/t2"); assertNullJNDI("/t.2"); - jmsServer.addTopicToJndi("topicOne", "/tI"); + jmsServer.addTopicToBindingRegistry("topicOne", "/tI"); jmsServer.stop(); jmsServer.start(); @@ -189,11 +189,11 @@ public class StoreConfigTest extends JMSTestBase assertNullJNDI("/t.2"); - assertTrue(jmsServer.removeTopicFromJNDI("topicOne", "/tI")); + assertTrue(jmsServer.removeTopicFromBindingRegistry("topicOne", "/tI")); - assertFalse(jmsServer.removeTopicFromJNDI("topicOne","nothing")); - assertFalse(jmsServer.removeTopicFromJNDI("nothing","nothing")); - assertFalse(jmsServer.removeTopicFromJNDI("nothing")); + assertFalse(jmsServer.removeTopicFromBindingRegistry("topicOne", "nothing")); + assertFalse(jmsServer.removeTopicFromBindingRegistry("nothing", "nothing")); + assertFalse(jmsServer.removeTopicFromBindingRegistry("nothing")); assertNullJNDI("/tI"); checkDestination("/t1"); @@ -208,7 +208,7 @@ public class StoreConfigTest extends JMSTestBase checkDestination("/t.1"); - jmsServer.removeTopicFromJNDI("topicOne"); + jmsServer.removeTopicFromBindingRegistry("topicOne"); assertTrue(jmsServer.createTopic(true, "topicOne", "/topicx.1", "/topicx.2")); @@ -292,7 +292,7 @@ public class StoreConfigTest extends JMSTestBase assertNullJNDI("/q2"); assertNullJNDI("/q.2"); - jmsServer.addQueueToJndi("queue1", "/qI"); + jmsServer.addQueueToBindingRegistry("queue1", "/qI"); jmsServer.stop(); jmsServer.start(); @@ -305,9 +305,9 @@ public class StoreConfigTest extends JMSTestBase assertNullJNDI("/q.2"); - assertTrue(jmsServer.removeQueueFromJNDI("queue1", "/q1")); + assertTrue(jmsServer.removeQueueFromBindingRegistry("queue1", "/q1")); - assertFalse(jmsServer.removeQueueFromJNDI("queue1","nothing")); + assertFalse(jmsServer.removeQueueFromBindingRegistry("queue1", "nothing")); assertNullJNDI("/q1"); checkDestination("/q.1"); @@ -321,7 +321,7 @@ public class StoreConfigTest extends JMSTestBase checkDestination("/q.1"); checkDestination("/qI"); - jmsServer.removeQueueFromJNDI("queue1"); + jmsServer.removeQueueFromBindingRegistry("queue1"); assertTrue(jmsServer.createQueue(true, "queue1", null, true, "/newq1", "/newq.1")); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/JMSFailoverListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/JMSFailoverListenerTest.java index 6bfdd206d9..0c8d986fd8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/JMSFailoverListenerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/JMSFailoverListenerTest.java @@ -40,6 +40,7 @@ import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.core.config.Configuration; import org.apache.activemq.core.config.ha.SharedStoreMasterPolicyConfiguration; import org.apache.activemq.core.config.ha.SharedStoreSlavePolicyConfiguration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.InVMRegistry; import org.apache.activemq.core.remoting.impl.invm.TransportConstants; import org.apache.activemq.core.server.ActiveMQServer; @@ -315,7 +316,7 @@ public class JMSFailoverListenerTest extends ServiceTestBase backupJMSService = new JMSServerManagerImpl(backupService); - backupJMSService.setContext(ctx2); + backupJMSService.setRegistry(new JndiBindingRegistry(ctx2)); backupJMSService.getActiveMQServer().setIdentity("JMSBackup"); log.info("Starting backup"); @@ -340,7 +341,7 @@ public class JMSFailoverListenerTest extends ServiceTestBase liveJMSService = new JMSServerManagerImpl(liveService); - liveJMSService.setContext(ctx1); + liveJMSService.setRegistry(new JndiBindingRegistry(ctx1)); liveJMSService.getActiveMQServer().setIdentity("JMSLive"); log.info("Starting life"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/JMSFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/JMSFailoverTest.java index b7c305f15d..e87c216be9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/JMSFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/JMSFailoverTest.java @@ -47,6 +47,7 @@ import org.apache.activemq.core.config.ha.SharedStoreMasterPolicyConfiguration; import org.apache.activemq.core.config.ha.SharedStoreSlavePolicyConfiguration; import org.apache.activemq.core.protocol.core.Packet; import org.apache.activemq.core.protocol.core.impl.wireformat.SessionReceiveContinuationMessage; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.InVMRegistry; import org.apache.activemq.core.remoting.impl.invm.TransportConstants; import org.apache.activemq.core.server.ActiveMQServer; @@ -543,7 +544,7 @@ public class JMSFailoverTest extends ServiceTestBase backupJMSService = new JMSServerManagerImpl(backupService); - backupJMSService.setContext(ctx2); + backupJMSService.setRegistry(new JndiBindingRegistry(ctx2)); backupJMSService.getActiveMQServer().setIdentity("JMSBackup"); log.info("Starting backup"); @@ -569,7 +570,7 @@ public class JMSFailoverTest extends ServiceTestBase liveJMSService = new JMSServerManagerImpl(liveService); - liveJMSService.setContext(ctx1); + liveJMSService.setRegistry(new JndiBindingRegistry(ctx1)); liveJMSService.getActiveMQServer().setIdentity("JMSLive"); log.info("Starting life"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/ReplicatedJMSFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/ReplicatedJMSFailoverTest.java index 01a0fb384d..99ff34c272 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/ReplicatedJMSFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/cluster/ReplicatedJMSFailoverTest.java @@ -19,6 +19,7 @@ package org.apache.activemq.tests.integration.jms.cluster; import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.core.config.ha.ReplicaPolicyConfiguration; import org.apache.activemq.core.config.ha.ReplicatedPolicyConfiguration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.TransportConstants; import org.apache.activemq.core.server.ActiveMQServers; import org.apache.activemq.jms.server.impl.JMSServerManagerImpl; @@ -55,7 +56,7 @@ public class ReplicatedJMSFailoverTest extends JMSFailoverTest backupJMSService = new JMSServerManagerImpl(backupService); - backupJMSService.setContext(ctx2); + backupJMSService.setRegistry(new JndiBindingRegistry(ctx2)); backupJMSService.start(); @@ -74,7 +75,7 @@ public class ReplicatedJMSFailoverTest extends JMSFailoverTest liveJMSService = new JMSServerManagerImpl(liveService); - liveJMSService.setContext(ctx1); + liveJMSService.setRegistry(new JndiBindingRegistry(ctx1)); liveJMSService.start(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ExceptionListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ExceptionListenerTest.java index f3fbfe01e9..7dd5f5b270 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ExceptionListenerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ExceptionListenerTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.tests.integration.jms.connection; import org.apache.activemq.api.core.ActiveMQInternalErrorException; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.junit.Before; import org.junit.After; @@ -73,7 +74,7 @@ public class ExceptionListenerTest extends UnitTestCase .addAcceptorConfiguration(new TransportConfiguration("org.apache.activemq.core.remoting.impl.invm.InVMAcceptorFactory")); server = addServer(ActiveMQServers.newActiveMQServer(conf, false)); jmsServer = new JMSServerManagerImpl(server); - jmsServer.setContext(new NullInitialContext()); + jmsServer.setRegistry(new JndiBindingRegistry(new NullInitialContext())); jmsServer.start(); jmsServer.createQueue(false, ExceptionListenerTest.Q_NAME, null, true, ExceptionListenerTest.Q_NAME); cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory")); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerDeployerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerDeployerTest.java index bede98b726..ba003405cf 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerDeployerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerDeployerTest.java @@ -26,6 +26,7 @@ import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration; import org.apache.activemq.core.config.Configuration; import org.apache.activemq.core.deployers.DeploymentManager; import org.apache.activemq.core.deployers.impl.FileDeploymentManager; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.jms.server.JMSServerManager; @@ -157,7 +158,7 @@ public class JMSServerDeployerTest extends ServiceTestBase jmsServer = new JMSServerManagerImpl(server); context = new InVMNamingContext(); - jmsServer.setContext(context); + jmsServer.setRegistry(new JndiBindingRegistry(context)); jmsServer.start(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerStartStopTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerStartStopTest.java index 4a605efe06..01815e7c1f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerStartStopTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerStartStopTest.java @@ -210,7 +210,7 @@ public class JMSServerStartStopTest extends UnitTestCase liveJMSServer = new JMSServerManagerImpl(liveServer, "server-start-stop-jms-config1.xml"); addActiveMQComponent(liveJMSServer); - liveJMSServer.setContext(null); + liveJMSServer.setRegistry(null); liveJMSServer.start(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/config/JMSConfigurationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/config/JMSConfigurationTest.java index 671f4fec2a..fa5409d0f5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/config/JMSConfigurationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/config/JMSConfigurationTest.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.tests.integration.jms.server.config; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.junit.Test; import java.util.ArrayList; @@ -66,7 +67,6 @@ public class JMSConfigurationTest extends ServiceTestBase ActiveMQServer coreServer = new ActiveMQServerImpl(coreConfiguration); JMSConfiguration jmsConfiguration = new JMSConfigurationImpl(); - jmsConfiguration.setContext(context); TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName()); List transportConfigs = new ArrayList(); transportConfigs.add(connectorConfig); @@ -92,6 +92,8 @@ public class JMSConfigurationTest extends ServiceTestBase jmsConfiguration.getTopicConfigurations().add(topicConfig); JMSServerManager server = new JMSServerManagerImpl(coreServer, jmsConfiguration); + + server.setRegistry(new JndiBindingRegistry(context)); server.start(); for (String binding : cfConfig.getBindings()) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java index 686a5e78e5..c0b6ae94b5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/ConnectionFactoryControlTest.java @@ -20,6 +20,7 @@ import java.util.List; import javax.management.Notification; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.junit.Before; import org.junit.After; import org.junit.Test; @@ -171,7 +172,7 @@ public class ConnectionFactoryControlTest extends ManagementTestBase ctx = new InVMNamingContext(); - serverManager.setContext(ctx); + serverManager.setRegistry(new JndiBindingRegistry(ctx)); serverManager.activated(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSQueueControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSQueueControlTest.java index cfab79b4ff..4f94ee4ea2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSQueueControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSQueueControlTest.java @@ -45,6 +45,7 @@ import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.api.jms.management.JMSQueueControl; import org.apache.activemq.api.jms.management.JMSServerControl; import org.apache.activemq.core.config.Configuration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.core.settings.impl.AddressFullMessagePolicy; @@ -1229,7 +1230,7 @@ public class JMSQueueControlTest extends ManagementTestBase ActiveMQQueue testQueue = (ActiveMQQueue) ActiveMQJMSClient.createQueue(testQueueName); JMSQueueControl queueControl = createManagementControl(testQueue); - String[] bindings = queueControl.getJNDIBindings(); + String[] bindings = queueControl.getRegistryBindings(); String newJndi = "newTestQueueAddJndi"; @@ -1237,9 +1238,9 @@ public class JMSQueueControlTest extends ManagementTestBase { assertFalse(b.equals(newJndi)); } - queueControl.addJNDI(newJndi); + queueControl.addBinding(newJndi); - bindings = queueControl.getJNDIBindings(); + bindings = queueControl.getRegistryBindings(); boolean newBindingAdded = false; for (String b : bindings) { @@ -1258,7 +1259,7 @@ public class JMSQueueControlTest extends ManagementTestBase queueControl = createManagementControl(testQueue); - bindings = queueControl.getJNDIBindings(); + bindings = queueControl.getRegistryBindings(); newBindingAdded = false; for (String b : bindings) { @@ -1327,7 +1328,7 @@ public class JMSQueueControlTest extends ManagementTestBase serverManager = new JMSServerManagerImpl(server); context = new InVMNamingContext(); - serverManager.setContext(context); + serverManager.setRegistry(new JndiBindingRegistry(context)); serverManager.start(); serverManager.activated(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java index 7677786da0..3921cb145b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java @@ -293,13 +293,13 @@ public class JMSQueueControlUsingJMSTest extends JMSQueueControlTest return (String)proxy.retrieveAttributeValue("selector"); } - public void addJNDI(String jndi) throws Exception + public void addBinding(String jndi) throws Exception { // TODO: Add a test for this - proxy.invokeOperation("addJNDI", jndi); + proxy.invokeOperation("addBindings", jndi); } - public String[] getJNDIBindings() + public String[] getRegistryBindings() { // TODO: Add a test for this return null; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControl2Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControl2Test.java index 4ca8615fae..2e719b024f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControl2Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControl2Test.java @@ -40,6 +40,7 @@ import org.apache.activemq.api.jms.management.JMSConsumerInfo; import org.apache.activemq.api.jms.management.JMSServerControl; import org.apache.activemq.api.jms.management.JMSSessionInfo; import org.apache.activemq.core.config.Configuration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory; @@ -89,7 +90,7 @@ public class JMSServerControl2Test extends ManagementTestBase context = new InVMNamingContext(); serverManager = new JMSServerManagerImpl(server); addActiveMQComponent(serverManager); - serverManager.setContext(context); + serverManager.setRegistry(new JndiBindingRegistry(context)); serverManager.start(); serverManager.activated(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControlRestartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControlRestartTest.java index 7dfe5fc980..aa91243f2e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControlRestartTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControlRestartTest.java @@ -30,6 +30,7 @@ import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.api.jms.management.JMSManagementHelper; import org.apache.activemq.api.jms.management.JMSServerControl; import org.apache.activemq.core.config.Configuration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.core.server.ActiveMQServer; @@ -161,7 +162,7 @@ public class JMSServerControlRestartTest extends ManagementTestBase context = new InVMNamingContext(); serverManager = new JMSServerManagerImpl(server); - serverManager.setContext(context); + serverManager.setRegistry(new JndiBindingRegistry(context)); return serverManager; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControlTest.java index 259fd54800..d36492f910 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/JMSServerControlTest.java @@ -50,6 +50,7 @@ import org.apache.activemq.api.jms.ActiveMQJMSClient; import org.apache.activemq.api.jms.management.JMSServerControl; import org.apache.activemq.core.config.Configuration; import org.apache.activemq.core.postoffice.QueueBinding; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.core.server.ActiveMQServers; @@ -61,7 +62,7 @@ import org.apache.activemq.jms.client.ActiveMQQueueConnectionFactory; import org.apache.activemq.jms.persistence.JMSStorageManager; import org.apache.activemq.jms.persistence.config.PersistedConnectionFactory; import org.apache.activemq.jms.persistence.config.PersistedDestination; -import org.apache.activemq.jms.persistence.config.PersistedJNDI; +import org.apache.activemq.jms.persistence.config.PersistedBindings; import org.apache.activemq.jms.persistence.config.PersistedType; import org.apache.activemq.jms.server.impl.JMSServerManagerImpl; import org.apache.activemq.tests.integration.management.ManagementControlHelper; @@ -1073,7 +1074,7 @@ public class JMSServerControlTest extends ManagementTestBase serverManager = new JMSServerManagerImpl(server); context = new InVMNamingContext(); - serverManager.setContext(context); + serverManager.setRegistry(new JndiBindingRegistry(context)); serverManager.start(); serverManager.activated(); @@ -1207,31 +1208,31 @@ public class JMSServerControlTest extends ManagementTestBase return delegate.recoverConnectionFactories(); } - public void addJNDI(PersistedType type, String name, String... address) throws Exception + public void addBindings(PersistedType type, String name, String... address) throws Exception { persistedJNDIMap.putIfAbsent(name, new ArrayList()); for (String ad : address) { persistedJNDIMap.get(name).add(ad); } - delegate.addJNDI(type, name, address); + delegate.addBindings(type, name, address); } - public List recoverPersistedJNDI() throws Exception + public List recoverPersistedBindings() throws Exception { - return delegate.recoverPersistedJNDI(); + return delegate.recoverPersistedBindings(); } - public void deleteJNDI(PersistedType type, String name, String address) throws Exception + public void deleteBindings(PersistedType type, String name, String address) throws Exception { persistedJNDIMap.get(name).remove(address); - delegate.deleteJNDI(type, name, address); + delegate.deleteBindings(type, name, address); } - public void deleteJNDI(PersistedType type, String name) throws Exception + public void deleteBindings(PersistedType type, String name) throws Exception { persistedJNDIMap.get(name).clear(); - delegate.deleteJNDI(type, name); + delegate.deleteBindings(type, name); } public void start() throws Exception diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/TopicControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/TopicControlTest.java index 5af1e68378..6298368ed8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/TopicControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/TopicControlTest.java @@ -38,6 +38,7 @@ import org.apache.activemq.api.jms.management.TopicControl; import org.apache.activemq.core.config.Configuration; import org.apache.activemq.core.postoffice.Binding; import org.apache.activemq.core.postoffice.impl.LocalQueueBinding; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.core.server.ActiveMQServers; @@ -95,7 +96,7 @@ public class TopicControlTest extends ManagementTestBase Assert.assertEquals(topic.getTopicName(), topicControl.getName()); Assert.assertEquals(topic.getAddress(), topicControl.getAddress()); Assert.assertEquals(topic.isTemporary(), topicControl.isTemporary()); - Object[] bindings = topicControl.getJNDIBindings(); + Object[] bindings = topicControl.getRegistryBindings(); assertEquals(1, bindings.length); Assert.assertEquals(topicBinding, bindings[0]); } @@ -607,7 +608,7 @@ public class TopicControlTest extends ManagementTestBase serverManager = new JMSServerManagerImpl(server); serverManager.start(); - serverManager.setContext(new InVMNamingContext()); + serverManager.setRegistry(new JndiBindingRegistry(new InVMNamingContext())); serverManager.activated(); clientID = RandomUtil.randomString(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java index fae01a7fcd..a9d1d12802 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/management/TopicControlUsingJMSTest.java @@ -15,6 +15,7 @@ * limitations under the License. */ package org.apache.activemq.tests.integration.jms.server.management; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.junit.Before; import org.junit.After; @@ -86,7 +87,8 @@ public class TopicControlUsingJMSTest extends ManagementTestBase Assert.assertEquals(topic.getTopicName(), proxy.retrieveAttributeValue("name")); Assert.assertEquals(topic.getAddress(), proxy.retrieveAttributeValue("address")); Assert.assertEquals(topic.isTemporary(), proxy.retrieveAttributeValue("temporary")); - Object[] bindings = (Object[])proxy.retrieveAttributeValue("JNDIBindings"); + Object[] bindings = (Object[])proxy.retrieveAttributeValue("" + + "RegistryBindings"); assertEquals(1, bindings.length); Assert.assertEquals(topicBinding, bindings[0]); } @@ -448,7 +450,7 @@ public class TopicControlUsingJMSTest extends ManagementTestBase serverManager = new JMSServerManagerImpl(server); serverManager.start(); - serverManager.setContext(new InVMNamingContext()); + serverManager.setRegistry(new JndiBindingRegistry(new InVMNamingContext())); serverManager.activated(); clientID = RandomUtil.randomString(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ManagementActivationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ManagementActivationTest.java index 29647d548c..f18dbff0f9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ManagementActivationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ManagementActivationTest.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.activemq.api.core.TransportConfiguration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration; import org.apache.activemq.jms.server.config.impl.ConnectionFactoryConfigurationImpl; import org.apache.activemq.jms.server.impl.JMSServerManagerImpl; @@ -69,7 +70,7 @@ public class ManagementActivationTest extends FailoverTestBase super.setUp(); backupJmsServer = new JMSServerManagerImpl(backupServer.getServer()); context = new InVMNamingContext(); - backupJmsServer.setContext(context); + backupJmsServer.setRegistry(new JndiBindingRegistry(context)); backupJmsServer.start(); } @@ -265,7 +266,7 @@ public class ManagementActivationTest extends FailoverTestBase boolean exception = false; try { - backupJmsServer.removeQueueFromJNDI("fakeQueue"); + backupJmsServer.removeQueueFromBindingRegistry("fakeQueue"); } catch (Exception e) { @@ -287,7 +288,7 @@ public class ManagementActivationTest extends FailoverTestBase boolean exception = false; try { - backupJmsServer.removeTopicFromJNDI("fakeTopic"); + backupJmsServer.removeTopicFromBindingRegistry("fakeTopic"); } catch (Exception e) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/openwire/OpenWireTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/openwire/OpenWireTestBase.java index cbbf7b9573..95f29e2dd5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/openwire/OpenWireTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/openwire/OpenWireTestBase.java @@ -31,6 +31,7 @@ import org.apache.activemq.api.core.SimpleString; import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.api.jms.management.JMSServerControl; import org.apache.activemq.core.config.Configuration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.core.security.Role; import org.apache.activemq.core.server.ActiveMQServer; @@ -128,7 +129,7 @@ public class OpenWireTestBase extends ServiceTestBase } jmsServer = new JMSServerManagerImpl(server); namingContext = new InVMNamingContext(); - jmsServer.setContext(namingContext); + jmsServer.setRegistry(new JndiBindingRegistry(namingContext)); jmsServer.start(); registerConnectionFactory(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/JMSDynamicConfigTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/JMSDynamicConfigTest.java index 9332f3d544..8c1e9ce5bd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/JMSDynamicConfigTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/JMSDynamicConfigTest.java @@ -67,7 +67,7 @@ public class JMSDynamicConfigTest extends JMSTestBase jmsServer.createConnectionFactory(true, cfg, "tst"); assertNotNull(namingContext.lookup("tst")); - jmsServer.removeConnectionFactoryFromJNDI("tst"); + jmsServer.removeConnectionFactoryFromBindingRegistry("tst"); try { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/JMSStorageManagerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/JMSStorageManagerTest.java index 3735bc17e5..b842dddcd9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/JMSStorageManagerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/JMSStorageManagerTest.java @@ -21,7 +21,7 @@ import org.junit.Test; import java.util.List; import org.apache.activemq.jms.persistence.config.PersistedDestination; -import org.apache.activemq.jms.persistence.config.PersistedJNDI; +import org.apache.activemq.jms.persistence.config.PersistedBindings; import org.apache.activemq.jms.persistence.config.PersistedType; /** @@ -42,11 +42,11 @@ public class JMSStorageManagerTest extends StorageManagerTestBase jmsJournal.storeDestination(new PersistedDestination(PersistedType.Queue, "jndiPersistQueue", null, true)); - jmsJournal.addJNDI(PersistedType.Queue, "jndiPersistQueue", "jndi-1"); + jmsJournal.addBindings(PersistedType.Queue, "jndiPersistQueue", "jndi-1"); List destinations = jmsJournal.recoverDestinations(); - List jndiList = jmsJournal.recoverPersistedJNDI(); + List jndiList = jmsJournal.recoverPersistedBindings(); assertEquals(1, destinations.size()); @@ -66,13 +66,13 @@ public class JMSStorageManagerTest extends StorageManagerTestBase assertEquals(0, destinations.size()); - jndiList = jmsJournal.recoverPersistedJNDI(); + jndiList = jmsJournal.recoverPersistedBindings(); assertEquals(1, jndiList.size()); - PersistedJNDI jndi = jndiList.get(0); + PersistedBindings jndi = jndiList.get(0); - List jndis = jndi.getJndi(); + List jndis = jndi.getBindings(); assertEquals(1, jndis.size()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/XmlImportExportTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/XmlImportExportTest.java index ff83adf40c..8301d0e89c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/XmlImportExportTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/persistence/XmlImportExportTest.java @@ -18,6 +18,7 @@ package org.apache.activemq.tests.integration.persistence; import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.api.jms.JMSFactoryType; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.jms.client.ActiveMQConnectionFactory; import org.apache.activemq.jms.server.JMSServerManager; import org.apache.activemq.jms.server.impl.JMSServerManagerImpl; @@ -172,7 +173,7 @@ public class XmlImportExportTest extends ServiceTestBase jmsServer = new JMSServerManagerImpl(server); addActiveMQComponent(jmsServer); namingContext = new InVMContext(); - jmsServer.setContext(namingContext); + jmsServer.setRegistry(new JndiBindingRegistry(namingContext)); jmsServer.start(); locator = createInVMNonHALocator(); factory = createSessionFactory(locator); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/ExtraStompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/ExtraStompTest.java index 6b427e2729..976f74fed2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/ExtraStompTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/ExtraStompTest.java @@ -29,6 +29,7 @@ import org.apache.activemq.api.core.client.ActiveMQClient; import org.apache.activemq.core.config.Configuration; import org.apache.activemq.core.protocol.stomp.Stomp; import org.apache.activemq.core.protocol.stomp.StompProtocolManagerFactory; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory; import org.apache.activemq.core.remoting.impl.netty.TransportConstants; @@ -703,7 +704,7 @@ public class ExtraStompTest extends StompTestBase .setName(getTopicName()) .setBindings(getTopicName())); server = new JMSServerManagerImpl(activeMQServer, jmsConfig); - server.setContext(new InVMNamingContext()); + server.setRegistry(new JndiBindingRegistry((new InVMNamingContext()))); return server; } @@ -810,7 +811,7 @@ public class ExtraStompTest extends StompTestBase .setName(getTopicName()) .setBindings(getTopicName())); server = new JMSServerManagerImpl(activeMQServer, jmsConfig); - server.setContext(new InVMNamingContext()); + server.setRegistry(new JndiBindingRegistry(new InVMNamingContext())); return server; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/StompTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/StompTestBase.java index a731a05948..3aec0838c6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/StompTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/StompTestBase.java @@ -52,6 +52,7 @@ import io.netty.handler.codec.string.StringEncoder; import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.core.config.Configuration; import org.apache.activemq.core.protocol.stomp.StompProtocolManagerFactory; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory; @@ -215,7 +216,7 @@ public abstract class StompTestBase extends UnitTestCase .setName(getTopicName()) .setBindings(getTopicName())); server = new JMSServerManagerImpl(activeMQServer, jmsConfig); - server.setContext(new InVMNamingContext()); + server.setRegistry(new JndiBindingRegistry(new InVMNamingContext())); return server; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/StompWebSocketTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/StompWebSocketTest.java index ab8bd60052..63a9e6e57b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/StompWebSocketTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/StompWebSocketTest.java @@ -85,7 +85,7 @@ public class StompWebSocketTest extends UnitTestCase JMSConfiguration jmsConfig = new JMSConfigurationImpl(); server = new JMSServerManagerImpl(activeMQServer, jmsConfig); - server.setContext(null); + server.setRegistry(null); return server; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/v11/StompV11TestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/v11/StompV11TestBase.java index 9d1e42dd93..b264c4f413 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/v11/StompV11TestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/stomp/v11/StompV11TestBase.java @@ -15,6 +15,7 @@ * limitations under the License. */ package org.apache.activemq.tests.integration.stomp.v11; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.junit.Before; import org.junit.After; @@ -121,7 +122,7 @@ public abstract class StompV11TestBase extends UnitTestCase .setName(getTopicName()) .setBindings(getTopicName())); server = new JMSServerManagerImpl(activeMQServer, jmsConfig); - server.setContext(new InVMNamingContext()); + server.setRegistry(new JndiBindingRegistry(new InVMNamingContext())); return server; } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSClusteredTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSClusteredTestBase.java index d63b862999..b83a1cf658 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSClusteredTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSClusteredTestBase.java @@ -31,6 +31,7 @@ import org.apache.activemq.api.jms.ActiveMQJMSClient; import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.core.config.ClusterConnectionConfiguration; import org.apache.activemq.core.config.Configuration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.core.server.ActiveMQServers; @@ -155,7 +156,7 @@ public class JMSClusteredTestBase extends ServiceTestBase server2 = ActiveMQServers.newActiveMQServer(conf2, mBeanServer2, enablePersistence()); jmsServer2 = new JMSServerManagerImpl(server2, jmsconfig); context2 = new InVMNamingContext(); - jmsServer2.setContext(context2); + jmsServer2.setRegistry(new JndiBindingRegistry(context2)); } /** @@ -202,7 +203,7 @@ public class JMSClusteredTestBase extends ServiceTestBase server1 = ActiveMQServers.newActiveMQServer(conf1, mBeanServer1, enablePersistence()); jmsServer1 = new JMSServerManagerImpl(server1, jmsconfig); context1 = new InVMNamingContext(); - jmsServer1.setContext(context1); + jmsServer1.setRegistry(new JndiBindingRegistry(context1)); } protected boolean enablePersistence() diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSTestBase.java index 2a7eea1d19..b568b9aebd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/util/JMSTestBase.java @@ -38,6 +38,7 @@ import org.apache.activemq.api.core.TransportConfiguration; import org.apache.activemq.api.core.management.QueueControl; import org.apache.activemq.api.jms.management.JMSQueueControl; import org.apache.activemq.core.config.Configuration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.server.ActiveMQServer; import org.apache.activemq.core.server.ActiveMQServers; import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration; @@ -159,7 +160,7 @@ public class JMSTestBase extends ServiceTestBase addServer(server); jmsServer = new JMSServerManagerImpl(server); namingContext = new InVMNamingContext(); - jmsServer.setContext(namingContext); + jmsServer.setRegistry(new JndiBindingRegistry(namingContext)); jmsServer.start(); registerConnectionFactory(); @@ -178,7 +179,7 @@ public class JMSTestBase extends ServiceTestBase protected void restartServer() throws Exception { namingContext = new InVMNamingContext(); - jmsServer.setContext(namingContext); + jmsServer.setRegistry(new JndiBindingRegistry(namingContext)); jmsServer.start(); jmsServer.activated(); registerConnectionFactory(); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java index 12247ea4d0..0db11048b8 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/ActiveMQServerTestCase.java @@ -140,7 +140,6 @@ public abstract class ActiveMQServerTestCase { // create any new server we need ActiveMQServerTestCase.servers.add(ServerManagement.create()); - // start the servers if needed if (!ActiveMQServerTestCase.servers.get(0).isStarted()) { diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/LocalTestServer.java b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/LocalTestServer.java index 920ac217ac..21bd249fcf 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/LocalTestServer.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/jms/tests/tools/container/LocalTestServer.java @@ -37,6 +37,7 @@ import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.api.jms.management.JMSQueueControl; import org.apache.activemq.api.jms.management.TopicControl; import org.apache.activemq.core.config.impl.FileConfiguration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory; import org.apache.activemq.core.security.Role; import org.apache.activemq.core.server.ActiveMQServer; @@ -119,6 +120,7 @@ public class LocalTestServer implements Server, Runnable ActiveMQServerImpl activeMQServer = new ActiveMQServerImpl(fileConfiguration, beanServer, securityManager); jmsServerManager = new JMSServerManagerImpl(activeMQServer); System.setProperty(Constants.SERVER_INDEX_PROPERTY_NAME, "" + getServerID()); + jmsServerManager.setRegistry(new JndiBindingRegistry(getInitialContext())); fileConfiguration.start(); jmsServerManager.start(); diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java b/tests/timing-tests/src/test/java/org/apache/activemq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java index c28251a616..4aa27e7cad 100644 --- a/tests/timing-tests/src/test/java/org/apache/activemq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java +++ b/tests/timing-tests/src/test/java/org/apache/activemq/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java @@ -49,6 +49,7 @@ import org.apache.activemq.api.jms.ActiveMQJMSClient; import org.apache.activemq.api.jms.JMSFactoryType; import org.apache.activemq.api.jms.management.JMSQueueControl; import org.apache.activemq.core.config.Configuration; +import org.apache.activemq.core.registry.JndiBindingRegistry; import org.apache.activemq.core.remoting.impl.invm.InVMAcceptorFactory; import org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.core.server.ActiveMQServers; @@ -622,7 +623,7 @@ public class JMSBridgeImplTest extends UnitTestCase .addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())); InVMNamingContext context = new InVMNamingContext(); jmsServer = new JMSServerManagerImpl(ActiveMQServers.newActiveMQServer(config, false)); - jmsServer.setContext(context); + jmsServer.setRegistry(new JndiBindingRegistry(context)); jmsServer.start(); jmsServer.createQueue(false, JMSBridgeImplTest.SOURCE, null, true, "/queue/" + JMSBridgeImplTest.SOURCE);