[hornetq-commits] JBoss hornetq SVN: r9664 - in trunk: src/main/org/hornetq/core/registry and 7 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Sep 9 20:55:58 EDT 2010


Author: clebert.suconic at jboss.com
Date: 2010-09-09 20:55:58 -0400 (Thu, 09 Sep 2010)
New Revision: 9664

Added:
   trunk/src/main/org/hornetq/spi/core/naming/
   trunk/src/main/org/hornetq/spi/core/naming/BindingRegistry.java
Removed:
   trunk/src/main/org/hornetq/spi/BindingRegistry.java
Modified:
   trunk/.classpath
   trunk/src/main/org/hornetq/core/registry/JndiBindingRegistry.java
   trunk/src/main/org/hornetq/core/registry/MapBindingRegistry.java
   trunk/src/main/org/hornetq/integration/spring/SpringBindingRegistry.java
   trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
   trunk/src/main/org/hornetq/jms/server/embedded/EmbeddedJMS.java
   trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
Log:
Fixing ManualReconnectionToSingleServerTest as the context was not being reapplied to the new BindingRegistry introduced by Bill Burke.

Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2010-09-09 17:43:28 UTC (rev 9663)
+++ trunk/.classpath	2010-09-10 00:55:58 UTC (rev 9664)
@@ -17,7 +17,7 @@
 	<classpathentry kind="src" path="examples/core/microcontainer/src"/>
 	<classpathentry kind="src" path="examples/core/embedded-remote/src"/>
 	<classpathentry kind="src" path="examples/core/perf/src"/>
-   <classpathentry kind="src" path="examples/core/twitter-connector/src"/>
+	<classpathentry kind="src" path="examples/core/twitter-connector/src"/>
 	<classpathentry kind="src" path="examples/jms/applet/src"/>
 	<classpathentry kind="src" path="examples/jms/application-layer-failover/src"/>
 	<classpathentry kind="src" path="examples/jms/bridge/src"/>
@@ -126,5 +126,12 @@
 	<classpathentry kind="lib" path="thirdparty/wutka-dtdparser/lib/dtdparser121.jar"/>
 	<classpathentry kind="lib" path="thirdparty/org/jboss/ejb3/lib/jboss-ejb3-ext-api.jar"/>
 	<classpathentry kind="lib" path="thirdparty/org/twitter4j/lib/twitter4j-core.jar"/>
+	<classpathentry kind="lib" path="thirdparty/org/springframework/lib/spring-asm.jar"/>
+	<classpathentry kind="lib" path="thirdparty/org/springframework/lib/spring-beans.jar"/>
+	<classpathentry kind="lib" path="thirdparty/org/springframework/lib/spring-context.jar"/>
+	<classpathentry kind="lib" path="thirdparty/org/springframework/lib/spring-core.jar"/>
+	<classpathentry kind="lib" path="thirdparty/org/springframework/lib/spring-expression.jar"/>
+	<classpathentry kind="lib" path="thirdparty/org/springframework/lib/spring-jms.jar"/>
+	<classpathentry kind="lib" path="thirdparty/org/springframework/lib/spring-tx.jar"/>
 	<classpathentry kind="output" path="eclipse-output"/>
 </classpath>

Modified: trunk/src/main/org/hornetq/core/registry/JndiBindingRegistry.java
===================================================================
--- trunk/src/main/org/hornetq/core/registry/JndiBindingRegistry.java	2010-09-09 17:43:28 UTC (rev 9663)
+++ trunk/src/main/org/hornetq/core/registry/JndiBindingRegistry.java	2010-09-10 00:55:58 UTC (rev 9664)
@@ -1,6 +1,6 @@
 package org.hornetq.core.registry;
 
-import org.hornetq.spi.BindingRegistry;
+import org.hornetq.spi.core.naming.BindingRegistry;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -14,6 +14,22 @@
 {
    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;

Modified: trunk/src/main/org/hornetq/core/registry/MapBindingRegistry.java
===================================================================
--- trunk/src/main/org/hornetq/core/registry/MapBindingRegistry.java	2010-09-09 17:43:28 UTC (rev 9663)
+++ trunk/src/main/org/hornetq/core/registry/MapBindingRegistry.java	2010-09-10 00:55:58 UTC (rev 9664)
@@ -1,15 +1,17 @@
 package org.hornetq.core.registry;
 
-import org.hornetq.spi.BindingRegistry;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 
+import org.hornetq.spi.core.naming.BindingRegistry;
+
 /**
  * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
  * @version $Revision: 1 $
  */
 public class MapBindingRegistry implements BindingRegistry
 {
-   protected ConcurrentHashMap<String, Object> registry = new ConcurrentHashMap<String, Object>();
+   protected ConcurrentMap<String, Object> registry = new ConcurrentHashMap<String, Object>();
 
    public Object lookup(String name)
    {
@@ -29,4 +31,17 @@
    public void close()
    {
    }
+
+   public Object getContext()
+   {
+      return registry;
+   }
+
+   /* (non-Javadoc)
+    * @see org.hornetq.spi.core.naming.BindingRegistry#setContext(java.lang.Object)
+    */
+   public void setContext(Object ctx)
+   {
+      registry = (ConcurrentMap)ctx;
+   }
 }

Modified: trunk/src/main/org/hornetq/integration/spring/SpringBindingRegistry.java
===================================================================
--- trunk/src/main/org/hornetq/integration/spring/SpringBindingRegistry.java	2010-09-09 17:43:28 UTC (rev 9663)
+++ trunk/src/main/org/hornetq/integration/spring/SpringBindingRegistry.java	2010-09-10 00:55:58 UTC (rev 9664)
@@ -1,6 +1,6 @@
 package org.hornetq.integration.spring;
 
-import org.hornetq.spi.BindingRegistry;
+import org.hornetq.spi.core.naming.BindingRegistry;
 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 
 /**
@@ -34,4 +34,20 @@
    public void close()
    {
    }
+
+   /* (non-Javadoc)
+    * @see org.hornetq.spi.core.naming.BindingRegistry#getContext()
+    */
+   public Object getContext()
+   {
+      return this.factory;
+   }
+
+   /* (non-Javadoc)
+    * @see org.hornetq.spi.core.naming.BindingRegistry#setContext(java.lang.Object)
+    */
+   public void setContext(Object ctx)
+   {
+      this.factory = (ConfigurableBeanFactory) ctx;
+   }
 }

Modified: trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/JMSServerManager.java	2010-09-09 17:43:28 UTC (rev 9663)
+++ trunk/src/main/org/hornetq/jms/server/JMSServerManager.java	2010-09-10 00:55:58 UTC (rev 9664)
@@ -25,7 +25,7 @@
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.settings.impl.AddressSettings;
 import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
-import org.hornetq.spi.BindingRegistry;
+import org.hornetq.spi.core.naming.BindingRegistry;
 
 /**
  * The JMS Management interface.

Modified: trunk/src/main/org/hornetq/jms/server/embedded/EmbeddedJMS.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/embedded/EmbeddedJMS.java	2010-09-09 17:43:28 UTC (rev 9663)
+++ trunk/src/main/org/hornetq/jms/server/embedded/EmbeddedJMS.java	2010-09-10 00:55:58 UTC (rev 9664)
@@ -5,7 +5,7 @@
 import org.hornetq.core.server.embedded.EmbeddedHornetQ;
 import org.hornetq.jms.server.config.JMSConfiguration;
 import org.hornetq.jms.server.impl.JMSServerManagerImpl;
-import org.hornetq.spi.BindingRegistry;
+import org.hornetq.spi.core.naming.BindingRegistry;
 
 import javax.naming.Context;
 

Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java	2010-09-09 17:43:28 UTC (rev 9663)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java	2010-09-10 00:55:58 UTC (rev 9664)
@@ -66,7 +66,7 @@
 import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
 import org.hornetq.jms.server.management.JMSManagementService;
 import org.hornetq.jms.server.management.impl.JMSManagementServiceImpl;
-import org.hornetq.spi.BindingRegistry;
+import org.hornetq.spi.core.naming.BindingRegistry;
 import org.hornetq.utils.TimeAndCounterIDGenerator;
 
 /**
@@ -355,6 +355,10 @@
    public synchronized void setContext(final Context context)
    {
       this.context = context;
+      if (registry != null && registry instanceof JndiBindingRegistry)
+      {
+         registry.setContext(context);
+      }
 
       contextSet = true;
    }

Deleted: trunk/src/main/org/hornetq/spi/BindingRegistry.java
===================================================================
--- trunk/src/main/org/hornetq/spi/BindingRegistry.java	2010-09-09 17:43:28 UTC (rev 9663)
+++ trunk/src/main/org/hornetq/spi/BindingRegistry.java	2010-09-10 00:55:58 UTC (rev 9664)
@@ -1,15 +0,0 @@
-package org.hornetq.spi;
-
-/**
- * Abstract interface for a registry to store endpoints like connection factories into.
- *
- * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
- * @version $Revision: 1 $
- */
-public interface BindingRegistry
-{
-   Object lookup(String name);
-   boolean bind(String name, Object obj);
-   void unbind(String name);
-   void close();
-}

Copied: trunk/src/main/org/hornetq/spi/core/naming/BindingRegistry.java (from rev 9663, trunk/src/main/org/hornetq/spi/BindingRegistry.java)
===================================================================
--- trunk/src/main/org/hornetq/spi/core/naming/BindingRegistry.java	                        (rev 0)
+++ trunk/src/main/org/hornetq/spi/core/naming/BindingRegistry.java	2010-09-10 00:55:58 UTC (rev 9664)
@@ -0,0 +1,28 @@
+package org.hornetq.spi.core.naming;
+
+/**
+ * Abstract interface for a registry to store endpoints like connection factories into.
+ *
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+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
+    */
+   Object getContext();
+   
+   void setContext(Object ctx);
+   
+   Object lookup(String name);
+
+   boolean bind(String name, Object obj);
+
+   void unbind(String name);
+
+   void close();
+}



More information about the hornetq-commits mailing list