You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/02/12 21:01:41 UTC

[1/8] activemq-6 git commit: ACTIVEMQ6-7 - Improve Serialization on Connection Factory

Repository: activemq-6
Updated Branches:
  refs/heads/master b8db8b051 -> 87966029c


ACTIVEMQ6-7 - Improve Serialization on Connection Factory

https://issues.apache.org/jira/browse/ACTIVEMQ6-7


Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/b24d7290
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/b24d7290
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/b24d7290

Branch: refs/heads/master
Commit: b24d72900bf1b2bda18212f2ea99cce5ad23af20
Parents: 33addb4
Author: Clebert Suconic <cl...@apache.org>
Authored: Fri Dec 12 14:01:48 2014 -0500
Committer: Andy Taylor <an...@apache.org>
Committed: Wed Feb 11 11:36:10 2015 +0000

----------------------------------------------------------------------
 activemq-commons/pom.xml                        |   4 +
 .../apache/activemq/utils/uri/URIFactory.java   |  70 ++++++
 .../apache/activemq/utils/uri/URISchema.java    | 188 +++++++++++++++
 .../apache/activemq/utils/URIParserTest.java    | 237 +++++++++++++++++++
 .../core/client/ActiveMQClientLogger.java       |   4 +
 .../client/impl/ClientSessionFactoryImpl.java   |  14 --
 .../remoting/impl/netty/NettyConnector.java     |  58 ++---
 .../impl/netty/NettyConnectorFactory.java       |   6 -
 .../remoting/impl/netty/TransportConstants.java |  67 +++---
 .../spi/core/remoting/ConnectorFactory.java     |  10 -
 activemq-jms-client/pom.xml                     |   7 +
 .../jndi/ActiveMQInitialContextFactory.java     |   6 +-
 .../apache/activemq/uri/AbstractCFSchema.java   |  45 ++++
 .../activemq/uri/ConnectionFactoryParser.java   |  34 +++
 .../apache/activemq/uri/ConnectionOptions.java  | 120 ++++++++++
 .../org/apache/activemq/uri/JGroupsSchema.java  |  69 ++++++
 .../java/org/apache/activemq/uri/UDPSchema.java |  65 +++++
 .../activemq/uri/ConnectionFactoryURITest.java  |  60 +++++
 .../remoting/impl/invm/InVMAcceptorFactory.java |   6 -
 .../impl/invm/InVMConnectorFactory.java         |   5 -
 .../remoting/impl/invm/TransportConstants.java  |  25 +-
 .../impl/netty/NettyAcceptorFactory.java        |   5 -
 .../spi/core/remoting/AcceptorFactory.java      |   8 -
 pom.xml                                         |   7 +
 .../integration/jms/SimpleJNDIClientTest.java   |   2 +-
 25 files changed, 979 insertions(+), 143 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-commons/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-commons/pom.xml b/activemq-commons/pom.xml
index f2aa751..4f15126 100644
--- a/activemq-commons/pom.xml
+++ b/activemq-commons/pom.xml
@@ -46,6 +46,10 @@
          <artifactId>netty-all</artifactId>
       </dependency>
       <dependency>
+         <groupId>commons-beanutils</groupId>
+         <artifactId>commons-beanutils</artifactId>
+      </dependency>
+      <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java
----------------------------------------------------------------------
diff --git a/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java
new file mode 100644
index 0000000..4bc5fa4
--- /dev/null
+++ b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.utils.uri;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @author clebertsuconic
+ */
+
+public class URIFactory<T>
+{
+
+   private URI defaultURI;
+
+   private final Map<String, URISchema<T>> schemas = new ConcurrentHashMap<>();
+
+   public URI getDefaultURI()
+   {
+      return defaultURI;
+   }
+
+   public void setDefaultURI(URI uri)
+   {
+      this.defaultURI = uri;
+   }
+
+   public void registerSchema(URISchema<T> schemaFactory)
+   {
+      schemas.put(schemaFactory.getSchemaName(), schemaFactory);
+      schemaFactory.setFactory(this);
+   }
+
+   public void removeSchema(final String schemaName)
+   {
+      schemas.remove(schemaName);
+   }
+
+   public T newObject(URI uri) throws Exception
+   {
+      URISchema<T> schemaFactory = schemas.get(uri.getScheme());
+
+      if (schemaFactory == null)
+      {
+         throw new NullPointerException("Schema " + uri.getScheme() + " not found");
+      }
+
+
+      return schemaFactory.newObject(uri);
+   }
+
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java
----------------------------------------------------------------------
diff --git a/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java
new file mode 100644
index 0000000..4226d71
--- /dev/null
+++ b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java
@@ -0,0 +1,188 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.utils.uri;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.beanutils.BeanUtilsBean;
+import org.apache.commons.beanutils.FluentPropertyBeanIntrospector;
+
+/**
+ * @author clebertsuconic
+ */
+
+public abstract class URISchema<T>
+{
+   public abstract String getSchemaName();
+
+   public T newObject(URI uri) throws Exception
+   {
+      return newObject(uri, null);
+   }
+
+   private URIFactory<T> parentFactory;
+
+
+   void setFactory(URIFactory<T> factory)
+   {
+      this.parentFactory = parentFactory;
+   }
+
+   protected URIFactory<T> getFactory()
+   {
+      return parentFactory;
+   }
+
+
+   protected String getHost(URI uri)
+   {
+      URI defaultFactory = getDefaultURI();
+      if (defaultFactory != null && uri.getHost() == null && defaultFactory.getScheme().equals(uri.getScheme()))
+      {
+         uri = defaultFactory;
+      }
+      return uri.getHost();
+   }
+
+   protected URI getDefaultURI()
+   {
+      URIFactory<T> factory = getFactory();
+      if (factory == null)
+      {
+         return null;
+      }
+      else
+      {
+         return factory.getDefaultURI();
+      }
+   }
+
+   protected int getPort(URI uri)
+   {
+      URI defaultFactory = getDefaultURI();
+      if (defaultFactory != null && uri.getPort() < 0 && defaultFactory.getScheme().equals(uri.getScheme()))
+      {
+         uri = defaultFactory;
+      }
+      return uri.getPort();
+   }
+
+   /**
+    * It will create a new Object for the URI selected schema.
+    * the propertyOverrides is used to replace whatever was defined on the URL string
+    * @param uri
+    * @param propertyOverrides
+    * @return
+    * @throws Exception
+    */
+   public T newObject(URI uri, Map<String, String> propertyOverrides) throws Exception
+   {
+      return internalNewObject(uri, parseQuery(uri.getQuery(), propertyOverrides));
+   }
+
+   protected abstract T internalNewObject(URI uri, Map<String, String> query) throws Exception;
+
+   private static final BeanUtilsBean beanUtils = new BeanUtilsBean();
+
+
+   static
+   {
+      // This is to customize the BeanUtils to use Fluent Proeprties as well
+      beanUtils.getPropertyUtils().addBeanIntrospector(new FluentPropertyBeanIntrospector());
+   }
+
+
+   public static Map<String, String> parseQuery(String uri, Map<String, String> propertyOverrides) throws URISyntaxException
+   {
+      try
+      {
+         Map<String, String> rc = new HashMap<String, String>();
+         if (uri != null && !uri.isEmpty())
+         {
+            String[] parameters = uri.split("&");
+            for (int i = 0; i < parameters.length; i++)
+            {
+               int p = parameters[i].indexOf("=");
+               if (p >= 0)
+               {
+                  String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
+                  String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
+                  rc.put(name, value);
+               }
+               else
+               {
+                  rc.put(parameters[i], null);
+               }
+            }
+         }
+
+         if (propertyOverrides != null)
+         {
+            for (Map.Entry<String, String> entry: propertyOverrides.entrySet())
+            {
+               rc.put(entry.getKey(), entry.getValue());
+            }
+         }
+         return rc;
+      }
+      catch (UnsupportedEncodingException e)
+      {
+         throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
+      }
+   }
+
+
+
+   protected String printQuery(Map<String, String> query)
+   {
+      StringBuffer buffer = new StringBuffer();
+      for (Map.Entry<String, String> entry : query.entrySet())
+      {
+         buffer.append(entry.getKey() + "=" + entry.getValue());
+         buffer.append("\n");
+      }
+
+      return  buffer.toString();
+   }
+
+   protected static <P> P copyData(P source, P target) throws Exception
+   {
+      synchronized (beanUtils)
+      {
+         beanUtils.copyProperties(source, target);
+      }
+      return target;
+   }
+
+   protected static <P> P setData(URI uri, P obj, Map<String, String> query) throws Exception
+   {
+      synchronized (beanUtils)
+      {
+         beanUtils.setProperty(obj, "host", uri.getHost());
+         beanUtils.setProperty(obj, "port", uri.getPort());
+         beanUtils.setProperty(obj, "userInfo", uri.getUserInfo());
+         beanUtils.populate(obj, query);
+      }
+      return obj;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java
----------------------------------------------------------------------
diff --git a/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java b/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java
new file mode 100644
index 0000000..be389c6
--- /dev/null
+++ b/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java
@@ -0,0 +1,237 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.utils;
+
+import org.apache.activemq.utils.uri.URIFactory;
+import org.apache.activemq.utils.uri.URISchema;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * @author clebertsuconic
+ */
+
+public class URIParserTest
+{
+
+   /**
+    * this is just a simple test to validate the model
+    *
+    * @throws Throwable
+    */
+   @Test
+   public void testSchemaFruit() throws Throwable
+   {
+      FruitParser parser = new FruitParser();
+      Fruit fruit = (Fruit)parser.newObject(new URI("fruit://some:guy@fair-market:3030?color=green&fluentName=something"));
+
+      Assert.assertEquals("fruit", fruit.getName());
+      Assert.assertEquals(3030, fruit.getPort());
+      Assert.assertEquals("fair-market", fruit.getHost());
+      Assert.assertEquals("some:guy", fruit.getUserInfo());
+      Assert.assertEquals("green", fruit.getColor());
+      Assert.assertEquals("something", fruit.getFluentName());
+
+
+   }
+
+   /**
+    * Even thought there's no host Poperty on FruitBase.. this should still work fine without throwing any exceptions
+    *
+    * @throws Throwable
+    */
+   @Test
+   public void testSchemaNoHosPropertyt() throws Throwable
+   {
+      FruitParser parser = new FruitParser();
+      FruitBase fruit = parser.newObject(new URI("base://some:guy@fair-market:3030?color=green&fluentName=something"));
+      Assert.assertEquals("base", fruit.getName());
+      Assert.assertEquals("green", fruit.getColor());
+      Assert.assertEquals("something", fruit.getFluentName());
+   }
+
+   /**
+    * Even thought there's no host Poperty on FruitBase.. this should still work fine without throwing any exceptions
+    *
+    * @throws Throwable
+    */
+   @Test
+   public void testSchemaNoHostOnURL() throws Throwable
+   {
+      FruitParser parser = new FruitParser();
+      Fruit fruit = (Fruit)parser.newObject(new URI("fruit://some:guy@port?color=green&fluentName=something"));
+
+      System.out.println("fruit:" + fruit);
+      Assert.assertEquals("fruit", fruit.getName());
+      Assert.assertEquals("green", fruit.getColor());
+      Assert.assertEquals("something", fruit.getFluentName());
+   }
+
+
+   class FruitParser extends URIFactory<FruitBase>
+   {
+      FruitParser()
+      {
+         this.registerSchema(new FruitSchema());
+         this.registerSchema(new FruitBaseSchema());
+      }
+   }
+
+   class FruitSchema extends URISchema<FruitBase>
+   {
+      @Override
+      public String getSchemaName()
+      {
+         return "fruit";
+      }
+
+
+      @Override
+      public FruitBase internalNewObject(URI uri, Map<String, String> query) throws Exception
+      {
+         return setData(uri, new Fruit(getSchemaName()), query);
+      }
+   }
+
+   class FruitBaseSchema extends URISchema<FruitBase>
+   {
+      @Override
+      public String getSchemaName()
+      {
+         return "base";
+      }
+
+
+      @Override
+      public FruitBase internalNewObject(URI uri, Map<String, String> query) throws Exception
+      {
+         return setData(uri, new FruitBase(getSchemaName()), query);
+      }
+   }
+
+
+   public static class FruitBase
+   {
+      final String name;
+      String fluentName;
+      String color;
+
+      FruitBase(final String name)
+      {
+         this.name = name;
+      }
+
+
+      public String getName()
+      {
+         return name;
+      }
+
+
+      public String getColor()
+      {
+         return color;
+      }
+
+      public void setColor(String color)
+      {
+         this.color = color;
+      }
+
+      public String getFluentName()
+      {
+         return fluentName;
+      }
+
+      public FruitBase setFluentName(String name)
+      {
+         this.fluentName = name;
+
+         return this;
+      }
+
+      @Override
+      public String toString()
+      {
+         return "FruitBase{" +
+            "name='" + name + '\'' +
+            ", fluentName='" + fluentName + '\'' +
+            ", color='" + color + '\'' +
+            '}';
+      }
+   }
+
+   public static class Fruit extends FruitBase
+   {
+
+
+      public Fruit(String name)
+      {
+         super(name);
+      }
+
+      String host;
+      int port;
+      String userInfo;
+
+
+
+      public void setHost(String host)
+      {
+         this.host = host;
+      }
+
+      public String getHost()
+      {
+         return host;
+      }
+
+      public void setPort(int port)
+      {
+         this.port = port;
+      }
+
+      public int getPort()
+      {
+         return port;
+      }
+
+      public void setUserInfo(String userInfo)
+      {
+         this.userInfo = userInfo;
+      }
+
+      public String getUserInfo()
+      {
+         return userInfo;
+      }
+
+      @Override
+      public String toString()
+      {
+         return "Fruit{" +
+            "host='" + host + '\'' +
+            ", port=" + port +
+            ", userInfo='" + userInfo + '\'' +
+            "super=" + super.toString() + '}';
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-core-client/src/main/java/org/apache/activemq/core/client/ActiveMQClientLogger.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/client/ActiveMQClientLogger.java b/activemq-core-client/src/main/java/org/apache/activemq/core/client/ActiveMQClientLogger.java
index 4acf387..ae78db7 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/core/client/ActiveMQClientLogger.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/core/client/ActiveMQClientLogger.java
@@ -416,4 +416,8 @@ public interface ActiveMQClientLogger extends BasicLogger
    @LogMessage(level = Logger.Level.ERROR)
    @Message(id = 214024, value = "HTTP upgrade not supported by remote acceptor")
    void httpUpgradeNotSupportedByRemoteAcceptor();
+
+   @LogMessage(level = Logger.Level.ERROR)
+   @Message(id = 214025, value = "Invalid type {0}, Using default connection factory at {1}", format = Message.Format.MESSAGE_FORMAT)
+   void invalidCFType(String type, String uri);
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ClientSessionFactoryImpl.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ClientSessionFactoryImpl.java b/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ClientSessionFactoryImpl.java
index e7a37a2..07aafcc 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ClientSessionFactoryImpl.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ClientSessionFactoryImpl.java
@@ -60,7 +60,6 @@ import org.apache.activemq.spi.core.remoting.TopologyResponseHandler;
 import org.apache.activemq.spi.core.remoting.SessionContext;
 import org.apache.activemq.utils.ClassloadingUtil;
 import org.apache.activemq.utils.ConcurrentHashSet;
-import org.apache.activemq.utils.ConfigurationHelper;
 import org.apache.activemq.utils.ConfirmationWindowWarning;
 import org.apache.activemq.utils.ExecutorFactory;
 import org.apache.activemq.utils.OrderedExecutorFactory;
@@ -1265,19 +1264,6 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
 
    private void checkTransportKeys(final ConnectorFactory factory, final TransportConfiguration tc)
    {
-      if (tc.getParams() != null)
-      {
-         Set<String> invalid = ConfigurationHelper.checkKeys(factory.getAllowableProperties(), tc.getParams().keySet());
-
-         if (!invalid.isEmpty())
-         {
-            String msg = "The following keys are invalid for configuring a connector: " +
-               ConfigurationHelper.stringSetToCommaListString(invalid);
-
-            throw new IllegalStateException(msg);
-
-         }
-      }
    }
 
    /**

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnector.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnector.java b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnector.java
index 3ed9e87..34a532b 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnector.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnector.java
@@ -163,66 +163,66 @@ public class NettyConnector extends AbstractConnector
 
    private final ConnectionLifeCycleListener listener;
 
-   private final boolean sslEnabled;
+   private boolean sslEnabled = TransportConstants.DEFAULT_SSL_ENABLED;
 
-   private final boolean httpEnabled;
+   private boolean httpEnabled;
 
-   private final long httpMaxClientIdleTime;
+   private long httpMaxClientIdleTime;
 
-   private final long httpClientIdleScanPeriod;
+   private long httpClientIdleScanPeriod;
 
-   private final boolean httpRequiresSessionId;
+   private boolean httpRequiresSessionId;
 
    // if true, after the connection, the connector will send
    // a HTTP GET request (+ Upgrade: activemq-remoting) that
    // will be handled by the server's http server.
-   private final boolean httpUpgradeEnabled;
+   private boolean httpUpgradeEnabled;
 
-   private final boolean useServlet;
+   private boolean useServlet;
 
-   private final String host;
+   private String host;
 
-   private final int port;
+   private int port;
 
-   private final String localAddress;
+   private String localAddress;
 
-   private final int localPort;
+   private int localPort;
 
-   private final String keyStoreProvider;
+   private String keyStoreProvider;
 
-   private final String keyStorePath;
+   private String keyStorePath;
 
-   private final String keyStorePassword;
+   private String keyStorePassword;
 
-   private final String trustStoreProvider;
+   private String trustStoreProvider;
 
-   private final String trustStorePath;
+   private String trustStorePath;
 
-   private final String trustStorePassword;
+   private String trustStorePassword;
 
-   private final String enabledCipherSuites;
+   private String enabledCipherSuites;
 
-   private final String enabledProtocols;
+   private String enabledProtocols;
 
-   private final boolean tcpNoDelay;
+   private boolean tcpNoDelay;
 
-   private final int tcpSendBufferSize;
+   private int tcpSendBufferSize;
 
-   private final int tcpReceiveBufferSize;
+   private int tcpReceiveBufferSize;
 
-   private final long batchDelay;
+   private long batchDelay;
 
-   private final ConcurrentMap<Object, Connection> connections = new ConcurrentHashMap<Object, Connection>();
+   private ConcurrentMap<Object, Connection> connections = new ConcurrentHashMap<Object, Connection>();
 
-   private final String servletPath;
+   private String servletPath;
 
-   private final int nioRemotingThreads;
+   private int nioRemotingThreads;
 
-   private final boolean useNioGlobalWorkerPool;
+   private boolean useNioGlobalWorkerPool;
 
-   private final ScheduledExecutorService scheduledThreadPool;
+   private ScheduledExecutorService scheduledThreadPool;
 
-   private final Executor closeExecutor;
+   private Executor closeExecutor;
 
    private BatchFlusher flusher;
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnectorFactory.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnectorFactory.java b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnectorFactory.java
index 213aecc..d7d8dce 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnectorFactory.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnectorFactory.java
@@ -17,7 +17,6 @@
 package org.apache.activemq.core.remoting.impl.netty;
 
 import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledExecutorService;
 
@@ -46,11 +45,6 @@ public class NettyConnectorFactory implements ConnectorFactory
       return new NettyConnector(configuration, handler, listener, closeExecutor, threadPool, scheduledThreadPool);
    }
 
-   public Set<String> getAllowableProperties()
-   {
-      return TransportConstants.ALLOWABLE_CONNECTOR_KEYS;
-   }
-
    @Override
    public boolean isReliable()
    {

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/TransportConstants.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/TransportConstants.java b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/TransportConstants.java
index 36033a1..f7aeb35 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/TransportConstants.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/TransportConstants.java
@@ -27,36 +27,37 @@ import org.apache.activemq.api.config.ActiveMQDefaultConfiguration;
  * A TransportConstants
  *
  * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author ClebertSuconic
  */
 public class TransportConstants
 {
-   public static final String SSL_ENABLED_PROP_NAME = "ssl-enabled";
+   public static final String SSL_ENABLED_PROP_NAME = "sslEnabled";
 
-   public static final String HTTP_ENABLED_PROP_NAME = "http-enabled";
+   public static final String HTTP_ENABLED_PROP_NAME = "httpEnabled";
 
-   public static final String HTTP_CLIENT_IDLE_PROP_NAME = "http-client-idle-time";
+   public static final String HTTP_CLIENT_IDLE_PROP_NAME = "httpClientIdleTime";
 
-   public static final String HTTP_CLIENT_IDLE_SCAN_PERIOD = "http-client-idle-scan-period";
+   public static final String HTTP_CLIENT_IDLE_SCAN_PERIOD = "httpClientIdleScanPeriod";
 
-   public static final String HTTP_RESPONSE_TIME_PROP_NAME = "http-response-time";
+   public static final String HTTP_RESPONSE_TIME_PROP_NAME = "httpResponseTime";
 
-   public static final String HTTP_SERVER_SCAN_PERIOD_PROP_NAME = "http-server-scan-period";
+   public static final String HTTP_SERVER_SCAN_PERIOD_PROP_NAME = "httpServerScanPeriod";
 
-   public static final String HTTP_REQUIRES_SESSION_ID = "http-requires-session-id";
+   public static final String HTTP_REQUIRES_SESSION_ID = "httpRequiresSessionId";
 
-   public static final String HTTP_UPGRADE_ENABLED_PROP_NAME = "http-upgrade-enabled";
+   public static final String HTTP_UPGRADE_ENABLED_PROP_NAME = "httpUpgradeEnabled";
 
-   public static final String HTTP_UPGRADE_ENDPOINT_PROP_NAME = "http-upgrade-endpoint";
+   public static final String HTTP_UPGRADE_ENDPOINT_PROP_NAME = "httpPpgradeEndpoint";
 
-   public static final String USE_SERVLET_PROP_NAME = "use-servlet";
+   public static final String USE_SERVLET_PROP_NAME = "useServlet";
 
-   public static final String SERVLET_PATH = "servlet-path";
+   public static final String SERVLET_PATH = "servletPath";
 
-   public static final String USE_NIO_PROP_NAME = "use-nio";
+   public static final String USE_NIO_PROP_NAME = "useNio";
 
-   public static final String USE_NIO_GLOBAL_WORKER_POOL_PROP_NAME = "use-nio-global-worker-pool";
+   public static final String USE_NIO_GLOBAL_WORKER_POOL_PROP_NAME = "useNioGlobalWorkerPool";
 
-   public static final String USE_INVM_PROP_NAME = "use-invm";
+   public static final String USE_INVM_PROP_NAME = "useInvm";
 
    public static final String PROTOCOL_PROP_NAME = "protocol";
 
@@ -66,27 +67,27 @@ public class TransportConstants
 
    public static final String PORT_PROP_NAME = "port";
 
-   public static final String LOCAL_ADDRESS_PROP_NAME = "local-address";
+   public static final String LOCAL_ADDRESS_PROP_NAME = "localAddress";
 
-   public static final String LOCAL_PORT_PROP_NAME = "local-port";
+   public static final String LOCAL_PORT_PROP_NAME = "localPort";
 
-   public static final String KEYSTORE_PROVIDER_PROP_NAME = "key-store-provider";
+   public static final String KEYSTORE_PROVIDER_PROP_NAME = "keyStoreProvider";
 
-   public static final String KEYSTORE_PATH_PROP_NAME = "key-store-path";
+   public static final String KEYSTORE_PATH_PROP_NAME = "keyStorePath";
 
-   public static final String KEYSTORE_PASSWORD_PROP_NAME = "key-store-password";
+   public static final String KEYSTORE_PASSWORD_PROP_NAME = "keyStorePassword";
 
-   public static final String TRUSTSTORE_PROVIDER_PROP_NAME = "trust-store-provider";
+   public static final String TRUSTSTORE_PROVIDER_PROP_NAME = "trustStoreProvider";
 
-   public static final String TRUSTSTORE_PATH_PROP_NAME = "trust-store-path";
+   public static final String TRUSTSTORE_PATH_PROP_NAME = "trustStorePath";
 
-   public static final String TRUSTSTORE_PASSWORD_PROP_NAME = "trust-store-password";
+   public static final String TRUSTSTORE_PASSWORD_PROP_NAME = "trustStorePassword";
 
-   public static final String ENABLED_CIPHER_SUITES_PROP_NAME = "enabled-cipher-suites";
+   public static final String ENABLED_CIPHER_SUITES_PROP_NAME = "enabledCipherSuites";
 
-   public static final String ENABLED_PROTOCOLS_PROP_NAME = "enabled-protocols";
+   public static final String ENABLED_PROTOCOLS_PROP_NAME = "enabledProtocols";
 
-   public static final String NEED_CLIENT_AUTH_PROP_NAME = "need-client-auth";
+   public static final String NEED_CLIENT_AUTH_PROP_NAME = "needClientAuth";
 
    public static final String BACKLOG_PROP_NAME = "backlog";
 
@@ -102,21 +103,21 @@ public class TransportConstants
     * @see <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/net/socketOpt.html">Oracle
     * doc on tcpNoDelay</a>
     */
-   public static final String TCP_NODELAY_PROPNAME = "tcp-no-delay";
+   public static final String TCP_NODELAY_PROPNAME = "tcpNoDelay";
 
-   public static final String TCP_SENDBUFFER_SIZE_PROPNAME = "tcp-send-buffer-size";
+   public static final String TCP_SENDBUFFER_SIZE_PROPNAME = "tcpSendBufferSize";
 
-   public static final String TCP_RECEIVEBUFFER_SIZE_PROPNAME = "tcp-receive-buffer-size";
+   public static final String TCP_RECEIVEBUFFER_SIZE_PROPNAME = "tcpReceiveBufferSize";
 
-   public static final String NIO_REMOTING_THREADS_PROPNAME = "nio-remoting-threads";
+   public static final String NIO_REMOTING_THREADS_PROPNAME = "nioRemotingThreads";
 
-   public static final String BATCH_DELAY = "batch-delay";
+   public static final String BATCH_DELAY = "batchDelay";
 
-   public static final String DIRECT_DELIVER = "direct-deliver";
+   public static final String DIRECT_DELIVER = "directDeliver";
 
-   public static final String CLUSTER_CONNECTION = "cluster-connection";
+   public static final String CLUSTER_CONNECTION = "clusterConnection";
 
-   public static final String STOMP_CONSUMERS_CREDIT = "stomp-consumer-credits";
+   public static final String STOMP_CONSUMERS_CREDIT = "stompConsumerCredits";
 
    public static final int STOMP_DEFAULT_CONSUMERS_CREDIT = 10 * 1024; // 10K
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectorFactory.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectorFactory.java b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectorFactory.java
index 806a138..2afd912 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectorFactory.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ConnectorFactory.java
@@ -17,7 +17,6 @@
 package org.apache.activemq.spi.core.remoting;
 
 import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledExecutorService;
 
@@ -52,15 +51,6 @@ public interface ConnectorFactory extends TransportConfigurationHelper
                              ClientProtocolManager protocolManager);
 
    /**
-    * Returns the allowable properties for this connector.
-    * <p>
-    * This will differ between different connector implementations.
-    *
-    * @return the allowable properties.
-    */
-   Set<String> getAllowableProperties();
-
-   /**
     * Indicates if connectors from this factory are reliable or not. If a connector is reliable then connection
     * monitoring (i.e. pings/pongs) will be disabled.
     *

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-jms-client/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-jms-client/pom.xml b/activemq-jms-client/pom.xml
index 2949d63..c40729a 100644
--- a/activemq-jms-client/pom.xml
+++ b/activemq-jms-client/pom.xml
@@ -50,6 +50,13 @@
          <groupId>javax.inject</groupId>
          <artifactId>javax.inject</artifactId>
       </dependency>
+
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <scope>test</scope>
+      </dependency>
+
    </dependencies>
 
    <profiles>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java
index 18b145d..a600b31 100644
--- a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java
@@ -60,8 +60,8 @@ import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
 public class ActiveMQInitialContextFactory implements InitialContextFactory
 {
    public static final String CONNECTION_FACTORY_NAMES = "connectionFactoryNames";
-   public static final String REFRESH_TIMEOUT = "refresh-timeout";
-   public static final String DISCOVERY_INITIAL_WAIT_TIMEOUT = "discovery-initial-wait-timeout";
+   public static final String REFRESH_TIMEOUT = "refreshTimeout";
+   public static final String DISCOVERY_INITIAL_WAIT_TIMEOUT = "discoveryInitialWaitTimeout";
 
    private static final String[] DEFAULT_CONNECTION_FACTORY_NAMES = {"ConnectionFactory", "XAConnectionFactory", "QueueConnectionFactory", "TopicConnectionFactory"};
    public static final String TCP_SCHEME = "tcp";
@@ -340,7 +340,7 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory
          else if (providerURI.getScheme().equals(VM_SCHEME))
          {
             Map inVmTransportConfig = new HashMap();
-            inVmTransportConfig.put("server-id", providerURI.getHost());
+            inVmTransportConfig.put("serverId", providerURI.getHost());
             TransportConfiguration tc = new TransportConfiguration("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory", inVmTransportConfig);
             connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(getJmsFactoryType(environment), tc);
          }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java
new file mode 100644
index 0000000..3e4c01e
--- /dev/null
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.uri;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.apache.activemq.core.client.ActiveMQClientLogger;
+import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.utils.uri.URISchema;
+
+/**
+ * @author clebertsuconic
+ */
+
+public abstract class AbstractCFSchema extends URISchema<ActiveMQConnectionFactory>
+{
+
+   protected ConnectionOptions newConectionOptions(URI uri, Map<String, String> query) throws Exception
+   {
+      String type = query.get("type");
+      // We do this check here to guarantee proper logging
+      if (ConnectionOptions.convertCFType(type) == null)
+      {
+         ActiveMQClientLogger.LOGGER.invalidCFType(type, uri.toString());
+      }
+      return setData(uri, new ConnectionOptions(), query);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java
new file mode 100644
index 0000000..88ef45e
--- /dev/null
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.uri;
+
+import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.utils.uri.URIFactory;
+
+/**
+ * @author clebertsuconic
+ */
+
+public class ConnectionFactoryParser extends URIFactory<ActiveMQConnectionFactory>
+{
+   public ConnectionFactoryParser()
+   {
+      registerSchema(new UDPSchema());
+      registerSchema(new JGroupsSchema());
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java
new file mode 100644
index 0000000..c9a46b3
--- /dev/null
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java
@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.uri;
+
+import org.apache.activemq.api.jms.JMSFactoryType;
+
+/**
+ * This will represent all the possible options you could setup on URLs
+ * When parsing the URL this will serve as an intermediate object
+ * And it could also be a pl
+ * @author clebertsuconic
+ */
+
+public class ConnectionOptions
+{
+
+   private boolean ha;
+
+   private JMSFactoryType factoryType = JMSFactoryType.CF;
+
+   private String host;
+
+   private int port;
+
+   public ConnectionOptions setHost(String host)
+   {
+      this.host = host;
+      return this;
+   }
+
+   public String getHost()
+   {
+      return host;
+   }
+
+
+   public ConnectionOptions setPort(int port)
+   {
+      this.port = port;
+      return this;
+   }
+
+   public int getPort()
+   {
+      return port;
+   }
+
+   public boolean isHa()
+   {
+      return ha;
+   }
+
+   public void setHa(boolean ha)
+   {
+      this.ha = ha;
+   }
+
+   public JMSFactoryType getFactoryTypeEnum()
+   {
+      return factoryType;
+   }
+
+   public String getType()
+   {
+      return factoryType.toString();
+   }
+
+
+   public void setType(final String type)
+   {
+      this.factoryType = convertCFType(type);
+      if (factoryType == null)
+      {
+         factoryType = JMSFactoryType.CF;
+      }
+   }
+
+   public static JMSFactoryType convertCFType(String type)
+   {
+      try
+      {
+         if (type == null)
+         {
+            return null;
+         }
+         else
+         {
+            return Enum.valueOf(JMSFactoryType.class, type);
+         }
+      }
+      catch (Exception e)
+      {
+         return null;
+      }
+   }
+
+   @Override
+   public String toString()
+   {
+      return "ConnectionOptions{" +
+         "ha=" + ha +
+         ", factoryType=" + factoryType +
+         '}';
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java
new file mode 100644
index 0000000..302facd
--- /dev/null
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.uri;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
+import org.apache.activemq.api.core.JGroupsBroadcastGroupConfiguration;
+import org.apache.activemq.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.utils.uri.URISchema;
+
+/**
+ * @author clebertsuconic
+ */
+
+public class JGroupsSchema extends AbstractCFSchema
+{
+   @Override
+   public String getSchemaName()
+   {
+      return "jgroups";
+   }
+
+
+   @Override
+   public ActiveMQConnectionFactory internalNewObject(URI uri, Map<String, String> query) throws Exception
+   {
+      ConnectionOptions options = newConectionOptions(uri, query);
+
+      System.out.println("authority = " + uri.getAuthority() + " path = " + uri.getPath());
+
+      JGroupsBroadcastGroupConfiguration jgroupsConfig = new JGroupsBroadcastGroupConfiguration(uri.getAuthority(), uri.getPath() != null ? uri.getPath() : UUID.randomUUID().toString());
+
+      URISchema.setData(uri, jgroupsConfig, query);
+
+
+      DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setBroadcastEndpointFactoryConfiguration(jgroupsConfig);
+
+      URISchema.setData(uri, dcConfig, query);
+
+
+      if (options.isHa())
+      {
+         return ActiveMQJMSClient.createConnectionFactoryWithHA(dcConfig, options.getFactoryTypeEnum());
+      }
+      else
+      {
+         return ActiveMQJMSClient.createConnectionFactoryWithoutHA(dcConfig, options.getFactoryTypeEnum());
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java
new file mode 100644
index 0000000..b604233
--- /dev/null
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.uri;
+
+import java.io.PrintStream;
+import java.net.URI;
+import java.util.Map;
+
+import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.core.remoting.impl.netty.TransportConstants;
+import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.utils.uri.URISchema;
+
+/**
+ * @author clebertsuconic
+ */
+
+public class UDPSchema extends AbstractCFSchema
+{
+   @Override
+   public String getSchemaName()
+   {
+      return "udp";
+   }
+
+
+   @Override
+   public ActiveMQConnectionFactory internalNewObject(URI uri, Map<String, String> query) throws Exception
+   {
+      ConnectionOptions options = newConectionOptions(uri, query);
+
+      DiscoveryGroupConfiguration dgc = URISchema.setData(uri, new DiscoveryGroupConfiguration(), query)
+         .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
+                                                      .setGroupAddress(getHost(uri))
+                                                      .setGroupPort(getPort(uri))
+                                                      .setLocalBindAddress(query.containsKey(TransportConstants.LOCAL_ADDRESS_PROP_NAME) ? (String) query.get(TransportConstants.LOCAL_ADDRESS_PROP_NAME) : null)
+                                                      .setLocalBindPort(query.containsKey(TransportConstants.LOCAL_PORT_PROP_NAME) ? Integer.parseInt((String) query.get(TransportConstants.LOCAL_PORT_PROP_NAME)) : -1));
+
+      if (options.isHa())
+      {
+         return ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, options.getFactoryTypeEnum());
+      }
+      else
+      {
+         return ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, options.getFactoryTypeEnum());
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java b/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java
new file mode 100644
index 0000000..19fb50a
--- /dev/null
+++ b/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.uri;
+
+import javax.jms.ConnectionFactory;
+import javax.jms.XAQueueConnectionFactory;
+import java.net.URI;
+
+import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author clebertsuconic
+ */
+
+public class ConnectionFactoryURITest
+{
+   ConnectionFactoryParser parser = new ConnectionFactoryParser();
+
+
+   @Test
+   public void testUDP() throws Exception
+   {
+      ActiveMQConnectionFactory factory = parser.newObject(new URI("udp://localhost:3030?ha=true&type=QUEUE_XA_CF"));
+
+      Assert.assertTrue(factory instanceof XAQueueConnectionFactory);
+   }
+
+   @Test
+   public void testInvalidCFType() throws Exception
+   {
+      ActiveMQConnectionFactory factory = parser.newObject(new URI("udp://localhost:3030?ha=true&type=QUEUE_XA_CFInvalid"));
+
+      Assert.assertTrue(factory instanceof ConnectionFactory);
+   }
+
+   @Test
+   public void testJGroups() throws Exception
+   {
+      ActiveMQConnectionFactory factory = parser.newObject(new URI("jgroups://test.xml?test=33"));
+
+//      Assert.assertTrue(factory instanceof ConnectionFactory);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java
index c0e186d..df30e00 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java
@@ -47,10 +47,4 @@ public class InVMAcceptorFactory implements AcceptorFactory
    {
       return new InVMAcceptor(clusterConnection, configuration, handler, listener, threadPool);
    }
-
-   public Set<String> getAllowableProperties()
-   {
-      return TransportConstants.ALLOWABLE_ACCEPTOR_KEYS;
-   }
-
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java
index 1c05bca..5de4161 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java
@@ -48,11 +48,6 @@ public class InVMConnectorFactory implements ConnectorFactory
       return connector;
    }
 
-   public Set<String> getAllowableProperties()
-   {
-      return TransportConstants.ALLOWABLE_CONNECTOR_KEYS;
-   }
-
    @Override
    public boolean isReliable()
    {

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java
index 4f9a490..9987383 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java
@@ -27,36 +27,15 @@ import org.apache.activemq.api.config.ActiveMQDefaultConfiguration;
  *
  * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
  * @author <a href="mailto:mtaylor@redhat.com">Martyn Taylor</a>
+ * @author ClebertSuconic
  *
  */
 public final class TransportConstants
 {
-   public static final String SERVER_ID_PROP_NAME = "server-id";
+   public static final String SERVER_ID_PROP_NAME = "serverId";
 
    public static final int DEFAULT_SERVER_ID = 0;
 
-   public static final Set<String> ALLOWABLE_CONNECTOR_KEYS;
-
-   public static final Set<String> ALLOWABLE_ACCEPTOR_KEYS;
-
-   static
-   {
-      Set<String> allowableAcceptorKeys = new HashSet<String>();
-      allowableAcceptorKeys.add(TransportConstants.SERVER_ID_PROP_NAME);
-      allowableAcceptorKeys.add(org.apache.activemq.core.remoting.impl.netty.TransportConstants.CLUSTER_CONNECTION);
-      allowableAcceptorKeys.add(ActiveMQDefaultConfiguration.getPropMaskPassword());
-      allowableAcceptorKeys.add(ActiveMQDefaultConfiguration.getPropPasswordCodec());
-
-      ALLOWABLE_ACCEPTOR_KEYS = Collections.unmodifiableSet(allowableAcceptorKeys);
-
-      Set<String> allowableConnectorKeys = new HashSet<String>();
-      allowableConnectorKeys.add(TransportConstants.SERVER_ID_PROP_NAME);
-      allowableConnectorKeys.add(ActiveMQDefaultConfiguration.getPropMaskPassword());
-      allowableConnectorKeys.add(ActiveMQDefaultConfiguration.getPropPasswordCodec());
-
-      ALLOWABLE_CONNECTOR_KEYS = Collections.unmodifiableSet(allowableConnectorKeys);
-   }
-
    private TransportConstants()
    {
       // Utility class

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java
index 502c92a..1bb545b 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java
@@ -46,9 +46,4 @@ public class NettyAcceptorFactory implements AcceptorFactory
    {
       return new NettyAcceptor(name, connection, configuration, handler, listener, scheduledThreadPool, protocolMap);
    }
-
-   public Set<String> getAllowableProperties()
-   {
-      return TransportConstants.ALLOWABLE_ACCEPTOR_KEYS;
-   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java b/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java
index 04976cf..02dbb35 100644
--- a/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java
+++ b/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java
@@ -56,12 +56,4 @@ public interface AcceptorFactory
                            ScheduledExecutorService scheduledThreadPool,
                            Map<String, ProtocolManager> protocolMap);
 
-   /**
-    * Returns the allowable properties for this acceptor.
-    * <p/>
-    * This will differ between different acceptor implementations.
-    *
-    * @return the allowable properties.
-    */
-   Set<String> getAllowableProperties();
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c3ae18a..0cf4326 100644
--- a/pom.xml
+++ b/pom.xml
@@ -410,6 +410,13 @@
             <version>2.0.0</version>
             <!-- License: Apache 2.0 -->
          </dependency>
+
+         <!-- for URL reflection. Using Populate on URI Factory at activemq-commons -->
+         <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
+            <version>1.9.2</version>
+         </dependency>
       </dependencies>
    </dependencyManagement>
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/b24d7290/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java
index 680d429..9c48cc7 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java
@@ -463,7 +463,7 @@ public class SimpleJNDIClientTest extends UnitTestCase
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(Context.PROVIDER_URL, "jgroups://test-jgroups-file_ping.xml");
+      props.put(Context.PROVIDER_URL, "jgroups://test-jgroups-file_ping.xml/");
       Context ctx = new InitialContext(props);
 
       ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("ConnectionFactory");


[7/8] activemq-6 git commit: ACTIVEMQ6-7 - Improve Serialization on Connection Factory

Posted by cl...@apache.org.
ACTIVEMQ6-7 - Improve Serialization on Connection Factory

https://issues.apache.org/jira/browse/ACTIVEMQ6-7

Connection Factory is now externalizable and is now serialized as a string that represents a URI. There are schemas for every possible type for connection factory and server locator.

The client JNDI representation of factories has also been changed to be consistent with this.


Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/3b76ccc9
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/3b76ccc9
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/3b76ccc9

Branch: refs/heads/master
Commit: 3b76ccc92b5f0e00de54a4fd6c3705d1b8509771
Parents: b24d729
Author: Andy Taylor <an...@apache.org>
Authored: Thu Jan 29 09:18:36 2015 +0000
Committer: Andy Taylor <an...@apache.org>
Committed: Thu Feb 12 09:14:24 2015 +0000

----------------------------------------------------------------------
 .../activemq/utils/uri/SchemaConstants.java     |  31 ++
 .../apache/activemq/utils/uri/URIFactory.java   |  85 +++-
 .../apache/activemq/utils/uri/URISchema.java    |  86 +++-
 .../apache/activemq/utils/URIParserTest.java    |  12 +
 .../api/core/BroadcastEndpointFactory.java      |   2 +-
 .../BroadcastEndpointFactoryConfiguration.java  |  28 --
 .../api/core/BroadcastGroupConfiguration.java   |  18 +-
 .../core/ChannelBroadcastEndpointFactory.java   |  41 ++
 .../api/core/DiscoveryGroupConfiguration.java   |  67 +--
 ...ryGroupConfigurationCompatibilityHelper.java |  45 ---
 .../api/core/JGroupsBroadcastEndpoint.java      | 281 +++++++++++++
 .../JGroupsBroadcastGroupConfiguration.java     | 404 -------------------
 .../core/JGroupsChannelBroadcastEndpoint.java   |  39 ++
 .../api/core/JGroupsFileBroadcastEndpoint.java  |  49 +++
 .../JGroupsFileBroadcastEndpointFactory.java    |  55 +++
 .../JGroupsPropertiesBroadcastEndpoint.java     |  43 ++
 ...roupsPropertiesBroadcastEndpointFactory.java |  55 +++
 .../api/core/UDPBroadcastEndpointFactory.java   | 330 +++++++++++++++
 .../core/UDPBroadcastGroupConfiguration.java    | 339 ----------------
 .../api/core/client/ActiveMQClient.java         |  14 +
 .../api/core/client/TopologyMember.java         |   4 +-
 .../core/client/impl/ServerLocatorImpl.java     |   9 +-
 .../remoting/ClientProtocolManagerFactory.java  |   4 +-
 .../uri/AbstractServerLocatorSchema.java        |  34 ++
 .../apache/activemq/uri/ConnectionOptions.java  |  75 ++++
 .../activemq/uri/InVMServerLocatorSchema.java   |  73 ++++
 .../uri/JGroupsServerLocatorSchema.java         | 102 +++++
 .../activemq/uri/ServerLocatorParser.java       |  33 ++
 .../activemq/uri/TCPServerLocatorSchema.java    | 160 ++++++++
 .../activemq/uri/UDPServerLocatorSchema.java    |  89 ++++
 activemq-jms-client/pom.xml                     |   7 +
 .../activemq/api/jms/ActiveMQJMSClient.java     |  13 +
 .../jms/client/ActiveMQConnectionFactory.java   |  70 +++-
 .../client/ActiveMQJMSConnectionFactory.java    |   1 -
 .../jndi/ActiveMQInitialContextFactory.java     | 359 ++--------------
 .../apache/activemq/uri/AbstractCFSchema.java   |   6 +-
 .../activemq/uri/ConnectionFactoryParser.java   |   2 +
 .../apache/activemq/uri/ConnectionOptions.java  | 120 ------
 .../org/apache/activemq/uri/InVMSchema.java     |  51 +++
 .../org/apache/activemq/uri/JGroupsSchema.java  |  53 ++-
 .../activemq/uri/JMSConnectionOptions.java      |  79 ++++
 .../java/org/apache/activemq/uri/TCPSchema.java |  67 +++
 .../java/org/apache/activemq/uri/UDPSchema.java |  33 +-
 .../activemq/uri/ConnectionFactoryURITest.java  | 368 ++++++++++++++++-
 .../activemq/ra/ActiveMQResourceAdapter.java    |  33 +-
 .../activemq/core/config/Configuration.java     |   3 +-
 .../core/config/impl/ConfigurationImpl.java     |   3 +-
 .../deployers/impl/FileConfigurationParser.java |  26 +-
 .../impl/BroadcastGroupControlImpl.java         |  14 +-
 .../remoting/impl/invm/InVMAcceptorFactory.java |   1 -
 .../impl/invm/InVMConnectorFactory.java         |   1 -
 .../remoting/impl/invm/TransportConstants.java  |   5 -
 .../impl/netty/NettyAcceptorFactory.java        |   1 -
 .../server/impl/RemotingServiceImpl.java        |  15 -
 .../core/server/cluster/ClusterManager.java     |   2 +-
 .../spi/core/remoting/AcceptorFactory.java      |   1 -
 .../core/config/impl/FileConfigurationTest.java |  16 +-
 docs/user-manual/en/using-jms.md                | 105 ++---
 .../aerogear/src/main/resources/jndi.properties |   2 +-
 .../ApplicationLayerFailoverExample.java        |   2 +-
 .../activemq/jms/example/BridgeExample.java     |   4 +-
 .../browser/src/main/resources/jndi.properties  |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../ClusteredDurableSubscriptionExample.java    |   4 +-
 .../jms/example/ClusteredGroupingExample.java   |   6 +-
 .../jms/example/ClusteredJgroupsExample.java    |   4 +-
 .../activemq/server0/client-jndi.properties     |   2 +-
 .../jms/example/ClusteredQueueExample.java      |   4 +-
 .../jms/example/ClusteredStandaloneExample.java |   6 +-
 .../example/StaticClusteredQueueExample.java    |   2 +-
 .../jms/example/ClusterStaticOnewayExample.java |   2 +-
 .../jms/example/ClusteredTopicExample.java      |   4 +-
 .../ColocatedFailoverScaleDownExample.java      |   8 +-
 .../jms/example/ColocatedFailoverExample.java   |   8 +-
 .../src/main/resources/jndi.properties          |   3 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../activemq/jms/example/DivertExample.java     |   4 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../expiry/src/main/resources/jndi.properties   |   2 +-
 .../jms/example/HAPolicyAutoBackupExample.java  |  12 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../activemq/jms/example/JMSBridgeExample.java  |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../jms/jmx/src/main/resources/jndi.properties  |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   3 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   3 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../paging/src/main/resources/jndi.properties   |   2 +-
 .../jms/perf/src/main/resources/jndi.properties |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   3 +-
 .../QueueMessageRedistributionExample.java      |   4 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../queue/src/main/resources/jndi.properties    |   2 +-
 .../activemq/jms/example/ReattachExample.java   |   2 +-
 .../src/main/resources/jndi.properties          |   7 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../activemq/jms/example/ScaleDownExample.java  |  12 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../security/src/main/resources/jndi.properties |   2 +-
 .../src/main/resources/jndi.properties          |   3 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../stomp/src/main/resources/jndi.properties    |   2 +-
 .../stomp1.1/src/main/resources/jndi.properties |   2 +-
 .../stomp1.2/src/main/resources/jndi.properties |   2 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../jms/example/SymmetricClusterExample.java    |   7 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../topic/src/main/resources/jndi.properties    |   2 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../xa-send/src/main/resources/jndi.properties  |   2 +-
 .../activemq/jms/soak/example/SoakReceiver.java |   2 +-
 .../activemq/jms/soak/example/SoakSender.java   |   2 +-
 .../client/ServerLocatorSerializationTest.java  | 131 ------
 .../integration/client/SessionFactoryTest.java  |  48 +--
 .../BridgeWithDiscoveryGroupStartTest.java      |   8 +-
 .../cluster/distribution/ClusterTestBase.java   |  14 +-
 .../HAClientTopologyWithDiscoveryTest.java      |   8 +-
 .../discovery/DiscoveryBaseTest.java            |  12 +-
 .../discovery/DiscoveryStayAliveTest.java       |  10 +-
 .../integration/discovery/DiscoveryTest.java    |  67 ++-
 .../jms/ActiveMQConnectionFactoryTest.java      |  16 +-
 .../integration/jms/SimpleJNDIClientTest.java   | 383 ++++--------------
 .../ConnectionFactorySerializationTest.java     | 325 +++++++++++++--
 ...tionFactoryWithJGroupsSerializationTest.java |  19 +-
 .../jms/server/JMSServerDeployerTest.java       |  10 +-
 .../management/ActiveMQServerControlTest.java   |   3 +-
 .../management/BroadcastGroupControlTest.java   |  12 +-
 .../ClusterConnectionControl2Test.java          |  14 +-
 .../ClusterConnectionControlTest.java           |   8 +-
 .../ra/ActiveMQRAClusteredTestBase.java         |   5 +-
 .../integration/ra/ResourceAdapterTest.java     |   8 +-
 .../src/test/resources/jndi.properties          |   3 +-
 .../jtests/jms/framework/PTPTestCase.java       |   3 +-
 .../jtests/jms/framework/PubSubTestCase.java    |   3 +-
 .../jtests/jms/framework/UnifiedTestCase.java   |   5 +-
 .../tests/unit/ra/ResourceAdapterTest.java      |   4 +-
 167 files changed, 3112 insertions(+), 2352 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-commons/src/main/java/org/apache/activemq/utils/uri/SchemaConstants.java
----------------------------------------------------------------------
diff --git a/activemq-commons/src/main/java/org/apache/activemq/utils/uri/SchemaConstants.java b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/SchemaConstants.java
new file mode 100644
index 0000000..6e7afe1
--- /dev/null
+++ b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/SchemaConstants.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.utils.uri;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class SchemaConstants
+{
+   public static final String TCP = "tcp";
+
+   public static final String UDP = "udp";
+
+   public static final String JGROUPS = "jgroups";
+
+   public static final String VM = "vm";
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java
----------------------------------------------------------------------
diff --git a/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java
index 4bc5fa4..452bedd 100644
--- a/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java
+++ b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URIFactory.java
@@ -18,13 +18,13 @@
 package org.apache.activemq.utils.uri;
 
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @author clebertsuconic
  */
-
 public class URIFactory<T>
 {
 
@@ -48,11 +48,25 @@ public class URIFactory<T>
       schemaFactory.setFactory(this);
    }
 
-   public void removeSchema(final String schemaName)
+   public void removeSchema(final SchemaConstants schemaName)
    {
       schemas.remove(schemaName);
    }
 
+   public T newObject(String uriString) throws Exception
+   {
+      URI uri = normalise(uriString);
+      URISchema<T> schemaFactory = schemas.get(uri.getScheme());
+
+      if (schemaFactory == null)
+      {
+         throw new NullPointerException("Schema " + uri.getScheme() + " not found");
+      }
+
+
+      return schemaFactory.newObject(uri);
+   }
+
    public T newObject(URI uri) throws Exception
    {
       URISchema<T> schemaFactory = schemas.get(uri.getScheme());
@@ -66,5 +80,72 @@ public class URIFactory<T>
       return schemaFactory.newObject(uri);
    }
 
+   public void populateObject(URI uri, T bean) throws Exception
+   {
+      URISchema<T> schemaFactory = schemas.get(uri.getScheme());
 
+      if (schemaFactory == null)
+      {
+         throw new NullPointerException("Schema " + uri.getScheme() + " not found");
+      }
+
+      schemaFactory.populateObject(uri, bean);
+   }
+
+   public URI createSchema(String scheme, T bean) throws Exception
+   {
+      URISchema<T> schemaFactory = schemas.get(scheme);
+
+      if (schemaFactory == null)
+      {
+         throw new NullPointerException("Schema " + scheme + " not found");
+      }
+      return schemaFactory.newURI(bean);
+   }
+
+   /*
+   * this method is used to change a string with multiple URI's in it into a valid URI.
+   * for instance it is possible to have the following String
+   * (tcp://localhost:5445,tcp://localhost:5545,tcp://localhost:5555)?somequery
+   * This is an invalid URI so will be changed so that the first URI is used and the
+   * extra ones added as part of the URI fragment, like so
+   * tcp://localhost:5445?someQuery#tcp://localhost:5545,tcp://localhost:5555.
+   *
+   * It is the job of the URISchema implementation to handle these fragments as needed.
+   * */
+   private URI normalise(String uri) throws URISyntaxException
+   {
+      if (uri.startsWith("("))
+      {
+         String[] split = uri.split("\\)");
+         String[] connectorURIS = split[0].substring(split[0].indexOf('(') + 1).split(",");
+         String factoryQuery = split.length > 1 ? split[1] : "";
+         StringBuilder builder = new StringBuilder(connectorURIS[0]);
+         if (factoryQuery != null && factoryQuery.length() > 0)
+         {
+            if (connectorURIS[0].contains("?"))
+            {
+               builder.append("&").append(factoryQuery.substring(1));
+            }
+            else
+            {
+               builder.append(factoryQuery);
+            }
+         }
+         if (connectorURIS.length > 1)
+         {
+            builder.append("#");
+            for (int i = 1; i < connectorURIS.length; i++)
+            {
+               if (i > 1)
+               {
+                  builder.append(",");
+               }
+               builder.append(connectorURIS[i]);
+            }
+         }
+         return new URI(builder.toString());
+      }
+      return new URI(uri);
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java
----------------------------------------------------------------------
diff --git a/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java
index 4226d71..26ec4cd 100644
--- a/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java
+++ b/activemq-commons/src/main/java/org/apache/activemq/utils/uri/URISchema.java
@@ -14,15 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.activemq.utils.uri;
 
+import java.beans.PropertyDescriptor;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URLDecoder;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.commons.beanutils.BeanUtilsBean;
 import org.apache.commons.beanutils.FluentPropertyBeanIntrospector;
@@ -40,6 +42,16 @@ public abstract class URISchema<T>
       return newObject(uri, null);
    }
 
+   public void populateObject(URI uri, T bean) throws Exception
+   {
+      setData(uri, bean, parseQuery(uri.getQuery(), null));
+   }
+
+   public URI newURI(T bean) throws Exception
+   {
+      return internalNewURI(bean);
+   }
+
    private URIFactory<T> parentFactory;
 
 
@@ -102,6 +114,8 @@ public abstract class URISchema<T>
 
    protected abstract T internalNewObject(URI uri, Map<String, String> query) throws Exception;
 
+   protected abstract URI internalNewURI(T bean) throws Exception;
+
    private static final BeanUtilsBean beanUtils = new BeanUtilsBean();
 
 
@@ -185,4 +199,74 @@ public abstract class URISchema<T>
       }
       return obj;
    }
+
+   public static void setData(URI uri, HashMap<String, Object> properties, Set<String> allowableProperties, Map<String, String> query)
+   {
+      if (allowableProperties.contains("host"))
+      {
+         properties.put("host", uri.getHost());
+      }
+      if (allowableProperties.contains("port"))
+      {
+         properties.put("port", uri.getPort());
+      }
+      if (allowableProperties.contains("userInfo"))
+      {
+         properties.put("userInfo", uri.getUserInfo());
+      }
+      for (Map.Entry<String, String> entry : query.entrySet())
+      {
+         if (allowableProperties.contains(entry.getKey()))
+         {
+            properties.put(entry.getKey(), entry.getValue());
+         }
+      }
+   }
+
+   public static String getData(List<String> ignored, Object... beans) throws Exception
+   {
+      StringBuilder sb = new StringBuilder();
+      synchronized (beanUtils)
+      {
+         for (Object bean : beans)
+         {
+            if (bean != null)
+            {
+               PropertyDescriptor[] descriptors = beanUtils.getPropertyUtils().getPropertyDescriptors(bean);
+               for (PropertyDescriptor descriptor : descriptors)
+               {
+                  if (descriptor.getReadMethod() != null && descriptor.getWriteMethod() != null && isWriteable(descriptor, ignored))
+                  {
+                     String value = beanUtils.getProperty(bean, descriptor.getName());
+                     if (value != null)
+                     {
+                        sb.append("&").append(descriptor.getName()).append("=").append(value);
+                     }
+                  }
+               }
+            }
+         }
+      }
+      return sb.toString();
+   }
+
+   private static boolean isWriteable(PropertyDescriptor descriptor, List<String> ignored)
+   {
+      if (ignored != null && ignored.contains(descriptor.getName()))
+      {
+         return false;
+      }
+      Class<?> type = descriptor.getPropertyType();
+      return (type == Double.class) ||
+             (type == double.class) ||
+             (type == Long.class) ||
+             (type == long.class) ||
+             (type == Integer.class) ||
+             (type == int.class) ||
+             (type == Float.class) ||
+             (type == float.class) ||
+             (type == Boolean.class) ||
+             (type == boolean.class) ||
+             (type == String.class);
+   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java
----------------------------------------------------------------------
diff --git a/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java b/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java
index be389c6..1654ec4 100644
--- a/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java
+++ b/activemq-commons/src/test/java/org/apache/activemq/utils/URIParserTest.java
@@ -109,6 +109,12 @@ public class URIParserTest
       {
          return setData(uri, new Fruit(getSchemaName()), query);
       }
+
+      @Override
+      protected URI internalNewURI(FruitBase bean)
+      {
+         return null;
+      }
    }
 
    class FruitBaseSchema extends URISchema<FruitBase>
@@ -125,6 +131,12 @@ public class URIParserTest
       {
          return setData(uri, new FruitBase(getSchemaName()), query);
       }
+
+      @Override
+      protected URI internalNewURI(FruitBase bean)
+      {
+         return null;
+      }
    }
 
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastEndpointFactory.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastEndpointFactory.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastEndpointFactory.java
index 2091c84..8fbe217 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastEndpointFactory.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastEndpointFactory.java
@@ -16,8 +16,8 @@
  */
 package org.apache.activemq.api.core;
 
-import java.io.Serializable;
 
+import java.io.Serializable;
 
 public interface BroadcastEndpointFactory extends Serializable
 {

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastEndpointFactoryConfiguration.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastEndpointFactoryConfiguration.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastEndpointFactoryConfiguration.java
deleted file mode 100644
index c600c88..0000000
--- a/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastEndpointFactoryConfiguration.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.api.core;
-
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
- *         9/25/12
- */
-public interface BroadcastEndpointFactoryConfiguration extends Serializable
-{
-   BroadcastEndpointFactory createBroadcastEndpointFactory();
-}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastGroupConfiguration.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastGroupConfiguration.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastGroupConfiguration.java
index 6714830..a27b543 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastGroupConfiguration.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/BroadcastGroupConfiguration.java
@@ -38,7 +38,7 @@ public final class BroadcastGroupConfiguration implements Serializable
 
    private long broadcastPeriod = ActiveMQDefaultConfiguration.getDefaultBroadcastPeriod();
 
-   private BroadcastEndpointFactoryConfiguration endpointFactoryConfiguration = null;
+   private BroadcastEndpointFactory endpointFactory = null;
 
    private List<String> connectorInfos = null;
 
@@ -79,14 +79,14 @@ public final class BroadcastGroupConfiguration implements Serializable
       return this;
    }
 
-   public BroadcastEndpointFactoryConfiguration getEndpointFactoryConfiguration()
+   public BroadcastEndpointFactory getEndpointFactory()
    {
-      return endpointFactoryConfiguration;
+      return endpointFactory;
    }
 
-   public BroadcastGroupConfiguration setEndpointFactoryConfiguration(BroadcastEndpointFactoryConfiguration endpointFactoryConfiguration)
+   public BroadcastGroupConfiguration setEndpointFactory(BroadcastEndpointFactory endpointFactory)
    {
-      this.endpointFactoryConfiguration = endpointFactoryConfiguration;
+      this.endpointFactory = endpointFactory;
       return this;
    }
 
@@ -97,7 +97,7 @@ public final class BroadcastGroupConfiguration implements Serializable
       int result = 1;
       result = prime * result + (int)(broadcastPeriod ^ (broadcastPeriod >>> 32));
       result = prime * result + ((connectorInfos == null) ? 0 : connectorInfos.hashCode());
-      result = prime * result + ((endpointFactoryConfiguration == null) ? 0 : endpointFactoryConfiguration.hashCode());
+      result = prime * result + ((endpointFactory == null) ? 0 : endpointFactory.hashCode());
       result = prime * result + ((name == null) ? 0 : name.hashCode());
       return result;
    }
@@ -121,12 +121,12 @@ public final class BroadcastGroupConfiguration implements Serializable
       }
       else if (!connectorInfos.equals(other.connectorInfos))
          return false;
-      if (endpointFactoryConfiguration == null)
+      if (endpointFactory == null)
       {
-         if (other.endpointFactoryConfiguration != null)
+         if (other.endpointFactory != null)
             return false;
       }
-      else if (!endpointFactoryConfiguration.equals(other.endpointFactoryConfiguration))
+      else if (!endpointFactory.equals(other.endpointFactory))
          return false;
       if (name == null)
       {

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/ChannelBroadcastEndpointFactory.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/ChannelBroadcastEndpointFactory.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/ChannelBroadcastEndpointFactory.java
new file mode 100644
index 0000000..ce77d6f
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/ChannelBroadcastEndpointFactory.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.api.core;
+
+import org.jgroups.JChannel;
+
+/**
+* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+*/
+public class ChannelBroadcastEndpointFactory implements BroadcastEndpointFactory
+{
+   private final JChannel channel;
+
+   private final String channelName;
+
+   public ChannelBroadcastEndpointFactory(JChannel channel, String channelName)
+   {
+      this.channel = channel;
+      this.channelName = channelName;
+   }
+
+   @Override
+   public BroadcastEndpoint createBroadcastEndpoint() throws Exception
+   {
+      return new JGroupsChannelBroadcastEndpoint(channel, channelName).initChannel();
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/DiscoveryGroupConfiguration.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/DiscoveryGroupConfiguration.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/DiscoveryGroupConfiguration.java
index 5789cc6..cbe0d7a 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/api/core/DiscoveryGroupConfiguration.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/DiscoveryGroupConfiguration.java
@@ -16,9 +16,6 @@
  */
 package org.apache.activemq.api.core;
 
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.io.Serializable;
 
 import org.apache.activemq.api.core.client.ActiveMQClient;
@@ -48,29 +45,9 @@ public final class DiscoveryGroupConfiguration implements Serializable
    private long discoveryInitialWaitTimeout = ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT;
 
    /*
-   * The localBindAddress is needed so we can be backward compatible with 2.2 clients
-   * */
-   private transient String localBindAddress = null;
-
-   /*
-   * The localBindPort is needed so we can be backward compatible with 2.2 clients
-   * */
-   private transient int localBindPort = -1;
-
-   /*
-   * The groupAddress is needed so we can be backward compatible with 2.2 clients
-   * */
-   private String groupAddress = null;
-
-   /*
-   * The groupPort is needed so we can be backward compatible with 2.2 clients
-   * */
-   private int groupPort = -1;
-
-   /*
    * This is the actual object used by the class, it has to be transient so we can handle deserialization with a 2.2 client
    * */
-   private transient BroadcastEndpointFactoryConfiguration endpointFactoryConfiguration;
+   private BroadcastEndpointFactory endpointFactory;
 
    public DiscoveryGroupConfiguration()
    {
@@ -121,51 +98,17 @@ public final class DiscoveryGroupConfiguration implements Serializable
       return this;
    }
 
-   public BroadcastEndpointFactoryConfiguration getBroadcastEndpointFactoryConfiguration()
+   public BroadcastEndpointFactory getBroadcastEndpointFactory()
    {
-      return endpointFactoryConfiguration;
+      return endpointFactory;
    }
 
-   public DiscoveryGroupConfiguration setBroadcastEndpointFactoryConfiguration(BroadcastEndpointFactoryConfiguration endpointFactoryConfiguration)
+   public DiscoveryGroupConfiguration setBroadcastEndpointFactory(BroadcastEndpointFactory endpointFactory)
    {
-      this.endpointFactoryConfiguration = endpointFactoryConfiguration;
-      if (endpointFactoryConfiguration instanceof DiscoveryGroupConfigurationCompatibilityHelper)
-      {
-         DiscoveryGroupConfigurationCompatibilityHelper dgcch = (DiscoveryGroupConfigurationCompatibilityHelper) endpointFactoryConfiguration;
-         localBindAddress = dgcch.getLocalBindAddress();
-         localBindPort = dgcch.getLocalBindPort();
-         groupAddress = dgcch.getGroupAddress();
-         groupPort = dgcch.getGroupPort();
-      }
+      this.endpointFactory = endpointFactory;
       return this;
    }
 
-   private void writeObject(ObjectOutputStream out) throws IOException
-   {
-      out.defaultWriteObject();
-      if (groupPort < 0)
-      {
-         out.writeObject(endpointFactoryConfiguration);
-      }
-   }
-
-   private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException
-   {
-      in.defaultReadObject();
-      if (groupPort < 0)
-      {
-         endpointFactoryConfiguration = (BroadcastEndpointFactoryConfiguration) in.readObject();
-      }
-      else
-      {
-         endpointFactoryConfiguration = new UDPBroadcastGroupConfiguration()
-            .setGroupAddress(groupAddress)
-            .setGroupPort(groupPort)
-            .setLocalBindAddress(localBindAddress)
-            .setLocalBindPort(localBindPort);
-      }
-   }
-
    @Override
    public boolean equals(Object o)
    {

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/DiscoveryGroupConfigurationCompatibilityHelper.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/DiscoveryGroupConfigurationCompatibilityHelper.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/DiscoveryGroupConfigurationCompatibilityHelper.java
deleted file mode 100644
index 4fd1bca..0000000
--- a/activemq-core-client/src/main/java/org/apache/activemq/api/core/DiscoveryGroupConfigurationCompatibilityHelper.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.api.core;
-
-/**
- * This interface is needed for making a DiscoveryGroupConfiguration backward
- * compatible with version 2.2 clients. It is used to extract from new
- * {@link org.apache.activemq.api.core.BroadcastEndpointFactoryConfiguration} the four
- * UDP attributes in order to form a version 2.2 DiscoveryGroupConfiguration
- * in time of serialization.
- *
- * @see DiscoveryGroupConfiguration#readObject(java.io.ObjectInputStream)
- * @see DiscoveryGroupConfiguration#writeObject(java.io.ObjectOutputStream)
- *
- * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
- *         12/13/12
- */
-public interface DiscoveryGroupConfigurationCompatibilityHelper
-{
-// XXX No javadocs
-   String getLocalBindAddress();
-
-// XXX No javadocs
-   int getLocalBindPort();
-
-// XXX No javadocs
-   String getGroupAddress();
-
-// XXX No javadocs
-   int getGroupPort();
-}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsBroadcastEndpoint.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsBroadcastEndpoint.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsBroadcastEndpoint.java
new file mode 100644
index 0000000..07381ed
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsBroadcastEndpoint.java
@@ -0,0 +1,281 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.api.core;
+
+import org.jgroups.JChannel;
+import org.jgroups.ReceiverAdapter;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * This class is the implementation of ActiveMQ members discovery that will use JGroups.
+ *
+ * @author Howard Gao
+ */
+public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint
+{
+   private final String channelName;
+
+   private boolean clientOpened;
+
+   private boolean broadcastOpened;
+
+   private JChannelWrapper channel;
+
+   private JGroupsReceiver receiver;
+
+   public JGroupsBroadcastEndpoint(String channelName)
+   {
+      this.channelName = channelName;
+   }
+
+   public void broadcast(final byte[] data) throws Exception
+   {
+      if (broadcastOpened)
+      {
+         org.jgroups.Message msg = new org.jgroups.Message();
+
+         msg.setBuffer(data);
+
+         channel.send(msg);
+      }
+   }
+
+   public byte[] receiveBroadcast() throws Exception
+   {
+      if (clientOpened)
+      {
+         return receiver.receiveBroadcast();
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception
+   {
+      if (clientOpened)
+      {
+         return receiver.receiveBroadcast(time, unit);
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   public synchronized void openClient() throws Exception
+   {
+      if (clientOpened)
+      {
+         return;
+      }
+      internalOpen();
+      receiver = new JGroupsReceiver();
+      channel.setReceiver(receiver);
+      clientOpened = true;
+   }
+
+   public synchronized void openBroadcaster() throws Exception
+   {
+      if (broadcastOpened) return;
+      internalOpen();
+      broadcastOpened = true;
+   }
+
+   public abstract JChannel createChannel() throws Exception;
+
+   public JGroupsBroadcastEndpoint initChannel() throws Exception
+   {
+      this.channel = JChannelManager.getJChannel(channelName, this);
+      return this;
+   }
+
+   protected void internalOpen() throws Exception
+   {
+      channel.connect();
+   }
+
+   public synchronized void close(boolean isBroadcast) throws Exception
+   {
+      if (isBroadcast)
+      {
+         broadcastOpened = false;
+      }
+      else
+      {
+         channel.removeReceiver(receiver);
+         clientOpened = false;
+      }
+      channel.close();
+   }
+
+   /**
+    * This class is used to receive messages from a JGroups channel.
+    * Incoming messages are put into a queue.
+    */
+   private static final class JGroupsReceiver extends ReceiverAdapter
+   {
+      private final BlockingQueue<byte[]> dequeue = new LinkedBlockingDeque<byte[]>();
+
+      @Override
+      public void receive(org.jgroups.Message msg)
+      {
+         dequeue.add(msg.getBuffer());
+      }
+
+      public byte[] receiveBroadcast() throws Exception
+      {
+         return dequeue.take();
+      }
+
+      public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception
+      {
+         return dequeue.poll(time, unit);
+      }
+   }
+
+   /**
+    * This class wraps a JChannel with a reference counter. The reference counter
+    * controls the life of the JChannel. When reference count is zero, the channel
+    * will be disconnected.
+    */
+   protected static class JChannelWrapper
+   {
+      int refCount = 1;
+      JChannel channel;
+      String channelName;
+      List<JGroupsReceiver> receivers = new ArrayList<JGroupsReceiver>();
+
+      public JChannelWrapper(String channelName, JChannel channel) throws Exception
+      {
+         this.refCount = 1;
+         this.channelName = channelName;
+         this.channel = channel;
+      }
+
+      public synchronized void close()
+      {
+         refCount--;
+         if (refCount == 0)
+         {
+            JChannelManager.closeChannel(this.channelName, channel);
+         }
+      }
+
+      public void removeReceiver(JGroupsReceiver receiver)
+      {
+         synchronized (receivers)
+         {
+            receivers.remove(receiver);
+         }
+      }
+
+      public synchronized void connect() throws Exception
+      {
+         if (channel.isConnected()) return;
+         channel.setReceiver(new ReceiverAdapter()
+         {
+
+            @Override
+            public void receive(org.jgroups.Message msg)
+            {
+               synchronized (receivers)
+               {
+                  for (JGroupsReceiver r : receivers)
+                  {
+                     r.receive(msg);
+                  }
+               }
+            }
+         });
+         channel.connect(channelName);
+      }
+
+      public void setReceiver(JGroupsReceiver jGroupsReceiver)
+      {
+         synchronized (receivers)
+         {
+            receivers.add(jGroupsReceiver);
+         }
+      }
+
+      public void send(org.jgroups.Message msg) throws Exception
+      {
+         channel.send(msg);
+      }
+
+      public JChannelWrapper addRef()
+      {
+         this.refCount++;
+         return this;
+      }
+
+      @Override
+      public String toString()
+      {
+         return "JChannelWrapper of [" + channel + "] " + refCount + " " + channelName;
+      }
+   }
+
+   /**
+    * This class maintain a global Map of JChannels wrapped in JChannelWrapper for
+    * the purpose of reference counting.
+    * <p/>
+    * Wherever a JChannel is needed it should only get it by calling the getChannel()
+    * method of this class. The real disconnect of channels are also done here only.
+    */
+   protected static class JChannelManager
+   {
+      private static Map<String, JChannelWrapper> channels;
+
+      public static synchronized JChannelWrapper getJChannel(String channelName, JGroupsBroadcastEndpoint endpoint) throws Exception
+      {
+         if (channels == null)
+         {
+            channels = new HashMap<>();
+         }
+         JChannelWrapper wrapper = channels.get(channelName);
+         if (wrapper == null)
+         {
+            wrapper = new JChannelWrapper(channelName, endpoint.createChannel());
+            channels.put(channelName, wrapper);
+            return wrapper;
+         }
+         return wrapper.addRef();
+      }
+
+      public static synchronized void closeChannel(String channelName, JChannel channel)
+      {
+         channel.setReceiver(null);
+         channel.disconnect();
+         channel.close();
+         JChannelWrapper wrapper = channels.remove(channelName);
+         if (wrapper == null)
+         {
+            throw new IllegalStateException("Did not find channel " + channelName);
+         }
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsBroadcastGroupConfiguration.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsBroadcastGroupConfiguration.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsBroadcastGroupConfiguration.java
deleted file mode 100644
index 9d2a0ac..0000000
--- a/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsBroadcastGroupConfiguration.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.api.core;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingDeque;
-import java.util.concurrent.TimeUnit;
-
-import org.jgroups.JChannel;
-import org.jgroups.Message;
-import org.jgroups.ReceiverAdapter;
-import org.jgroups.conf.PlainConfigurator;
-
-/**
- * The configuration for creating broadcasting/discovery groups using JGroups channels
- * There are two ways to constructing a JGroups channel (JChannel):
- * <ol>
- * <li> by passing in a JGroups configuration file<br>
- * The file must exists in the activemq classpath. ActiveMQ creates a JChannel with the
- * configuration file and use it for broadcasting and discovery. In standalone server
- * mode ActiveMQ uses this way for constructing JChannels.</li>
- * <li> by passing in a JChannel instance<br>
- * This is useful when ActiveMQ needs to get a JChannel from a running JGroups service as in the
- * case of AS7 integration.</li>
- * </ol>
- * <p>
- * Note only one JChannel is needed in a VM. To avoid the channel being prematurely disconnected
- * by any party, a wrapper class is used.
- *
- * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
- * @author <a href="mailto:hgao@redhat.com">Howard Gao</a>
- * @see JChannelWrapper, JChannelManager
- */
-public final class JGroupsBroadcastGroupConfiguration implements BroadcastEndpointFactoryConfiguration, DiscoveryGroupConfigurationCompatibilityHelper
-{
-   private static final long serialVersionUID = 8952238567248461285L;
-
-   private final BroadcastEndpointFactory factory;
-
-   public JGroupsBroadcastGroupConfiguration(final String jgroupsFile, final String channelName)
-   {
-      factory = new BroadcastEndpointFactory()
-      {
-         private static final long serialVersionUID = 1047956472941098435L;
-
-         @Override
-         public BroadcastEndpoint createBroadcastEndpoint() throws Exception
-         {
-            JGroupsBroadcastEndpoint endpoint = new JGroupsBroadcastEndpoint();
-            endpoint.initChannel(jgroupsFile, channelName);
-            return endpoint;
-         }
-      };
-   }
-
-   public JGroupsBroadcastGroupConfiguration(final JChannel channel, final String channelName)
-   {
-      factory = new BroadcastEndpointFactory()
-      {
-         private static final long serialVersionUID = 5110372849181145377L;
-
-         @Override
-         public BroadcastEndpoint createBroadcastEndpoint() throws Exception
-         {
-            JGroupsBroadcastEndpoint endpoint = new JGroupsBroadcastEndpoint();
-            endpoint.initChannel(channel, channelName);
-            return endpoint;
-         }
-      };
-   }
-
-   @Override
-   public BroadcastEndpointFactory createBroadcastEndpointFactory()
-   {
-      return factory;
-   }
-
-   @Override
-   public String getLocalBindAddress()
-   {
-      return null;
-   }
-
-   @Override
-   /*
-   * return -1 to force deserialization of object
-   * */
-   public int getLocalBindPort()
-   {
-      return -1;
-   }
-
-   @Override
-   public String getGroupAddress()
-   {
-      return null;
-   }
-
-   @Override
-   public int getGroupPort()
-   {
-      return -1;
-   }
-
-   /**
-    * This class is the implementation of ActiveMQ members discovery that will use JGroups.
-    *
-    * @author Howard Gao
-    */
-   private static final class JGroupsBroadcastEndpoint implements BroadcastEndpoint
-   {
-      private boolean clientOpened;
-
-      private boolean broadcastOpened;
-
-      private JChannelWrapper<?> channel;
-
-      private JGroupsReceiver receiver;
-
-      public void broadcast(final byte[] data) throws Exception
-      {
-         if (broadcastOpened)
-         {
-            Message msg = new Message();
-
-            msg.setBuffer(data);
-
-            channel.send(msg);
-         }
-      }
-
-      public byte[] receiveBroadcast() throws Exception
-      {
-         if (clientOpened)
-         {
-            return receiver.receiveBroadcast();
-         }
-         else
-         {
-            return null;
-         }
-      }
-
-      public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception
-      {
-         if (clientOpened)
-         {
-            return receiver.receiveBroadcast(time, unit);
-         }
-         else
-         {
-            return null;
-         }
-      }
-
-      public synchronized void openClient() throws Exception
-      {
-         if (clientOpened)
-         {
-            return;
-         }
-         internalOpen();
-         receiver = new JGroupsReceiver();
-         channel.setReceiver(receiver);
-         clientOpened = true;
-      }
-
-      public synchronized void openBroadcaster() throws Exception
-      {
-         if (broadcastOpened) return;
-         internalOpen();
-         broadcastOpened = true;
-      }
-
-      private void initChannel(final String jgroupsConfig, final String channelName) throws Exception
-      {
-         PlainConfigurator configurator = new PlainConfigurator(jgroupsConfig);
-         try
-         {
-            this.channel = JChannelManager.getJChannel(channelName, configurator);
-            return;
-         }
-         catch (Exception e)
-         {
-            this.channel = null;
-         }
-         URL configURL = Thread.currentThread().getContextClassLoader().getResource(jgroupsConfig);
-
-         if (configURL == null)
-         {
-            throw new RuntimeException("couldn't find JGroups configuration " + jgroupsConfig);
-         }
-         this.channel = JChannelManager.getJChannel(channelName, configURL);
-      }
-
-      private void initChannel(final JChannel channel1, final String channelName) throws Exception
-      {
-         this.channel = JChannelManager.getJChannel(channelName, channel1);
-      }
-
-      protected void internalOpen() throws Exception
-      {
-         channel.connect();
-      }
-
-      public synchronized void close(boolean isBroadcast) throws Exception
-      {
-         if (isBroadcast)
-         {
-            broadcastOpened = false;
-         }
-         else
-         {
-            channel.removeReceiver(receiver);
-            clientOpened = false;
-         }
-         channel.close();
-      }
-
-      /**
-       * This class is used to receive messages from a JGroups channel.
-       * Incoming messages are put into a queue.
-       */
-      private static final class JGroupsReceiver extends ReceiverAdapter
-      {
-         private final BlockingQueue<byte[]> dequeue = new LinkedBlockingDeque<byte[]>();
-
-         @Override
-         public void receive(org.jgroups.Message msg)
-         {
-            dequeue.add(msg.getBuffer());
-         }
-
-         public byte[] receiveBroadcast() throws Exception
-         {
-            return dequeue.take();
-         }
-
-         public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception
-         {
-            return dequeue.poll(time, unit);
-         }
-      }
-
-      /**
-       * This class wraps a JChannel with a reference counter. The reference counter
-       * controls the life of the JChannel. When reference count is zero, the channel
-       * will be disconnected.
-       *
-       * @param <T>
-       */
-      private static class JChannelWrapper<T>
-      {
-         int refCount = 1;
-         JChannel channel;
-         String channelName;
-         List<JGroupsReceiver> receivers = new ArrayList<JGroupsReceiver>();
-
-         public JChannelWrapper(String channelName, T t) throws Exception
-         {
-            this.refCount = 1;
-            this.channelName = channelName;
-            if (t instanceof URL)
-            {
-               this.channel = new JChannel((URL) t);
-            }
-            else if (t instanceof JChannel)
-            {
-               this.channel = (JChannel) t;
-            }
-            else if (t instanceof PlainConfigurator)
-            {
-               this.channel = new JChannel((PlainConfigurator)t);
-            }
-            else
-            {
-               throw new IllegalArgumentException("Unsupported type " + t);
-            }
-         }
-
-         public synchronized void close()
-         {
-            refCount--;
-            if (refCount == 0)
-            {
-               JChannelManager.closeChannel(this.channelName, channel);
-            }
-         }
-
-         public void removeReceiver(JGroupsReceiver receiver)
-         {
-            synchronized (receivers)
-            {
-               receivers.remove(receiver);
-            }
-         }
-
-         public synchronized void connect() throws Exception
-         {
-            if (channel.isConnected()) return;
-            channel.setReceiver(new ReceiverAdapter()
-            {
-
-               @Override
-               public void receive(Message msg)
-               {
-                  synchronized (receivers)
-                  {
-                     for (JGroupsReceiver r : receivers)
-                     {
-                        r.receive(msg);
-                     }
-                  }
-               }
-            });
-            channel.connect(channelName);
-         }
-
-         public void setReceiver(JGroupsReceiver jGroupsReceiver)
-         {
-            synchronized (receivers)
-            {
-               receivers.add(jGroupsReceiver);
-            }
-         }
-
-         public void send(Message msg) throws Exception
-         {
-            channel.send(msg);
-         }
-
-         public JChannelWrapper<T> addRef()
-         {
-            this.refCount++;
-            return this;
-         }
-
-         @Override
-         public String toString()
-         {
-            return "JChannelWrapper of [" + channel + "] " + refCount + " " + channelName;
-         }
-      }
-
-      /**
-       * This class maintain a global Map of JChannels wrapped in JChannelWrapper for
-       * the purpose of reference counting.
-       * <p/>
-       * Wherever a JChannel is needed it should only get it by calling the getChannel()
-       * method of this class. The real disconnect of channels are also done here only.
-       */
-      private static class JChannelManager
-      {
-         private static Map<String, JChannelWrapper<?>> channels;
-
-         public static synchronized <T> JChannelWrapper<?> getJChannel(String channelName, T t) throws Exception
-         {
-            if (channels == null)
-            {
-               channels = new HashMap<String, JChannelWrapper<?>>();
-            }
-            JChannelWrapper<?> wrapper = channels.get(channelName);
-            if (wrapper == null)
-            {
-               wrapper = new JChannelWrapper<T>(channelName, t);
-               channels.put(channelName, wrapper);
-               return wrapper;
-            }
-            return wrapper.addRef();
-         }
-
-         public static synchronized void closeChannel(String channelName, JChannel channel)
-         {
-            channel.setReceiver(null);
-            channel.disconnect();
-            channel.close();
-            JChannelWrapper<?> wrapper = channels.remove(channelName);
-            if (wrapper == null)
-            {
-               throw new IllegalStateException("Did not find channel " + channelName);
-            }
-         }
-      }
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsChannelBroadcastEndpoint.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsChannelBroadcastEndpoint.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsChannelBroadcastEndpoint.java
new file mode 100644
index 0000000..e14d0f0
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsChannelBroadcastEndpoint.java
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.api.core;
+
+import org.jgroups.JChannel;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class JGroupsChannelBroadcastEndpoint extends JGroupsBroadcastEndpoint
+{
+   private final JChannel jChannel;
+
+   public JGroupsChannelBroadcastEndpoint(JChannel jChannel, final String channelName) throws Exception
+   {
+      super(channelName);
+      this.jChannel = jChannel;
+   }
+
+   @Override
+   public JChannel createChannel() throws Exception
+   {
+      return jChannel;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsFileBroadcastEndpoint.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsFileBroadcastEndpoint.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsFileBroadcastEndpoint.java
new file mode 100644
index 0000000..6f0b8ad
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsFileBroadcastEndpoint.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.api.core;
+
+import org.jgroups.JChannel;
+
+import java.net.URL;
+
+/**
+ * This class is the implementation of ActiveMQ members discovery that will use JGroups.
+ *
+ * @author Howard Gao
+ */
+public final class JGroupsFileBroadcastEndpoint extends JGroupsBroadcastEndpoint
+{
+   private String file;
+
+   public JGroupsFileBroadcastEndpoint(final String file, final String channelName) throws Exception
+   {
+      super(channelName);
+      this.file = file;
+   }
+
+   public JChannel createChannel() throws Exception
+   {
+      URL configURL = Thread.currentThread().getContextClassLoader().getResource(file);
+
+      if (configURL == null)
+      {
+         throw new RuntimeException("couldn't find JGroups configuration " + file);
+      }
+
+      return new JChannel(configURL);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsFileBroadcastEndpointFactory.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsFileBroadcastEndpointFactory.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsFileBroadcastEndpointFactory.java
new file mode 100644
index 0000000..21bef7a
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsFileBroadcastEndpointFactory.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.api.core;
+
+/**
+* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+*/
+public class JGroupsFileBroadcastEndpointFactory implements BroadcastEndpointFactory
+{
+   private String file;
+
+   private String channelName;
+
+   @Override
+   public BroadcastEndpoint createBroadcastEndpoint() throws Exception
+   {
+      return new JGroupsFileBroadcastEndpoint(file, channelName).initChannel();
+   }
+
+   public String getFile()
+   {
+      return file;
+   }
+
+   public JGroupsFileBroadcastEndpointFactory setFile(String file)
+   {
+      this.file = file;
+      return this;
+   }
+
+   public String getChannelName()
+   {
+      return channelName;
+   }
+
+   public JGroupsFileBroadcastEndpointFactory setChannelName(String channelName)
+   {
+      this.channelName = channelName;
+      return this;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsPropertiesBroadcastEndpoint.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsPropertiesBroadcastEndpoint.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsPropertiesBroadcastEndpoint.java
new file mode 100644
index 0000000..ddc5c19
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsPropertiesBroadcastEndpoint.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.api.core;
+
+import org.jgroups.JChannel;
+import org.jgroups.conf.PlainConfigurator;
+
+/**
+ * This class is the implementation of ActiveMQ members discovery that will use JGroups.
+ *
+ * @author Howard Gao
+ */
+public final class JGroupsPropertiesBroadcastEndpoint extends JGroupsBroadcastEndpoint
+{
+   private String properties;
+
+   public JGroupsPropertiesBroadcastEndpoint(final String properties, final String channelName) throws Exception
+   {
+      super(channelName);
+      this.properties = properties;
+   }
+
+   @Override
+   public JChannel createChannel() throws Exception
+   {
+      PlainConfigurator configurator = new PlainConfigurator(properties);
+      return new JChannel(configurator);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsPropertiesBroadcastEndpointFactory.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsPropertiesBroadcastEndpointFactory.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsPropertiesBroadcastEndpointFactory.java
new file mode 100644
index 0000000..b9d06b9
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/JGroupsPropertiesBroadcastEndpointFactory.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.api.core;
+
+/**
+* @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+*/
+public class JGroupsPropertiesBroadcastEndpointFactory implements BroadcastEndpointFactory
+{
+   private String properties;
+
+   private String channelName;
+
+   @Override
+   public BroadcastEndpoint createBroadcastEndpoint() throws Exception
+   {
+      return new JGroupsPropertiesBroadcastEndpoint(properties, channelName).initChannel();
+   }
+
+   public String getProperties()
+   {
+      return properties;
+   }
+
+   public JGroupsPropertiesBroadcastEndpointFactory setProperties(String properties)
+   {
+      this.properties = properties;
+      return this;
+   }
+
+   public String getChannelName()
+   {
+      return channelName;
+   }
+
+   public JGroupsPropertiesBroadcastEndpointFactory setChannelName(String channelName)
+   {
+      this.channelName = channelName;
+      return this;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/UDPBroadcastEndpointFactory.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/UDPBroadcastEndpointFactory.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/UDPBroadcastEndpointFactory.java
new file mode 100644
index 0000000..b2f6095
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/UDPBroadcastEndpointFactory.java
@@ -0,0 +1,330 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.api.core;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.MulticastSocket;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.activemq.core.client.ActiveMQClientLogger;
+
+
+/**
+ * The configuration used to determine how the server will broadcast members.
+ * <p>
+ * This is analogous to {@link org.apache.activemq.api.core.DiscoveryGroupConfiguration}
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a> Created 18 Nov 2008 08:44:30
+ */
+public final class UDPBroadcastEndpointFactory implements BroadcastEndpointFactory
+{
+   private transient String localBindAddress = null;
+
+   private transient int localBindPort = -1;
+
+   private String groupAddress = null;
+
+   private int groupPort = -1;
+
+   public UDPBroadcastEndpointFactory()
+   {
+   }
+
+   public BroadcastEndpoint createBroadcastEndpoint() throws Exception
+   {
+      return new UDPBroadcastEndpoint()
+         .setGroupAddress(groupAddress != null ? InetAddress.getByName(groupAddress) : null)
+         .setGroupPort(groupPort)
+         .setLocalBindAddress(localBindAddress != null ? InetAddress.getByName(localBindAddress) : null)
+         .setLocalBindPort(localBindPort);
+   }
+
+   public String getGroupAddress()
+   {
+      return groupAddress;
+   }
+
+   public UDPBroadcastEndpointFactory setGroupAddress(String groupAddress)
+   {
+      this.groupAddress = groupAddress;
+      return this;
+   }
+
+   public int getGroupPort()
+   {
+      return groupPort;
+   }
+
+   public UDPBroadcastEndpointFactory setGroupPort(int groupPort)
+   {
+      this.groupPort = groupPort;
+      return this;
+   }
+
+   public int getLocalBindPort()
+   {
+      return localBindPort;
+   }
+
+   public UDPBroadcastEndpointFactory setLocalBindPort(int localBindPort)
+   {
+      this.localBindPort = localBindPort;
+      return this;
+   }
+
+   public String getLocalBindAddress()
+   {
+      return localBindAddress;
+   }
+
+   public UDPBroadcastEndpointFactory setLocalBindAddress(String localBindAddress)
+   {
+      this.localBindAddress = localBindAddress;
+      return this;
+   }
+
+   /**
+    * <p> This is the member discovery implementation using direct UDP. It was extracted as a refactoring from
+    * {@link org.apache.activemq.core.cluster.DiscoveryGroup}</p>
+    *
+    * @author Tomohisa
+    * @author Howard Gao
+    * @author Clebert Suconic
+    */
+   private static class UDPBroadcastEndpoint implements BroadcastEndpoint
+   {
+      private static final int SOCKET_TIMEOUT = 500;
+
+      private InetAddress localAddress;
+
+      private int localBindPort;
+
+      private InetAddress groupAddress;
+
+      private int groupPort;
+
+      private DatagramSocket broadcastingSocket;
+
+      private MulticastSocket receivingSocket;
+
+      private volatile boolean open;
+
+      public UDPBroadcastEndpoint()
+      {
+      }
+
+      public UDPBroadcastEndpoint setGroupAddress(InetAddress groupAddress)
+      {
+         this.groupAddress = groupAddress;
+         return this;
+      }
+
+      public UDPBroadcastEndpoint setGroupPort(int groupPort)
+      {
+         this.groupPort = groupPort;
+         return this;
+      }
+
+      public UDPBroadcastEndpoint setLocalBindAddress(InetAddress localAddress)
+      {
+         this.localAddress = localAddress;
+         return this;
+      }
+
+      public UDPBroadcastEndpoint setLocalBindPort(int localBindPort)
+      {
+         this.localBindPort = localBindPort;
+         return this;
+      }
+
+
+      public void broadcast(byte[] data) throws Exception
+      {
+         DatagramPacket packet = new DatagramPacket(data, data.length, groupAddress, groupPort);
+         broadcastingSocket.send(packet);
+      }
+
+      public byte[] receiveBroadcast() throws Exception
+      {
+         final byte[] data = new byte[65535];
+         final DatagramPacket packet = new DatagramPacket(data, data.length);
+
+         while (open)
+         {
+            try
+            {
+               receivingSocket.receive(packet);
+            }
+            // TODO: Do we need this?
+            catch (InterruptedIOException e)
+            {
+               continue;
+            }
+            catch (IOException e)
+            {
+               if (open)
+               {
+                  ActiveMQClientLogger.LOGGER.warn(this + " getting exception when receiving broadcasting.", e);
+               }
+            }
+            break;
+         }
+         return data;
+      }
+
+      public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception
+      {
+         // We just use the regular method on UDP, there's no timeout support
+         // and this is basically for tests only
+         return receiveBroadcast();
+      }
+
+      public void openBroadcaster() throws Exception
+      {
+         if (localBindPort != -1)
+         {
+            broadcastingSocket = new DatagramSocket(localBindPort, localAddress);
+         }
+         else
+         {
+            if (localAddress != null)
+            {
+               ActiveMQClientLogger.LOGGER.broadcastGroupBindError();
+            }
+            broadcastingSocket = new DatagramSocket();
+         }
+
+         open = true;
+      }
+
+      public void openClient() throws Exception
+      {
+         // HORNETQ-874
+         if (checkForLinux() || checkForSolaris() || checkForHp())
+         {
+            try
+            {
+               receivingSocket = new MulticastSocket(new InetSocketAddress(groupAddress, groupPort));
+            }
+            catch (IOException e)
+            {
+               ActiveMQClientLogger.LOGGER.ioDiscoveryError(groupAddress.getHostAddress(), groupAddress instanceof Inet4Address ? "IPv4" : "IPv6");
+
+               receivingSocket = new MulticastSocket(groupPort);
+            }
+         }
+         else
+         {
+            receivingSocket = new MulticastSocket(groupPort);
+         }
+
+         if (localAddress != null)
+         {
+            receivingSocket.setInterface(localAddress);
+         }
+
+         receivingSocket.joinGroup(groupAddress);
+
+         receivingSocket.setSoTimeout(SOCKET_TIMEOUT);
+
+         open = true;
+      }
+
+      //@Todo: using isBroadcast to share endpoint between broadcast and receiving
+      public void close(boolean isBroadcast) throws Exception
+      {
+         open = false;
+
+         if (broadcastingSocket != null)
+         {
+            broadcastingSocket.close();
+         }
+
+         if (receivingSocket != null)
+         {
+            receivingSocket.close();
+         }
+      }
+
+      private static boolean checkForLinux()
+      {
+         return checkForPresence("os.name", "linux");
+      }
+
+      private static boolean checkForHp()
+      {
+         return checkForPresence("os.name", "hp");
+      }
+
+      private static boolean checkForSolaris()
+      {
+         return checkForPresence("os.name", "sun");
+      }
+
+      private static boolean checkForPresence(String key, String value)
+      {
+         try
+         {
+            String tmp = System.getProperty(key);
+            return tmp != null && tmp.trim().toLowerCase().startsWith(value);
+         }
+         catch (Throwable t)
+         {
+            return false;
+         }
+      }
+
+   }
+
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = 1;
+      result = prime * result + ((groupAddress == null) ? 0 : groupAddress.hashCode());
+      result = prime * result + groupPort;
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (obj == null)
+         return false;
+      if (getClass() != obj.getClass())
+         return false;
+      UDPBroadcastEndpointFactory other = (UDPBroadcastEndpointFactory) obj;
+      if (groupAddress == null)
+      {
+         if (other.groupAddress != null)
+            return false;
+      }
+      else if (!groupAddress.equals(other.groupAddress))
+         return false;
+      if (groupPort != other.groupPort)
+         return false;
+      return true;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/UDPBroadcastGroupConfiguration.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/UDPBroadcastGroupConfiguration.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/UDPBroadcastGroupConfiguration.java
deleted file mode 100644
index 5c84d79..0000000
--- a/activemq-core-client/src/main/java/org/apache/activemq/api/core/UDPBroadcastGroupConfiguration.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.api.core;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.MulticastSocket;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.activemq.core.client.ActiveMQClientLogger;
-
-
-/**
- * The configuration used to determine how the server will broadcast members.
- * <p>
- * This is analogous to {@link org.apache.activemq.api.core.DiscoveryGroupConfiguration}
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a> Created 18 Nov 2008 08:44:30
- */
-public final class UDPBroadcastGroupConfiguration implements BroadcastEndpointFactoryConfiguration, DiscoveryGroupConfigurationCompatibilityHelper
-{
-   private static final long serialVersionUID = 1052413739064253955L;
-
-   private transient String localBindAddress = null;
-
-   private transient int localBindPort = -1;
-
-   private String groupAddress = null;
-
-   private int groupPort = -1;
-
-   public UDPBroadcastGroupConfiguration()
-   {
-   }
-
-   public BroadcastEndpointFactory createBroadcastEndpointFactory()
-   {
-      return new BroadcastEndpointFactory()
-      {
-         @Override
-         public BroadcastEndpoint createBroadcastEndpoint() throws Exception
-         {
-            return new UDPBroadcastEndpoint()
-               .setGroupAddress(groupAddress != null ? InetAddress.getByName(groupAddress) : null)
-               .setGroupPort(groupPort)
-               .setLocalBindAddress(localBindAddress != null ? InetAddress.getByName(localBindAddress) : null)
-               .setLocalBindPort(localBindPort);
-         }
-      };
-   }
-
-   public String getGroupAddress()
-   {
-      return groupAddress;
-   }
-
-   public UDPBroadcastGroupConfiguration setGroupAddress(String groupAddress)
-   {
-      this.groupAddress = groupAddress;
-      return this;
-   }
-
-   public int getGroupPort()
-   {
-      return groupPort;
-   }
-
-   public UDPBroadcastGroupConfiguration setGroupPort(int groupPort)
-   {
-      this.groupPort = groupPort;
-      return this;
-   }
-
-   public int getLocalBindPort()
-   {
-      return localBindPort;
-   }
-
-   public UDPBroadcastGroupConfiguration setLocalBindPort(int localBindPort)
-   {
-      this.localBindPort = localBindPort;
-      return this;
-   }
-
-   public String getLocalBindAddress()
-   {
-      return localBindAddress;
-   }
-
-   public UDPBroadcastGroupConfiguration setLocalBindAddress(String localBindAddress)
-   {
-      this.localBindAddress = localBindAddress;
-      return this;
-   }
-
-   /**
-    * <p> This is the member discovery implementation using direct UDP. It was extracted as a refactoring from
-    * {@link org.apache.activemq.core.cluster.DiscoveryGroup}</p>
-    *
-    * @author Tomohisa
-    * @author Howard Gao
-    * @author Clebert Suconic
-    */
-   private static class UDPBroadcastEndpoint implements BroadcastEndpoint
-   {
-      private static final int SOCKET_TIMEOUT = 500;
-
-      private InetAddress localAddress;
-
-      private int localBindPort;
-
-      private InetAddress groupAddress;
-
-      private int groupPort;
-
-      private DatagramSocket broadcastingSocket;
-
-      private MulticastSocket receivingSocket;
-
-      private volatile boolean open;
-
-      public UDPBroadcastEndpoint()
-      {
-      }
-
-      public UDPBroadcastEndpoint setGroupAddress(InetAddress groupAddress)
-      {
-         this.groupAddress = groupAddress;
-         return this;
-      }
-
-      public UDPBroadcastEndpoint setGroupPort(int groupPort)
-      {
-         this.groupPort = groupPort;
-         return this;
-      }
-
-      public UDPBroadcastEndpoint setLocalBindAddress(InetAddress localAddress)
-      {
-         this.localAddress = localAddress;
-         return this;
-      }
-
-      public UDPBroadcastEndpoint setLocalBindPort(int localBindPort)
-      {
-         this.localBindPort = localBindPort;
-         return this;
-      }
-
-
-      public void broadcast(byte[] data) throws Exception
-      {
-         DatagramPacket packet = new DatagramPacket(data, data.length, groupAddress, groupPort);
-         broadcastingSocket.send(packet);
-      }
-
-      public byte[] receiveBroadcast() throws Exception
-      {
-         final byte[] data = new byte[65535];
-         final DatagramPacket packet = new DatagramPacket(data, data.length);
-
-         while (open)
-         {
-            try
-            {
-               receivingSocket.receive(packet);
-            }
-            // TODO: Do we need this?
-            catch (InterruptedIOException e)
-            {
-               continue;
-            }
-            catch (IOException e)
-            {
-               if (open)
-               {
-                  ActiveMQClientLogger.LOGGER.warn(this + " getting exception when receiving broadcasting.", e);
-               }
-            }
-            break;
-         }
-         return data;
-      }
-
-      public byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception
-      {
-         // We just use the regular method on UDP, there's no timeout support
-         // and this is basically for tests only
-         return receiveBroadcast();
-      }
-
-      public void openBroadcaster() throws Exception
-      {
-         if (localBindPort != -1)
-         {
-            broadcastingSocket = new DatagramSocket(localBindPort, localAddress);
-         }
-         else
-         {
-            if (localAddress != null)
-            {
-               ActiveMQClientLogger.LOGGER.broadcastGroupBindError();
-            }
-            broadcastingSocket = new DatagramSocket();
-         }
-
-         open = true;
-      }
-
-      public void openClient() throws Exception
-      {
-         // HORNETQ-874
-         if (checkForLinux() || checkForSolaris() || checkForHp())
-         {
-            try
-            {
-               receivingSocket = new MulticastSocket(new InetSocketAddress(groupAddress, groupPort));
-            }
-            catch (IOException e)
-            {
-               ActiveMQClientLogger.LOGGER.ioDiscoveryError(groupAddress.getHostAddress(), groupAddress instanceof Inet4Address ? "IPv4" : "IPv6");
-
-               receivingSocket = new MulticastSocket(groupPort);
-            }
-         }
-         else
-         {
-            receivingSocket = new MulticastSocket(groupPort);
-         }
-
-         if (localAddress != null)
-         {
-            receivingSocket.setInterface(localAddress);
-         }
-
-         receivingSocket.joinGroup(groupAddress);
-
-         receivingSocket.setSoTimeout(SOCKET_TIMEOUT);
-
-         open = true;
-      }
-
-      //@Todo: using isBroadcast to share endpoint between broadcast and receiving
-      public void close(boolean isBroadcast) throws Exception
-      {
-         open = false;
-
-         if (broadcastingSocket != null)
-         {
-            broadcastingSocket.close();
-         }
-
-         if (receivingSocket != null)
-         {
-            receivingSocket.close();
-         }
-      }
-
-      private static boolean checkForLinux()
-      {
-         return checkForPresence("os.name", "linux");
-      }
-
-      private static boolean checkForHp()
-      {
-         return checkForPresence("os.name", "hp");
-      }
-
-      private static boolean checkForSolaris()
-      {
-         return checkForPresence("os.name", "sun");
-      }
-
-      private static boolean checkForPresence(String key, String value)
-      {
-         try
-         {
-            String tmp = System.getProperty(key);
-            return tmp != null && tmp.trim().toLowerCase().startsWith(value);
-         }
-         catch (Throwable t)
-         {
-            return false;
-         }
-      }
-
-   }
-
-   @Override
-   public int hashCode()
-   {
-      final int prime = 31;
-      int result = 1;
-      result = prime * result + ((groupAddress == null) ? 0 : groupAddress.hashCode());
-      result = prime * result + groupPort;
-      return result;
-   }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (this == obj)
-         return true;
-      if (obj == null)
-         return false;
-      if (getClass() != obj.getClass())
-         return false;
-      UDPBroadcastGroupConfiguration other = (UDPBroadcastGroupConfiguration) obj;
-      if (groupAddress == null)
-      {
-         if (other.groupAddress != null)
-            return false;
-      }
-      else if (!groupAddress.equals(other.groupAddress))
-         return false;
-      if (groupPort != other.groupPort)
-         return false;
-      return true;
-   }
-}


[5/8] activemq-6 git commit: ACTIVEMQ6-7 - Improve Serialization on Connection Factory

Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java b/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java
index 19fb50a..7e922fb 100644
--- a/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java
+++ b/activemq-jms-client/src/test/java/org/apache/activemq/uri/ConnectionFactoryURITest.java
@@ -17,11 +17,31 @@
 
 package org.apache.activemq.uri;
 
-import javax.jms.ConnectionFactory;
-import javax.jms.XAQueueConnectionFactory;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
 import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
 
+import org.apache.activemq.api.core.BroadcastEndpointFactory;
+import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
+import org.apache.activemq.api.core.JGroupsFileBroadcastEndpointFactory;
+import org.apache.activemq.api.core.JGroupsPropertiesBroadcastEndpointFactory;
+import org.apache.activemq.api.core.TransportConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
+import org.apache.activemq.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.api.jms.JMSFactoryType;
+import org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory;
+import org.apache.activemq.core.remoting.impl.netty.TransportConstants;
 import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.jms.client.ActiveMQJMSConnectionFactory;
+import org.apache.activemq.jms.client.ActiveMQQueueConnectionFactory;
+import org.apache.activemq.jms.client.ActiveMQTopicConnectionFactory;
+import org.apache.activemq.jms.client.ActiveMQXAQueueConnectionFactory;
+import org.apache.activemq.jms.client.ActiveMQXATopicConnectionFactory;
+import org.apache.activemq.tests.util.RandomUtil;
+import org.apache.commons.beanutils.BeanUtilsBean;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -33,13 +53,212 @@ public class ConnectionFactoryURITest
 {
    ConnectionFactoryParser parser = new ConnectionFactoryParser();
 
+   @Test
+   public void testQUEUE_XA_CF() throws Exception
+   {
+      ActiveMQConnectionFactory factory = parser.newObject(new URI("tcp://localhost:3030?ha=true&type=QUEUE_XA_CF"));
+
+      Assert.assertTrue(ActiveMQXAQueueConnectionFactory.class.getName().equals(factory.getClass().getName()));
+   }
+
+   @Test
+   public void testTOPICXA_CF() throws Exception
+   {
+      ActiveMQConnectionFactory factory = parser.newObject(new URI("tcp://localhost:3030?ha=true&type=TOPIC_XA_CF"));
+
+      Assert.assertTrue(ActiveMQXATopicConnectionFactory.class.getName().equals(factory.getClass().getName()));
+   }
+   @Test
+
+   public void testQUEUE_CF() throws Exception
+   {
+      ActiveMQConnectionFactory factory = parser.newObject(new URI("tcp://localhost:3030?ha=true&type=QUEUE_CF"));
+
+      Assert.assertTrue(ActiveMQQueueConnectionFactory.class.getName().equals(factory.getClass().getName()));
+   }
+
+   @Test
+   public void testTOPIC_CF() throws Exception
+   {
+      ActiveMQConnectionFactory factory = parser.newObject(new URI("tcp://localhost:3030?ha=true&type=TOPIC_CF"));
+
+      Assert.assertTrue(ActiveMQTopicConnectionFactory.class.getName().equals(factory.getClass().getName()));
+   }
+
+   @Test
+   public void testCF() throws Exception
+   {
+      ActiveMQConnectionFactory factory = parser.newObject(new URI("tcp://localhost:3030?ha=true&type=CF"));
+
+      Assert.assertTrue(ActiveMQJMSConnectionFactory.class.getName().equals(factory.getClass().getName()));
+   }
+
+   @Test
+   public void testNoCF() throws Exception
+   {
+      ActiveMQConnectionFactory factory = parser.newObject(new URI("tcp://localhost:3030?ha=true"));
+
+      Assert.assertTrue(ActiveMQJMSConnectionFactory.class.getName().equals(factory.getClass().getName()));
+   }
+
+   @Test
+   public void testTCPAllProperties() throws Exception
+   {
+      StringBuilder sb = new StringBuilder();
+      sb.append("tcp://localhost:3030?ha=true");
+      BeanUtilsBean bean = new BeanUtilsBean();
+      ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
+      populate(sb, bean, factory);
+      ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()));
+      checkEquals(bean, factory, factory2);
+   }
+
+   @Test
+   public void testTCPAllNettyConnectorProperties() throws Exception
+   {
+      Map<String, Object> props = new HashMap<>();
+      Set<String> allowableConnectorKeys = TransportConstants.ALLOWABLE_CONNECTOR_KEYS;
+      StringBuilder sb = new StringBuilder();
+      sb.append("tcp://localhost:3030?ha=true");
+      populateConnectorParams(props, allowableConnectorKeys, sb);
+      ActiveMQConnectionFactory factory = parser.newObject(new URI(sb.toString()));
+
+      Map<String, Object> params = factory.getStaticConnectors()[0].getParams();
+      Assert.assertEquals(params.get("host"), "localhost");
+      Assert.assertEquals(params.get("port"), 3030);
+      for (Map.Entry<String, Object> entry : params.entrySet())
+      {
+         if (!entry.getKey().equals("host") && !entry.getKey().equals("port"))
+         {
+            Assert.assertEquals(entry.getValue(), props.get(entry.getKey()));
+         }
+      }
+   }
+
+
+   @Test
+   public void testTCPAllNettyConnectorPropertiesMultiple() throws Exception
+   {
+      Map<String, Object> props = new HashMap<>();
+      Set<String> allowableConnectorKeys = TransportConstants.ALLOWABLE_CONNECTOR_KEYS;
+      StringBuilder sb = new StringBuilder();
+      sb.append("(tcp://localhost0:5445?");//localhost1:5446,localhost2:5447,localhost3:5448)&ha=true");
+      populateConnectorParams(props, allowableConnectorKeys, sb);
+      Map<String, Object> props2 = new HashMap<>();
+      sb.append(",tcp://localhost1:5446?");
+      populateConnectorParams(props2, allowableConnectorKeys, sb);
+      Map<String, Object> props3 = new HashMap<>();
+      sb.append(",tcp://localhost2:5447?");
+      populateConnectorParams(props3, allowableConnectorKeys, sb);
+      sb.append(")?ha=true&clientID=myID");
+
+      ActiveMQConnectionFactory factory = parser.newObject(sb.toString());
+
+      TransportConfiguration[] staticConnectors = factory.getStaticConnectors();
+      Assert.assertEquals(3, staticConnectors.length);
+      checkTC(props, staticConnectors[0],0);
+      checkTC(props2, staticConnectors[1],1);
+      checkTC(props3, staticConnectors[2],2);
+   }
+
+   private void checkTC(Map<String, Object> props, TransportConfiguration staticConnector, int offfSet)
+   {
+      TransportConfiguration connector = staticConnector;
+      Assert.assertEquals(connector.getParams().get("host"), "localhost" + offfSet);
+      Assert.assertEquals(connector.getParams().get("port"), (5445 + offfSet));
+      Map<String, Object> params = connector.getParams();
+      for (Map.Entry<String, Object> entry : params.entrySet())
+      {
+         if (!entry.getKey().equals("host") && !entry.getKey().equals("port"))
+         {
+            Assert.assertEquals(entry.getValue(), props.get(entry.getKey()));
+         }
+      }
+   }
+
+   private void populateConnectorParams(Map<String, Object> props, Set<String> allowableConnectorKeys, StringBuilder sb)
+   {
+      for (String allowableConnectorKey : allowableConnectorKeys)
+      {
+         if (!allowableConnectorKey.equals("host") && !allowableConnectorKey.equals("port"))
+         {
+            String value = RandomUtil.randomString();
+            props.put(allowableConnectorKey, value);
+            sb.append("&").append(allowableConnectorKey).append("=").append(value);
+         }
+      }
+   }
+
+   @Test
+   public void testTCPURI() throws Exception
+   {
+      TransportConfiguration tc = new TransportConfiguration(NettyConnectorFactory.class.getName());
+      HashMap<String, Object> params = new HashMap<>();
+      params.put("host", "localhost1");
+      params.put("port", 5446);
+      TransportConfiguration tc2 = new TransportConfiguration(NettyConnectorFactory.class.getName(), params);
+      HashMap<String, Object> params2 = new HashMap<>();
+      params2.put("host", "localhost2");
+      params2.put("port", 5447);
+      TransportConfiguration tc3 = new TransportConfiguration(NettyConnectorFactory.class.getName(), params2);
+      ActiveMQConnectionFactory connectionFactoryWithHA = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, tc, tc2, tc3);
+      URI tcp = parser.createSchema("tcp", connectionFactoryWithHA);
+      ActiveMQConnectionFactory factory = parser.newObject(tcp);
+      BeanUtilsBean bean = new BeanUtilsBean();
+      checkEquals(bean, connectionFactoryWithHA, factory);
+   }
 
    @Test
    public void testUDP() throws Exception
    {
       ActiveMQConnectionFactory factory = parser.newObject(new URI("udp://localhost:3030?ha=true&type=QUEUE_XA_CF"));
 
-      Assert.assertTrue(factory instanceof XAQueueConnectionFactory);
+      Assert.assertTrue(ActiveMQXAQueueConnectionFactory.class.getName().equals(factory.getClass().getName()));
+   }
+
+   @Test
+   public void testUDPAllProperties() throws Exception
+   {
+      StringBuilder sb = new StringBuilder();
+      sb.append("udp://localhost:3030?ha=true");
+      BeanUtilsBean bean = new BeanUtilsBean();
+      ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
+      populate(sb, bean, factory);
+      ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()));
+      checkEquals(bean, factory, factory2);
+   }
+
+   @Test
+   public void testUDPURI() throws Exception
+   {
+      DiscoveryGroupConfiguration discoveryGroupConfiguration = new DiscoveryGroupConfiguration();
+      UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory();
+      endpoint.setGroupPort(3333).setGroupAddress("wahey").setLocalBindPort(555).setLocalBindAddress("uhuh");
+      discoveryGroupConfiguration.setName("foo")
+            .setRefreshTimeout(12345)
+            .setDiscoveryInitialWaitTimeout(5678)
+            .setBroadcastEndpointFactory(endpoint);
+      ActiveMQConnectionFactory connectionFactoryWithHA = ActiveMQJMSClient.createConnectionFactoryWithHA(discoveryGroupConfiguration, JMSFactoryType.CF);
+      URI tcp = parser.createSchema("udp", connectionFactoryWithHA);
+      ActiveMQConnectionFactory factory = parser.newObject(tcp);
+      DiscoveryGroupConfiguration dgc = factory.getDiscoveryGroupConfiguration();
+      Assert.assertNotNull(dgc);
+      BroadcastEndpointFactory befc = dgc.getBroadcastEndpointFactory();
+      Assert.assertNotNull(befc);
+      Assert.assertTrue(befc instanceof UDPBroadcastEndpointFactory);
+      UDPBroadcastEndpointFactory ubgc = (UDPBroadcastEndpointFactory) befc;
+      Assert.assertEquals(ubgc.getGroupAddress(), "wahey");
+      Assert.assertEquals(ubgc.getGroupPort(), 3333);
+      //these 2 are transient
+      Assert.assertEquals(ubgc.getLocalBindAddress(), null);
+      Assert.assertEquals(ubgc.getLocalBindPort(), -1);
+      Assert.assertEquals(dgc.getName(), "foo");
+      Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5678);
+      Assert.assertEquals(dgc.getRefreshTimeout(), 12345);
+
+
+      BeanUtilsBean bean = new BeanUtilsBean();
+      checkEquals(bean, connectionFactoryWithHA, factory);
    }
 
    @Test
@@ -47,14 +266,149 @@ public class ConnectionFactoryURITest
    {
       ActiveMQConnectionFactory factory = parser.newObject(new URI("udp://localhost:3030?ha=true&type=QUEUE_XA_CFInvalid"));
 
-      Assert.assertTrue(factory instanceof ConnectionFactory);
+      Assert.assertTrue(ActiveMQJMSConnectionFactory.class.getName().equals(factory.getClass().getName()));
+   }
+
+   @Test
+   public void testJGroupsFile() throws Exception
+   {
+      ActiveMQConnectionFactory factory = parser.newObject(new URI("jgroups://channel-name?file=/path/to/some/file/channel-file.xml&test=33"));
+
+      Assert.assertTrue(ActiveMQJMSConnectionFactory.class.getName().equals(factory.getClass().getName()));
+      JGroupsFileBroadcastEndpointFactory broadcastEndpointFactory = (JGroupsFileBroadcastEndpointFactory) factory.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory();
+      Assert.assertEquals(broadcastEndpointFactory.getFile(), "/path/to/some/file/channel-file.xml");
+      Assert.assertEquals(broadcastEndpointFactory.getChannelName(), "channel-name");
+   }
+
+   @Test
+   public void testJGroupsKeyValue() throws Exception
+   {
+      ActiveMQConnectionFactory factory = parser.newObject(new URI("jgroups://channel-name?properties=param=value;param2=value2&test=33"));
+
+      Assert.assertTrue(ActiveMQJMSConnectionFactory.class.getName().equals(factory.getClass().getName()));
+      JGroupsPropertiesBroadcastEndpointFactory broadcastEndpointFactory = (JGroupsPropertiesBroadcastEndpointFactory) factory.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory();
+      Assert.assertEquals(broadcastEndpointFactory.getProperties(), "param=value;param2=value2");
+      Assert.assertEquals(broadcastEndpointFactory.getChannelName(), "channel-name");
    }
 
    @Test
-   public void testJGroups() throws Exception
+   public void testJGroupsAllProperties() throws Exception
    {
-      ActiveMQConnectionFactory factory = parser.newObject(new URI("jgroups://test.xml?test=33"));
+      StringBuilder sb = new StringBuilder();
+      sb.append("jgroups://?file=param=value;param=value&channelName=channelName&ha=true");
+      BeanUtilsBean bean = new BeanUtilsBean();
+      ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(true, (TransportConfiguration) null);
+      populate(sb, bean, factory);
+      ActiveMQConnectionFactory factory2 = parser.newObject(new URI(sb.toString()));
+      checkEquals(bean, factory, factory2);
+   }
+
+
+   @Test
+   public void testJGroupsFileURI() throws Exception
+   {
+      DiscoveryGroupConfiguration discoveryGroupConfiguration = new DiscoveryGroupConfiguration();
+      JGroupsFileBroadcastEndpointFactory endpointFactory = new JGroupsFileBroadcastEndpointFactory()
+            .setChannelName("channel-name")
+            .setFile("channel-file.xml");
+      discoveryGroupConfiguration.setName("foo")
+            .setRefreshTimeout(12345)
+            .setDiscoveryInitialWaitTimeout(5678)
+            .setBroadcastEndpointFactory(endpointFactory);
+      ActiveMQConnectionFactory connectionFactoryWithHA = ActiveMQJMSClient.createConnectionFactoryWithHA(discoveryGroupConfiguration, JMSFactoryType.CF);
+      URI tcp = parser.createSchema("jgroups", connectionFactoryWithHA);
+      ActiveMQConnectionFactory factory = parser.newObject(tcp);
+      DiscoveryGroupConfiguration dgc = factory.getDiscoveryGroupConfiguration();
+      Assert.assertNotNull(dgc);
+      BroadcastEndpointFactory befc = dgc.getBroadcastEndpointFactory();
+      Assert.assertNotNull(befc);
+      Assert.assertTrue(befc instanceof JGroupsFileBroadcastEndpointFactory);
+      Assert.assertEquals(dgc.getName(), "foo");
+      Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5678);
+      Assert.assertEquals(dgc.getRefreshTimeout(), 12345);
+      JGroupsFileBroadcastEndpointFactory fileBroadcastEndpointFactory = (JGroupsFileBroadcastEndpointFactory) befc;
+      Assert.assertEquals(fileBroadcastEndpointFactory.getFile(), "channel-file.xml");
+      Assert.assertEquals(fileBroadcastEndpointFactory.getChannelName(), "channel-name");
+
 
-//      Assert.assertTrue(factory instanceof ConnectionFactory);
+      BeanUtilsBean bean = new BeanUtilsBean();
+      checkEquals(bean, connectionFactoryWithHA, factory);
+   }
+
+   @Test
+   public void testJGroupsPropertiesURI() throws Exception
+   {
+      DiscoveryGroupConfiguration discoveryGroupConfiguration = new DiscoveryGroupConfiguration();
+      JGroupsPropertiesBroadcastEndpointFactory endpointFactory = new JGroupsPropertiesBroadcastEndpointFactory()
+            .setChannelName("channel-name")
+            .setProperties("param=val,param2-val2");
+      discoveryGroupConfiguration.setName("foo")
+            .setRefreshTimeout(12345)
+            .setDiscoveryInitialWaitTimeout(5678)
+            .setBroadcastEndpointFactory(endpointFactory);
+      ActiveMQConnectionFactory connectionFactoryWithHA = ActiveMQJMSClient.createConnectionFactoryWithHA(discoveryGroupConfiguration, JMSFactoryType.CF);
+      URI tcp = parser.createSchema("jgroups", connectionFactoryWithHA);
+      ActiveMQConnectionFactory factory = parser.newObject(tcp);
+      DiscoveryGroupConfiguration dgc = factory.getDiscoveryGroupConfiguration();
+      Assert.assertNotNull(dgc);
+      BroadcastEndpointFactory broadcastEndpointFactory = dgc.getBroadcastEndpointFactory();
+      Assert.assertNotNull(broadcastEndpointFactory);
+      Assert.assertTrue(broadcastEndpointFactory instanceof JGroupsPropertiesBroadcastEndpointFactory);
+      Assert.assertEquals(dgc.getName(), "foo");
+      Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5678);
+      Assert.assertEquals(dgc.getRefreshTimeout(), 12345);
+      JGroupsPropertiesBroadcastEndpointFactory propertiesBroadcastEndpointFactory = (JGroupsPropertiesBroadcastEndpointFactory) broadcastEndpointFactory;
+      Assert.assertEquals(propertiesBroadcastEndpointFactory.getProperties(), "param=val,param2-val2");
+      Assert.assertEquals(propertiesBroadcastEndpointFactory.getChannelName(), "channel-name");
+
+      BeanUtilsBean bean = new BeanUtilsBean();
+      checkEquals(bean, connectionFactoryWithHA, factory);
+   }
+
+   private void populate(StringBuilder sb, BeanUtilsBean bean, ActiveMQConnectionFactory factory) throws IllegalAccessException, InvocationTargetException
+   {
+      PropertyDescriptor[] descriptors = bean.getPropertyUtils().getPropertyDescriptors(factory);
+      for (PropertyDescriptor descriptor : descriptors)
+      {
+         if (descriptor.getWriteMethod() != null && descriptor.getReadMethod() != null)
+         {
+            if (descriptor.getPropertyType() == String.class)
+            {
+               String value = RandomUtil.randomString();
+               bean.setProperty(factory, descriptor.getName(), value);
+               sb.append("&").append(descriptor.getName()).append("=").append(value);
+            }
+            else if (descriptor.getPropertyType() == int.class)
+            {
+               int value = RandomUtil.randomPositiveInt();
+               bean.setProperty(factory, descriptor.getName(), value);
+               sb.append("&").append(descriptor.getName()).append("=").append(value);
+            }
+            else if (descriptor.getPropertyType() == long.class)
+            {
+               long value = RandomUtil.randomPositiveLong();
+               bean.setProperty(factory, descriptor.getName(), value);
+               sb.append("&").append(descriptor.getName()).append("=").append(value);
+            }
+            else if (descriptor.getPropertyType() == double.class)
+            {
+               double value = RandomUtil.randomDouble();
+               bean.setProperty(factory, descriptor.getName(), value);
+               sb.append("&").append(descriptor.getName()).append("=").append(value);
+            }
+         }
+      }
+   }
+
+   private void checkEquals(BeanUtilsBean bean, ActiveMQConnectionFactory factory, ActiveMQConnectionFactory factory2) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
+   {
+      PropertyDescriptor[] descriptors = bean.getPropertyUtils().getPropertyDescriptors(factory);
+      for (PropertyDescriptor descriptor : descriptors)
+      {
+         if (descriptor.getWriteMethod() != null && descriptor.getReadMethod() != null)
+         {
+            Assert.assertEquals(descriptor.getName() + " incorrect", bean.getProperty(factory, descriptor.getName()),bean.getProperty(factory2, descriptor.getName()));
+         }
+      }
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
----------------------------------------------------------------------
diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
index 1675f3f..a677218 100644
--- a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
+++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
@@ -39,11 +39,12 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.apache.activemq.api.core.ActiveMQException;
-import org.apache.activemq.api.core.BroadcastEndpointFactoryConfiguration;
+import org.apache.activemq.api.core.BroadcastEndpointFactory;
+import org.apache.activemq.api.core.ChannelBroadcastEndpointFactory;
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
-import org.apache.activemq.api.core.JGroupsBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.JGroupsFileBroadcastEndpointFactory;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.client.ClientSession;
 import org.apache.activemq.api.core.client.ClientSessionFactory;
 import org.apache.activemq.api.core.client.ActiveMQClient;
@@ -1873,13 +1874,13 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
 
       if (discoveryAddress != null || jgroupsFileName != null || jgroupsLocatorClassName != null)
       {
-         BroadcastEndpointFactoryConfiguration endpointFactoryConfiguration = null;
+         BroadcastEndpointFactory endpointFactory = null;
 
          if (jgroupsLocatorClassName != null)
          {
             String jchannelRefName = raProperties.getJgroupsChannelRefName();
             JChannel jchannel = ActiveMQRaUtils.locateJGroupsChannel(jgroupsLocatorClassName, jchannelRefName);
-            endpointFactoryConfiguration = new JGroupsBroadcastGroupConfiguration(jchannel, jgroupsChannel);
+            endpointFactory = new ChannelBroadcastEndpointFactory(jchannel, jgroupsChannel);
          }
          else if (discoveryAddress != null)
          {
@@ -1892,7 +1893,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
 
             String localBindAddress = overrideProperties.getDiscoveryLocalBindAddress() != null ? overrideProperties.getDiscoveryLocalBindAddress()
                : raProperties.getDiscoveryLocalBindAddress();
-            endpointFactoryConfiguration = new UDPBroadcastGroupConfiguration()
+            endpointFactory = new UDPBroadcastEndpointFactory()
                .setGroupAddress(discoveryAddress)
                .setGroupPort(discoveryPort)
                .setLocalBindAddress(localBindAddress)
@@ -1900,7 +1901,9 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
          }
          else if (jgroupsFileName != null)
          {
-            endpointFactoryConfiguration = new JGroupsBroadcastGroupConfiguration(jgroupsFileName, jgroupsChannel);
+            endpointFactory = new JGroupsFileBroadcastEndpointFactory()
+                  .setChannelName(jgroupsChannel)
+                  .setFile(jgroupsFileName);
          }
          Long refreshTimeout = overrideProperties.getDiscoveryRefreshTimeout() != null ? overrideProperties.getDiscoveryRefreshTimeout()
             : raProperties.getDiscoveryRefreshTimeout();
@@ -1920,7 +1923,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
          DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration()
             .setRefreshTimeout(refreshTimeout)
             .setDiscoveryInitialWaitTimeout(initialTimeout)
-            .setBroadcastEndpointFactoryConfiguration(endpointFactoryConfiguration);
+            .setBroadcastEndpointFactory(endpointFactory);
 
          if (ActiveMQRALogger.LOGGER.isDebugEnabled())
          {
@@ -2008,7 +2011,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
 
       if (connectorClassName == null)
       {
-         BroadcastEndpointFactoryConfiguration endpointFactoryConfiguration = null;
+         BroadcastEndpointFactory endpointFactory = null;
          if (discoveryAddress != null)
          {
             Integer discoveryPort = overrideProperties.getDiscoveryPort() != null ? overrideProperties.getDiscoveryPort()
@@ -2020,7 +2023,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
 
             String localBindAddress = overrideProperties.getDiscoveryLocalBindAddress() != null ? overrideProperties.getDiscoveryLocalBindAddress()
                : raProperties.getDiscoveryLocalBindAddress();
-            endpointFactoryConfiguration = new UDPBroadcastGroupConfiguration()
+            endpointFactory = new UDPBroadcastEndpointFactory()
                .setGroupAddress(discoveryAddress)
                .setGroupPort(discoveryPort)
                .setLocalBindAddress(localBindAddress)
@@ -2028,7 +2031,9 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
          }
          else if (jgroupsFileName != null)
          {
-            endpointFactoryConfiguration = new JGroupsBroadcastGroupConfiguration(jgroupsFileName, jgroupsChannel);
+            endpointFactory = new JGroupsFileBroadcastEndpointFactory()
+                  .setChannelName(jgroupsChannel)
+                  .setFile(jgroupsFileName);
          }
          else
          {
@@ -2037,9 +2042,9 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
             {
                String jgroupsChannelRefName = raProperties.getJgroupsChannelRefName();
                JChannel jchannel = ActiveMQRaUtils.locateJGroupsChannel(jgroupsLocatorClass, jgroupsChannelRefName);
-               endpointFactoryConfiguration = new JGroupsBroadcastGroupConfiguration(jchannel, jgroupsChannel);
+               endpointFactory = new ChannelBroadcastEndpointFactory(jchannel, jgroupsChannel);
             }
-            if (endpointFactoryConfiguration == null)
+            if (endpointFactory == null)
             {
                throw new IllegalArgumentException("must provide either TransportType or DiscoveryGroupAddress and DiscoveryGroupPort for ActiveMQ ResourceAdapter Connection Factory");
             }
@@ -2061,7 +2066,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable
          DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration()
             .setRefreshTimeout(refreshTimeout)
             .setDiscoveryInitialWaitTimeout(initialTimeout)
-            .setBroadcastEndpointFactoryConfiguration(endpointFactoryConfiguration);
+            .setBroadcastEndpointFactory(endpointFactory);
 
          groupConfiguration.setRefreshTimeout(refreshTimeout);
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/main/java/org/apache/activemq/core/config/Configuration.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/config/Configuration.java b/activemq-server/src/main/java/org/apache/activemq/core/config/Configuration.java
index c814979..1090257 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/config/Configuration.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/config/Configuration.java
@@ -16,7 +16,6 @@
  */
 package org.apache.activemq.core.config;
 
-import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -35,7 +34,7 @@ import org.apache.activemq.core.settings.impl.AddressSettings;
  *
  * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
  */
-public interface Configuration extends Serializable
+public interface Configuration
 {
    /**
     * To be used on dependency management on the application server

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/main/java/org/apache/activemq/core/config/impl/ConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/config/impl/ConfigurationImpl.java b/activemq-server/src/main/java/org/apache/activemq/core/config/impl/ConfigurationImpl.java
index 3c39a8b..9afd93d 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/config/impl/ConfigurationImpl.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/config/impl/ConfigurationImpl.java
@@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -51,7 +52,7 @@ import org.apache.activemq.core.settings.impl.AddressSettings;
  * @author <a href="mailto:ataylor@redhat.com>Andy Taylor</a>
  * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
  */
-public class ConfigurationImpl implements Configuration
+public class ConfigurationImpl implements Configuration, Serializable
 {
    // Constants ------------------------------------------------------------------------------
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/main/java/org/apache/activemq/core/deployers/impl/FileConfigurationParser.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/deployers/impl/FileConfigurationParser.java b/activemq-server/src/main/java/org/apache/activemq/core/deployers/impl/FileConfigurationParser.java
index 8ebea6e..a4010fe 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/deployers/impl/FileConfigurationParser.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/deployers/impl/FileConfigurationParser.java
@@ -27,14 +27,14 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.activemq.api.config.ActiveMQDefaultConfiguration;
-import org.apache.activemq.api.core.BroadcastEndpointFactoryConfiguration;
+import org.apache.activemq.api.core.BroadcastEndpointFactory;
 import org.apache.activemq.api.core.BroadcastGroupConfiguration;
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
-import org.apache.activemq.api.core.JGroupsBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.JGroupsFileBroadcastEndpointFactory;
 import org.apache.activemq.api.core.Pair;
 import org.apache.activemq.api.core.SimpleString;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.client.ActiveMQClient;
 import org.apache.activemq.core.config.BridgeConfiguration;
 import org.apache.activemq.core.config.ClusterConnectionConfiguration;
@@ -1268,15 +1268,17 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
 
       // TODO: validate if either jgroups or UDP is being filled
 
-      BroadcastEndpointFactoryConfiguration endpointFactoryConfiguration;
+      BroadcastEndpointFactory endpointFactory;
 
       if (jgroupsFile != null)
       {
-         endpointFactoryConfiguration = new JGroupsBroadcastGroupConfiguration(jgroupsFile, jgroupsChannel);
+         endpointFactory = new JGroupsFileBroadcastEndpointFactory()
+               .setFile(jgroupsFile)
+               .setChannelName(jgroupsChannel);
       }
       else
       {
-         endpointFactoryConfiguration = new UDPBroadcastGroupConfiguration()
+         endpointFactory = new UDPBroadcastEndpointFactory()
             .setGroupAddress(groupAddress)
             .setGroupPort(groupPort)
             .setLocalBindAddress(localAddress)
@@ -1287,7 +1289,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
          .setName(name)
          .setBroadcastPeriod(broadcastPeriod)
          .setConnectorInfos(connectorNames)
-         .setEndpointFactoryConfiguration(endpointFactoryConfiguration);
+         .setEndpointFactory(endpointFactory);
 
       mainConfig.getBroadcastGroupConfigurations().add(config);
    }
@@ -1317,14 +1319,16 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
       String jgroupsChannel = getString(e, "jgroups-channel", null, Validators.NO_CHECK);
 
       // TODO: validate if either jgroups or UDP is being filled
-      BroadcastEndpointFactoryConfiguration endpointFactoryConfiguration;
+      BroadcastEndpointFactory endpointFactory;
       if (jgroupsFile != null)
       {
-         endpointFactoryConfiguration = new JGroupsBroadcastGroupConfiguration(jgroupsFile, jgroupsChannel);
+         endpointFactory = new JGroupsFileBroadcastEndpointFactory()
+               .setFile(jgroupsFile)
+               .setChannelName(jgroupsChannel);
       }
       else
       {
-         endpointFactoryConfiguration = new UDPBroadcastGroupConfiguration()
+         endpointFactory = new UDPBroadcastEndpointFactory()
             .setGroupAddress(groupAddress)
             .setGroupPort(groupPort)
             .setLocalBindAddress(localBindAddress)
@@ -1335,7 +1339,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil
          .setName(name)
          .setRefreshTimeout(refreshTimeout)
          .setDiscoveryInitialWaitTimeout(discoveryInitialWaitTimeout)
-         .setBroadcastEndpointFactoryConfiguration(endpointFactoryConfiguration);
+         .setBroadcastEndpointFactory(endpointFactory);
 
       if (mainConfig.getDiscoveryGroupConfigurations().containsKey(name))
       {

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/main/java/org/apache/activemq/core/management/impl/BroadcastGroupControlImpl.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/management/impl/BroadcastGroupControlImpl.java b/activemq-server/src/main/java/org/apache/activemq/core/management/impl/BroadcastGroupControlImpl.java
index 506dd8f..f20fb21 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/management/impl/BroadcastGroupControlImpl.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/management/impl/BroadcastGroupControlImpl.java
@@ -19,7 +19,7 @@ package org.apache.activemq.core.management.impl;
 import javax.management.MBeanOperationInfo;
 
 import org.apache.activemq.api.core.BroadcastGroupConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.management.BroadcastGroupControl;
 import org.apache.activemq.core.persistence.StorageManager;
 import org.apache.activemq.core.server.cluster.BroadcastGroup;
@@ -130,9 +130,9 @@ public class BroadcastGroupControlImpl extends AbstractControl implements Broadc
       clearIO();
       try
       {
-         if (configuration.getEndpointFactoryConfiguration() instanceof UDPBroadcastGroupConfiguration)
+         if (configuration.getEndpointFactory() instanceof UDPBroadcastEndpointFactory)
          {
-            return ((UDPBroadcastGroupConfiguration)configuration.getEndpointFactoryConfiguration()).getGroupAddress();
+            return ((UDPBroadcastEndpointFactory)configuration.getEndpointFactory()).getGroupAddress();
          }
          throw new Exception("Invalid request because this is not a UDP Broadcast configuration.");
       }
@@ -147,9 +147,9 @@ public class BroadcastGroupControlImpl extends AbstractControl implements Broadc
       clearIO();
       try
       {
-         if (configuration.getEndpointFactoryConfiguration() instanceof UDPBroadcastGroupConfiguration)
+         if (configuration.getEndpointFactory() instanceof UDPBroadcastEndpointFactory)
          {
-            return ((UDPBroadcastGroupConfiguration)configuration.getEndpointFactoryConfiguration()).getGroupPort();
+            return ((UDPBroadcastEndpointFactory)configuration.getEndpointFactory()).getGroupPort();
          }
          throw new Exception("Invalid request because this is not a UDP Broadcast configuration.");
       }
@@ -164,9 +164,9 @@ public class BroadcastGroupControlImpl extends AbstractControl implements Broadc
       clearIO();
       try
       {
-         if (configuration.getEndpointFactoryConfiguration() instanceof UDPBroadcastGroupConfiguration)
+         if (configuration.getEndpointFactory() instanceof UDPBroadcastEndpointFactory)
          {
-            return ((UDPBroadcastGroupConfiguration)configuration.getEndpointFactoryConfiguration()).getLocalBindPort();
+            return ((UDPBroadcastEndpointFactory)configuration.getEndpointFactory()).getLocalBindPort();
          }
          throw new Exception("Invalid request because this is not a UDP Broadcast configuration.");
       }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java
index df30e00..1495571 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMAcceptorFactory.java
@@ -17,7 +17,6 @@
 package org.apache.activemq.core.remoting.impl.invm;
 
 import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledExecutorService;
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java
index 5de4161..e800bd1 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/InVMConnectorFactory.java
@@ -17,7 +17,6 @@
 package org.apache.activemq.core.remoting.impl.invm;
 
 import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledExecutorService;
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java
index 9987383..45b75d4 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/invm/TransportConstants.java
@@ -16,11 +16,6 @@
  */
 package org.apache.activemq.core.remoting.impl.invm;
 
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.activemq.api.config.ActiveMQDefaultConfiguration;
 
 /**
  * A TransportConstants

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java
index 1bb545b..674200c 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyAcceptorFactory.java
@@ -17,7 +17,6 @@
 package org.apache.activemq.core.remoting.impl.netty;
 
 import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledExecutorService;
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/main/java/org/apache/activemq/core/remoting/server/impl/RemotingServiceImpl.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/remoting/server/impl/RemotingServiceImpl.java b/activemq-server/src/main/java/org/apache/activemq/core/remoting/server/impl/RemotingServiceImpl.java
index 9cb009a..6baf3de 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/remoting/server/impl/RemotingServiceImpl.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/remoting/server/impl/RemotingServiceImpl.java
@@ -242,21 +242,6 @@ public class RemotingServiceImpl implements RemotingService, ConnectionLifeCycle
 
             AcceptorFactory factory = (AcceptorFactory) clazz.newInstance();
 
-            // Check valid properties
-
-            if (info.getParams() != null)
-            {
-               Set<String> invalid = ConfigurationHelper.checkKeys(factory.getAllowableProperties(), info.getParams()
-                  .keySet());
-
-               if (!invalid.isEmpty())
-               {
-                  ActiveMQServerLogger.LOGGER.invalidAcceptorKeys(ConfigurationHelper.stringSetToCommaListString(invalid));
-
-                  continue;
-               }
-            }
-
             Map<String, ProtocolManager> supportedProtocols = new ConcurrentHashMap();
 
             String protocol = ConfigurationHelper.getStringProperty(TransportConstants.PROTOCOL_PROP_NAME, null,

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/main/java/org/apache/activemq/core/server/cluster/ClusterManager.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/server/cluster/ClusterManager.java b/activemq-server/src/main/java/org/apache/activemq/core/server/cluster/ClusterManager.java
index 7d09fdd..5c5362e 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/server/cluster/ClusterManager.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/server/cluster/ClusterManager.java
@@ -856,7 +856,7 @@ public final class ClusterManager implements ActiveMQComponent
       if (group == null)
       {
          group = new BroadcastGroupImpl(nodeManager, config.getName(),
-                                        config.getBroadcastPeriod(), scheduledExecutor, config.getEndpointFactoryConfiguration().createBroadcastEndpointFactory());
+                                        config.getBroadcastPeriod(), scheduledExecutor, config.getEndpointFactory());
 
          for (String connectorInfo : config.getConnectorInfos())
          {

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java b/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java
index 02dbb35..2d92323 100644
--- a/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java
+++ b/activemq-server/src/main/java/org/apache/activemq/spi/core/remoting/AcceptorFactory.java
@@ -17,7 +17,6 @@
 package org.apache.activemq.spi.core.remoting;
 
 import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledExecutorService;
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-server/src/test/java/org/apache/activemq/core/config/impl/FileConfigurationTest.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/test/java/org/apache/activemq/core/config/impl/FileConfigurationTest.java b/activemq-server/src/test/java/org/apache/activemq/core/config/impl/FileConfigurationTest.java
index 182cd7f..c7fc2c4 100644
--- a/activemq-server/src/test/java/org/apache/activemq/core/config/impl/FileConfigurationTest.java
+++ b/activemq-server/src/test/java/org/apache/activemq/core/config/impl/FileConfigurationTest.java
@@ -22,7 +22,7 @@ import org.apache.activemq.api.core.BroadcastGroupConfiguration;
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.api.core.SimpleString;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.core.config.BridgeConfiguration;
 import org.apache.activemq.core.config.ClusterConnectionConfiguration;
 import org.apache.activemq.core.config.Configuration;
@@ -141,7 +141,7 @@ public class FileConfigurationTest extends ConfigurationImplTest
       Assert.assertEquals(2, conf.getBroadcastGroupConfigurations().size());
       for (BroadcastGroupConfiguration bc : conf.getBroadcastGroupConfigurations())
       {
-         UDPBroadcastGroupConfiguration udpBc = (UDPBroadcastGroupConfiguration) bc.getEndpointFactoryConfiguration();
+         UDPBroadcastEndpointFactory udpBc = (UDPBroadcastEndpointFactory) bc.getEndpointFactory();
          if (bc.getName().equals("bg1"))
          {
             Assert.assertEquals("bg1", bc.getName());
@@ -165,16 +165,16 @@ public class FileConfigurationTest extends ConfigurationImplTest
       Assert.assertEquals(2, conf.getDiscoveryGroupConfigurations().size());
       DiscoveryGroupConfiguration dc = conf.getDiscoveryGroupConfigurations().get("dg1");
       Assert.assertEquals("dg1", dc.getName());
-      Assert.assertEquals("192.168.0.120", ((UDPBroadcastGroupConfiguration) dc.getBroadcastEndpointFactoryConfiguration()).getGroupAddress());
-      assertEquals("172.16.8.10", ((UDPBroadcastGroupConfiguration) dc.getBroadcastEndpointFactoryConfiguration()).getLocalBindAddress());
-      Assert.assertEquals(11999, ((UDPBroadcastGroupConfiguration) dc.getBroadcastEndpointFactoryConfiguration()).getGroupPort());
+      Assert.assertEquals("192.168.0.120", ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getGroupAddress());
+      assertEquals("172.16.8.10", ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getLocalBindAddress());
+      Assert.assertEquals(11999, ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getGroupPort());
       Assert.assertEquals(12345, dc.getRefreshTimeout());
 
       dc = conf.getDiscoveryGroupConfigurations().get("dg2");
       Assert.assertEquals("dg2", dc.getName());
-      Assert.assertEquals("192.168.0.121", ((UDPBroadcastGroupConfiguration) dc.getBroadcastEndpointFactoryConfiguration()).getGroupAddress());
-      assertEquals("172.16.8.11", ((UDPBroadcastGroupConfiguration) dc.getBroadcastEndpointFactoryConfiguration()).getLocalBindAddress());
-      Assert.assertEquals(12999, ((UDPBroadcastGroupConfiguration) dc.getBroadcastEndpointFactoryConfiguration()).getGroupPort());
+      Assert.assertEquals("192.168.0.121", ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getGroupAddress());
+      assertEquals("172.16.8.11", ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getLocalBindAddress());
+      Assert.assertEquals(12999, ((UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory()).getGroupPort());
       Assert.assertEquals(23456, dc.getRefreshTimeout());
 
       Assert.assertEquals(2, conf.getDivertConfigurations().size());

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/docs/user-manual/en/using-jms.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/using-jms.md b/docs/user-manual/en/using-jms.md
index 0fe7595..81aac79 100644
--- a/docs/user-manual/en/using-jms.md
+++ b/docs/user-manual/en/using-jms.md
@@ -64,38 +64,27 @@ A JMS connection factory is used by the client to make connections to
 the server. It knows the location of the server it is connecting to, as
 well as many other configuration parameters.
 
-By default, a `javax.naming.Context` instance created using the
-`org.apache.activemq.jndi.ActiveMQInitialContextFactory` will
-automatically have the following connection factories available for
-lookup:
-
--   `ConnectionFactory`
-
--   `XAConnectionFactory`
-
--   `QueueConnectionFactory`
-
--   `TopicConnectionFactory`
-
 Here's a simple example of the JNDI context environment for a client
 looking up a connection factory to access an *embedded* instance of
 ActiveMQ:
 
     java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+    connectionFactory.invmConnectionFactory=vm://0
 
-It's really as simple as that. As noted previously, any JNDI context
-created with the `ActiveMQInitialContextFactory` will have a set of
-default connection factories available. Therefore, only the
-`java.naming.factory.initial` property is required to access an embedded
-broker.
+In this instance we have created a connection factory that is bound to
+`invmConnectionFactory`, any entry with prefix `connectionFactory.` will
+  create a connection factory.
 
 In certain situations there could be multiple server instances running
 within a particular JVM. In that situation each server would typically
 have an InVM acceptor with a unique server-ID. A client using JMS and
-JNDI can account for this by specifying a
-`javax.naming.Context.PROVIDER_URL` (`String` value of
-"java.naming.provider.url") in the JNDI environment like `vm://2` where
-`2` is the server-ID for acceptor.
+JNDI can account for this by specifying a connction factory for each
+server, like so:
+
+    java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+    connectionFactory.invmConnectionFactory0=vm://0
+    connectionFactory.invmConnectionFactory1=vm://1
+    connectionFactory.invmConnectionFactory2=vm://2
 
 Here is a list of all the supported URL schemes:
 
@@ -108,19 +97,17 @@ Here is a list of all the supported URL schemes:
 -   `jgroups`
 
 Most clients won't be connecting to an embedded broker. Clients will
-most commonly connect across a network a remote broker. In that case the
-client can use the `javax.naming.Context.PROVIDER_URL` (`String` value
-of "java.naming.provider.url") in the JNDI environment to specify where
-to connect. Here's a simple example of a client configuring a connection
-factory to connect to a remote broker running on myhost:5445:
+most commonly connect across a network a remote broker. Here's a simple
+example of a client configuring a connection factory to connect to a
+remote broker running on myhost:5445:
 
     java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-    java.naming.provider.url=tcp://myhost:5445
+    connectionFactory.ConnectionFactory=tcp://myhost:5445
 
 In the example above the client is using the `tcp` scheme for the
 provider URL. A client may also specify multiple comma-delimited
 host:port combinations in the URL (e.g.
-`tcp://remote-host1:5445,remote-host2:5445`). Whether there is one or
+`(tcp://remote-host1:5445,remote-host2:5445)`). Whether there is one or
 many host:port combinations in the URL they are treated as the *initial
 connector(s)* for the underlying connection.
 
@@ -132,13 +119,24 @@ Each scheme has a specific set of properties which can be set using the
 traditional URL query string format (e.g.
 `scheme://host:port?key1=value1&key2=value2`) to customize the
 underlying transport mechanism. For example, if a client wanted to
-connect to a remote server using TCP and SSL it would use a
-`Context.PROVIDER_URL` of `tcp://remote-host:5445?ssl-enabled=true`.
+connect to a remote server using TCP and SSL it would create a connection
+factory like so, `tcp://remote-host:5445?ssl-enabled=true`.
 
 All the properties available for the `tcp` scheme are described in [the
 documentation regarding the Netty
 transport](#configuring-transports.netty).
 
+Note if you are using the `tcp` scheme and multiple addresses then a query
+can be applied to all the url's or just to an individual connector, so where
+you have
+
+-   `(tcp://remote-host1:5445?httpEnabled=true,remote-host2:5445?httpEnabled=true)?clientID=1234`
+
+then the `httpEnabled` property is only set on the individual connectors where as the `clientId`
+is set on the actual connection factory. Any connector specific properties set on the whole
+URI will be applied to all the connectors.
+
+
 The `udp` scheme supports 4 properties:
 
 -   `local-address` - If you are running with multiple network
@@ -169,48 +167,23 @@ The `udp` scheme supports 4 properties:
     value for this parameter is 10000 milliseconds.
 
 Lastly, the `jgroups` scheme is supported which provides an alternative
-to the `udp` scheme for server discovery. The URL pattern is as follows
-`jgroups://<jgroups-xml-conf-filename>` where
-`<jgroups-xml-conf-filename>` refers to an XML file on the classpath
-that contains the JGroups configuration.
+to the `udp` scheme for server discovery. The URL pattern is either
+`jgroups://channelName?file=jgroups-xml-conf-filename`
+where`jgroups-xml-conf-filename` refers to an XML file on the classpath
+that contains the JGroups configuration or it can be
+`jgroups://channelName?properties=some-jgroups-properties`. In both instance the
+`channelName` is the name given to the jgroups channel created.
 
 The `refresh-timeout` and `discovery-initial-wait-timeout` properties
 are supported just like with `udp`.
 
-Although a `javax.naming.Context` instance created using the
-`org.apache.activemq.jndi.ActiveMQInitialContextFactory` will
-automatically have some connection factories present, it is possible for
-a client to specify its own connection factories. This is done using the
-`org.apache.activemq.jndi.ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES`
-property (String value of "connectionFactoryNames"). The value for this
-property is a comma delimited String of all the connection factories the
-client wishes to create. For example:
+The default type for the default connection factory is of type `javax.jms.ConnectionFactory`.
+This can be changed by setting the type like so
 
     java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-    java.naming.provider.url=tcp://localhost:5445
-    connectionFactoryNames=myConnectionFactory
-
-In this example, the client is creating a connection factory named
-"myConnectionFactory." This replaces all the default connection
-factories so that only the "myConnectionFactory" connection factory is
-available to the client.
-
-Aside from the underlying transport, the underlying connection factory
-implementation can also be configured using special properties. To
-configure a particular connection factory the client would follow this
-pattern for the property name to set in the environment:
-`connection.<connection-factory-name>.<property-name>`. For example, if
-the client wanted to customize the default connection factory
-"ConnectionFactory" to support high-availability then it would do this:
-
-    java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-    java.naming.provider.url=tcp://myhost:5445
-    connection.ConnectionFactory.ha=true
+    java.naming.provider.url=tcp://localhost:5445?type=CF
 
-Any property available on the underlying
-`org.apache.activemq.jms.client.ActiveMQConnectionFactory` can be set
-this way in addition to the `ha` (boolean) and `type` (String)
-properties. Here are the different options for the `type`:
+In this example it is still set to the default, below shows a list of types that can be set.
 
 #### Configuration for Connection Factory Types
 <table>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/aerogear/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/aerogear/src/main/resources/jndi.properties b/examples/jms/aerogear/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/aerogear/src/main/resources/jndi.properties
+++ b/examples/jms/aerogear/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/jms/example/ApplicationLayerFailoverExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/jms/example/ApplicationLayerFailoverExample.java b/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/jms/example/ApplicationLayerFailoverExample.java
index 0c6e023..98373ac 100644
--- a/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/jms/example/ApplicationLayerFailoverExample.java
+++ b/examples/jms/application-layer-failover/src/main/java/org/apache/activemq/jms/example/ApplicationLayerFailoverExample.java
@@ -154,7 +154,7 @@ public class ApplicationLayerFailoverExample extends ActiveMQExample
       // Step 1. Get an initial context for looking up JNDI from the server
       Hashtable<String, Object> properties = new Hashtable<String, Object>();
       properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      properties.put("java.naming.provider.url", "tcp://127.0.0.1:" + (5445 + server));
+      properties.put("connectionFactory.ConnectionFactory", "tcp://127.0.0.1:" + (5445 + server));
       properties.put("queue.queue/exampleQueue", "exampleQueue");
       initialContext = new InitialContext(properties);
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/bridge/src/main/java/org/apache/activemq/jms/example/BridgeExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/bridge/src/main/java/org/apache/activemq/jms/example/BridgeExample.java b/examples/jms/bridge/src/main/java/org/apache/activemq/jms/example/BridgeExample.java
index 4f235b3..502a3e8 100644
--- a/examples/jms/bridge/src/main/java/org/apache/activemq/jms/example/BridgeExample.java
+++ b/examples/jms/bridge/src/main/java/org/apache/activemq/jms/example/BridgeExample.java
@@ -59,7 +59,7 @@ public class BridgeExample extends ActiveMQExample
 
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", "tcp://127.0.0.1:5445");
+         properties.put("connectionFactory.ConnectionFactory", "tcp://127.0.0.1:5445");
          properties.put("queue.queue/sausage-factory", "sausage-factory");
          ic0 = new InitialContext(properties);
 
@@ -75,7 +75,7 @@ public class BridgeExample extends ActiveMQExample
 
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", "tcp://127.0.0.1:5446");
+         properties.put("connectionFactory.ConnectionFactory", "tcp://127.0.0.1:5446");
          properties.put("queue.queue/mincing-machine", "mincing-machine");
          ic1 = new InitialContext(properties);
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/browser/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/browser/src/main/resources/jndi.properties b/examples/jms/browser/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/browser/src/main/resources/jndi.properties
+++ b/examples/jms/browser/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/client-kickoff/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/client-kickoff/src/main/resources/jndi.properties b/examples/jms/client-kickoff/src/main/resources/jndi.properties
index 142c406..26a519c 100644
--- a/examples/jms/client-kickoff/src/main/resources/jndi.properties
+++ b/examples/jms/client-kickoff/src/main/resources/jndi.properties
@@ -16,4 +16,4 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/client-side-failoverlistener/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/client-side-failoverlistener/src/main/resources/jndi.properties b/examples/jms/client-side-failoverlistener/src/main/resources/jndi.properties
index 6feb57f..8f3fcff 100644
--- a/examples/jms/client-side-failoverlistener/src/main/resources/jndi.properties
+++ b/examples/jms/client-side-failoverlistener/src/main/resources/jndi.properties
@@ -16,9 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
 queue.queue/exampleQueue=exampleQueue
-connection.ConnectionFactory.ha=true
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/client-side-load-balancing/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/client-side-load-balancing/src/main/resources/jndi.properties b/examples/jms/client-side-load-balancing/src/main/resources/jndi.properties
index e1bd346..81cf898 100644
--- a/examples/jms/client-side-load-balancing/src/main/resources/jndi.properties
+++ b/examples/jms/client-side-load-balancing/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=udp://231.7.7.7:9876
+connectionFactory.ConnectionFactory=udp://231.7.7.7:9876
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/jms/example/ClusteredDurableSubscriptionExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/jms/example/ClusteredDurableSubscriptionExample.java b/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/jms/example/ClusteredDurableSubscriptionExample.java
index 4b39f6c..4e4afc0 100644
--- a/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/jms/example/ClusteredDurableSubscriptionExample.java
+++ b/examples/jms/clustered-durable-subscription/src/main/java/org/apache/activemq/jms/example/ClusteredDurableSubscriptionExample.java
@@ -60,7 +60,7 @@ public class ClusteredDurableSubscriptionExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI from server 0
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0]);
          properties.put("topic.topic/exampleTopic", "exampleTopic");
          ic0 = new InitialContext(properties);
 
@@ -74,7 +74,7 @@ public class ClusteredDurableSubscriptionExample extends ActiveMQExample
 
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
+         properties.put("connectionFactory.ConnectionFactory", args[1]);
          ic1 = new InitialContext(properties);
 
          // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/jms/example/ClusteredGroupingExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/jms/example/ClusteredGroupingExample.java b/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/jms/example/ClusteredGroupingExample.java
index e5ead04..869f5ed 100644
--- a/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/jms/example/ClusteredGroupingExample.java
+++ b/examples/jms/clustered-grouping/src/main/java/org/apache/activemq/jms/example/ClusteredGroupingExample.java
@@ -62,7 +62,7 @@ public class ClusteredGroupingExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI from server 0
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0]);
          properties.put("queue.queue/exampleQueue", "exampleQueue");
          ic0 = new InitialContext(properties);
 
@@ -75,7 +75,7 @@ public class ClusteredGroupingExample extends ActiveMQExample
          // Step 4. Get an initial context for looking up JNDI from server 1
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
+         properties.put("connectionFactory.ConnectionFactory", args[1]);
          ic1 = new InitialContext(properties);
 
          // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1
@@ -84,7 +84,7 @@ public class ClusteredGroupingExample extends ActiveMQExample
          // Step 4. Get an initial context for looking up JNDI from server 2
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[2]);
+         properties.put("connectionFactory.ConnectionFactory", args[2]);
          ic2 = new InitialContext(properties);
 
          // Step 5. Look-up a JMS Connection Factory object from JNDI on server 2

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/jms/example/ClusteredJgroupsExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/jms/example/ClusteredJgroupsExample.java b/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/jms/example/ClusteredJgroupsExample.java
index 87e38d7..bdf6699 100644
--- a/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/jms/example/ClusteredJgroupsExample.java
+++ b/examples/jms/clustered-jgroups/src/main/java/org/apache/activemq/jms/example/ClusteredJgroupsExample.java
@@ -58,7 +58,7 @@ public class ClusteredJgroupsExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI from server 0
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0]);
          properties.put("queue.queue/exampleQueue", "exampleQueue");
          ic0 = new InitialContext(properties);
 
@@ -71,7 +71,7 @@ public class ClusteredJgroupsExample extends ActiveMQExample
          // Step 4. Get an initial context for looking up JNDI from server 1
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
+         properties.put("connectionFactory.ConnectionFactory", args[1]);
          ic1 = new InitialContext(properties);
 
          // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/client-jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/client-jndi.properties b/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/client-jndi.properties
index 142c406..26a519c 100644
--- a/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/client-jndi.properties
+++ b/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/client-jndi.properties
@@ -16,4 +16,4 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/clustered-queue/src/main/java/org/apache/activemq/jms/example/ClusteredQueueExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/clustered-queue/src/main/java/org/apache/activemq/jms/example/ClusteredQueueExample.java b/examples/jms/clustered-queue/src/main/java/org/apache/activemq/jms/example/ClusteredQueueExample.java
index 2da1881..bdc8be3 100644
--- a/examples/jms/clustered-queue/src/main/java/org/apache/activemq/jms/example/ClusteredQueueExample.java
+++ b/examples/jms/clustered-queue/src/main/java/org/apache/activemq/jms/example/ClusteredQueueExample.java
@@ -58,7 +58,7 @@ public class ClusteredQueueExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI from server 0
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0]);
          properties.put("queue.queue/exampleQueue", "exampleQueue");
          ic0 = new InitialContext(properties);
 
@@ -71,7 +71,7 @@ public class ClusteredQueueExample extends ActiveMQExample
          // Step 4. Get an initial context for looking up JNDI from server 1
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
+         properties.put("connectionFactory.ConnectionFactory", args[1]);
          ic1 = new InitialContext(properties);
 
          // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/jms/example/ClusteredStandaloneExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/jms/example/ClusteredStandaloneExample.java b/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/jms/example/ClusteredStandaloneExample.java
index e516469..60dc7d3 100644
--- a/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/jms/example/ClusteredStandaloneExample.java
+++ b/examples/jms/clustered-standalone/src/main/java/org/apache/activemq/jms/example/ClusteredStandaloneExample.java
@@ -56,18 +56,18 @@ public class ClusteredStandaloneExample extends ActiveMQExample
       {
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0]);
          properties.put("topic.topic/exampleTopic", "exampleTopic");
          initialContext0 = new InitialContext(properties);
 
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
+         properties.put("connectionFactory.ConnectionFactory", args[1]);
          initialContext1 = new InitialContext(properties);
 
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[2]);
+         properties.put("connectionFactory.ConnectionFactory", args[2]);
          initialContext2 = new InitialContext(properties);
 
          // First we demonstrate a distributed topic.

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/jms/example/StaticClusteredQueueExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/jms/example/StaticClusteredQueueExample.java b/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/jms/example/StaticClusteredQueueExample.java
index f724c92..e587536 100644
--- a/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/jms/example/StaticClusteredQueueExample.java
+++ b/examples/jms/clustered-static-discovery/src/main/java/org/apache/activemq/jms/example/StaticClusteredQueueExample.java
@@ -62,7 +62,7 @@ public class StaticClusteredQueueExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI from server 3
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[3]);
+         properties.put("connectionFactory.ConnectionFactory", args[3]);
          properties.put("queue.queue/exampleQueue", "exampleQueue");
          ic0 = new InitialContext(properties);
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/jms/example/ClusterStaticOnewayExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/jms/example/ClusterStaticOnewayExample.java b/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/jms/example/ClusterStaticOnewayExample.java
index c88d2e4..0ddefeb 100644
--- a/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/jms/example/ClusterStaticOnewayExample.java
+++ b/examples/jms/clustered-static-oneway/src/main/java/org/apache/activemq/jms/example/ClusterStaticOnewayExample.java
@@ -60,7 +60,7 @@ public class ClusterStaticOnewayExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI from server 0
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0]);
          properties.put("queue.queue/exampleQueue", "exampleQueue");
          ic0 = new InitialContext(properties);
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/clustered-topic/src/main/java/org/apache/activemq/jms/example/ClusteredTopicExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/clustered-topic/src/main/java/org/apache/activemq/jms/example/ClusteredTopicExample.java b/examples/jms/clustered-topic/src/main/java/org/apache/activemq/jms/example/ClusteredTopicExample.java
index ca98789..61e3d65 100644
--- a/examples/jms/clustered-topic/src/main/java/org/apache/activemq/jms/example/ClusteredTopicExample.java
+++ b/examples/jms/clustered-topic/src/main/java/org/apache/activemq/jms/example/ClusteredTopicExample.java
@@ -58,7 +58,7 @@ public class ClusteredTopicExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI from server 0
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0]);
          properties.put("topic.topic/exampleTopic", "exampleTopic");
          ic0 = new InitialContext(properties);
 
@@ -71,7 +71,7 @@ public class ClusteredTopicExample extends ActiveMQExample
          // Step 4. Get an initial context for looking up JNDI from server 1
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
+         properties.put("connectionFactory.ConnectionFactory", args[1]);
          ic1 = new InitialContext(properties);
 
          // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverScaleDownExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverScaleDownExample.java b/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverScaleDownExample.java
index f5e5a29..bc23589 100644
--- a/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverScaleDownExample.java
+++ b/examples/jms/colocated-failover-scale-down/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverScaleDownExample.java
@@ -58,17 +58,13 @@ public class ColocatedFailoverScaleDownExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI for both servers
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
+         properties.put("connectionFactory.ConnectionFactory", args[1]);
          initialContext1 = new InitialContext(properties);
 
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1");
          properties.put("queue.queue/exampleQueue", "exampleQueue");
-         properties.put("connection.ConnectionFactory.ha", true);
-         properties.put("connection.ConnectionFactory.retryInterval", 1000);
-         properties.put("connection.ConnectionFactory.retryIntervalMultiplier", 1.0);
-         properties.put("connection.ConnectionFactory.reconnectAttempts", -1);
          initialContext = new InitialContext(properties);
 
          // Step 2. Look up the JMS resources from JNDI

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/colocated-failover/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/colocated-failover/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverExample.java b/examples/jms/colocated-failover/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverExample.java
index 1e912e0..4c6a9a9 100644
--- a/examples/jms/colocated-failover/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverExample.java
+++ b/examples/jms/colocated-failover/src/main/java/org/apache/activemq/jms/example/ColocatedFailoverExample.java
@@ -56,17 +56,13 @@ public class ColocatedFailoverExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI for both servers
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
+         properties.put("connectionFactory.ConnectionFactory", args[1]);
          initialContext1 = new InitialContext(properties);
 
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1");
          properties.put("queue.queue/exampleQueue", "exampleQueue");
-         properties.put("connection.ConnectionFactory.ha", true);
-         properties.put("connection.ConnectionFactory.retryInterval", 1000);
-         properties.put("connection.ConnectionFactory.retryIntervalMultiplier", 1.0);
-         properties.put("connection.ConnectionFactory.reconnectAttempts", -1);
          initialContext = new InitialContext(properties);
 
          // Step 2. Look up the JMS resources from JNDI

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/consumer-rate-limit/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/consumer-rate-limit/src/main/resources/jndi.properties b/examples/jms/consumer-rate-limit/src/main/resources/jndi.properties
index e0f10fc..9692146 100644
--- a/examples/jms/consumer-rate-limit/src/main/resources/jndi.properties
+++ b/examples/jms/consumer-rate-limit/src/main/resources/jndi.properties
@@ -16,6 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.consumerMaxRate=10
+connectionFactory.ConnectionFactory=tcp://localhost:5445?consumerMaxRate=10
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/dead-letter/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/dead-letter/src/main/resources/jndi.properties b/examples/jms/dead-letter/src/main/resources/jndi.properties
index cb6ac0e..d9700fd 100644
--- a/examples/jms/dead-letter/src/main/resources/jndi.properties
+++ b/examples/jms/dead-letter/src/main/resources/jndi.properties
@@ -16,6 +16,6 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue
 queue.queue/deadLetterQueue=deadLetterQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/delayed-redelivery/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/delayed-redelivery/src/main/resources/jndi.properties b/examples/jms/delayed-redelivery/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/delayed-redelivery/src/main/resources/jndi.properties
+++ b/examples/jms/delayed-redelivery/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/divert/src/main/java/org/apache/activemq/jms/example/DivertExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/divert/src/main/java/org/apache/activemq/jms/example/DivertExample.java b/examples/jms/divert/src/main/java/org/apache/activemq/jms/example/DivertExample.java
index 57e4327..4f197ce 100644
--- a/examples/jms/divert/src/main/java/org/apache/activemq/jms/example/DivertExample.java
+++ b/examples/jms/divert/src/main/java/org/apache/activemq/jms/example/DivertExample.java
@@ -61,7 +61,7 @@ public class DivertExample extends ActiveMQExample
          // Step 1. Create an initial context to perform the JNDI lookup on the London server
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0]);
          properties.put("queue.queue/orders", "orders");
          properties.put("topic.topic/priceUpdates", "priceUpdates");
          properties.put("topic.topic/spyTopic", "spyTopic");
@@ -80,7 +80,7 @@ public class DivertExample extends ActiveMQExample
          // Step 6. Create an initial context to perform the JNDI lookup on the New York server
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
+         properties.put("connectionFactory.ConnectionFactory", args[1]);
          properties.put("topic.topic/newYorkPriceUpdates", "newYorkPriceUpdates");
          initialContextNewYork = new InitialContext(properties);
 


[8/8] activemq-6 git commit: This closes #93 on URI work and connection factory serialization

Posted by cl...@apache.org.
This closes #93 on URI work and connection factory serialization


Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/87966029
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/87966029
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/87966029

Branch: refs/heads/master
Commit: 87966029c759bdb58e85f3d68e332495b1705f73
Parents: b8db8b0 3b76ccc
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Feb 12 15:01:12 2015 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Feb 12 15:01:12 2015 -0500

----------------------------------------------------------------------
 activemq-commons/pom.xml                        |   4 +
 .../activemq/utils/uri/SchemaConstants.java     |  31 ++
 .../apache/activemq/utils/uri/URIFactory.java   | 151 +++++++
 .../apache/activemq/utils/uri/URISchema.java    | 272 ++++++++++++
 .../apache/activemq/utils/URIParserTest.java    | 249 +++++++++++
 .../api/core/BroadcastEndpointFactory.java      |   2 +-
 .../BroadcastEndpointFactoryConfiguration.java  |  28 --
 .../api/core/BroadcastGroupConfiguration.java   |  18 +-
 .../core/ChannelBroadcastEndpointFactory.java   |  41 ++
 .../api/core/DiscoveryGroupConfiguration.java   |  67 +--
 ...ryGroupConfigurationCompatibilityHelper.java |  45 --
 .../api/core/JGroupsBroadcastEndpoint.java      | 281 +++++++++++++
 .../JGroupsBroadcastGroupConfiguration.java     | 404 ------------------
 .../core/JGroupsChannelBroadcastEndpoint.java   |  39 ++
 .../api/core/JGroupsFileBroadcastEndpoint.java  |  49 +++
 .../JGroupsFileBroadcastEndpointFactory.java    |  55 +++
 .../JGroupsPropertiesBroadcastEndpoint.java     |  43 ++
 ...roupsPropertiesBroadcastEndpointFactory.java |  55 +++
 .../api/core/UDPBroadcastEndpointFactory.java   | 330 +++++++++++++++
 .../core/UDPBroadcastGroupConfiguration.java    | 339 ---------------
 .../api/core/client/ActiveMQClient.java         |  14 +
 .../api/core/client/TopologyMember.java         |   4 +-
 .../core/client/ActiveMQClientLogger.java       |   4 +
 .../client/impl/ClientSessionFactoryImpl.java   |  14 -
 .../core/client/impl/ServerLocatorImpl.java     |   9 +-
 .../remoting/impl/netty/NettyConnector.java     |  58 +--
 .../impl/netty/NettyConnectorFactory.java       |   6 -
 .../remoting/impl/netty/TransportConstants.java |  67 +--
 .../remoting/ClientProtocolManagerFactory.java  |   4 +-
 .../spi/core/remoting/ConnectorFactory.java     |  10 -
 .../uri/AbstractServerLocatorSchema.java        |  34 ++
 .../apache/activemq/uri/ConnectionOptions.java  |  75 ++++
 .../activemq/uri/InVMServerLocatorSchema.java   |  73 ++++
 .../uri/JGroupsServerLocatorSchema.java         | 102 +++++
 .../activemq/uri/ServerLocatorParser.java       |  33 ++
 .../activemq/uri/TCPServerLocatorSchema.java    | 160 +++++++
 .../activemq/uri/UDPServerLocatorSchema.java    |  89 ++++
 activemq-jms-client/pom.xml                     |  14 +
 .../activemq/api/jms/ActiveMQJMSClient.java     |  13 +
 .../jms/client/ActiveMQConnectionFactory.java   |  70 +++-
 .../client/ActiveMQJMSConnectionFactory.java    |   1 -
 .../jndi/ActiveMQInitialContextFactory.java     | 363 ++--------------
 .../apache/activemq/uri/AbstractCFSchema.java   |  45 ++
 .../activemq/uri/ConnectionFactoryParser.java   |  36 ++
 .../org/apache/activemq/uri/InVMSchema.java     |  51 +++
 .../org/apache/activemq/uri/JGroupsSchema.java  |  86 ++++
 .../activemq/uri/JMSConnectionOptions.java      |  79 ++++
 .../java/org/apache/activemq/uri/TCPSchema.java |  67 +++
 .../java/org/apache/activemq/uri/UDPSchema.java |  70 ++++
 .../activemq/uri/ConnectionFactoryURITest.java  | 414 +++++++++++++++++++
 .../activemq/ra/ActiveMQResourceAdapter.java    |  33 +-
 .../activemq/core/config/Configuration.java     |   3 +-
 .../core/config/impl/ConfigurationImpl.java     |   3 +-
 .../deployers/impl/FileConfigurationParser.java |  26 +-
 .../impl/BroadcastGroupControlImpl.java         |  14 +-
 .../remoting/impl/invm/InVMAcceptorFactory.java |   7 -
 .../impl/invm/InVMConnectorFactory.java         |   6 -
 .../remoting/impl/invm/TransportConstants.java  |  30 +-
 .../impl/netty/NettyAcceptorFactory.java        |   6 -
 .../server/impl/RemotingServiceImpl.java        |  15 -
 .../core/server/cluster/ClusterManager.java     |   2 +-
 .../spi/core/remoting/AcceptorFactory.java      |   9 -
 .../core/config/impl/FileConfigurationTest.java |  16 +-
 docs/user-manual/en/using-jms.md                | 105 ++---
 .../aerogear/src/main/resources/jndi.properties |   2 +-
 .../ApplicationLayerFailoverExample.java        |   2 +-
 .../activemq/jms/example/BridgeExample.java     |   4 +-
 .../browser/src/main/resources/jndi.properties  |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../ClusteredDurableSubscriptionExample.java    |   4 +-
 .../jms/example/ClusteredGroupingExample.java   |   6 +-
 .../jms/example/ClusteredJgroupsExample.java    |   4 +-
 .../activemq/server0/client-jndi.properties     |   2 +-
 .../jms/example/ClusteredQueueExample.java      |   4 +-
 .../jms/example/ClusteredStandaloneExample.java |   6 +-
 .../example/StaticClusteredQueueExample.java    |   2 +-
 .../jms/example/ClusterStaticOnewayExample.java |   2 +-
 .../jms/example/ClusteredTopicExample.java      |   4 +-
 .../ColocatedFailoverScaleDownExample.java      |   8 +-
 .../jms/example/ColocatedFailoverExample.java   |   8 +-
 .../src/main/resources/jndi.properties          |   3 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../activemq/jms/example/DivertExample.java     |   4 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../expiry/src/main/resources/jndi.properties   |   2 +-
 .../jms/example/HAPolicyAutoBackupExample.java  |  12 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../activemq/jms/example/JMSBridgeExample.java  |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../jms/jmx/src/main/resources/jndi.properties  |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   3 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   3 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../paging/src/main/resources/jndi.properties   |   2 +-
 .../jms/perf/src/main/resources/jndi.properties |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   3 +-
 .../QueueMessageRedistributionExample.java      |   4 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../queue/src/main/resources/jndi.properties    |   2 +-
 .../activemq/jms/example/ReattachExample.java   |   2 +-
 .../src/main/resources/jndi.properties          |   7 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../activemq/jms/example/ScaleDownExample.java  |  12 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../security/src/main/resources/jndi.properties |   2 +-
 .../src/main/resources/jndi.properties          |   3 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../stomp/src/main/resources/jndi.properties    |   2 +-
 .../stomp1.1/src/main/resources/jndi.properties |   2 +-
 .../stomp1.2/src/main/resources/jndi.properties |   2 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../jms/example/SymmetricClusterExample.java    |   7 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../topic/src/main/resources/jndi.properties    |   2 +-
 .../src/main/resources/jndi.properties          |   6 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../src/main/resources/jndi.properties          |   2 +-
 .../xa-send/src/main/resources/jndi.properties  |   2 +-
 .../activemq/jms/soak/example/SoakReceiver.java |   2 +-
 .../activemq/jms/soak/example/SoakSender.java   |   2 +-
 pom.xml                                         |   7 +
 .../client/ServerLocatorSerializationTest.java  | 131 ------
 .../integration/client/SessionFactoryTest.java  |  48 +--
 .../BridgeWithDiscoveryGroupStartTest.java      |   8 +-
 .../cluster/distribution/ClusterTestBase.java   |  14 +-
 .../HAClientTopologyWithDiscoveryTest.java      |   8 +-
 .../discovery/DiscoveryBaseTest.java            |  12 +-
 .../discovery/DiscoveryStayAliveTest.java       |  10 +-
 .../integration/discovery/DiscoveryTest.java    |  67 ++-
 .../jms/ActiveMQConnectionFactoryTest.java      |  16 +-
 .../integration/jms/SimpleJNDIClientTest.java   | 383 ++++-------------
 .../ConnectionFactorySerializationTest.java     | 325 +++++++++++++--
 ...tionFactoryWithJGroupsSerializationTest.java |  19 +-
 .../jms/server/JMSServerDeployerTest.java       |  10 +-
 .../management/ActiveMQServerControlTest.java   |   3 +-
 .../management/BroadcastGroupControlTest.java   |  12 +-
 .../ClusterConnectionControl2Test.java          |  14 +-
 .../ClusterConnectionControlTest.java           |   8 +-
 .../ra/ActiveMQRAClusteredTestBase.java         |   5 +-
 .../integration/ra/ResourceAdapterTest.java     |   8 +-
 .../src/test/resources/jndi.properties          |   3 +-
 .../jtests/jms/framework/PTPTestCase.java       |   3 +-
 .../jtests/jms/framework/PubSubTestCase.java    |   3 +-
 .../jtests/jms/framework/UnifiedTestCase.java   |   5 +-
 .../tests/unit/ra/ResourceAdapterTest.java      |   4 +-
 174 files changed, 3924 insertions(+), 2328 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/87966029/activemq-core-client/src/main/java/org/apache/activemq/core/remoting/impl/netty/NettyConnector.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/87966029/pom.xml
----------------------------------------------------------------------


[4/8] activemq-6 git commit: ACTIVEMQ6-7 - Improve Serialization on Connection Factory

Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/durable-subscription/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/durable-subscription/src/main/resources/jndi.properties b/examples/jms/durable-subscription/src/main/resources/jndi.properties
index 65fc26e..9c96675 100644
--- a/examples/jms/durable-subscription/src/main/resources/jndi.properties
+++ b/examples/jms/durable-subscription/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 topic.topic/exampleTopic=exampleTopic

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/expiry/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/expiry/src/main/resources/jndi.properties b/examples/jms/expiry/src/main/resources/jndi.properties
index 1ea8e7c..82edb2e 100644
--- a/examples/jms/expiry/src/main/resources/jndi.properties
+++ b/examples/jms/expiry/src/main/resources/jndi.properties
@@ -16,6 +16,6 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue
 queue.queue/expiryQueue=expiryQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/jms/example/HAPolicyAutoBackupExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/jms/example/HAPolicyAutoBackupExample.java b/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/jms/example/HAPolicyAutoBackupExample.java
index 4fbcdcb..86b6f98 100644
--- a/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/jms/example/HAPolicyAutoBackupExample.java
+++ b/examples/jms/ha-policy-autobackup/src/main/java/org/apache/activemq/jms/example/HAPolicyAutoBackupExample.java
@@ -67,21 +67,13 @@ public class HAPolicyAutoBackupExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI from server 0 and 1
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1");
          properties.put("queue.queue/exampleQueue", "exampleQueue");
-         properties.put("connection.ConnectionFactory.ha", true);
-         properties.put("connection.ConnectionFactory.retryInterval", 1000);
-         properties.put("connection.ConnectionFactory.retryIntervalMultiplier", 1.0);
-         properties.put("connection.ConnectionFactory.reconnectAttempts", -1);
          ic0 = new InitialContext(properties);
 
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
-         properties.put("connection.ConnectionFactory.ha", true);
-         properties.put("connection.ConnectionFactory.retryInterval", 1000);
-         properties.put("connection.ConnectionFactory.retryIntervalMultiplier", 1.0);
-         properties.put("connection.ConnectionFactory.reconnectAttempts", -1);
+         properties.put("connectionFactory.ConnectionFactory", args[1] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1");
          ic1 = new InitialContext(properties);
 
          // Step 2. Look-up the JMS Queue object from JNDI

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/http-transport/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/http-transport/src/main/resources/jndi.properties b/examples/jms/http-transport/src/main/resources/jndi.properties
index c3cfd6c..7bc4a11 100644
--- a/examples/jms/http-transport/src/main/resources/jndi.properties
+++ b/examples/jms/http-transport/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:8080?http-enabled=true
+connectionFactory.ConnectionFactory=tcp://localhost:8080?http-enabled=true
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/interceptor/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/interceptor/src/main/resources/jndi.properties b/examples/jms/interceptor/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/interceptor/src/main/resources/jndi.properties
+++ b/examples/jms/interceptor/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/jms-auto-closeable/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/jms-auto-closeable/src/main/resources/jndi.properties b/examples/jms/jms-auto-closeable/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/jms-auto-closeable/src/main/resources/jndi.properties
+++ b/examples/jms/jms-auto-closeable/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/jms-bridge/src/main/java/org/apache/activemq/jms/example/JMSBridgeExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/jms-bridge/src/main/java/org/apache/activemq/jms/example/JMSBridgeExample.java b/examples/jms/jms-bridge/src/main/java/org/apache/activemq/jms/example/JMSBridgeExample.java
index 0eaa635..83b4228 100644
--- a/examples/jms/jms-bridge/src/main/java/org/apache/activemq/jms/example/JMSBridgeExample.java
+++ b/examples/jms/jms-bridge/src/main/java/org/apache/activemq/jms/example/JMSBridgeExample.java
@@ -165,7 +165,7 @@ public class JMSBridgeExample
    private static Hashtable<String, String> createJndiParams(String server)
    {
       Hashtable<String, String> jndiProps = new Hashtable<String, String>();
-      jndiProps.put("java.naming.provider.url", server);
+      jndiProps.put("connectionFactory.ConnectionFactory", server);
       jndiProps.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
       jndiProps.put("queue.target/queue", "target");
       jndiProps.put("topic.source/topic", "topic");

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/jms-completion-listener/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/jms-completion-listener/src/main/resources/jndi.properties b/examples/jms/jms-completion-listener/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/jms-completion-listener/src/main/resources/jndi.properties
+++ b/examples/jms/jms-completion-listener/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/jms-context/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/jms-context/src/main/resources/jndi.properties b/examples/jms/jms-context/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/jms-context/src/main/resources/jndi.properties
+++ b/examples/jms/jms-context/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/jms-shared-consumer/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/jms-shared-consumer/src/main/resources/jndi.properties b/examples/jms/jms-shared-consumer/src/main/resources/jndi.properties
index 65fc26e..9c96675 100644
--- a/examples/jms/jms-shared-consumer/src/main/resources/jndi.properties
+++ b/examples/jms/jms-shared-consumer/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 topic.topic/exampleTopic=exampleTopic

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/jmx/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/jmx/src/main/resources/jndi.properties b/examples/jms/jmx/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/jmx/src/main/resources/jndi.properties
+++ b/examples/jms/jmx/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/large-message/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/large-message/src/main/resources/jndi.properties b/examples/jms/large-message/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/large-message/src/main/resources/jndi.properties
+++ b/examples/jms/large-message/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/last-value-queue/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/last-value-queue/src/main/resources/jndi.properties b/examples/jms/last-value-queue/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/last-value-queue/src/main/resources/jndi.properties
+++ b/examples/jms/last-value-queue/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/management-notifications/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/management-notifications/src/main/resources/jndi.properties b/examples/jms/management-notifications/src/main/resources/jndi.properties
index 62c20c6..a9953c3 100644
--- a/examples/jms/management-notifications/src/main/resources/jndi.properties
+++ b/examples/jms/management-notifications/src/main/resources/jndi.properties
@@ -16,6 +16,6 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue
 topic.topic/notificationsTopic=notificationsTopic

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/management/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/management/src/main/resources/jndi.properties b/examples/jms/management/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/management/src/main/resources/jndi.properties
+++ b/examples/jms/management/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/message-counters/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/message-counters/src/main/resources/jndi.properties b/examples/jms/message-counters/src/main/resources/jndi.properties
index 1ea8e7c..82edb2e 100644
--- a/examples/jms/message-counters/src/main/resources/jndi.properties
+++ b/examples/jms/message-counters/src/main/resources/jndi.properties
@@ -16,6 +16,6 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue
 queue.queue/expiryQueue=expiryQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/message-group/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/message-group/src/main/resources/jndi.properties b/examples/jms/message-group/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/message-group/src/main/resources/jndi.properties
+++ b/examples/jms/message-group/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/message-group2/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/message-group2/src/main/resources/jndi.properties b/examples/jms/message-group2/src/main/resources/jndi.properties
index e77a1a2..58fe8fb 100644
--- a/examples/jms/message-group2/src/main/resources/jndi.properties
+++ b/examples/jms/message-group2/src/main/resources/jndi.properties
@@ -16,6 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.groupID=Group-0
+connectionFactory.ConnectionFactory=tcp://localhost:5445?groupID=Group-0
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/message-priority/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/message-priority/src/main/resources/jndi.properties b/examples/jms/message-priority/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/message-priority/src/main/resources/jndi.properties
+++ b/examples/jms/message-priority/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/multiple-failover-failback/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/multiple-failover-failback/src/main/resources/jndi.properties b/examples/jms/multiple-failover-failback/src/main/resources/jndi.properties
index 99e6a96..8f3fcff 100644
--- a/examples/jms/multiple-failover-failback/src/main/resources/jndi.properties
+++ b/examples/jms/multiple-failover-failback/src/main/resources/jndi.properties
@@ -16,9 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.ha=true
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1
+connectionFactory.ConnectionFactory=tcp://localhost:5445?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/multiple-failover/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/multiple-failover/src/main/resources/jndi.properties b/examples/jms/multiple-failover/src/main/resources/jndi.properties
index 99e6a96..8f3fcff 100644
--- a/examples/jms/multiple-failover/src/main/resources/jndi.properties
+++ b/examples/jms/multiple-failover/src/main/resources/jndi.properties
@@ -16,9 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.ha=true
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1
+connectionFactory.ConnectionFactory=tcp://localhost:5445?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/no-consumer-buffering/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/no-consumer-buffering/src/main/resources/jndi.properties b/examples/jms/no-consumer-buffering/src/main/resources/jndi.properties
index 6c55f67..40afd87 100644
--- a/examples/jms/no-consumer-buffering/src/main/resources/jndi.properties
+++ b/examples/jms/no-consumer-buffering/src/main/resources/jndi.properties
@@ -16,6 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.consumerWindowSize=0
+connectionFactory.ConnectionFactory=tcp://localhost:5445?consumerWindowSize=0
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/non-transaction-failover/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/non-transaction-failover/src/main/resources/jndi.properties b/examples/jms/non-transaction-failover/src/main/resources/jndi.properties
index 99e6a96..8f3fcff 100644
--- a/examples/jms/non-transaction-failover/src/main/resources/jndi.properties
+++ b/examples/jms/non-transaction-failover/src/main/resources/jndi.properties
@@ -16,9 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.ha=true
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1
+connectionFactory.ConnectionFactory=tcp://localhost:5445?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/paging/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/paging/src/main/resources/jndi.properties b/examples/jms/paging/src/main/resources/jndi.properties
index 04d55cb..a85328e 100644
--- a/examples/jms/paging/src/main/resources/jndi.properties
+++ b/examples/jms/paging/src/main/resources/jndi.properties
@@ -16,6 +16,6 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue
 queue.queue/pagingQueue=pagingQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/perf/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/perf/src/main/resources/jndi.properties b/examples/jms/perf/src/main/resources/jndi.properties
index 9121768..4a50fa8 100644
--- a/examples/jms/perf/src/main/resources/jndi.properties
+++ b/examples/jms/perf/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445?tcp-no-delay=false&tcp-send-buffer-size=1048576&tcp-receive-buffer-size=1048576
+connectionFactory.ConnectionFactory=tcp://localhost:5445?tcp-no-delay=false&tcp-send-buffer-size=1048576&tcp-receive-buffer-size=1048576
 queue.perfQueue=perfQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/pre-acknowledge/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/pre-acknowledge/src/main/resources/jndi.properties b/examples/jms/pre-acknowledge/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/pre-acknowledge/src/main/resources/jndi.properties
+++ b/examples/jms/pre-acknowledge/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/producer-rate-limit/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/producer-rate-limit/src/main/resources/jndi.properties b/examples/jms/producer-rate-limit/src/main/resources/jndi.properties
index fe67b3b..3ab55a5 100644
--- a/examples/jms/producer-rate-limit/src/main/resources/jndi.properties
+++ b/examples/jms/producer-rate-limit/src/main/resources/jndi.properties
@@ -16,6 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.producerMaxRate=50
+connectionFactory.ConnectionFactory=tcp://localhost:5445?producerMaxRate=50
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/jms/example/QueueMessageRedistributionExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/jms/example/QueueMessageRedistributionExample.java b/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/jms/example/QueueMessageRedistributionExample.java
index b2c473c..a64e0f6 100644
--- a/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/jms/example/QueueMessageRedistributionExample.java
+++ b/examples/jms/queue-message-redistribution/src/main/java/org/apache/activemq/jms/example/QueueMessageRedistributionExample.java
@@ -60,7 +60,7 @@ public class QueueMessageRedistributionExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI from server 0
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
+         properties.put("connectionFactory.ConnectionFactory", args[0]);
          properties.put("queue.queue/exampleQueue", "exampleQueue");
          ic0 = new InitialContext(properties);
 
@@ -73,7 +73,7 @@ public class QueueMessageRedistributionExample extends ActiveMQExample
          // Step 4. Get an initial context for looking up JNDI from server 1
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
+         properties.put("connectionFactory.ConnectionFactory", args[1]);
          ic1 = new InitialContext(properties);
 
          // Step 5. Look-up a JMS Connection Factory object from JNDI on server 1

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/queue-requestor/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/queue-requestor/src/main/resources/jndi.properties b/examples/jms/queue-requestor/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/queue-requestor/src/main/resources/jndi.properties
+++ b/examples/jms/queue-requestor/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/queue-selector/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/queue-selector/src/main/resources/jndi.properties b/examples/jms/queue-selector/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/queue-selector/src/main/resources/jndi.properties
+++ b/examples/jms/queue-selector/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/queue/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/queue/src/main/resources/jndi.properties b/examples/jms/queue/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/queue/src/main/resources/jndi.properties
+++ b/examples/jms/queue/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/reattach-node/src/main/java/org/apache/activemq/jms/example/ReattachExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/reattach-node/src/main/java/org/apache/activemq/jms/example/ReattachExample.java b/examples/jms/reattach-node/src/main/java/org/apache/activemq/jms/example/ReattachExample.java
index 9a9d58f..eeb5856 100644
--- a/examples/jms/reattach-node/src/main/java/org/apache/activemq/jms/example/ReattachExample.java
+++ b/examples/jms/reattach-node/src/main/java/org/apache/activemq/jms/example/ReattachExample.java
@@ -140,7 +140,7 @@ public class ReattachExample extends ActiveMQExample
    {
       Hashtable<String, Object> properties = new Hashtable<String, Object>();
       properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      properties.put("java.naming.provider.url", "tcp://localhost:5446");
+      properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:5446");
       InitialContext initialContext = new InitialContext(properties);
       ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory");
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/reattach-node/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/reattach-node/src/main/resources/jndi.properties b/examples/jms/reattach-node/src/main/resources/jndi.properties
index bc3c80f..639551e 100644
--- a/examples/jms/reattach-node/src/main/resources/jndi.properties
+++ b/examples/jms/reattach-node/src/main/resources/jndi.properties
@@ -16,10 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1
-connection.ConnectionFactory.failoverOnServerShutdown=true
-connection.ConnectionFactory.confirmationWindowSize=1048576
+connectionFactory.ConnectionFactory=tcp://localhost:5445?retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1&failoverOnServerShutdown=true&confirmationWindowSize=1048576
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/replicated-failback-static/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/replicated-failback-static/src/main/resources/jndi.properties b/examples/jms/replicated-failback-static/src/main/resources/jndi.properties
index 99e6a96..8f3fcff 100644
--- a/examples/jms/replicated-failback-static/src/main/resources/jndi.properties
+++ b/examples/jms/replicated-failback-static/src/main/resources/jndi.properties
@@ -16,9 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.ha=true
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1
+connectionFactory.ConnectionFactory=tcp://localhost:5445?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/replicated-failback/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/replicated-failback/src/main/resources/jndi.properties b/examples/jms/replicated-failback/src/main/resources/jndi.properties
index 99e6a96..8f3fcff 100644
--- a/examples/jms/replicated-failback/src/main/resources/jndi.properties
+++ b/examples/jms/replicated-failback/src/main/resources/jndi.properties
@@ -16,9 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.ha=true
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1
+connectionFactory.ConnectionFactory=tcp://localhost:5445?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/replicated-multiple-failover/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/replicated-multiple-failover/src/main/resources/jndi.properties b/examples/jms/replicated-multiple-failover/src/main/resources/jndi.properties
index 99e6a96..8f3fcff 100644
--- a/examples/jms/replicated-multiple-failover/src/main/resources/jndi.properties
+++ b/examples/jms/replicated-multiple-failover/src/main/resources/jndi.properties
@@ -16,9 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.ha=true
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1
+connectionFactory.ConnectionFactory=tcp://localhost:5445?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/replicated-transaction-failover/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/replicated-transaction-failover/src/main/resources/jndi.properties b/examples/jms/replicated-transaction-failover/src/main/resources/jndi.properties
index 99e6a96..8f3fcff 100644
--- a/examples/jms/replicated-transaction-failover/src/main/resources/jndi.properties
+++ b/examples/jms/replicated-transaction-failover/src/main/resources/jndi.properties
@@ -16,9 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.ha=true
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1
+connectionFactory.ConnectionFactory=tcp://localhost:5445?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/request-reply/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/request-reply/src/main/resources/jndi.properties b/examples/jms/request-reply/src/main/resources/jndi.properties
index 99e6a96..8f3fcff 100644
--- a/examples/jms/request-reply/src/main/resources/jndi.properties
+++ b/examples/jms/request-reply/src/main/resources/jndi.properties
@@ -16,9 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.ha=true
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1
+connectionFactory.ConnectionFactory=tcp://localhost:5445?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/scale-down/src/main/java/org/apache/activemq/jms/example/ScaleDownExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/scale-down/src/main/java/org/apache/activemq/jms/example/ScaleDownExample.java b/examples/jms/scale-down/src/main/java/org/apache/activemq/jms/example/ScaleDownExample.java
index 3d29180..0bcc4bc 100644
--- a/examples/jms/scale-down/src/main/java/org/apache/activemq/jms/example/ScaleDownExample.java
+++ b/examples/jms/scale-down/src/main/java/org/apache/activemq/jms/example/ScaleDownExample.java
@@ -56,21 +56,13 @@ public class ScaleDownExample extends ActiveMQExample
          // Step 1. Get an initial context for looking up JNDI for both servers
          Hashtable<String, Object> properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[0]);
-         properties.put("connection.ConnectionFactory.ha", true);
-         properties.put("connection.ConnectionFactory.retryInterval", 1000);
-         properties.put("connection.ConnectionFactory.retryIntervalMultiplier", 1.0);
-         properties.put("connection.ConnectionFactory.reconnectAttempts", -1);
+         properties.put("connectionFactory.ConnectionFactory", args[0] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1");
          properties.put("queue.queue/exampleQueue", "exampleQueue");
          initialContext = new InitialContext(properties);
 
          properties = new Hashtable<String, Object>();
          properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-         properties.put("java.naming.provider.url", args[1]);
-         properties.put("connection.ConnectionFactory.ha", true);
-         properties.put("connection.ConnectionFactory.retryInterval", 1000);
-         properties.put("connection.ConnectionFactory.retryIntervalMultiplier", 1.0);
-         properties.put("connection.ConnectionFactory.reconnectAttempts", -1);
+         properties.put("connectionFactory.ConnectionFactory", args[1] + "?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1");
          initialContext1 = new InitialContext(properties);
 
          // Step 2. Look up the JMS resources from JNDI

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/scheduled-message/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/scheduled-message/src/main/resources/jndi.properties b/examples/jms/scheduled-message/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/scheduled-message/src/main/resources/jndi.properties
+++ b/examples/jms/scheduled-message/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/security/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/security/src/main/resources/jndi.properties b/examples/jms/security/src/main/resources/jndi.properties
index 792ace4..f7af861 100644
--- a/examples/jms/security/src/main/resources/jndi.properties
+++ b/examples/jms/security/src/main/resources/jndi.properties
@@ -16,7 +16,7 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 topic.topic/genericTopic=genericTopic
 topic.topic/europeTopic=news.europe.europeTopic
 topic.topic/usTopic=news.us.usTopic

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/send-acknowledgements/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/send-acknowledgements/src/main/resources/jndi.properties b/examples/jms/send-acknowledgements/src/main/resources/jndi.properties
index a6bcbce..ed1d694 100644
--- a/examples/jms/send-acknowledgements/src/main/resources/jndi.properties
+++ b/examples/jms/send-acknowledgements/src/main/resources/jndi.properties
@@ -16,6 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.confirmationWindowSize=1048576
+connectionFactory.ConnectionFactory=tcp://localhost:5445?confirmationWindowSize=1048576
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/ssl-enabled/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/ssl-enabled/src/main/resources/jndi.properties b/examples/jms/ssl-enabled/src/main/resources/jndi.properties
index 4bcf3c7..2bbd868 100644
--- a/examples/jms/ssl-enabled/src/main/resources/jndi.properties
+++ b/examples/jms/ssl-enabled/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5500?ssl-enabled=true&trust-store-path=activemq/server0/activemq.example.truststore&trust-store-password=activemqexample
+connectionFactory.ConnectionFactory=tcp://localhost:5500?ssl-enabled=true&trust-store-path=activemq/server0/activemq.example.truststore&trust-store-password=activemqexample
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/static-selector-jms/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/static-selector-jms/src/main/resources/jndi.properties b/examples/jms/static-selector-jms/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/static-selector-jms/src/main/resources/jndi.properties
+++ b/examples/jms/static-selector-jms/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/static-selector/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/static-selector/src/main/resources/jndi.properties b/examples/jms/static-selector/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/static-selector/src/main/resources/jndi.properties
+++ b/examples/jms/static-selector/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/stomp-websockets/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stomp-websockets/src/main/resources/jndi.properties b/examples/jms/stomp-websockets/src/main/resources/jndi.properties
index 03499b1..b509e71 100644
--- a/examples/jms/stomp-websockets/src/main/resources/jndi.properties
+++ b/examples/jms/stomp-websockets/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 topic.topic/chat=chat

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/stomp/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stomp/src/main/resources/jndi.properties b/examples/jms/stomp/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/stomp/src/main/resources/jndi.properties
+++ b/examples/jms/stomp/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/stomp1.1/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.1/src/main/resources/jndi.properties b/examples/jms/stomp1.1/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/stomp1.1/src/main/resources/jndi.properties
+++ b/examples/jms/stomp1.1/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/stomp1.2/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.2/src/main/resources/jndi.properties b/examples/jms/stomp1.2/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/stomp1.2/src/main/resources/jndi.properties
+++ b/examples/jms/stomp1.2/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/stop-server-failover/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stop-server-failover/src/main/resources/jndi.properties b/examples/jms/stop-server-failover/src/main/resources/jndi.properties
index 99e6a96..8f3fcff 100644
--- a/examples/jms/stop-server-failover/src/main/resources/jndi.properties
+++ b/examples/jms/stop-server-failover/src/main/resources/jndi.properties
@@ -16,9 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.ha=true
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1
+connectionFactory.ConnectionFactory=tcp://localhost:5445?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/jms/example/SymmetricClusterExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/jms/example/SymmetricClusterExample.java b/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/jms/example/SymmetricClusterExample.java
index 235226a..c7925e4 100644
--- a/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/jms/example/SymmetricClusterExample.java
+++ b/examples/jms/symmetric-cluster/src/main/java/org/apache/activemq/jms/example/SymmetricClusterExample.java
@@ -26,8 +26,7 @@ import javax.jms.TextMessage;
 import javax.jms.Topic;
 
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
-import org.apache.activemq.api.core.client.ActiveMQClient;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.jms.ActiveMQJMSClient;
 import org.apache.activemq.api.jms.JMSFactoryType;
 import org.apache.activemq.common.example.ActiveMQExample;
@@ -82,10 +81,10 @@ public class SymmetricClusterExample extends ActiveMQExample
          // connection factory directly we avoid having to worry about a JNDI look-up.
          // In an app server environment you could use HA-JNDI to lookup from the clustered JNDI servers without
          // having to know about a specific one.
-         UDPBroadcastGroupConfiguration udpCfg = new UDPBroadcastGroupConfiguration();
+         UDPBroadcastEndpointFactory udpCfg = new UDPBroadcastEndpointFactory();
          udpCfg.setGroupAddress("231.7.7.7").setGroupPort(9876);
          DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration();
-         groupConfiguration.setBroadcastEndpointFactoryConfiguration(udpCfg);
+         groupConfiguration.setBroadcastEndpointFactory(udpCfg);
 
          ConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithHA(groupConfiguration, JMSFactoryType.CF);
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/temp-queue/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/temp-queue/src/main/resources/jndi.properties b/examples/jms/temp-queue/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/temp-queue/src/main/resources/jndi.properties
+++ b/examples/jms/temp-queue/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/topic-hierarchies/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/topic-hierarchies/src/main/resources/jndi.properties b/examples/jms/topic-hierarchies/src/main/resources/jndi.properties
index 142c406..26a519c 100644
--- a/examples/jms/topic-hierarchies/src/main/resources/jndi.properties
+++ b/examples/jms/topic-hierarchies/src/main/resources/jndi.properties
@@ -16,4 +16,4 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/topic-selector-example1/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/topic-selector-example1/src/main/resources/jndi.properties b/examples/jms/topic-selector-example1/src/main/resources/jndi.properties
index 65fc26e..9c96675 100644
--- a/examples/jms/topic-selector-example1/src/main/resources/jndi.properties
+++ b/examples/jms/topic-selector-example1/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 topic.topic/exampleTopic=exampleTopic

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/topic-selector-example2/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/topic-selector-example2/src/main/resources/jndi.properties b/examples/jms/topic-selector-example2/src/main/resources/jndi.properties
index 65fc26e..9c96675 100644
--- a/examples/jms/topic-selector-example2/src/main/resources/jndi.properties
+++ b/examples/jms/topic-selector-example2/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 topic.topic/exampleTopic=exampleTopic

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/topic/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/topic/src/main/resources/jndi.properties b/examples/jms/topic/src/main/resources/jndi.properties
index 65fc26e..9c96675 100644
--- a/examples/jms/topic/src/main/resources/jndi.properties
+++ b/examples/jms/topic/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 topic.topic/exampleTopic=exampleTopic

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/transaction-failover/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/transaction-failover/src/main/resources/jndi.properties b/examples/jms/transaction-failover/src/main/resources/jndi.properties
index 99e6a96..8f3fcff 100644
--- a/examples/jms/transaction-failover/src/main/resources/jndi.properties
+++ b/examples/jms/transaction-failover/src/main/resources/jndi.properties
@@ -16,9 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
-connection.ConnectionFactory.ha=true
-connection.ConnectionFactory.retryInterval=1000
-connection.ConnectionFactory.retryIntervalMultiplier=1.0
-connection.ConnectionFactory.reconnectAttempts=-1
+connectionFactory.ConnectionFactory=tcp://localhost:5445?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/transactional/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/transactional/src/main/resources/jndi.properties b/examples/jms/transactional/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/transactional/src/main/resources/jndi.properties
+++ b/examples/jms/transactional/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/xa-heuristic/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/xa-heuristic/src/main/resources/jndi.properties b/examples/jms/xa-heuristic/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/xa-heuristic/src/main/resources/jndi.properties
+++ b/examples/jms/xa-heuristic/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/xa-receive/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/xa-receive/src/main/resources/jndi.properties b/examples/jms/xa-receive/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/xa-receive/src/main/resources/jndi.properties
+++ b/examples/jms/xa-receive/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/jms/xa-send/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/xa-send/src/main/resources/jndi.properties b/examples/jms/xa-send/src/main/resources/jndi.properties
index 6364ce4..85eda3d 100644
--- a/examples/jms/xa-send/src/main/resources/jndi.properties
+++ b/examples/jms/xa-send/src/main/resources/jndi.properties
@@ -16,5 +16,5 @@
 # under the License.
 
 java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:5445
+connectionFactory.ConnectionFactory=tcp://localhost:5445
 queue.queue/exampleQueue=exampleQueue

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakReceiver.java
----------------------------------------------------------------------
diff --git a/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakReceiver.java b/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakReceiver.java
index bc890b8..3f6b530 100644
--- a/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakReceiver.java
+++ b/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakReceiver.java
@@ -64,7 +64,7 @@ public class SoakReceiver
                SoakParams params = SoakBase.getParams(fileName);
 
                Hashtable<String, String> jndiProps = new Hashtable<String, String>();
-               jndiProps.put("java.naming.provider.url", jndiURL);
+               jndiProps.put("connectionFactory.ConnectionFactory", jndiURL);
                jndiProps.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
 
                final SoakReceiver receiver = new SoakReceiver(jndiProps, params);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakSender.java
----------------------------------------------------------------------
diff --git a/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakSender.java b/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakSender.java
index 360f88f..1b9e7f4 100644
--- a/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakSender.java
+++ b/examples/soak/normal/src/main/java/org/apache/activemq/jms/soak/example/SoakSender.java
@@ -55,7 +55,7 @@ public class SoakSender
          SoakParams params = SoakBase.getParams(fileName);
 
          Hashtable<String, String> jndiProps = new Hashtable<String, String>();
-         jndiProps.put("java.naming.provider.url", jndiURL);
+         jndiProps.put("connectionFactory.ConnectionFactory", jndiURL);
          jndiProps.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
 
          final SoakSender sender = new SoakSender(jndiProps, params);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/ServerLocatorSerializationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/ServerLocatorSerializationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/ServerLocatorSerializationTest.java
deleted file mode 100644
index 4a4ca0e..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/ServerLocatorSerializationTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.tests.integration.client;
-import org.junit.Before;
-import org.junit.After;
-
-import org.junit.Test;
-
-import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.client.ClientSession;
-import org.apache.activemq.api.core.client.ClientSessionFactory;
-import org.apache.activemq.api.core.client.ActiveMQClient;
-import org.apache.activemq.api.core.client.ServerLocator;
-import org.apache.activemq.api.jms.ActiveMQJMSClient;
-import org.apache.activemq.api.jms.JMSFactoryType;
-import org.apache.activemq.core.client.impl.ServerLocatorImpl;
-import org.apache.activemq.core.config.Configuration;
-import org.apache.activemq.core.server.ActiveMQServer;
-import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
-import org.apache.activemq.tests.integration.IntegrationTestLogger;
-import org.apache.activemq.tests.util.ServiceTestBase;
-
-import javax.jms.Connection;
-import javax.jms.Session;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-public class ServerLocatorSerializationTest extends ServiceTestBase
-{
-   private ActiveMQServer server;
-   private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
-
-   @Override
-   @Before
-   public void setUp() throws Exception
-   {
-      super.setUp();
-      Configuration configuration = createDefaultConfig(isNetty());
-      server = createServer(false, configuration);
-      server.start();
-   }
-
-   @Override
-   @After
-   public void tearDown() throws Exception
-   {
-      server.stop();
-      super.tearDown();
-   }
-
-   @Test
-   public void testLocatorSerialization() throws Exception
-   {
-      log.info("Starting Netty locator");
-      ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(createTransportConfiguration(isNetty(), false, generateParams(0, isNetty())));
-
-      ClientSessionFactory csf = createSessionFactory(locator);
-      ClientSession session = csf.createSession(false, false);
-      session.close();
-      csf.close();
-
-      log.info("Serializing locator");
-      ServerLocatorImpl locatorImpl = (ServerLocatorImpl) locator;
-      ByteArrayOutputStream bos = new ByteArrayOutputStream();
-      ObjectOutputStream out = new ObjectOutputStream(bos);
-      out.writeObject(locatorImpl);
-
-      log.info("De-serializing locator");
-      ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
-      ObjectInputStream in = new ObjectInputStream(bis);
-      locatorImpl = (ServerLocatorImpl) in.readObject();
-
-      csf = createSessionFactory(locator);
-      session = csf.createSession(false, false);
-      session.close();
-      csf.close();
-
-      locator.close();
-      locatorImpl.close();
-   }
-
-   @Test
-   public void testConnectionFactorySerialization() throws Exception
-   {
-      log.info("Starting connection factory");
-      ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new TransportConfiguration("org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory"));
-
-      Connection connection = cf.createConnection();
-      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      session.close();
-      connection.close();
-
-      log.info("Serializing connection factory");
-      ByteArrayOutputStream bos = new ByteArrayOutputStream();
-      ObjectOutputStream out = new ObjectOutputStream(bos);
-      out.writeObject(cf);
-
-      log.info("De-serializing connection factory");
-      ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
-      ObjectInputStream in = new ObjectInputStream(bis);
-      cf = (ActiveMQConnectionFactory) in.readObject();
-
-      connection = cf.createConnection();
-      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-      session.close();
-      connection.close();
-
-      cf.close();
-   }
-
-   public boolean isNetty()
-   {
-      return true;
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/SessionFactoryTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/SessionFactoryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/SessionFactoryTest.java
index 3779a3a..73f8f11 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/SessionFactoryTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/SessionFactoryTest.java
@@ -16,10 +16,6 @@
  */
 package org.apache.activemq.tests.integration.client;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -27,7 +23,7 @@ import java.util.List;
 import org.apache.activemq.api.core.BroadcastGroupConfiguration;
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.client.ClientSession;
 import org.apache.activemq.api.core.client.ClientSessionFactory;
 import org.apache.activemq.api.core.client.ActiveMQClient;
@@ -52,9 +48,9 @@ import org.junit.Test;
 public class SessionFactoryTest extends ServiceTestBase
 {
    private final DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration()
-      .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-         .setGroupAddress(getUDPDiscoveryAddress())
-         .setGroupPort(getUDPDiscoveryPort()));
+      .setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory()
+                                         .setGroupAddress(getUDPDiscoveryAddress())
+                                         .setGroupPort(getUDPDiscoveryPort()));
 
    private ActiveMQServer liveService;
 
@@ -70,34 +66,6 @@ public class SessionFactoryTest extends ServiceTestBase
    }
 
    @Test
-   public void testSerializable() throws Exception
-   {
-      ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(InVMConnectorFactory.class.getName()));
-
-      ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-      ObjectOutputStream oos = new ObjectOutputStream(baos);
-
-      oos.writeObject(locator);
-
-      oos.close();
-
-      byte[] bytes = baos.toByteArray();
-
-      ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-
-      ObjectInputStream ois = new ObjectInputStream(bais);
-
-      ServerLocator csi = (ServerLocator) ois.readObject();
-
-      Assert.assertNotNull(csi);
-
-      csi.close();
-
-      locator.close();
-   }
-
-   @Test
    public void testCloseUnusedClientSessionFactoryWithoutGlobalPools() throws Exception
    {
       ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(liveTC);
@@ -576,10 +544,10 @@ public class SessionFactoryTest extends ServiceTestBase
          .setName(bcGroupName)
          .setBroadcastPeriod(broadcastPeriod)
          .setConnectorInfos(Arrays.asList(liveTC.getName()))
-         .setEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-            .setGroupAddress(getUDPDiscoveryAddress())
-            .setGroupPort(getUDPDiscoveryPort())
-            .setLocalBindPort(localBindPort));
+         .setEndpointFactory(new UDPBroadcastEndpointFactory()
+                                   .setGroupAddress(getUDPDiscoveryAddress())
+                                   .setGroupPort(getUDPDiscoveryPort())
+                                   .setLocalBindPort(localBindPort));
 
       List<BroadcastGroupConfiguration> bcConfigs1 = new ArrayList<BroadcastGroupConfiguration>();
       bcConfigs1.add(bcConfig1);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
index fad4118..6ab2816 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
@@ -27,7 +27,7 @@ import org.apache.activemq.api.core.BroadcastGroupConfiguration;
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.api.core.SimpleString;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.client.ClientConsumer;
 import org.apache.activemq.api.core.client.ClientMessage;
 import org.apache.activemq.api.core.client.ClientProducer;
@@ -121,13 +121,13 @@ public class BridgeWithDiscoveryGroupStartTest extends ServiceTestBase
          ArrayList<String> list = new ArrayList<String>();
          list.add(server1tc.getName());
 
-         UDPBroadcastGroupConfiguration endpoint = new UDPBroadcastGroupConfiguration().setGroupAddress(groupAddress).setGroupPort(port);
+         UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(port);
 
          BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration()
             .setName("bg1")
             .setBroadcastPeriod(250)
             .setConnectorInfos(list)
-            .setEndpointFactoryConfiguration(endpoint);
+            .setEndpointFactory(endpoint);
 
          server0.getConfiguration().getBroadcastGroupConfigurations().add(bcConfig);
 
@@ -135,7 +135,7 @@ public class BridgeWithDiscoveryGroupStartTest extends ServiceTestBase
             .setName("dg1")
             .setRefreshTimeout(5000)
             .setDiscoveryInitialWaitTimeout(5000)
-            .setBroadcastEndpointFactoryConfiguration(endpoint);
+            .setBroadcastEndpointFactory(endpoint);
 
          server0.getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/distribution/ClusterTestBase.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/distribution/ClusterTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/distribution/ClusterTestBase.java
index 7370f33..212c7e7 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/distribution/ClusterTestBase.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/distribution/ClusterTestBase.java
@@ -38,7 +38,7 @@ import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.api.core.Message;
 import org.apache.activemq.api.core.SimpleString;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.client.ClientConsumer;
 import org.apache.activemq.api.core.client.ClientMessage;
 import org.apache.activemq.api.core.client.ClientProducer;
@@ -1787,19 +1787,19 @@ public abstract class ClusterTestBase extends ServiceTestBase
       List<String> connectorPairs = new ArrayList<String>();
       connectorPairs.add(connector.getName());
 
-      UDPBroadcastGroupConfiguration endpoint = new UDPBroadcastGroupConfiguration().setGroupAddress(groupAddress).setGroupPort(port);
+      UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(port);
 
       BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration()
          .setName("bg1")
          .setBroadcastPeriod(200)
          .setConnectorInfos(connectorPairs)
-         .setEndpointFactoryConfiguration(endpoint);
+         .setEndpointFactory(endpoint);
 
       DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration()
          .setName("dg1")
          .setRefreshTimeout(1000)
          .setDiscoveryInitialWaitTimeout(1000)
-         .setBroadcastEndpointFactoryConfiguration(endpoint);
+         .setBroadcastEndpointFactory(endpoint);
 
       Configuration configuration = createBasicConfig(node)
          .setJournalMaxIO_AIO(1000)
@@ -1858,19 +1858,19 @@ public abstract class ClusterTestBase extends ServiceTestBase
       List<String> connectorPairs = new ArrayList<String>();
       connectorPairs.add(connector.getName());
 
-      UDPBroadcastGroupConfiguration endpoint = new UDPBroadcastGroupConfiguration().setGroupAddress(groupAddress).setGroupPort(port);
+      UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(port);
 
       BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration()
          .setName("bg1")
          .setBroadcastPeriod(1000)
          .setConnectorInfos(connectorPairs)
-         .setEndpointFactoryConfiguration(endpoint);
+         .setEndpointFactory(endpoint);
 
       DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration()
          .setName("dg1")
          .setRefreshTimeout(5000)
          .setDiscoveryInitialWaitTimeout(5000)
-         .setBroadcastEndpointFactoryConfiguration(endpoint);
+         .setBroadcastEndpointFactory(endpoint);
 
       Configuration configuration = createBasicConfig(sharedStorage ? liveNode : node)
          .clearAcceptorConfigurations()

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
index 6ca28bc..550f9fa 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
@@ -17,7 +17,7 @@
 package org.apache.activemq.tests.integration.cluster.topology;
 
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.client.ActiveMQClient;
 import org.apache.activemq.api.core.client.ServerLocator;
 
@@ -65,9 +65,9 @@ public class HAClientTopologyWithDiscoveryTest extends TopologyClusterTestBase
    protected ServerLocator createHAServerLocator()
    {
       ServerLocator locator = ActiveMQClient.createServerLocatorWithHA(new DiscoveryGroupConfiguration()
-                                                                          .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-                                                                                                                       .setGroupAddress(groupAddress)
-                                                                                                                       .setGroupPort(groupPort)));
+                                                                          .setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory()
+                                                                                                             .setGroupAddress(groupAddress)
+                                                                                                             .setGroupPort(groupPort)));
       locator.setBlockOnNonDurableSend(true);
       locator.setBlockOnDurableSend(true);
       addServerLocator(locator);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryBaseTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryBaseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryBaseTest.java
index 473bda3..76ccce6 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryBaseTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryBaseTest.java
@@ -26,7 +26,7 @@ import java.util.Map;
 
 import org.apache.activemq.api.core.SimpleString;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.core.cluster.DiscoveryEntry;
 import org.apache.activemq.core.cluster.DiscoveryGroup;
 import org.apache.activemq.core.cluster.DiscoveryListener;
@@ -169,12 +169,11 @@ public class DiscoveryBaseTest extends UnitTestCase
                                              final InetAddress groupAddress,
                                              final int groupPort) throws Exception
    {
-      return new BroadcastGroupImpl(new FakeNodeManager(nodeID), name, 0, null, new UDPBroadcastGroupConfiguration()
+      return new BroadcastGroupImpl(new FakeNodeManager(nodeID), name, 0, null, new UDPBroadcastEndpointFactory()
          .setGroupAddress(groupAddress.getHostAddress())
          .setGroupPort(groupPort)
          .setLocalBindAddress(localAddress != null ? localAddress.getHostAddress() : null)
-         .setLocalBindPort(localPort)
-         .createBroadcastEndpointFactory());
+         .setLocalBindPort(localPort));
    }
 
    protected DiscoveryGroup newDiscoveryGroup(final String nodeID, final String name, final InetAddress localBindAddress,
@@ -186,11 +185,10 @@ public class DiscoveryBaseTest extends UnitTestCase
    protected DiscoveryGroup newDiscoveryGroup(final String nodeID, final String name, final InetAddress localBindAddress,
                                               final InetAddress groupAddress, final int groupPort, final long timeout, NotificationService notif) throws Exception
    {
-      return new DiscoveryGroup(nodeID, name, timeout, new UDPBroadcastGroupConfiguration()
+      return new DiscoveryGroup(nodeID, name, timeout, new UDPBroadcastEndpointFactory()
          .setGroupAddress(groupAddress.getHostAddress())
          .setGroupPort(groupPort)
-         .setLocalBindAddress(localBindAddress != null ? localBindAddress.getHostAddress() : null)
-         .createBroadcastEndpointFactory(), notif);
+         .setLocalBindAddress(localBindAddress != null ? localBindAddress.getHostAddress() : null), notif);
    }
 
    protected final class FakeNodeManager extends NodeManager

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryStayAliveTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryStayAliveTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryStayAliveTest.java
index cd86f0e..dbf5a44 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryStayAliveTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryStayAliveTest.java
@@ -25,7 +25,7 @@ import org.apache.activemq.api.core.ActiveMQBuffer;
 import org.apache.activemq.api.core.ActiveMQBuffers;
 import org.apache.activemq.api.core.BroadcastEndpoint;
 import org.apache.activemq.api.core.BroadcastEndpointFactory;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.core.cluster.DiscoveryGroup;
 import org.apache.activemq.core.server.cluster.impl.BroadcastGroupImpl;
 import org.apache.activemq.tests.util.RandomUtil;
@@ -99,8 +99,8 @@ public class DiscoveryStayAliveTest extends DiscoveryBaseTest
 
       BroadcastGroupImpl bg = new BroadcastGroupImpl(new FakeNodeManager("test-nodeID"),
                                                      RandomUtil.randomString(),
-                                                     1, scheduledExecutorService, new UDPBroadcastGroupConfiguration().setGroupAddress(address1).
-                                                        setGroupPort(groupPort).createBroadcastEndpointFactory());
+                                                     1, scheduledExecutorService, new UDPBroadcastEndpointFactory().setGroupAddress(address1).
+                                                        setGroupPort(groupPort));
 
       bg.start();
 
@@ -109,8 +109,8 @@ public class DiscoveryStayAliveTest extends DiscoveryBaseTest
 
       for (int i = 0; i < 10; i++)
       {
-         BroadcastEndpointFactory factoryEndpoint = new UDPBroadcastGroupConfiguration().setGroupAddress(address1).
-            setGroupPort(groupPort).createBroadcastEndpointFactory();
+         BroadcastEndpointFactory factoryEndpoint = new UDPBroadcastEndpointFactory().setGroupAddress(address1).
+            setGroupPort(groupPort);
          sendBadData(factoryEndpoint);
 
          Thread.sleep(100);


[6/8] activemq-6 git commit: ACTIVEMQ6-7 - Improve Serialization on Connection Factory

Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/client/ActiveMQClient.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/client/ActiveMQClient.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/client/ActiveMQClient.java
index 1dc004e..90c0f6e 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/api/core/client/ActiveMQClient.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/client/ActiveMQClient.java
@@ -21,6 +21,9 @@ import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.api.core.TransportConfiguration;
 import org.apache.activemq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy;
 import org.apache.activemq.core.client.impl.ServerLocatorImpl;
+import org.apache.activemq.uri.ServerLocatorParser;
+
+import java.net.URI;
 
 /**
  * Utility class for creating ActiveMQ {@link ClientSessionFactory} objects.
@@ -113,6 +116,17 @@ public final class ActiveMQClient
    public static final String DEFAULT_CORE_PROTOCOL = "CORE";
 
    /**
+    * Creates a ActiveMQConnectionFactory;
+    *
+    * @return the ActiveMQConnectionFactory
+    */
+   public static ServerLocator createServerLocator(final String url) throws Exception
+   {
+      ServerLocatorParser parser = new ServerLocatorParser();
+      return parser.newObject(new URI(url));
+   }
+
+   /**
     * Create a ServerLocator which creates session factories using a static list of transportConfigurations, the ServerLocator is not updated automatically
     * as the cluster topology changes, and no HA backup information is propagated to the client
     *

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/api/core/client/TopologyMember.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/api/core/client/TopologyMember.java b/activemq-core-client/src/main/java/org/apache/activemq/api/core/client/TopologyMember.java
index dd9e95a..72b1374 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/api/core/client/TopologyMember.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/api/core/client/TopologyMember.java
@@ -16,8 +16,6 @@
  */
 package org.apache.activemq.api.core.client;
 
-import java.io.Serializable;
-
 import org.apache.activemq.api.core.TransportConfiguration;
 import org.apache.activemq.spi.core.protocol.RemotingConnection;
 
@@ -27,7 +25,7 @@ import org.apache.activemq.spi.core.protocol.RemotingConnection;
  * Each TopologyMember represents a single server and possibly any backup server that may take over
  * its duties (using the nodeId of the original server).
  */
-public interface TopologyMember extends Serializable
+public interface TopologyMember
 {
    /**
     * Returns the {@code backup-group-name} of the live server and backup servers associated with

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ServerLocatorImpl.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ServerLocatorImpl.java b/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ServerLocatorImpl.java
index 268f9c7..db0b34c 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ServerLocatorImpl.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/core/client/impl/ServerLocatorImpl.java
@@ -72,13 +72,8 @@ import org.apache.activemq.utils.UUIDGenerator;
  *
  * @author Tim Fox
  */
-public final class ServerLocatorImpl implements ServerLocatorInternal, DiscoveryListener, Serializable
+public final class ServerLocatorImpl implements ServerLocatorInternal, DiscoveryListener
 {
-   /*needed for backward compatibility*/
-   @SuppressWarnings("unused")
-   private final Set<ClusterTopologyListener> topologyListeners = new HashSet<ClusterTopologyListener>();
-
-   /*end of compatibility fixes*/
    private enum STATE
    {
       INITIALIZED, CLOSED, CLOSING
@@ -398,7 +393,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
    private static DiscoveryGroup createDiscoveryGroup(String nodeID, DiscoveryGroupConfiguration config) throws Exception
    {
       DiscoveryGroup group = new DiscoveryGroup(nodeID, config.getName(),
-                                                config.getRefreshTimeout(), config.getBroadcastEndpointFactoryConfiguration().createBroadcastEndpointFactory(), null);
+                                                config.getRefreshTimeout(), config.getBroadcastEndpointFactory(), null);
       return group;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ClientProtocolManagerFactory.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ClientProtocolManagerFactory.java b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ClientProtocolManagerFactory.java
index 9eeffd5..e90488b 100644
--- a/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ClientProtocolManagerFactory.java
+++ b/activemq-core-client/src/main/java/org/apache/activemq/spi/core/remoting/ClientProtocolManagerFactory.java
@@ -16,12 +16,10 @@
  */
 package org.apache.activemq.spi.core.remoting;
 
-import java.io.Serializable;
-
 /**
  * @author Clebert Suconic
  */
-public interface ClientProtocolManagerFactory extends Serializable
+public interface ClientProtocolManagerFactory
 {
 
    ClientProtocolManager newProtocolManager();

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/uri/AbstractServerLocatorSchema.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/uri/AbstractServerLocatorSchema.java b/activemq-core-client/src/main/java/org/apache/activemq/uri/AbstractServerLocatorSchema.java
new file mode 100644
index 0000000..01297f4
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/uri/AbstractServerLocatorSchema.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.uri;
+
+import org.apache.activemq.api.core.client.ServerLocator;
+import org.apache.activemq.utils.uri.URISchema;
+
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public abstract class AbstractServerLocatorSchema extends URISchema<ServerLocator>
+{
+   protected ConnectionOptions newConnectionOptions(URI uri, Map<String, String> query) throws Exception
+   {
+      return setData(uri, new ConnectionOptions(), query);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java b/activemq-core-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java
new file mode 100644
index 0000000..9c69ad2
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.uri;
+/**
+ * This will represent all the possible options you could setup on URLs
+ * When parsing the URL this will serve as an intermediate object
+ * And it could also be a pl
+ * @author clebertsuconic
+ */
+
+public class ConnectionOptions
+{
+
+   private boolean ha;
+
+   private String host;
+
+   private int port;
+
+   public ConnectionOptions setHost(String host)
+   {
+      this.host = host;
+      return this;
+   }
+
+   public String getHost()
+   {
+      return host;
+   }
+
+
+   public ConnectionOptions setPort(int port)
+   {
+      this.port = port;
+      return this;
+   }
+
+   public int getPort()
+   {
+      return port;
+   }
+
+   public boolean isHa()
+   {
+      return ha;
+   }
+
+   public void setHa(boolean ha)
+   {
+      this.ha = ha;
+   }
+
+   @Override
+   public String toString()
+   {
+      return "ConnectionOptions{" +
+         "ha=" + ha +
+         '}';
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/uri/InVMServerLocatorSchema.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/uri/InVMServerLocatorSchema.java b/activemq-core-client/src/main/java/org/apache/activemq/uri/InVMServerLocatorSchema.java
new file mode 100644
index 0000000..54c3254
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/uri/InVMServerLocatorSchema.java
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.uri;
+
+import org.apache.activemq.api.core.TransportConfiguration;
+import org.apache.activemq.api.core.client.ActiveMQClient;
+import org.apache.activemq.api.core.client.ServerLocator;
+import org.apache.activemq.utils.uri.SchemaConstants;
+import org.apache.activemq.utils.uri.URISchema;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class InVMServerLocatorSchema extends AbstractServerLocatorSchema
+{
+   @Override
+   public String getSchemaName()
+   {
+      return SchemaConstants.VM;
+   }
+
+   @Override
+   protected ServerLocator internalNewObject(URI uri, Map<String, String> query) throws Exception
+   {
+      TransportConfiguration tc = createTransportConfiguration(uri);
+      ServerLocator factory = ActiveMQClient.createServerLocatorWithoutHA(tc);
+      return URISchema.setData(uri, factory, query);
+   }
+
+   public static TransportConfiguration createTransportConfiguration(URI uri)
+   {
+      Map<String, Object> inVmTransportConfig = new HashMap<>();
+      inVmTransportConfig.put("serverId", uri.getHost());
+      return new TransportConfiguration("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory", inVmTransportConfig);
+   }
+
+   @Override
+   protected URI internalNewURI(ServerLocator bean) throws Exception
+   {
+      return getUri(bean.getStaticTransportConfigurations());
+   }
+
+   public static URI getUri(TransportConfiguration[] configurations) throws URISyntaxException
+   {
+      String host = "0";
+      if (configurations != null && configurations.length > 0)
+      {
+         TransportConfiguration configuration = configurations[0];
+         Map<String, Object> params = configuration.getParams();
+         host = params.get("serverId") == null ? host : params.get("serverId").toString();
+      }
+      return new URI(SchemaConstants.VM, null, host, -1, null, null, null);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/uri/JGroupsServerLocatorSchema.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/uri/JGroupsServerLocatorSchema.java b/activemq-core-client/src/main/java/org/apache/activemq/uri/JGroupsServerLocatorSchema.java
new file mode 100644
index 0000000..b840bcb
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/uri/JGroupsServerLocatorSchema.java
@@ -0,0 +1,102 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.uri;
+
+import org.apache.activemq.api.core.BroadcastEndpointFactory;
+import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
+import org.apache.activemq.api.core.JGroupsFileBroadcastEndpointFactory;
+import org.apache.activemq.api.core.JGroupsPropertiesBroadcastEndpointFactory;
+import org.apache.activemq.api.core.client.ActiveMQClient;
+import org.apache.activemq.api.core.client.ServerLocator;
+import org.apache.activemq.utils.uri.SchemaConstants;
+import org.apache.activemq.utils.uri.URISchema;
+
+import java.io.NotSerializableException;
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class JGroupsServerLocatorSchema extends AbstractServerLocatorSchema
+{
+   @Override
+   public String getSchemaName()
+   {
+      return SchemaConstants.JGROUPS;
+   }
+
+   @Override
+   protected ServerLocator internalNewObject(URI uri, Map<String, String> query) throws Exception
+   {
+      ConnectionOptions options = newConnectionOptions(uri, query);
+
+      DiscoveryGroupConfiguration dcConfig = getDiscoveryGroupConfiguration(uri, query);
+
+      if (options.isHa())
+      {
+         return ActiveMQClient.createServerLocatorWithHA(dcConfig);
+      }
+      else
+      {
+         return ActiveMQClient.createServerLocatorWithoutHA(dcConfig);
+      }
+   }
+
+   @Override
+   protected URI internalNewURI(ServerLocator bean) throws Exception
+   {
+      DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
+      BroadcastEndpointFactory endpoint =  dgc.getBroadcastEndpointFactory();
+      String auth;
+      if (endpoint instanceof JGroupsFileBroadcastEndpointFactory)
+      {
+         auth = ((JGroupsFileBroadcastEndpointFactory) endpoint).getChannelName();
+      }
+      else if (endpoint instanceof JGroupsPropertiesBroadcastEndpointFactory)
+      {
+         auth = ((JGroupsPropertiesBroadcastEndpointFactory) endpoint).getChannelName();
+      }
+      else
+      {
+         throw new NotSerializableException(endpoint + "not serializable");
+      }
+      String query = URISchema.getData(null, bean, dgc, endpoint);
+      dgc.setBroadcastEndpointFactory(endpoint);
+      return new URI(SchemaConstants.JGROUPS, null,  auth, -1, null, query, null);
+   }
+
+   public static DiscoveryGroupConfiguration getDiscoveryGroupConfiguration(URI uri, Map<String, String> query) throws Exception
+   {
+      BroadcastEndpointFactory endpointFactory;
+      if (query.containsKey("file"))
+      {
+         endpointFactory = new JGroupsFileBroadcastEndpointFactory().setChannelName(uri.getAuthority());
+      }
+      else
+      {
+         endpointFactory = new JGroupsPropertiesBroadcastEndpointFactory().setChannelName(uri.getAuthority());
+      }
+
+      URISchema.setData(uri, endpointFactory, query);
+
+      DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setBroadcastEndpointFactory(endpointFactory);
+
+      URISchema.setData(uri, dcConfig, query);
+      return dcConfig;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/uri/ServerLocatorParser.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/uri/ServerLocatorParser.java b/activemq-core-client/src/main/java/org/apache/activemq/uri/ServerLocatorParser.java
new file mode 100644
index 0000000..c77250a
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/uri/ServerLocatorParser.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.uri;
+
+import org.apache.activemq.api.core.client.ServerLocator;
+import org.apache.activemq.utils.uri.URIFactory;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class ServerLocatorParser extends URIFactory<ServerLocator>
+{
+   public ServerLocatorParser()
+   {
+      registerSchema(new TCPServerLocatorSchema());
+      registerSchema(new UDPServerLocatorSchema());
+      registerSchema(new JGroupsServerLocatorSchema());
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/uri/TCPServerLocatorSchema.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/uri/TCPServerLocatorSchema.java b/activemq-core-client/src/main/java/org/apache/activemq/uri/TCPServerLocatorSchema.java
new file mode 100644
index 0000000..ee92c84
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/uri/TCPServerLocatorSchema.java
@@ -0,0 +1,160 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.uri;
+
+import org.apache.activemq.api.core.TransportConfiguration;
+import org.apache.activemq.api.core.client.ActiveMQClient;
+import org.apache.activemq.api.core.client.ServerLocator;
+import org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory;
+import org.apache.activemq.core.remoting.impl.netty.TransportConstants;
+import org.apache.activemq.utils.uri.SchemaConstants;
+import org.apache.activemq.utils.uri.URISchema;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class TCPServerLocatorSchema extends AbstractServerLocatorSchema
+{
+   @Override
+   public String getSchemaName()
+   {
+      return SchemaConstants.TCP;
+   }
+
+   @Override
+   protected ServerLocator internalNewObject(URI uri, Map<String, String> query) throws Exception
+   {
+      ConnectionOptions options = newConnectionOptions(uri, query);
+
+      TransportConfiguration[] configurations = getTransportConfigurations(uri, query);
+
+      if (options.isHa())
+      {
+         return ActiveMQClient.createServerLocatorWithHA(configurations);
+      }
+      else
+      {
+         return ActiveMQClient.createServerLocatorWithoutHA(configurations);
+      }
+   }
+
+   public static TransportConfiguration[] getTransportConfigurations(URI uri, Map<String, String> query) throws URISyntaxException
+   {
+      HashMap<String, Object> props = new HashMap<>();
+
+      URISchema.setData(uri, props, TransportConstants.ALLOWABLE_CONNECTOR_KEYS, query);
+      List<TransportConfiguration> transportConfigurations = new ArrayList<>();
+
+      transportConfigurations.add(new TransportConfiguration(NettyConnectorFactory.class.getName(),
+                                                                    props,
+                                                                    uri.toString()));
+      String connectors = uri.getFragment();
+
+      if (connectors != null)
+      {
+         String[] split = connectors.split(",");
+         for (String s : split)
+         {
+            URI extraUri = new URI(s);
+            HashMap<String, Object> newProps = new HashMap<>();
+            URISchema.setData(extraUri, newProps, TransportConstants.ALLOWABLE_CONNECTOR_KEYS, query);
+            URISchema.setData(extraUri, newProps, TransportConstants.ALLOWABLE_CONNECTOR_KEYS, URISchema.parseQuery(extraUri.getQuery(), null));
+            transportConfigurations.add(new TransportConfiguration(NettyConnectorFactory.class.getName(),
+                                                                   newProps,
+                                                                   extraUri.toString()));
+         }
+      }
+      TransportConfiguration[] configurations = new TransportConfiguration[transportConfigurations.size()];
+      transportConfigurations.toArray(configurations);
+      return configurations;
+   }
+
+   @Override
+   protected URI internalNewURI(ServerLocator bean) throws Exception
+   {
+      String query = URISchema.getData(null, bean);
+      TransportConfiguration[] staticConnectors = bean.getStaticTransportConfigurations();
+      return getURI(query, staticConnectors);
+   }
+
+   public static URI getURI(String query, TransportConfiguration[] staticConnectors) throws Exception
+   {
+      if (staticConnectors == null || staticConnectors.length < 1)
+      {
+         throw new Exception();
+      }
+      StringBuilder fragment = new StringBuilder();
+      for (int i = 1; i < staticConnectors.length; i++)
+      {
+         TransportConfiguration connector = staticConnectors[i];
+         Map<String, Object> params = connector.getParams();
+         URI extraUri = new URI(SchemaConstants.TCP, null, getHost(params), getPort(params), null, createQuery(params, null), null);
+         if (i > 1)
+         {
+            fragment.append(",");
+         }
+         fragment.append(extraUri.toASCIIString());
+
+      }
+      Map<String, Object> params = staticConnectors[0].getParams();
+      return new URI(SchemaConstants.TCP, null,  getHost(params), getPort(params), null, createQuery(params, query), fragment.toString());
+   }
+
+   private static int getPort(Map<String, Object> params)
+   {
+      Object port = params.get("port");
+      if (port instanceof String)
+      {
+         return Integer.valueOf((String) port);
+      }
+      return port != null ? (int) port : 5445;
+   }
+
+   private static String getHost(Map<String, Object> params)
+   {
+      return params.get("host") != null ? (String) params.get("host") : "localhost";
+   }
+
+   private static String createQuery(Map<String, Object> params, String query)
+   {
+      StringBuilder cb;
+      if (query == null)
+      {
+         cb = new StringBuilder();
+      }
+      else
+      {
+         cb = new StringBuilder(query);
+      }
+      for (String param : params.keySet())
+      {
+         if (cb.length() > 0)
+         {
+            cb.append("&");
+         }
+         cb.append(param).append("=").append(params.get(param));
+      }
+      return cb.toString();
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-core-client/src/main/java/org/apache/activemq/uri/UDPServerLocatorSchema.java
----------------------------------------------------------------------
diff --git a/activemq-core-client/src/main/java/org/apache/activemq/uri/UDPServerLocatorSchema.java b/activemq-core-client/src/main/java/org/apache/activemq/uri/UDPServerLocatorSchema.java
new file mode 100644
index 0000000..ef1d96b
--- /dev/null
+++ b/activemq-core-client/src/main/java/org/apache/activemq/uri/UDPServerLocatorSchema.java
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.uri;
+
+import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
+import org.apache.activemq.api.core.client.ActiveMQClient;
+import org.apache.activemq.api.core.client.ServerLocator;
+import org.apache.activemq.utils.uri.SchemaConstants;
+import org.apache.activemq.utils.uri.URISchema;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class UDPServerLocatorSchema extends AbstractServerLocatorSchema
+{
+   protected static List<String> IGNORED = new ArrayList<>();
+   static
+   {
+      IGNORED.add("localBindAddress");
+      IGNORED.add("localBindPort");
+   }
+   @Override
+   public String getSchemaName()
+   {
+      return SchemaConstants.UDP;
+   }
+
+   @Override
+   protected ServerLocator internalNewObject(URI uri, Map<String, String> query) throws Exception
+   {
+      ConnectionOptions options = newConnectionOptions(uri, query);
+
+      DiscoveryGroupConfiguration dgc = getDiscoveryGroupConfiguration(uri, query, getHost(uri), getPort(uri));
+
+      if (options.isHa())
+      {
+         return ActiveMQClient.createServerLocatorWithHA(dgc);
+      }
+      else
+      {
+         return ActiveMQClient.createServerLocatorWithoutHA(dgc);
+      }
+   }
+
+   @Override
+   protected URI internalNewURI(ServerLocator bean) throws Exception
+   {
+      DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
+      UDPBroadcastEndpointFactory endpoint = (UDPBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
+      dgc.setBroadcastEndpointFactory(endpoint);
+      String query = URISchema.getData(IGNORED, bean, dgc, endpoint);
+      return new URI(SchemaConstants.UDP, null,  endpoint.getGroupAddress(), endpoint.getGroupPort(), null, query, null);
+   }
+
+   public static DiscoveryGroupConfiguration getDiscoveryGroupConfiguration(URI uri, Map<String, String> query, String host, int port) throws Exception
+   {
+      UDPBroadcastEndpointFactory endpointFactoryConfiguration = new UDPBroadcastEndpointFactory()
+               .setGroupAddress(host)
+               .setGroupPort(port);
+
+      URISchema.setData(uri, endpointFactoryConfiguration, query);
+
+      DiscoveryGroupConfiguration dgc = URISchema.setData(uri, new DiscoveryGroupConfiguration(), query)
+         .setBroadcastEndpointFactory(endpointFactoryConfiguration);
+
+      URISchema.setData(uri, dgc, query);
+      return dgc;
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-jms-client/pom.xml b/activemq-jms-client/pom.xml
index c40729a..629b8ee 100644
--- a/activemq-jms-client/pom.xml
+++ b/activemq-jms-client/pom.xml
@@ -41,6 +41,13 @@
          <groupId>org.apache.activemq</groupId>
          <artifactId>activemq-core-client</artifactId>
          <version>${project.version}</version>
+         <scope>test</scope>
+         <type>test-jar</type>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>activemq-core-client</artifactId>
+         <version>${project.version}</version>
       </dependency>
       <dependency>
          <groupId>org.apache.geronimo.specs</groupId>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSClient.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSClient.java b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSClient.java
index 8649459..181de27 100644
--- a/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSClient.java
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/api/jms/ActiveMQJMSClient.java
@@ -29,6 +29,9 @@ import org.apache.activemq.jms.client.ActiveMQTopicConnectionFactory;
 import org.apache.activemq.jms.client.ActiveMQXAConnectionFactory;
 import org.apache.activemq.jms.client.ActiveMQXAQueueConnectionFactory;
 import org.apache.activemq.jms.client.ActiveMQXATopicConnectionFactory;
+import org.apache.activemq.uri.ConnectionFactoryParser;
+
+import java.net.URI;
 
 /**
  * A utility class for creating ActiveMQ client-side JMS managed resources.
@@ -37,6 +40,16 @@ import org.apache.activemq.jms.client.ActiveMQXATopicConnectionFactory;
  */
 public class ActiveMQJMSClient
 {
+   /**
+    * Creates a ActiveMQConnectionFactory;
+    *
+    * @return the ActiveMQConnectionFactory
+    */
+   public static ActiveMQConnectionFactory createConnectionFactory(final String url) throws Exception
+   {
+      ConnectionFactoryParser parser = new ConnectionFactoryParser();
+      return parser.newObject(new URI(url));
+   }
 
    /**
     * Creates a ActiveMQConnectionFactory that receives cluster topology updates from the cluster as

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQConnectionFactory.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQConnectionFactory.java b/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQConnectionFactory.java
index 5ec04d0..5383077 100644
--- a/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQConnectionFactory.java
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQConnectionFactory.java
@@ -33,16 +33,24 @@ import javax.jms.XATopicConnection;
 import javax.naming.NamingException;
 import javax.naming.Reference;
 import javax.naming.Referenceable;
-import java.io.Serializable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.net.URI;
 
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.api.core.TransportConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.client.ClientSessionFactory;
 import org.apache.activemq.api.core.client.ActiveMQClient;
 import org.apache.activemq.api.core.client.ServerLocator;
 import org.apache.activemq.api.jms.JMSFactoryType;
 import org.apache.activemq.jms.referenceable.ConnectionFactoryObjectFactory;
 import org.apache.activemq.jms.referenceable.SerializableObjectRefAddr;
+import org.apache.activemq.uri.ConnectionFactoryParser;
+import org.apache.activemq.uri.ServerLocatorParser;
 
 /**
  * ActiveMQ implementation of a JMS ConnectionFactory.
@@ -50,11 +58,9 @@ import org.apache.activemq.jms.referenceable.SerializableObjectRefAddr;
  * @author <a href="mailto:ovidiu@feodorov.com">Ovidiu Feodorov</a>
  * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
  */
-public class ActiveMQConnectionFactory implements Serializable, Referenceable, ConnectionFactory, XAConnectionFactory
+public class ActiveMQConnectionFactory implements Externalizable, Referenceable, ConnectionFactory, XAConnectionFactory
 {
-   private static final long serialVersionUID = -2810634789345348326L;
-
-   private final ServerLocator serverLocator;
+   private ServerLocator serverLocator;
 
    private String clientID;
 
@@ -62,7 +68,58 @@ public class ActiveMQConnectionFactory implements Serializable, Referenceable, C
 
    private int transactionBatchSize = ActiveMQClient.DEFAULT_ACK_BATCH_SIZE;
 
-   private boolean readOnly;
+   private  boolean readOnly;
+
+   public void writeExternal(ObjectOutput out) throws IOException
+   {
+      ConnectionFactoryParser parser = new ConnectionFactoryParser();
+      String scheme;
+      if (serverLocator.getDiscoveryGroupConfiguration() != null)
+      {
+         if (serverLocator.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory() instanceof UDPBroadcastEndpointFactory)
+         {
+            scheme = "udp";
+         }
+         else
+         {
+            scheme = "jgroups";
+         }
+      }
+      else
+      {
+         scheme = "tcp";
+      }
+      try
+      {
+         URI uri = parser.createSchema(scheme, this);
+         out.writeUTF(uri.toASCIIString());
+      }
+      catch (Exception e)
+      {
+         if (e instanceof IOException)
+         {
+            throw (IOException) e;
+         }
+         throw new IOException(e);
+      }
+   }
+
+   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+   {
+      String url = in.readUTF();
+      ConnectionFactoryParser parser = new ConnectionFactoryParser();
+      ServerLocatorParser locatorParser = new ServerLocatorParser();
+      try
+      {
+         URI uri = new URI(url);
+         serverLocator = locatorParser.newObject(uri);
+         parser.populateObject(uri, this);
+      }
+      catch (Exception e)
+      {
+         throw new InvalidObjectException(e.getMessage());
+      }
+   }
 
    public ActiveMQConnectionFactory()
    {
@@ -559,7 +616,6 @@ public class ActiveMQConnectionFactory implements Serializable, Referenceable, C
 
    public synchronized int getInitialConnectAttempts()
    {
-      checkWrite();
       return serverLocator.getInitialConnectAttempts();
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQJMSConnectionFactory.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQJMSConnectionFactory.java b/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQJMSConnectionFactory.java
index d762cbc..0bc852b 100644
--- a/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQJMSConnectionFactory.java
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/jms/client/ActiveMQJMSConnectionFactory.java
@@ -67,5 +67,4 @@ public class ActiveMQJMSConnectionFactory extends ActiveMQConnectionFactory impl
    {
       super(ha, initialConnectors);
    }
-
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java
index a600b31..2f9735e 100644
--- a/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/jndi/ActiveMQInitialContextFactory.java
@@ -21,34 +21,14 @@ import javax.jms.Topic;
 import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.spi.InitialContextFactory;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
-import org.apache.activemq.api.core.JGroupsBroadcastGroupConfiguration;
-import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
-import org.apache.activemq.api.core.client.ActiveMQClient;
 import org.apache.activemq.api.jms.ActiveMQJMSClient;
-import org.apache.activemq.api.jms.JMSFactoryType;
-import org.apache.activemq.core.client.ActiveMQClientLogger;
-import org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory;
-import org.apache.activemq.core.remoting.impl.netty.TransportConstants;
 import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.uri.ConnectionFactoryParser;
 
 /**
  * A factory of the ActiveMQ InitialContext which contains
@@ -59,52 +39,40 @@ import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
  */
 public class ActiveMQInitialContextFactory implements InitialContextFactory
 {
-   public static final String CONNECTION_FACTORY_NAMES = "connectionFactoryNames";
    public static final String REFRESH_TIMEOUT = "refreshTimeout";
    public static final String DISCOVERY_INITIAL_WAIT_TIMEOUT = "discoveryInitialWaitTimeout";
-
-   private static final String[] DEFAULT_CONNECTION_FACTORY_NAMES = {"ConnectionFactory", "XAConnectionFactory", "QueueConnectionFactory", "TopicConnectionFactory"};
-   public static final String TCP_SCHEME = "tcp";
-   public static final String JGROUPS_SCHEME = "jgroups";
-   public static final String UDP_SCHEME = "udp";
-   public static final String VM_SCHEME = "vm";
-   public static final String HA = "ha";
-   public static final String CF_TYPE = "type";
-   public static final String QUEUE_CF = "QUEUE_CF";
-   public static final String TOPIC_CF = "TOPIC_CF";
-   public static final String QUEUE_XA_CF = "QUEUE_XA_CF";
-   public static final String TOPIC_XA_CF = "TOPIC_XA_CF";
-   public static final String XA_CF = "XA_CF";
    public static final String DYNAMIC_QUEUE_CONTEXT = "dynamicQueues";
    public static final String DYNAMIC_TOPIC_CONTEXT = "dynamicTopics";
-
-   private String connectionPrefix = "connection.";
+   private String connectionFactoryPrefix = "connectionFactory.";
    private String queuePrefix = "queue.";
    private String topicPrefix = "topic.";
 
    public Context getInitialContext(Hashtable environment) throws NamingException
    {
       // lets create a factory
-      Map<String, Object> data = new ConcurrentHashMap<String, Object>();
-      String[] names = getConnectionFactoryNames(environment);
-      for (int i = 0; i < names.length; i++)
+      Map<String, Object> data = new ConcurrentHashMap<>();
+      for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); )
       {
-         ActiveMQConnectionFactory factory = null;
-         String name = names[i];
-
-         try
-         {
-            factory = createConnectionFactory(name, environment);
-         }
-         catch (Exception e)
+         Map.Entry entry = (Map.Entry) iter.next();
+         String key = entry.getKey().toString();
+         if (key.startsWith(connectionFactoryPrefix))
          {
-            e.printStackTrace();
-            throw new NamingException("Invalid broker URL");
+            String jndiName = key.substring(connectionFactoryPrefix.length());
+            try
+            {
+               ActiveMQConnectionFactory factory = createConnectionFactory((String) environment.get(key));
+               data.put(jndiName, factory);
+            }
+            catch (Exception e)
+            {
+               e.printStackTrace();
+               throw new NamingException("Invalid broker URL");
+            }
          }
-
-         data.put(name, factory);
       }
 
+
+
       createQueues(data, environment);
       createTopics(data, environment);
 
@@ -160,58 +128,6 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory
       return new ReadOnlyContext(environment, data);
    }
 
-   protected ActiveMQConnectionFactory createConnectionFactory(String name, Hashtable environment) throws URISyntaxException, MalformedURLException
-   {
-      Hashtable connectionFactoryProperties = new Hashtable(environment);
-      if (DEFAULT_CONNECTION_FACTORY_NAMES[1].equals(name))
-      {
-         connectionFactoryProperties.put(CF_TYPE, XA_CF);
-      }
-      if (DEFAULT_CONNECTION_FACTORY_NAMES[2].equals(name))
-      {
-         connectionFactoryProperties.put(CF_TYPE, QUEUE_CF);
-      }
-      if (DEFAULT_CONNECTION_FACTORY_NAMES[3].equals(name))
-      {
-         connectionFactoryProperties.put(CF_TYPE, TOPIC_CF);
-      }
-      String prefix = connectionPrefix + name + ".";
-      for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); )
-      {
-         Map.Entry entry = (Map.Entry) iter.next();
-         String key = (String) entry.getKey();
-         if (key.startsWith(prefix))
-         {
-            // Rename the key...
-            connectionFactoryProperties.remove(key);
-            key = key.substring(prefix.length());
-            connectionFactoryProperties.put(key, entry.getValue());
-         }
-      }
-      return createConnectionFactory(connectionFactoryProperties);
-   }
-
-   protected String[] getConnectionFactoryNames(Map environment)
-   {
-      String factoryNames = (String) environment.get(CONNECTION_FACTORY_NAMES);
-      if (factoryNames != null)
-      {
-         List<String> list = new ArrayList<String>();
-         for (StringTokenizer enumeration = new StringTokenizer(factoryNames, ","); enumeration.hasMoreTokens(); )
-         {
-            list.add(enumeration.nextToken().trim());
-         }
-         int size = list.size();
-         if (size > 0)
-         {
-            String[] answer = new String[size];
-            list.toArray(answer);
-            return answer;
-         }
-      }
-      return DEFAULT_CONNECTION_FACTORY_NAMES;
-   }
-
    protected void createQueues(Map<String, Object> data, Hashtable environment)
    {
       for (Iterator iter = environment.entrySet().iterator(); iter.hasNext(); )
@@ -259,238 +175,9 @@ public class ActiveMQInitialContextFactory implements InitialContextFactory
    /**
     * Factory method to create a new connection factory from the given environment
     */
-   protected ActiveMQConnectionFactory createConnectionFactory(Hashtable environment) throws URISyntaxException, MalformedURLException
+   protected ActiveMQConnectionFactory createConnectionFactory(String uri) throws Exception
    {
-      ActiveMQConnectionFactory connectionFactory;
-      Map transportConfig = new HashMap();
-
-      if (environment.containsKey(Context.PROVIDER_URL))
-      {
-         URI providerURI = new URI(((String)environment.get(Context.PROVIDER_URL)));
-
-         if (providerURI.getQuery() != null)
-         {
-            try
-            {
-               transportConfig = parseQuery(providerURI.getQuery());
-            }
-            catch (URISyntaxException e)
-            {
-            }
-         }
-
-         if (providerURI.getScheme().equals(TCP_SCHEME))
-         {
-            String[] connectors = providerURI.getAuthority().split(",");
-            TransportConfiguration[] transportConfigurations = new TransportConfiguration[connectors.length];
-            for (int i = 0; i < connectors.length; i++)
-            {
-               Map individualTransportConfig = new HashMap(transportConfig);
-               String[] hostAndPort = connectors[i].split(":");
-               individualTransportConfig.put(TransportConstants.HOST_PROP_NAME, hostAndPort[0]);
-               individualTransportConfig.put(TransportConstants.PORT_PROP_NAME, hostAndPort[1]);
-               transportConfigurations[i] = new TransportConfiguration(NettyConnectorFactory.class.getCanonicalName(), individualTransportConfig);
-            }
-
-            if (Boolean.TRUE.equals(environment.get(HA)))
-            {
-               connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(getJmsFactoryType(environment), transportConfigurations);
-            }
-            else
-            {
-               connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(getJmsFactoryType(environment), transportConfigurations);
-            }
-         }
-         else if (providerURI.getScheme().equals(UDP_SCHEME))
-         {
-            DiscoveryGroupConfiguration dgc = new DiscoveryGroupConfiguration()
-               .setRefreshTimeout(transportConfig.containsKey(REFRESH_TIMEOUT) ? Long.parseLong((String) transportConfig.get(REFRESH_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT)
-               .setDiscoveryInitialWaitTimeout(transportConfig.containsKey(DISCOVERY_INITIAL_WAIT_TIMEOUT) ? Long.parseLong((String) transportConfig.get(DISCOVERY_INITIAL_WAIT_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT)
-               .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-                                                            .setGroupAddress(providerURI.getHost())
-                                                            .setGroupPort(providerURI.getPort())
-                                                            .setLocalBindAddress(transportConfig.containsKey(TransportConstants.LOCAL_ADDRESS_PROP_NAME) ? (String) transportConfig.get(TransportConstants.LOCAL_ADDRESS_PROP_NAME) : null)
-                                                            .setLocalBindPort(transportConfig.containsKey(TransportConstants.LOCAL_PORT_PROP_NAME) ? Integer.parseInt((String) transportConfig.get(TransportConstants.LOCAL_PORT_PROP_NAME)) : -1));
-            if (Boolean.TRUE.equals(environment.get(HA)))
-            {
-               connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, getJmsFactoryType(environment));
-            }
-            else
-            {
-               connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, getJmsFactoryType(environment));
-            }
-         }
-         else if (providerURI.getScheme().equals(JGROUPS_SCHEME))
-         {
-            JGroupsBroadcastGroupConfiguration config = new JGroupsBroadcastGroupConfiguration(providerURI.getAuthority(), providerURI.getPath() != null ? providerURI.getPath() : UUID.randomUUID().toString());
-
-            DiscoveryGroupConfiguration dgc = new DiscoveryGroupConfiguration()
-               .setRefreshTimeout(transportConfig.containsKey(REFRESH_TIMEOUT) ? Long.parseLong((String) transportConfig.get(REFRESH_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT)
-               .setDiscoveryInitialWaitTimeout(transportConfig.containsKey(DISCOVERY_INITIAL_WAIT_TIMEOUT) ? Long.parseLong((String) transportConfig.get(DISCOVERY_INITIAL_WAIT_TIMEOUT)) : ActiveMQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT)
-               .setBroadcastEndpointFactoryConfiguration(config);
-            if (Boolean.TRUE.equals(environment.get(HA)))
-            {
-               connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, getJmsFactoryType(environment));
-            }
-            else
-            {
-               connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, getJmsFactoryType(environment));
-            }
-         }
-         else if (providerURI.getScheme().equals(VM_SCHEME))
-         {
-            Map inVmTransportConfig = new HashMap();
-            inVmTransportConfig.put("serverId", providerURI.getHost());
-            TransportConfiguration tc = new TransportConfiguration("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory", inVmTransportConfig);
-            connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(getJmsFactoryType(environment), tc);
-         }
-         else
-         {
-            throw new IllegalArgumentException("Invalid scheme");
-         }
-      }
-      else
-      {
-         TransportConfiguration tc = new TransportConfiguration("org.apache.activemq.core.remoting.impl.invm.InVMConnectorFactory");
-         connectionFactory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(getJmsFactoryType(environment), tc);
-      }
-
-      Properties properties = new Properties();
-      properties.putAll(environment);
-
-      for (Object key : environment.keySet())
-      {
-         invokeSetter(connectionFactory, (String) key, environment.get(key));
-      }
-
-      return connectionFactory;
-   }
-
-   private JMSFactoryType getJmsFactoryType(Hashtable environment)
-   {
-      JMSFactoryType ultimateType = JMSFactoryType.CF; // default value
-      if (environment.containsKey(CF_TYPE))
-      {
-         String tempType = (String) environment.get(CF_TYPE);
-         if (QUEUE_CF.equals(tempType))
-         {
-            ultimateType = JMSFactoryType.QUEUE_CF;
-         }
-         else if (TOPIC_CF.equals(tempType))
-         {
-            ultimateType = JMSFactoryType.TOPIC_CF;
-         }
-         else if (QUEUE_XA_CF.equals(tempType))
-         {
-            ultimateType = JMSFactoryType.QUEUE_XA_CF;
-         }
-         else if (TOPIC_XA_CF.equals(tempType))
-         {
-            ultimateType = JMSFactoryType.TOPIC_XA_CF;
-         }
-         else if (XA_CF.equals(tempType))
-         {
-            ultimateType = JMSFactoryType.XA_CF;
-         }
-      }
-      return ultimateType;
-   }
-
-
-   public static Map<String, String> parseQuery(String uri) throws URISyntaxException
-   {
-      try
-      {
-         uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query
-         Map<String, String> rc = new HashMap<String, String>();
-         if (uri != null && !uri.isEmpty())
-         {
-            String[] parameters = uri.split("&");
-            for (int i = 0; i < parameters.length; i++)
-            {
-               int p = parameters[i].indexOf("=");
-               if (p >= 0)
-               {
-                  String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
-                  String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
-                  rc.put(name, value);
-               }
-               else
-               {
-                  rc.put(parameters[i], null);
-               }
-            }
-         }
-         return rc;
-      }
-      catch (UnsupportedEncodingException e)
-      {
-         throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
-      }
-   }
-
-   public String getConnectionPrefix()
-   {
-      return connectionPrefix;
-   }
-
-   public void setConnectionPrefix(String connectionPrefix)
-   {
-      this.connectionPrefix = connectionPrefix;
-   }
-
-   private void invokeSetter(Object target, final String propertyName, final Object propertyValue)
-   {
-      Method setter = null;
-
-      Method[] methods = target.getClass().getMethods();
-
-      // turn something like "consumerWindowSize" to "setConsumerWindowSize"
-      String setterMethodName = "set" + Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1);
-
-      for (Method m : methods)
-      {
-         if (m.getName().equals(setterMethodName))
-         {
-            setter = m;
-            break;
-         }
-      }
-
-      try
-      {
-         if (setter != null)
-         {
-            ActiveMQClientLogger.LOGGER.info("Invoking: " + setter + " that takes a " + setter.getParameterTypes()[0] + " with a " + propertyValue.getClass());
-            if (propertyValue.getClass() == String.class && setter.getParameterTypes()[0] != String.class)
-            {
-               String stringPropertyValue = (String) propertyValue;
-               if (setter.getParameterTypes()[0] == Integer.TYPE)
-               {
-                  setter.invoke(target, Integer.parseInt(stringPropertyValue));
-               }
-               else if (setter.getParameterTypes()[0] == Long.TYPE)
-               {
-                  setter.invoke(target, Long.parseLong(stringPropertyValue));
-               }
-               else if (setter.getParameterTypes()[0] == Double.TYPE)
-               {
-                  setter.invoke(target, Double.parseDouble(stringPropertyValue));
-               }
-               else if (setter.getParameterTypes()[0] == Boolean.TYPE)
-               {
-                  setter.invoke(target, Boolean.parseBoolean(stringPropertyValue));
-               }
-            }
-            else
-            {
-               setter.invoke(target, propertyValue);
-            }
-         }
-      }
-      catch (Exception e)
-      {
-         ActiveMQClientLogger.LOGGER.warn("Caught exception during invocation of: " + setter, e);
-      }
+      ConnectionFactoryParser parser = new ConnectionFactoryParser();
+      return parser.newObject(uri);
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java
index 3e4c01e..7608afb 100644
--- a/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/AbstractCFSchema.java
@@ -31,15 +31,15 @@ import org.apache.activemq.utils.uri.URISchema;
 public abstract class AbstractCFSchema extends URISchema<ActiveMQConnectionFactory>
 {
 
-   protected ConnectionOptions newConectionOptions(URI uri, Map<String, String> query) throws Exception
+   protected JMSConnectionOptions newConectionOptions(URI uri, Map<String, String> query) throws Exception
    {
       String type = query.get("type");
       // We do this check here to guarantee proper logging
-      if (ConnectionOptions.convertCFType(type) == null)
+      if (JMSConnectionOptions.convertCFType(type) == null)
       {
          ActiveMQClientLogger.LOGGER.invalidCFType(type, uri.toString());
       }
-      return setData(uri, new ConnectionOptions(), query);
+      return setData(uri, new JMSConnectionOptions(), query);
    }
 
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java
index 88ef45e..ec2e8db 100644
--- a/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionFactoryParser.java
@@ -28,7 +28,9 @@ public class ConnectionFactoryParser extends URIFactory<ActiveMQConnectionFactor
 {
    public ConnectionFactoryParser()
    {
+      registerSchema(new TCPSchema());
       registerSchema(new UDPSchema());
       registerSchema(new JGroupsSchema());
+      registerSchema(new InVMSchema());
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java
deleted file mode 100644
index c9a46b3..0000000
--- a/activemq-jms-client/src/main/java/org/apache/activemq/uri/ConnectionOptions.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.activemq.uri;
-
-import org.apache.activemq.api.jms.JMSFactoryType;
-
-/**
- * This will represent all the possible options you could setup on URLs
- * When parsing the URL this will serve as an intermediate object
- * And it could also be a pl
- * @author clebertsuconic
- */
-
-public class ConnectionOptions
-{
-
-   private boolean ha;
-
-   private JMSFactoryType factoryType = JMSFactoryType.CF;
-
-   private String host;
-
-   private int port;
-
-   public ConnectionOptions setHost(String host)
-   {
-      this.host = host;
-      return this;
-   }
-
-   public String getHost()
-   {
-      return host;
-   }
-
-
-   public ConnectionOptions setPort(int port)
-   {
-      this.port = port;
-      return this;
-   }
-
-   public int getPort()
-   {
-      return port;
-   }
-
-   public boolean isHa()
-   {
-      return ha;
-   }
-
-   public void setHa(boolean ha)
-   {
-      this.ha = ha;
-   }
-
-   public JMSFactoryType getFactoryTypeEnum()
-   {
-      return factoryType;
-   }
-
-   public String getType()
-   {
-      return factoryType.toString();
-   }
-
-
-   public void setType(final String type)
-   {
-      this.factoryType = convertCFType(type);
-      if (factoryType == null)
-      {
-         factoryType = JMSFactoryType.CF;
-      }
-   }
-
-   public static JMSFactoryType convertCFType(String type)
-   {
-      try
-      {
-         if (type == null)
-         {
-            return null;
-         }
-         else
-         {
-            return Enum.valueOf(JMSFactoryType.class, type);
-         }
-      }
-      catch (Exception e)
-      {
-         return null;
-      }
-   }
-
-   @Override
-   public String toString()
-   {
-      return "ConnectionOptions{" +
-         "ha=" + ha +
-         ", factoryType=" + factoryType +
-         '}';
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/uri/InVMSchema.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/InVMSchema.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/InVMSchema.java
new file mode 100644
index 0000000..4de3b24
--- /dev/null
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/InVMSchema.java
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.uri;
+
+import org.apache.activemq.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.utils.uri.SchemaConstants;
+import org.apache.activemq.utils.uri.URISchema;
+
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class InVMSchema extends AbstractCFSchema
+{
+   @Override
+   public String getSchemaName()
+   {
+      return SchemaConstants.VM;
+   }
+
+   @Override
+   protected ActiveMQConnectionFactory internalNewObject(URI uri, Map<String, String> query) throws Exception
+   {
+      JMSConnectionOptions options = newConectionOptions(uri, query);
+      ActiveMQConnectionFactory factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(options.getFactoryTypeEnum(), InVMServerLocatorSchema.createTransportConfiguration(uri));
+      return URISchema.setData(uri, factory, query);
+   }
+
+   @Override
+   protected URI internalNewURI(ActiveMQConnectionFactory bean) throws Exception
+   {
+      return InVMServerLocatorSchema.getUri(bean.getStaticConnectors());
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java
index 302facd..4d92153 100644
--- a/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/JGroupsSchema.java
@@ -17,14 +17,17 @@
 
 package org.apache.activemq.uri;
 
+import java.io.NotSerializableException;
 import java.net.URI;
 import java.util.Map;
-import java.util.UUID;
 
+import org.apache.activemq.api.core.BroadcastEndpointFactory;
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
-import org.apache.activemq.api.core.JGroupsBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.JGroupsFileBroadcastEndpointFactory;
+import org.apache.activemq.api.core.JGroupsPropertiesBroadcastEndpointFactory;
 import org.apache.activemq.api.jms.ActiveMQJMSClient;
 import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.utils.uri.SchemaConstants;
 import org.apache.activemq.utils.uri.URISchema;
 
 /**
@@ -36,34 +39,48 @@ public class JGroupsSchema extends AbstractCFSchema
    @Override
    public String getSchemaName()
    {
-      return "jgroups";
+      return SchemaConstants.JGROUPS;
    }
 
-
    @Override
    public ActiveMQConnectionFactory internalNewObject(URI uri, Map<String, String> query) throws Exception
    {
-      ConnectionOptions options = newConectionOptions(uri, query);
-
-      System.out.println("authority = " + uri.getAuthority() + " path = " + uri.getPath());
-
-      JGroupsBroadcastGroupConfiguration jgroupsConfig = new JGroupsBroadcastGroupConfiguration(uri.getAuthority(), uri.getPath() != null ? uri.getPath() : UUID.randomUUID().toString());
-
-      URISchema.setData(uri, jgroupsConfig, query);
-
-
-      DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setBroadcastEndpointFactoryConfiguration(jgroupsConfig);
-
-      URISchema.setData(uri, dcConfig, query);
+      JMSConnectionOptions options = newConectionOptions(uri, query);
 
+      DiscoveryGroupConfiguration dcConfig = JGroupsServerLocatorSchema.getDiscoveryGroupConfiguration(uri, query);
 
+      ActiveMQConnectionFactory factory;
       if (options.isHa())
       {
-         return ActiveMQJMSClient.createConnectionFactoryWithHA(dcConfig, options.getFactoryTypeEnum());
+         factory = ActiveMQJMSClient.createConnectionFactoryWithHA(dcConfig, options.getFactoryTypeEnum());
+      }
+      else
+      {
+         factory =  ActiveMQJMSClient.createConnectionFactoryWithoutHA(dcConfig, options.getFactoryTypeEnum());
+      }
+      return URISchema.setData(uri, factory, query);
+   }
+
+   @Override
+   protected URI internalNewURI(ActiveMQConnectionFactory bean) throws Exception
+   {
+      DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
+      BroadcastEndpointFactory endpoint =  dgc.getBroadcastEndpointFactory();
+      String auth;
+      if (endpoint instanceof JGroupsFileBroadcastEndpointFactory)
+      {
+         auth = ((JGroupsFileBroadcastEndpointFactory) endpoint).getChannelName();
+      }
+      else if (endpoint instanceof JGroupsPropertiesBroadcastEndpointFactory)
+      {
+         auth = ((JGroupsPropertiesBroadcastEndpointFactory) endpoint).getChannelName();
       }
       else
       {
-         return ActiveMQJMSClient.createConnectionFactoryWithoutHA(dcConfig, options.getFactoryTypeEnum());
+         throw new NotSerializableException(endpoint + "not serializable");
       }
+      String query = URISchema.getData(null, bean, dgc, endpoint);
+      dgc.setBroadcastEndpointFactory(endpoint);
+      return new URI(SchemaConstants.JGROUPS, null,  auth, -1, null, query, null);
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/uri/JMSConnectionOptions.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/JMSConnectionOptions.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/JMSConnectionOptions.java
new file mode 100644
index 0000000..8855fd7
--- /dev/null
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/JMSConnectionOptions.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.uri;
+
+import org.apache.activemq.api.jms.JMSFactoryType;
+
+/**
+ * This will represent all the possible options you could setup on URLs
+ * When parsing the URL this will serve as an intermediate object
+ * And it could also be a pl
+ * @author clebertsuconic
+ */
+
+public class JMSConnectionOptions extends ConnectionOptions
+{
+   private JMSFactoryType factoryType = JMSFactoryType.CF;
+
+   public JMSFactoryType getFactoryTypeEnum()
+   {
+      return factoryType;
+   }
+
+   public String getType()
+   {
+      return factoryType.toString();
+   }
+
+
+   public void setType(final String type)
+   {
+      this.factoryType = convertCFType(type);
+      if (factoryType == null)
+      {
+         factoryType = JMSFactoryType.CF;
+      }
+   }
+
+   public static JMSFactoryType convertCFType(String type)
+   {
+      try
+      {
+         if (type == null)
+         {
+            return JMSFactoryType.CF;
+         }
+         else
+         {
+            return Enum.valueOf(JMSFactoryType.class, type);
+         }
+      }
+      catch (Exception e)
+      {
+         return null;
+      }
+   }
+
+   @Override
+   public String toString()
+   {
+      return "JMSConnectionOptions{" +
+         ", factoryType=" + factoryType +
+         '}';
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/uri/TCPSchema.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/TCPSchema.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/TCPSchema.java
new file mode 100644
index 0000000..a9b7565
--- /dev/null
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/TCPSchema.java
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.uri;
+
+import org.apache.activemq.api.core.TransportConfiguration;
+import org.apache.activemq.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.utils.uri.SchemaConstants;
+import org.apache.activemq.utils.uri.URISchema;
+
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class TCPSchema extends AbstractCFSchema
+{
+   @Override
+   public String getSchemaName()
+   {
+      return SchemaConstants.TCP;
+   }
+
+   @Override
+   protected ActiveMQConnectionFactory internalNewObject(URI uri, Map<String, String> query) throws Exception
+   {
+      JMSConnectionOptions options = newConectionOptions(uri, query);
+
+      TransportConfiguration[] configurations = TCPServerLocatorSchema.getTransportConfigurations(uri, query);
+
+      ActiveMQConnectionFactory factory;
+
+      if (options.isHa())
+      {
+         factory = ActiveMQJMSClient.createConnectionFactoryWithHA(options.getFactoryTypeEnum(), configurations);
+      }
+      else
+      {
+         factory =  ActiveMQJMSClient.createConnectionFactoryWithoutHA(options.getFactoryTypeEnum(), configurations);
+      }
+
+      return URISchema.setData(uri, factory, query);
+   }
+
+   @Override
+   protected URI internalNewURI(ActiveMQConnectionFactory bean) throws Exception
+   {
+      String query = URISchema.getData(null, bean);
+      TransportConfiguration[] staticConnectors = bean.getStaticConnectors();
+      return TCPServerLocatorSchema.getURI(query, staticConnectors);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java
----------------------------------------------------------------------
diff --git a/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java b/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java
index b604233..fdf613b 100644
--- a/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java
+++ b/activemq-jms-client/src/main/java/org/apache/activemq/uri/UDPSchema.java
@@ -17,15 +17,14 @@
 
 package org.apache.activemq.uri;
 
-import java.io.PrintStream;
 import java.net.URI;
 import java.util.Map;
 
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.jms.ActiveMQJMSClient;
-import org.apache.activemq.core.remoting.impl.netty.TransportConstants;
 import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.utils.uri.SchemaConstants;
 import org.apache.activemq.utils.uri.URISchema;
 
 /**
@@ -37,29 +36,35 @@ public class UDPSchema extends AbstractCFSchema
    @Override
    public String getSchemaName()
    {
-      return "udp";
+      return SchemaConstants.UDP;
    }
 
-
    @Override
    public ActiveMQConnectionFactory internalNewObject(URI uri, Map<String, String> query) throws Exception
    {
-      ConnectionOptions options = newConectionOptions(uri, query);
+      JMSConnectionOptions options = newConectionOptions(uri, query);
 
-      DiscoveryGroupConfiguration dgc = URISchema.setData(uri, new DiscoveryGroupConfiguration(), query)
-         .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-                                                      .setGroupAddress(getHost(uri))
-                                                      .setGroupPort(getPort(uri))
-                                                      .setLocalBindAddress(query.containsKey(TransportConstants.LOCAL_ADDRESS_PROP_NAME) ? (String) query.get(TransportConstants.LOCAL_ADDRESS_PROP_NAME) : null)
-                                                      .setLocalBindPort(query.containsKey(TransportConstants.LOCAL_PORT_PROP_NAME) ? Integer.parseInt((String) query.get(TransportConstants.LOCAL_PORT_PROP_NAME)) : -1));
+      DiscoveryGroupConfiguration dgc = UDPServerLocatorSchema.getDiscoveryGroupConfiguration(uri, query, getHost(uri), getPort(uri));
 
+      ActiveMQConnectionFactory factory;
       if (options.isHa())
       {
-         return ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, options.getFactoryTypeEnum());
+         factory = ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, options.getFactoryTypeEnum());
       }
       else
       {
-         return ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, options.getFactoryTypeEnum());
+         factory =  ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, options.getFactoryTypeEnum());
       }
+      return URISchema.setData(uri, factory, query);
+   }
+
+   @Override
+   protected URI internalNewURI(ActiveMQConnectionFactory bean) throws Exception
+   {
+      DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
+      UDPBroadcastEndpointFactory endpoint = (UDPBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
+      String query = URISchema.getData(UDPServerLocatorSchema.IGNORED, bean, dgc, endpoint);
+      dgc.setBroadcastEndpointFactory(endpoint);
+      return new URI(SchemaConstants.UDP, null,  endpoint.getGroupAddress(), endpoint.getGroupPort(), null, query, null);
    }
 }


[3/8] activemq-6 git commit: ACTIVEMQ6-7 - Improve Serialization on Connection Factory

Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryTest.java
index 24ee708..6078eca 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/discovery/DiscoveryTest.java
@@ -16,11 +16,7 @@
  */
 package org.apache.activemq.tests.integration.discovery;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.net.InetAddress;
 import java.net.NetworkInterface;
 import java.util.Arrays;
@@ -30,10 +26,10 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.activemq.api.core.BroadcastEndpoint;
 import org.apache.activemq.api.core.BroadcastEndpointFactory;
-import org.apache.activemq.api.core.JGroupsBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.JGroupsFileBroadcastEndpointFactory;
 import org.apache.activemq.api.core.SimpleString;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.management.CoreNotificationType;
 import org.apache.activemq.core.cluster.DiscoveryEntry;
 import org.apache.activemq.core.cluster.DiscoveryGroup;
@@ -102,7 +98,7 @@ public class DiscoveryTest extends DiscoveryBaseTest
 
       bg = new BroadcastGroupImpl(new FakeNodeManager(nodeID),
                                   RandomUtil.randomString(),
-                                  0, null, new UDPBroadcastGroupConfiguration().setGroupAddress(address1).setGroupPort(groupPort).createBroadcastEndpointFactory());
+                                  0, null, new UDPBroadcastEndpointFactory().setGroupAddress(address1).setGroupPort(groupPort));
 
       bg.start();
 
@@ -132,7 +128,9 @@ public class DiscoveryTest extends DiscoveryBaseTest
       final String nodeID = RandomUtil.randomString();
 
       bg = new BroadcastGroupImpl(new FakeNodeManager(nodeID), "broadcast", 100, null,
-                                  new JGroupsBroadcastGroupConfiguration(TEST_JGROUPS_CONF_FILE, "tst").createBroadcastEndpointFactory());
+                                  new JGroupsFileBroadcastEndpointFactory()
+                                       .setChannelName("tst")
+                                       .setFile(TEST_JGROUPS_CONF_FILE));
 
       bg.start();
 
@@ -141,7 +139,9 @@ public class DiscoveryTest extends DiscoveryBaseTest
       bg.addConnector(live1);
 
       dg = new DiscoveryGroup(nodeID + "1", "broadcast", 5000L,
-                              new JGroupsBroadcastGroupConfiguration(TEST_JGROUPS_CONF_FILE, "tst").createBroadcastEndpointFactory(),
+                              new JGroupsFileBroadcastEndpointFactory()
+                              .setChannelName("tst")
+                              .setFile(TEST_JGROUPS_CONF_FILE),
                               null);
 
       dg.start();
@@ -160,9 +160,9 @@ public class DiscoveryTest extends DiscoveryBaseTest
    @Test
    public void testJGropusChannelReferenceCounting() throws Exception
    {
-      JGroupsBroadcastGroupConfiguration jgroupsConfig =
-         new JGroupsBroadcastGroupConfiguration(TEST_JGROUPS_CONF_FILE, "tst");
-      BroadcastEndpointFactory factory = jgroupsConfig.createBroadcastEndpointFactory();
+      BroadcastEndpointFactory factory = new JGroupsFileBroadcastEndpointFactory()
+                                             .setChannelName("tst")
+                                             .setFile(TEST_JGROUPS_CONF_FILE);
       BroadcastEndpoint broadcaster = factory.createBroadcastEndpoint();
       broadcaster.openBroadcaster();
 
@@ -222,9 +222,9 @@ public class DiscoveryTest extends DiscoveryBaseTest
    @Test
    public void testJGropusChannelReferenceCounting1() throws Exception
    {
-      JGroupsBroadcastGroupConfiguration jgroupsConfig =
-         new JGroupsBroadcastGroupConfiguration(TEST_JGROUPS_CONF_FILE, "tst");
-      BroadcastEndpointFactory factory = jgroupsConfig.createBroadcastEndpointFactory();
+      BroadcastEndpointFactory factory = new JGroupsFileBroadcastEndpointFactory()
+                                             .setChannelName("tst")
+                                             .setFile(TEST_JGROUPS_CONF_FILE);
       BroadcastEndpoint broadcaster = factory.createBroadcastEndpoint();
       broadcaster.openBroadcaster();
 
@@ -293,9 +293,9 @@ public class DiscoveryTest extends DiscoveryBaseTest
    @Test
    public void testJGropusChannelReferenceCounting2() throws Exception
    {
-      JGroupsBroadcastGroupConfiguration jgroupsConfig =
-         new JGroupsBroadcastGroupConfiguration(TEST_JGROUPS_CONF_FILE, "tst");
-      BroadcastEndpointFactory factory = jgroupsConfig.createBroadcastEndpointFactory();
+      BroadcastEndpointFactory factory = new JGroupsFileBroadcastEndpointFactory()
+                                             .setChannelName("tst")
+                                             .setFile(TEST_JGROUPS_CONF_FILE);
       BroadcastEndpoint broadcaster = factory.createBroadcastEndpoint();
       broadcaster.openBroadcaster();
 
@@ -374,13 +374,14 @@ public class DiscoveryTest extends DiscoveryBaseTest
       BroadcastEndpoint client = null;
       try
       {
-         JGroupsBroadcastGroupConfiguration jgroupsConfig =
-            new JGroupsBroadcastGroupConfiguration(TEST_JGROUPS_CONF_FILE, "tst");
-         broadcaster = jgroupsConfig.createBroadcastEndpointFactory().createBroadcastEndpoint();
+         JGroupsFileBroadcastEndpointFactory endpointFactory = new JGroupsFileBroadcastEndpointFactory()
+               .setChannelName("tst")
+               .setFile(TEST_JGROUPS_CONF_FILE);
+         broadcaster = endpointFactory.createBroadcastEndpoint();
 
          broadcaster.openBroadcaster();
 
-         client = jgroupsConfig.createBroadcastEndpointFactory().createBroadcastEndpoint();
+         client = endpointFactory.createBroadcastEndpoint();
 
          client.openClient();
 
@@ -1180,26 +1181,4 @@ public class DiscoveryTest extends DiscoveryBaseTest
          .getSimpleStringProperty(new SimpleString("name"))
          .toString());
    }
-
-   /**
-    * https://issues.jboss.org/browse/HORNETQ-1389
-    * @throws Exception
-    */
-   @Test
-   public void testJGroupsBroadcastGroupConfigurationSerializable() throws Exception
-   {
-      JGroupsBroadcastGroupConfiguration jgroupsConfig =
-         new JGroupsBroadcastGroupConfiguration(TEST_JGROUPS_CONF_FILE, "somChannel");
-      ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
-      ObjectOutputStream objectOut = new ObjectOutputStream(byteOut);
-      objectOut.writeObject(jgroupsConfig);
-
-      byte[] serializedData = byteOut.toByteArray();
-      ByteArrayInputStream byteIn = new ByteArrayInputStream(serializedData);
-      ObjectInputStream objectIn = new ObjectInputStream(byteIn);
-
-      Object object = objectIn.readObject();
-      assertNotNull(object);
-      assertTrue(object instanceof JGroupsBroadcastGroupConfiguration);
-   }
 }

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/ActiveMQConnectionFactoryTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/ActiveMQConnectionFactoryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/ActiveMQConnectionFactoryTest.java
index 6aace2b..ba40718 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/ActiveMQConnectionFactoryTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/ActiveMQConnectionFactoryTest.java
@@ -34,7 +34,7 @@ import org.junit.Assert;
 import org.apache.activemq.api.core.BroadcastGroupConfiguration;
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.client.ActiveMQClient;
 import org.apache.activemq.api.jms.ActiveMQJMSClient;
 import org.apache.activemq.api.jms.JMSFactoryType;
@@ -169,9 +169,9 @@ public class ActiveMQConnectionFactoryTest extends UnitTestCase
    public void testDiscoveryConstructor() throws Exception
    {
       DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration()
-         .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-                                                      .setGroupAddress(groupAddress)
-                                                      .setGroupPort(groupPort));
+         .setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory()
+                                            .setGroupAddress(groupAddress)
+                                            .setGroupPort(groupPort));
       ActiveMQConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration, JMSFactoryType.CF);
       assertFactoryParams(cf,
                           null,
@@ -734,10 +734,10 @@ public class ActiveMQConnectionFactoryTest extends UnitTestCase
          .setName(bcGroupName)
          .setBroadcastPeriod(broadcastPeriod)
          .setConnectorInfos(connectorNames)
-         .setEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-                                             .setGroupAddress(groupAddress)
-                                             .setGroupPort(groupPort)
-                                             .setLocalBindPort(localBindPort));
+         .setEndpointFactory(new UDPBroadcastEndpointFactory()
+                                   .setGroupAddress(groupAddress)
+                                   .setGroupPort(groupPort)
+                                   .setLocalBindPort(localBindPort));
 
       List<BroadcastGroupConfiguration> bcConfigs1 = new ArrayList<BroadcastGroupConfiguration>();
       bcConfigs1.add(bcConfig1);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java
index 9c48cc7..22edf72 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/SimpleJNDIClientTest.java
@@ -31,10 +31,14 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.activemq.api.config.ActiveMQDefaultConfiguration;
+import org.apache.activemq.api.core.BroadcastEndpoint;
+import org.apache.activemq.api.core.BroadcastEndpointFactory;
 import org.apache.activemq.api.core.BroadcastGroupConfiguration;
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
+import org.apache.activemq.api.core.JGroupsFileBroadcastEndpoint;
+import org.apache.activemq.api.core.JGroupsPropertiesBroadcastEndpointFactory;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.jms.JMSFactoryType;
 import org.apache.activemq.core.config.Configuration;
 import org.apache.activemq.core.config.ha.SharedStoreMasterPolicyConfiguration;
@@ -43,7 +47,6 @@ import org.apache.activemq.core.server.ActiveMQServer;
 import org.apache.activemq.core.server.ActiveMQServers;
 import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
 import org.apache.activemq.jndi.ActiveMQInitialContextFactory;
-import org.apache.activemq.tests.util.RandomUtil;
 import org.apache.activemq.tests.util.UnitTestCase;
 import org.junit.Assert;
 import org.junit.Before;
@@ -68,43 +71,19 @@ public class SimpleJNDIClientTest extends UnitTestCase
    private TransportConfiguration liveTC;
 
    @Test
-   public void testDefaultConnectionFactories() throws NamingException, JMSException
+   public void testMultipleConnectionFactories() throws NamingException, JMSException
    {
       Hashtable<String, Object> props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
+      props.put("connectionFactory.VmConnectionFactory", "vm://0");
+      props.put("connectionFactory.TCPConnectionFactory", "tcp://localhost:5445");
+      props.put("connectionFactory.UDPConnectionFactory", "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort());
+      props.put("connectionFactory.JGroupsConnectionFactory", "jgroups://mychannelid?file=test-jgroups-file_ping.xml");
       Context ctx = new InitialContext(props);
-
-      ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("ConnectionFactory");
-      Assert.assertEquals(JMSFactoryType.CF.intValue(), ((ActiveMQConnectionFactory)connectionFactory).getFactoryType());
-      connectionFactory.createConnection().close();
-
-      connectionFactory = (ConnectionFactory) ctx.lookup("XAConnectionFactory");
-      Assert.assertEquals(JMSFactoryType.XA_CF.intValue(), ((ActiveMQConnectionFactory)connectionFactory).getFactoryType());
-      connectionFactory.createConnection().close();
-
-      connectionFactory = (ConnectionFactory) ctx.lookup("TopicConnectionFactory");
-      Assert.assertEquals(JMSFactoryType.TOPIC_CF.intValue(), ((ActiveMQConnectionFactory)connectionFactory).getFactoryType());
-      connectionFactory.createConnection().close();
-
-      connectionFactory = (ConnectionFactory) ctx.lookup("QueueConnectionFactory");
-      Assert.assertEquals(JMSFactoryType.QUEUE_CF.intValue(), ((ActiveMQConnectionFactory)connectionFactory).getFactoryType());
-      connectionFactory.createConnection().close();
-   }
-
-   @Test
-   public void testCustomCF() throws NamingException, JMSException
-   {
-      Hashtable props = new Hashtable<>();
-      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
-      props.put("connection.myConnectionFactory.type", "CF");
-      Context ctx = new InitialContext(props);
-
-      ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("myConnectionFactory");
-
-      Assert.assertEquals(JMSFactoryType.CF.intValue(), ((ActiveMQConnectionFactory)connectionFactory).getFactoryType());
-
-      connectionFactory.createConnection().close();
+      ctx.lookup("VmConnectionFactory");
+      ctx.lookup("TCPConnectionFactory");
+      ctx.lookup("UDPConnectionFactory");
+      ctx.lookup("JGroupsConnectionFactory");
    }
 
    @Test
@@ -112,7 +91,7 @@ public class SimpleJNDIClientTest extends UnitTestCase
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(Context.PROVIDER_URL, "vm://0");
+      props.put("connectionFactory.ConnectionFactory", "vm://0");
       Context ctx = new InitialContext(props);
 
       ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("ConnectionFactory");
@@ -125,7 +104,7 @@ public class SimpleJNDIClientTest extends UnitTestCase
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(Context.PROVIDER_URL, "vm://1");
+      props.put("connectionFactory.ConnectionFactory", "vm://1");
       Context ctx = new InitialContext(props);
 
       ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("ConnectionFactory");
@@ -138,8 +117,7 @@ public class SimpleJNDIClientTest extends UnitTestCase
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
-      props.put("connection.myConnectionFactory.type", "XA_CF");
+      props.put("connectionFactory.myConnectionFactory", "vm://0?type=XA_CF");
       Context ctx = new InitialContext(props);
 
       ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
@@ -152,8 +130,7 @@ public class SimpleJNDIClientTest extends UnitTestCase
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
-      props.put("connection.myConnectionFactory.type", "QUEUE_CF");
+      props.put("connectionFactory.myConnectionFactory", "vm://0?type=QUEUE_CF");
       Context ctx = new InitialContext(props);
 
       ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
@@ -166,8 +143,7 @@ public class SimpleJNDIClientTest extends UnitTestCase
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
-      props.put("connection.myConnectionFactory.type", "QUEUE_XA_CF");
+      props.put("connectionFactory.myConnectionFactory", "vm://0?type=QUEUE_XA_CF");
       Context ctx = new InitialContext(props);
 
       ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
@@ -180,8 +156,7 @@ public class SimpleJNDIClientTest extends UnitTestCase
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
-      props.put("connection.myConnectionFactory.type", "TOPIC_CF");
+      props.put("connectionFactory.myConnectionFactory", "vm://0?type=TOPIC_CF");
       Context ctx = new InitialContext(props);
 
       ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
@@ -194,8 +169,7 @@ public class SimpleJNDIClientTest extends UnitTestCase
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
-      props.put("connection.myConnectionFactory.type", "TOPIC_XA_CF");
+      props.put("connectionFactory.myConnectionFactory", "vm://0?type=TOPIC_XA_CF");
       Context ctx = new InitialContext(props);
 
       ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
@@ -204,280 +178,97 @@ public class SimpleJNDIClientTest extends UnitTestCase
    }
 
    @Test
-   public void testCFWithProperties() throws NamingException, JMSException
+   public void testRemoteCFWithTCP() throws NamingException, JMSException
    {
-      // we don't test the 'ha' property here because it's not supported on a local connection factory (i.e. one
-      // constructed from an InitialContext where the environment doesn't contain the property "java.naming.provider.url")
-
-      long callFailoverTimeout = RandomUtil.randomPositiveLong();
-      long callTimeout = RandomUtil.randomPositiveLong();
-      long clientFailureCheckPeriod = RandomUtil.randomPositiveLong();
-      String clientID = RandomUtil.randomString();
-      int confirmationWindowSize = RandomUtil.randomPositiveInt();
-      String connectionLoadBalancingPolicyClassName = RandomUtil.randomString();
-      long connectionTTL = RandomUtil.randomPositiveLong();
-      int consumerMaxRate = RandomUtil.randomPositiveInt();
-      int consumerWindowSize = RandomUtil.randomPositiveInt();
-      int minLargeMessageSize = RandomUtil.randomPositiveInt();
-      int dupsOKBatchSize = RandomUtil.randomPositiveInt();
-      String groupID = RandomUtil.randomString();
-      int initialConnectAttempts = RandomUtil.randomPositiveInt();
-      int initialMessagePacketSize = RandomUtil.randomPositiveInt();
-      long maxRetryInterval = RandomUtil.randomPositiveLong();
-      int producerMaxRate = RandomUtil.randomPositiveInt();
-      int producerWindowSize = RandomUtil.randomPositiveInt();
-      int reconnectAttempts = RandomUtil.randomPositiveInt();
-      long retryInterval = RandomUtil.randomPositiveLong();
-      double retryIntervalMultiplier = RandomUtil.randomDouble();
-      int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt();
-      int threadPoolMaxSize = RandomUtil.randomPositiveInt();
-      int transactionBatchSize = RandomUtil.randomPositiveInt();
-      boolean autoGroup = RandomUtil.randomBoolean();
-      boolean blockOnAcknowledge = RandomUtil.randomBoolean();
-      boolean blockOnDurableSend = RandomUtil.randomBoolean();
-      boolean blockOnNonDurableSend = RandomUtil.randomBoolean();
-      boolean cacheLargeMessagesClient = RandomUtil.randomBoolean();
-      boolean compressLargeMessage = RandomUtil.randomBoolean();
-      boolean failoverOnInitialConnection = RandomUtil.randomBoolean();
-      boolean preAcknowledge = RandomUtil.randomBoolean();
-      boolean useGlobalPools = RandomUtil.randomBoolean();
-
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
-      props.put("connection.myConnectionFactory.callFailoverTimeout", callFailoverTimeout);
-      props.put("connection.myConnectionFactory.callTimeout", callTimeout);
-      props.put("connection.myConnectionFactory.clientFailureCheckPeriod", clientFailureCheckPeriod);
-      props.put("connection.myConnectionFactory.clientID", clientID);
-      props.put("connection.myConnectionFactory.confirmationWindowSize", confirmationWindowSize);
-      props.put("connection.myConnectionFactory.connectionLoadBalancingPolicyClassName", connectionLoadBalancingPolicyClassName);
-      props.put("connection.myConnectionFactory.connectionTTL", connectionTTL);
-      props.put("connection.myConnectionFactory.consumerMaxRate", consumerMaxRate);
-      props.put("connection.myConnectionFactory.consumerWindowSize", consumerWindowSize);
-      props.put("connection.myConnectionFactory.minLargeMessageSize", minLargeMessageSize);
-      props.put("connection.myConnectionFactory.dupsOKBatchSize", dupsOKBatchSize);
-      props.put("connection.myConnectionFactory.groupID", groupID);
-      props.put("connection.myConnectionFactory.initialConnectAttempts", initialConnectAttempts);
-      props.put("connection.myConnectionFactory.initialMessagePacketSize", initialMessagePacketSize);
-      props.put("connection.myConnectionFactory.maxRetryInterval", maxRetryInterval);
-      props.put("connection.myConnectionFactory.producerMaxRate", producerMaxRate);
-      props.put("connection.myConnectionFactory.producerWindowSize", producerWindowSize);
-      props.put("connection.myConnectionFactory.reconnectAttempts", reconnectAttempts);
-      props.put("connection.myConnectionFactory.retryInterval", retryInterval);
-      props.put("connection.myConnectionFactory.retryIntervalMultiplier", retryIntervalMultiplier);
-      props.put("connection.myConnectionFactory.scheduledThreadPoolMaxSize", scheduledThreadPoolMaxSize);
-      props.put("connection.myConnectionFactory.threadPoolMaxSize", threadPoolMaxSize);
-      props.put("connection.myConnectionFactory.transactionBatchSize", transactionBatchSize);
-      props.put("connection.myConnectionFactory.blockOnAcknowledge", blockOnAcknowledge);
-      props.put("connection.myConnectionFactory.blockOnDurableSend", blockOnDurableSend);
-      props.put("connection.myConnectionFactory.blockOnNonDurableSend", blockOnNonDurableSend);
-      props.put("connection.myConnectionFactory.cacheLargeMessagesClient", cacheLargeMessagesClient);
-      props.put("connection.myConnectionFactory.compressLargeMessage", compressLargeMessage);
-      props.put("connection.myConnectionFactory.failoverOnInitialConnection", failoverOnInitialConnection);
-      props.put("connection.myConnectionFactory.autoGroup", autoGroup);
-      props.put("connection.myConnectionFactory.preAcknowledge", preAcknowledge);
-      props.put("connection.myConnectionFactory.useGlobalPools", useGlobalPools);
+      props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:5445");
       Context ctx = new InitialContext(props);
 
-      ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
+      ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("myConnectionFactory");
 
-      Assert.assertEquals(callFailoverTimeout, cf.getCallFailoverTimeout());
-      Assert.assertEquals(callTimeout, cf.getCallTimeout());
-      Assert.assertEquals(clientFailureCheckPeriod, cf.getClientFailureCheckPeriod());
-      Assert.assertEquals(clientID, cf.getClientID());
-      Assert.assertEquals(confirmationWindowSize, cf.getConfirmationWindowSize());
-      Assert.assertEquals(connectionLoadBalancingPolicyClassName, cf.getConnectionLoadBalancingPolicyClassName());
-      Assert.assertEquals(connectionTTL, cf.getConnectionTTL());
-      Assert.assertEquals(consumerMaxRate, cf.getConsumerMaxRate());
-      Assert.assertEquals(consumerWindowSize, cf.getConsumerWindowSize());
-      Assert.assertEquals(minLargeMessageSize, cf.getMinLargeMessageSize());
-      Assert.assertEquals(dupsOKBatchSize, cf.getDupsOKBatchSize());
-      Assert.assertEquals(groupID, cf.getGroupID());
-      Assert.assertEquals(initialConnectAttempts, cf.getInitialConnectAttempts());
-      Assert.assertEquals(initialMessagePacketSize, cf.getInitialMessagePacketSize());
-      Assert.assertEquals(maxRetryInterval, cf.getMaxRetryInterval());
-      Assert.assertEquals(producerMaxRate, cf.getProducerMaxRate());
-      Assert.assertEquals(producerWindowSize, cf.getProducerWindowSize());
-      Assert.assertEquals(reconnectAttempts, cf.getReconnectAttempts());
-      Assert.assertEquals(retryInterval, cf.getRetryInterval());
-      Assert.assertEquals(retryIntervalMultiplier, cf.getRetryIntervalMultiplier(), 0.0001);
-      Assert.assertEquals(scheduledThreadPoolMaxSize, cf.getScheduledThreadPoolMaxSize());
-      Assert.assertEquals(threadPoolMaxSize, cf.getThreadPoolMaxSize());
-      Assert.assertEquals(transactionBatchSize, cf.getTransactionBatchSize());
-      Assert.assertEquals(autoGroup, cf.isAutoGroup());
-      Assert.assertEquals(blockOnAcknowledge, cf.isBlockOnAcknowledge());
-      Assert.assertEquals(blockOnDurableSend, cf.isBlockOnDurableSend());
-      Assert.assertEquals(blockOnNonDurableSend, cf.isBlockOnNonDurableSend());
-      Assert.assertEquals(cacheLargeMessagesClient, cf.isCacheLargeMessagesClient());
-      Assert.assertEquals(compressLargeMessage, cf.isCompressLargeMessage());
-      Assert.assertEquals(failoverOnInitialConnection, cf.isFailoverOnInitialConnection());
-      Assert.assertEquals(preAcknowledge, cf.isPreAcknowledge());
-      Assert.assertEquals(useGlobalPools, cf.isUseGlobalPools());
+      connectionFactory.createConnection().close();
    }
 
    @Test
-   public void testCFWithStringProperties() throws NamingException, JMSException
+   public void testRemoteCFWithTCPandHA() throws NamingException, JMSException
    {
-      // we don't test the 'ha' property here because it's not supported on a local connection factory (i.e. one
-      // constructed from an InitialContext where the environment doesn't contain the property "java.naming.provider.url")
-
-      String callFailoverTimeout = Long.toString(RandomUtil.randomPositiveLong());
-      String callTimeout = Long.toString(RandomUtil.randomPositiveLong());
-      String clientFailureCheckPeriod = Long.toString(RandomUtil.randomPositiveLong());
-      String clientID = RandomUtil.randomString();
-      String confirmationWindowSize = Integer.toString(RandomUtil.randomPositiveInt());
-      String connectionLoadBalancingPolicyClassName = RandomUtil.randomString();
-      String connectionTTL = Long.toString(RandomUtil.randomPositiveLong());
-      String consumerMaxRate = Integer.toString(RandomUtil.randomPositiveInt());
-      String consumerWindowSize = Integer.toString(RandomUtil.randomPositiveInt());
-      String minLargeMessageSize = Integer.toString(RandomUtil.randomPositiveInt());
-      String dupsOKBatchSize = Integer.toString(RandomUtil.randomPositiveInt());
-      String groupID = RandomUtil.randomString();
-      String initialConnectAttempts = Integer.toString(RandomUtil.randomPositiveInt());
-      String initialMessagePacketSize = Integer.toString(RandomUtil.randomPositiveInt());
-      String maxRetryInterval = Long.toString(RandomUtil.randomPositiveLong());
-      String producerMaxRate = Integer.toString(RandomUtil.randomPositiveInt());
-      String producerWindowSize = Integer.toString(RandomUtil.randomPositiveInt());
-      String reconnectAttempts = Integer.toString(RandomUtil.randomPositiveInt());
-      String retryInterval = Long.toString(RandomUtil.randomPositiveLong());
-      String retryIntervalMultiplier = Double.toString(RandomUtil.randomDouble());
-      String scheduledThreadPoolMaxSize = Integer.toString(RandomUtil.randomPositiveInt());
-      String threadPoolMaxSize = Integer.toString(RandomUtil.randomPositiveInt());
-      String transactionBatchSize = Integer.toString(RandomUtil.randomPositiveInt());
-      String autoGroup = Boolean.toString(RandomUtil.randomBoolean());
-      String blockOnAcknowledge = Boolean.toString(RandomUtil.randomBoolean());
-      String blockOnDurableSend = Boolean.toString(RandomUtil.randomBoolean());
-      String blockOnNonDurableSend = Boolean.toString(RandomUtil.randomBoolean());
-      String cacheLargeMessagesClient = Boolean.toString(RandomUtil.randomBoolean());
-      String compressLargeMessage = Boolean.toString(RandomUtil.randomBoolean());
-      String failoverOnInitialConnection = Boolean.toString(RandomUtil.randomBoolean());
-      String preAcknowledge = Boolean.toString(RandomUtil.randomBoolean());
-      String useGlobalPools = Boolean.toString(RandomUtil.randomBoolean());
-
-      Hashtable props = new Hashtable<String, String>();
+      Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
-      props.put("connection.myConnectionFactory.callFailoverTimeout", callFailoverTimeout);
-      props.put("connection.myConnectionFactory.callTimeout", callTimeout);
-      props.put("connection.myConnectionFactory.clientFailureCheckPeriod", clientFailureCheckPeriod);
-      props.put("connection.myConnectionFactory.clientID", clientID);
-      props.put("connection.myConnectionFactory.confirmationWindowSize", confirmationWindowSize);
-      props.put("connection.myConnectionFactory.connectionLoadBalancingPolicyClassName", connectionLoadBalancingPolicyClassName);
-      props.put("connection.myConnectionFactory.connectionTTL", connectionTTL);
-      props.put("connection.myConnectionFactory.consumerMaxRate", consumerMaxRate);
-      props.put("connection.myConnectionFactory.consumerWindowSize", consumerWindowSize);
-      props.put("connection.myConnectionFactory.minLargeMessageSize", minLargeMessageSize);
-      props.put("connection.myConnectionFactory.dupsOKBatchSize", dupsOKBatchSize);
-      props.put("connection.myConnectionFactory.groupID", groupID);
-      props.put("connection.myConnectionFactory.initialConnectAttempts", initialConnectAttempts);
-      props.put("connection.myConnectionFactory.initialMessagePacketSize", initialMessagePacketSize);
-      props.put("connection.myConnectionFactory.maxRetryInterval", maxRetryInterval);
-      props.put("connection.myConnectionFactory.producerMaxRate", producerMaxRate);
-      props.put("connection.myConnectionFactory.producerWindowSize", producerWindowSize);
-      props.put("connection.myConnectionFactory.reconnectAttempts", reconnectAttempts);
-      props.put("connection.myConnectionFactory.retryInterval", retryInterval);
-      props.put("connection.myConnectionFactory.retryIntervalMultiplier", retryIntervalMultiplier);
-      props.put("connection.myConnectionFactory.scheduledThreadPoolMaxSize", scheduledThreadPoolMaxSize);
-      props.put("connection.myConnectionFactory.threadPoolMaxSize", threadPoolMaxSize);
-      props.put("connection.myConnectionFactory.transactionBatchSize", transactionBatchSize);
-      props.put("connection.myConnectionFactory.blockOnAcknowledge", blockOnAcknowledge);
-      props.put("connection.myConnectionFactory.blockOnDurableSend", blockOnDurableSend);
-      props.put("connection.myConnectionFactory.blockOnNonDurableSend", blockOnNonDurableSend);
-      props.put("connection.myConnectionFactory.cacheLargeMessagesClient", cacheLargeMessagesClient);
-      props.put("connection.myConnectionFactory.compressLargeMessage", compressLargeMessage);
-      props.put("connection.myConnectionFactory.failoverOnInitialConnection", failoverOnInitialConnection);
-      props.put("connection.myConnectionFactory.autoGroup", autoGroup);
-      props.put("connection.myConnectionFactory.preAcknowledge", preAcknowledge);
-      props.put("connection.myConnectionFactory.useGlobalPools", useGlobalPools);
+      props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:5445?ha=true");
       Context ctx = new InitialContext(props);
 
       ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
 
-      Assert.assertEquals(Long.parseLong(callFailoverTimeout), cf.getCallFailoverTimeout());
-      Assert.assertEquals(Long.parseLong(callTimeout), cf.getCallTimeout());
-      Assert.assertEquals(Long.parseLong(clientFailureCheckPeriod), cf.getClientFailureCheckPeriod());
-      Assert.assertEquals(clientID, cf.getClientID());
-      Assert.assertEquals(Integer.parseInt(confirmationWindowSize), cf.getConfirmationWindowSize());
-      Assert.assertEquals(connectionLoadBalancingPolicyClassName, cf.getConnectionLoadBalancingPolicyClassName());
-      Assert.assertEquals(Long.parseLong(connectionTTL), cf.getConnectionTTL());
-      Assert.assertEquals(Integer.parseInt(consumerMaxRate), cf.getConsumerMaxRate());
-      Assert.assertEquals(Integer.parseInt(consumerWindowSize), cf.getConsumerWindowSize());
-      Assert.assertEquals(Integer.parseInt(minLargeMessageSize), cf.getMinLargeMessageSize());
-      Assert.assertEquals(Integer.parseInt(dupsOKBatchSize), cf.getDupsOKBatchSize());
-      Assert.assertEquals(groupID, cf.getGroupID());
-      Assert.assertEquals(Integer.parseInt(initialConnectAttempts), cf.getInitialConnectAttempts());
-      Assert.assertEquals(Integer.parseInt(initialMessagePacketSize), cf.getInitialMessagePacketSize());
-      Assert.assertEquals(Long.parseLong(maxRetryInterval), cf.getMaxRetryInterval());
-      Assert.assertEquals(Integer.parseInt(producerMaxRate), cf.getProducerMaxRate());
-      Assert.assertEquals(Integer.parseInt(producerWindowSize), cf.getProducerWindowSize());
-      Assert.assertEquals(Integer.parseInt(reconnectAttempts), cf.getReconnectAttempts());
-      Assert.assertEquals(Long.parseLong(retryInterval), cf.getRetryInterval());
-      Assert.assertEquals(Double.parseDouble(retryIntervalMultiplier), cf.getRetryIntervalMultiplier(), 0.0001);
-      Assert.assertEquals(Integer.parseInt(scheduledThreadPoolMaxSize), cf.getScheduledThreadPoolMaxSize());
-      Assert.assertEquals(Integer.parseInt(threadPoolMaxSize), cf.getThreadPoolMaxSize());
-      Assert.assertEquals(Integer.parseInt(transactionBatchSize), cf.getTransactionBatchSize());
-      Assert.assertEquals(Boolean.parseBoolean(autoGroup), cf.isAutoGroup());
-      Assert.assertEquals(Boolean.parseBoolean(blockOnAcknowledge), cf.isBlockOnAcknowledge());
-      Assert.assertEquals(Boolean.parseBoolean(blockOnDurableSend), cf.isBlockOnDurableSend());
-      Assert.assertEquals(Boolean.parseBoolean(blockOnNonDurableSend), cf.isBlockOnNonDurableSend());
-      Assert.assertEquals(Boolean.parseBoolean(cacheLargeMessagesClient), cf.isCacheLargeMessagesClient());
-      Assert.assertEquals(Boolean.parseBoolean(compressLargeMessage), cf.isCompressLargeMessage());
-      Assert.assertEquals(Boolean.parseBoolean(failoverOnInitialConnection), cf.isFailoverOnInitialConnection());
-      Assert.assertEquals(Boolean.parseBoolean(preAcknowledge), cf.isPreAcknowledge());
-      Assert.assertEquals(Boolean.parseBoolean(useGlobalPools), cf.isUseGlobalPools());
+      Assert.assertEquals(true, cf.isHA());
    }
 
    @Test
-   public void testRemoteCFWithTCP() throws NamingException, JMSException
+   public void testRemoteCFWithJGroups() throws Exception
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
+      props.put("connectionFactory.myConnectionFactory", "jgroups://mychannelid?file=test-jgroups-file_ping.xml");
       Context ctx = new InitialContext(props);
 
-      ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("myConnectionFactory");
-
-      connectionFactory.createConnection().close();
+      ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
+      connectionFactory.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory().createBroadcastEndpoint().close(false);
    }
 
    @Test
-   public void testRemoteCFWithTCPandHA() throws NamingException, JMSException
+   public void testRemoteCFWithJgroupsWithTransportConfigFile() throws Exception
    {
-      boolean ha = true;
-
       Hashtable props = new Hashtable<>();
-      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
-      props.put("connection.myConnectionFactory.ha", ha);
+      props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
+      props.put("connectionFactory.myConnectionFactory", "jgroups://testChannelName?file=test-jgroups-file_ping.xml&" +
+         ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
+         ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
       Context ctx = new InitialContext(props);
 
       ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
 
-      Assert.assertEquals(ha, cf.isHA());
+      DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration();
+      Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
+      Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());
+
+      BroadcastEndpoint broadcastEndpoint = cf.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory().createBroadcastEndpoint();
+      Assert.assertTrue(broadcastEndpoint instanceof JGroupsFileBroadcastEndpoint);
+      broadcastEndpoint.close(false);
    }
 
    @Test
-   public void testRemoteCFWithJGroups() throws Exception
+   public void testRemoteCFWithJgroupsWithTransportConfigProps() throws Exception
    {
       Hashtable props = new Hashtable<>();
-      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(Context.PROVIDER_URL, "jgroups://test-jgroups-file_ping.xml/");
+      props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
+      props.put("connectionFactory.ConnectionFactory", "jgroups://testChannelName?properties=param=value&" +
+                                      ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
+                                      ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
       Context ctx = new InitialContext(props);
 
-      ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) ctx.lookup("ConnectionFactory");
-      connectionFactory.getDiscoveryGroupConfiguration().getBroadcastEndpointFactoryConfiguration().createBroadcastEndpointFactory().createBroadcastEndpoint().close(false);
+      ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("ConnectionFactory");
+
+      DiscoveryGroupConfiguration discoveryGroupConfiguration = cf.getDiscoveryGroupConfiguration();
+      Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
+      Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());
+
+      BroadcastEndpointFactory broadcastEndpointFactory = cf.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory();
+      Assert.assertTrue(broadcastEndpointFactory instanceof JGroupsPropertiesBroadcastEndpointFactory);
+      JGroupsPropertiesBroadcastEndpointFactory endpointFactory =  (JGroupsPropertiesBroadcastEndpointFactory) broadcastEndpointFactory;
+      Assert.assertEquals(endpointFactory.getProperties(), "param=value");
+      Assert.assertEquals(endpointFactory.getChannelName(), "testChannelName");
    }
 
+
+
    @Test
-   public void testRemoteCFWithJgroupsWithTransportConfig() throws Exception
+   public void testRemoteCFWithJgroupsWithTransportConfigNullProps() throws Exception
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
-      props.put(Context.PROVIDER_URL, "jgroups://test-jgroups-file_ping.xml?" +
-         ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
-         ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
+      props.put("connectionFactory.ConnectionFactory", "jgroups://testChannelName?" +
+                                      ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
+                                      ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
       Context ctx = new InitialContext(props);
 
       ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("ConnectionFactory");
@@ -486,16 +277,20 @@ public class SimpleJNDIClientTest extends UnitTestCase
       Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
       Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());
 
-      cf.getDiscoveryGroupConfiguration().getBroadcastEndpointFactoryConfiguration().createBroadcastEndpointFactory().createBroadcastEndpoint().close(false);
+      BroadcastEndpointFactory broadcastEndpointFactory = cf.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory();
+      Assert.assertTrue(broadcastEndpointFactory instanceof JGroupsPropertiesBroadcastEndpointFactory);
+      JGroupsPropertiesBroadcastEndpointFactory endpointFactory =  (JGroupsPropertiesBroadcastEndpointFactory) broadcastEndpointFactory;
+      Assert.assertEquals(endpointFactory.getProperties(), null);
+      Assert.assertEquals(endpointFactory.getChannelName(), "testChannelName");
    }
 
+
    @Test
    public void testRemoteCFWithUDP() throws NamingException, JMSException
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(Context.PROVIDER_URL, "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort());
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
+      props.put("connectionFactory.myConnectionFactory", "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort());
       Context ctx = new InitialContext(props);
 
       ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("myConnectionFactory");
@@ -508,12 +303,11 @@ public class SimpleJNDIClientTest extends UnitTestCase
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
-      props.put(Context.PROVIDER_URL, "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort() + "?" +
+      props.put("connectionFactory.myConnectionFactory", "udp://" + getUDPDiscoveryAddress() + ":" + getUDPDiscoveryPort() + "?" +
          TransportConstants.LOCAL_ADDRESS_PROP_NAME + "=127.0.0.1&" +
          TransportConstants.LOCAL_PORT_PROP_NAME + "=1198&" +
          ActiveMQInitialContextFactory.REFRESH_TIMEOUT + "=5000&" +
          ActiveMQInitialContextFactory.DISCOVERY_INITIAL_WAIT_TIMEOUT + "=6000");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
       Context ctx = new InitialContext(props);
 
       ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
@@ -522,11 +316,12 @@ public class SimpleJNDIClientTest extends UnitTestCase
       Assert.assertEquals(5000, discoveryGroupConfiguration.getRefreshTimeout());
       Assert.assertEquals(6000, discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout());
 
-      UDPBroadcastGroupConfiguration udpBroadcastGroupConfiguration = (UDPBroadcastGroupConfiguration) discoveryGroupConfiguration.getBroadcastEndpointFactoryConfiguration();
-      Assert.assertEquals("127.0.0.1", udpBroadcastGroupConfiguration.getLocalBindAddress());
-      Assert.assertEquals(1198, udpBroadcastGroupConfiguration.getLocalBindPort());
-      Assert.assertEquals(getUDPDiscoveryAddress(), udpBroadcastGroupConfiguration.getGroupAddress());
-      Assert.assertEquals(getUDPDiscoveryPort(), udpBroadcastGroupConfiguration.getGroupPort());
+      UDPBroadcastEndpointFactory udpBroadcastEndpointFactory = (UDPBroadcastEndpointFactory) discoveryGroupConfiguration.getBroadcastEndpointFactory();
+      //these 2 are transient so are ignored
+      Assert.assertEquals(null, udpBroadcastEndpointFactory.getLocalBindAddress());
+      Assert.assertEquals(-1, udpBroadcastEndpointFactory.getLocalBindPort());
+      Assert.assertEquals(getUDPDiscoveryAddress(), udpBroadcastEndpointFactory.getGroupAddress());
+      Assert.assertEquals(getUDPDiscoveryPort(), udpBroadcastEndpointFactory.getGroupPort());
    }
 
    @Test
@@ -534,8 +329,7 @@ public class SimpleJNDIClientTest extends UnitTestCase
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445,127.0.0.2:5446");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
+      props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:5445/httpEnabled=true&foo=bar,tcp://127.0.0.2:5446?httpEnabled=false?clientID=myClientID");
       Context ctx = new InitialContext(props);
 
       ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("myConnectionFactory");
@@ -548,7 +342,7 @@ public class SimpleJNDIClientTest extends UnitTestCase
    {
       Hashtable props = new Hashtable<>();
       props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445?" +
+      props.put("connectionFactory.myConnectionFactory", "tcp://127.0.0.1:5445?" +
          TransportConstants.SSL_ENABLED_PROP_NAME + "=mySSLEnabledPropValue&" +
          TransportConstants.HTTP_ENABLED_PROP_NAME + "=myHTTPEnabledPropValue&" +
          TransportConstants.HTTP_CLIENT_IDLE_PROP_NAME + "=myHTTPClientIdlePropValue&" +
@@ -578,7 +372,6 @@ public class SimpleJNDIClientTest extends UnitTestCase
          ActiveMQDefaultConfiguration.getPropMaskPassword() + "=myPropMaskPassword&" +
          ActiveMQDefaultConfiguration.getPropPasswordCodec() + "=myPropPasswordCodec&" +
          TransportConstants.NETTY_CONNECT_TIMEOUT + "=myNettyConnectTimeout&");
-      props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, "myConnectionFactory");
       Context ctx = new InitialContext(props);
 
       ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory) ctx.lookup("myConnectionFactory");
@@ -634,7 +427,7 @@ public class SimpleJNDIClientTest extends UnitTestCase
       connectorNames.add(liveTC.getName());
 
       Map params = new HashMap();
-      params.put("server-id", 1);
+      params.put(org.apache.activemq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, 1);
 
       Configuration liveConf = createBasicConfig()
          .addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY))
@@ -653,10 +446,10 @@ public class SimpleJNDIClientTest extends UnitTestCase
          .setName(bcGroupName)
          .setBroadcastPeriod(broadcastPeriod)
          .setConnectorInfos(connectorNames)
-         .setEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-                                             .setGroupAddress(groupAddress)
-                                             .setGroupPort(groupPort)
-                                             .setLocalBindPort(localBindPort));
+         .setEndpointFactory(new UDPBroadcastEndpointFactory()
+                                   .setGroupAddress(groupAddress)
+                                   .setGroupPort(groupPort)
+                                   .setLocalBindPort(localBindPort));
 
       List<BroadcastGroupConfiguration> bcConfigs1 = new ArrayList<BroadcastGroupConfiguration>();
       bcConfigs1.add(bcConfig1);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ConnectionFactorySerializationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ConnectionFactorySerializationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ConnectionFactorySerializationTest.java
index 7b75c6a..37b0dc3 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ConnectionFactorySerializationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ConnectionFactorySerializationTest.java
@@ -16,22 +16,35 @@
  */
 package org.apache.activemq.tests.integration.jms.connection;
 
+import java.beans.PropertyDescriptor;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.JGroupsFileBroadcastEndpointFactory;
+import org.apache.activemq.api.core.JGroupsPropertiesBroadcastEndpointFactory;
+import org.apache.activemq.api.core.TransportConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.jms.JMSFactoryType;
+import org.apache.activemq.core.remoting.impl.netty.TransportConstants;
 import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.jms.server.config.ConnectionFactoryConfiguration;
+import org.apache.activemq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
 import org.apache.activemq.tests.util.JMSTestBase;
+import org.apache.activemq.tests.util.RandomUtil;
+import org.apache.commons.beanutils.BeanUtilsBean;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -53,57 +66,297 @@ public class ConnectionFactorySerializationTest extends JMSTestBase
    @Before
    public void setUp() throws Exception
    {
-      try
-      {
-         super.setUp();
-         // Deploy a connection factory with discovery
-         List<String> bindings = new ArrayList<String>();
-         bindings.add("MyConnectionFactory");
-         final String groupAddress = getUDPDiscoveryAddress();
-         final int port = getUDPDiscoveryPort();
-         String localBindAddress = getLocalHost().getHostAddress();
-
-         UDPBroadcastGroupConfiguration config = new UDPBroadcastGroupConfiguration()
-            .setGroupAddress(groupAddress)
-            .setGroupPort(port)
-            .setLocalBindAddress(localBindAddress)
-            .setLocalBindPort(8580);
-
-         DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration()
-            .setName("dg1")
-            .setRefreshTimeout(5000)
-            .setDiscoveryInitialWaitTimeout(5000)
-            .setBroadcastEndpointFactoryConfiguration(config);
+      super.setUp();
+   }
 
-         jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
+   // Public --------------------------------------------------------
 
-         jmsServer.createConnectionFactory("MyConnectionFactory",
-                                           false,
-                                           JMSFactoryType.CF,
-                                           dcConfig.getName(),
-                                           "/MyConnectionFactory");
-      }
-      catch (Exception e)
-      {
-         e.printStackTrace();
-      }
+   @Test
+   public void testConnectionFactoryUDP() throws Exception
+   {
+      createDiscoveryFactoryUDP();
+      cf = (ActiveMQConnectionFactory) namingContext.lookup("/MyConnectionFactory");
 
+      // apparently looking up the connection factory with the org.apache.activemq.jms.tests.tools.container.InVMInitialContextFactory
+      // is not enough to actually serialize it so we serialize it manually
+      byte[] x = serialize(cf);
+      ActiveMQConnectionFactory y = deserialize(x, ActiveMQConnectionFactory.class);
+      checkEquals(cf, y);
+      DiscoveryGroupConfiguration dgc = y.getDiscoveryGroupConfiguration();
+      Assert.assertEquals(dgc.getName(), "dg1");
+      Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5000);
+      Assert.assertEquals(dgc.getRefreshTimeout(), 5000);
+      Assert.assertTrue(dgc.getBroadcastEndpointFactory() instanceof UDPBroadcastEndpointFactory);
+      UDPBroadcastEndpointFactory befc = (UDPBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
+      Assert.assertEquals(-1, befc.getLocalBindPort());
+      Assert.assertEquals(null, befc.getLocalBindAddress());
+      Assert.assertEquals(1234, befc.getGroupPort());
+      Assert.assertEquals("1.2.3.4", befc.getGroupAddress());
    }
 
-   // Public --------------------------------------------------------
+   @Test
+   public void testConnectionFactoryJgroupsFile() throws Exception
+   {
+      createDiscoveryFactoryJGroupsFile();
+      cf = (ActiveMQConnectionFactory) namingContext.lookup("/MyConnectionFactory");
+
+      // apparently looking up the connection factory with the org.apache.activemq.jms.tests.tools.container.InVMInitialContextFactory
+      // is not enough to actually serialize it so we serialize it manually
+      byte[] x = serialize(cf);
+      ActiveMQConnectionFactory y = deserialize(x, ActiveMQConnectionFactory.class);
+      checkEquals(cf, y);
+      DiscoveryGroupConfiguration dgc = y.getDiscoveryGroupConfiguration();
+      Assert.assertEquals(dgc.getName(), "dg1");
+      Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5000);
+      Assert.assertEquals(dgc.getRefreshTimeout(), 5000);
+      Assert.assertTrue(dgc.getBroadcastEndpointFactory() instanceof JGroupsFileBroadcastEndpointFactory);
+      JGroupsFileBroadcastEndpointFactory befc = (JGroupsFileBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
+      Assert.assertEquals("myChannel", befc.getChannelName());
+      Assert.assertEquals("/META-INF/myfile.xml", befc.getFile());
+   }
 
    @Test
-   public void testNullLocalBindAddress() throws Exception
+   public void testConnectionFactoryJgroupsProperties() throws Exception
    {
+      createDiscoveryFactoryJGroupsProperties();
       cf = (ActiveMQConnectionFactory) namingContext.lookup("/MyConnectionFactory");
 
       // apparently looking up the connection factory with the org.apache.activemq.jms.tests.tools.container.InVMInitialContextFactory
       // is not enough to actually serialize it so we serialize it manually
       byte[] x = serialize(cf);
       ActiveMQConnectionFactory y = deserialize(x, ActiveMQConnectionFactory.class);
-      Assert.assertEquals(null, ((UDPBroadcastGroupConfiguration) y.getDiscoveryGroupConfiguration().getBroadcastEndpointFactoryConfiguration()).getLocalBindAddress());
+      checkEquals(cf, y);
+      DiscoveryGroupConfiguration dgc = y.getDiscoveryGroupConfiguration();
+      Assert.assertEquals(dgc.getName(), "dg1");
+      Assert.assertEquals(dgc.getDiscoveryInitialWaitTimeout(), 5000);
+      Assert.assertEquals(dgc.getRefreshTimeout(), 5000);
+      Assert.assertTrue(dgc.getBroadcastEndpointFactory() instanceof JGroupsPropertiesBroadcastEndpointFactory);
+      JGroupsPropertiesBroadcastEndpointFactory befc = (JGroupsPropertiesBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
+      Assert.assertEquals("myChannel", befc.getChannelName());
+      Assert.assertEquals("param=1,param2=2", befc.getProperties());
    }
 
+   @Test
+   public void testConnectionFactoryStatic1() throws Exception
+   {
+      createStaticFactory(true);
+      cf = (ActiveMQConnectionFactory) namingContext.lookup("/MyConnectionFactory");
+
+      // apparently looking up the connection factory with the org.apache.activemq.jms.tests.tools.container.InVMInitialContextFactory
+      // is not enough to actually serialize it so we serialize it manually
+      byte[] x = serialize(cf);
+      ActiveMQConnectionFactory y = deserialize(x, ActiveMQConnectionFactory.class);
+      checkEquals(cf, y);
+      TransportConfiguration[] staticConnectors = y.getStaticConnectors();
+      Assert.assertEquals(staticConnectors.length, 2);
+      TransportConfiguration tc0 = cf.getStaticConnectors()[0];
+      TransportConfiguration y0 = y.getStaticConnectors()[0];
+      Map<String, Object> ctParams = tc0.getParams();
+      Map<String, Object> y0Params = y0.getParams();
+      Assert.assertEquals(ctParams.size(), y0Params.size());
+      for (String key : y0Params.keySet())
+      {
+         Assert.assertEquals(ctParams.get(key), y0Params.get(key));
+      }
+   }
+
+   private void createDiscoveryFactoryUDP() throws Exception
+   {
+      // Deploy a connection factory with discovery
+      List<String> bindings = new ArrayList<String>();
+      bindings.add("MyConnectionFactory");
+      final String groupAddress = "1.2.3.4";
+      final int port = 1234;
+      String localBindAddress = getLocalHost().getHostAddress();
+
+      UDPBroadcastEndpointFactory config = new UDPBroadcastEndpointFactory()
+         .setGroupAddress(groupAddress)
+         .setGroupPort(port)
+         .setLocalBindAddress(localBindAddress)
+         .setLocalBindPort(8580);
+
+      DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration()
+         .setName("dg1")
+         .setRefreshTimeout(5000)
+         .setDiscoveryInitialWaitTimeout(5000)
+         .setBroadcastEndpointFactory(config);
+
+      jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
+
+      jmsServer.createConnectionFactory("MyConnectionFactory",
+                                        false,
+                                        JMSFactoryType.CF,
+                                        dcConfig.getName(),
+                                        "/MyConnectionFactory");
+   }
+
+   private void createDiscoveryFactoryJGroupsFile() throws Exception
+   {
+      // Deploy a connection factory with discovery
+      List<String> bindings = new ArrayList<String>();
+      bindings.add("MyConnectionFactory");
+
+      JGroupsFileBroadcastEndpointFactory config = new JGroupsFileBroadcastEndpointFactory()
+            .setChannelName("myChannel")
+            .setFile("/META-INF/myfile.xml");
+
+      DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration()
+            .setName("dg1")
+         .setRefreshTimeout(5000)
+         .setDiscoveryInitialWaitTimeout(5000)
+         .setBroadcastEndpointFactory(config);
+
+      jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
+
+      jmsServer.createConnectionFactory("MyConnectionFactory",
+                                        false,
+                                        JMSFactoryType.CF,
+                                        dcConfig.getName(),
+                                        "/MyConnectionFactory");
+   }
+
+   private void createDiscoveryFactoryJGroupsProperties() throws Exception
+   {
+      // Deploy a connection factory with discovery
+      List<String> bindings = new ArrayList<String>();
+      bindings.add("MyConnectionFactory");
+
+      JGroupsPropertiesBroadcastEndpointFactory config = new JGroupsPropertiesBroadcastEndpointFactory()
+            .setChannelName("myChannel")
+            .setProperties("param=1,param2=2");
+
+      DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration()
+            .setName("dg1")
+         .setRefreshTimeout(5000)
+         .setDiscoveryInitialWaitTimeout(5000)
+         .setBroadcastEndpointFactory(config);
+
+      jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
+
+      jmsServer.createConnectionFactory("MyConnectionFactory",
+                                        false,
+                                        JMSFactoryType.CF,
+                                        dcConfig.getName(),
+                                        "/MyConnectionFactory");
+   }
+
+   private void createStaticFactory(boolean b) throws Exception
+   {
+      HashMap<String, Object> params = new HashMap<>();
+      Set<String> allowableConnectorKeys = TransportConstants.ALLOWABLE_CONNECTOR_KEYS;
+      for (String allowableConnectorKey : allowableConnectorKeys)
+      {
+         String value = RandomUtil.randomString();
+         params.put(allowableConnectorKey, value);
+      }
+      params.put("host", "localhost0");
+      params.put("port", "1234");
+
+      TransportConfiguration main = new TransportConfiguration(NETTY_CONNECTOR_FACTORY, params);
+
+      jmsServer.getActiveMQServer().getConfiguration().getConnectorConfigurations().put(main.getName(), main);
+
+      HashMap<String, Object> params2 = new HashMap<>();
+      for (String allowableConnectorKey : allowableConnectorKeys)
+      {
+         String value = RandomUtil.randomString();
+         params2.put(allowableConnectorKey, value);
+      }
+      params2.put("host", "localhost1");
+      params2.put("port", "5678");
+
+      TransportConfiguration main2 = new TransportConfiguration(NETTY_CONNECTOR_FACTORY, params2);
+
+      jmsServer.getActiveMQServer().getConfiguration().getConnectorConfigurations().put(main2.getName(), main2);
+
+      ArrayList<String> connectorNames = new ArrayList<String>();
+      connectorNames.add(main.getName());
+      connectorNames.add(main2.getName());
+      ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl()
+            .setName("MyConnectionFactory")
+            .setHA(b)
+            .setConnectorNames(connectorNames)
+            .setClientID("clientID")
+            .setClientFailureCheckPeriod(-1)
+            .setConnectionTTL(-2)
+            .setFactoryType(JMSFactoryType.CF)
+            .setCallTimeout(-3)
+            .setCallFailoverTimeout(-4)
+            .setCacheLargeMessagesClient(b)
+            .setMinLargeMessageSize(-5)
+            .setConsumerWindowSize(-6)
+            .setConsumerMaxRate(-7)
+            .setConfirmationWindowSize(-8)
+            .setProducerWindowSize(-9)
+            .setProducerMaxRate(-10)
+            .setBlockOnAcknowledge(b)
+            .setBlockOnDurableSend(b)
+            .setBlockOnNonDurableSend(b)
+            .setAutoGroup(b)
+            .setPreAcknowledge(b)
+            .setLoadBalancingPolicyClassName("foobar")
+            .setTransactionBatchSize(-11)
+            .setDupsOKBatchSize(-12)
+            .setUseGlobalPools(b)
+            .setScheduledThreadPoolMaxSize(-13)
+            .setThreadPoolMaxSize(-14)
+            .setRetryInterval(-15)
+            .setRetryIntervalMultiplier(-16)
+            .setMaxRetryInterval(-17)
+            .setReconnectAttempts(-18)
+            .setFailoverOnInitialConnection(b)
+            .setGroupID("groupID");
+
+      jmsServer.createConnectionFactory(false, configuration, "/MyConnectionFactory");
+   }
+
+   private void populate(StringBuilder sb, BeanUtilsBean bean, ActiveMQConnectionFactory factory) throws IllegalAccessException, InvocationTargetException
+   {
+      PropertyDescriptor[] descriptors = bean.getPropertyUtils().getPropertyDescriptors(factory);
+      for (PropertyDescriptor descriptor : descriptors)
+      {
+         if (descriptor.getWriteMethod() != null && descriptor.getReadMethod() != null)
+         {
+            if (descriptor.getPropertyType() == String.class)
+            {
+               String value = RandomUtil.randomString();
+               bean.setProperty(factory, descriptor.getName(), value);
+               sb.append("&").append(descriptor.getName()).append("=").append(value);
+            }
+            else if (descriptor.getPropertyType() == int.class)
+            {
+               int value = RandomUtil.randomPositiveInt();
+               bean.setProperty(factory, descriptor.getName(), value);
+               sb.append("&").append(descriptor.getName()).append("=").append(value);
+            }
+            else if (descriptor.getPropertyType() == long.class)
+            {
+               long value = RandomUtil.randomPositiveLong();
+               bean.setProperty(factory, descriptor.getName(), value);
+               sb.append("&").append(descriptor.getName()).append("=").append(value);
+            }
+            else if (descriptor.getPropertyType() == double.class)
+            {
+               double value = RandomUtil.randomDouble();
+               bean.setProperty(factory, descriptor.getName(), value);
+               sb.append("&").append(descriptor.getName()).append("=").append(value);
+            }
+         }
+      }
+   }
+
+   private static void checkEquals(Object factory, Object factory2) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
+   {
+      BeanUtilsBean bean = new BeanUtilsBean();
+      PropertyDescriptor[] descriptors = bean.getPropertyUtils().getPropertyDescriptors(factory);
+      for (PropertyDescriptor descriptor : descriptors)
+      {
+         if (descriptor.getWriteMethod() != null && descriptor.getReadMethod() != null)
+         {
+            Assert.assertEquals(descriptor.getName() + " incorrect", bean.getProperty(factory, descriptor.getName()),bean.getProperty(factory2, descriptor.getName()));
+         }
+      }
+   }
    private static <T extends Serializable> byte[] serialize(T obj) throws IOException
    {
       ByteArrayOutputStream baos = new ByteArrayOutputStream();

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ConnectionFactoryWithJGroupsSerializationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ConnectionFactoryWithJGroupsSerializationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ConnectionFactoryWithJGroupsSerializationTest.java
index ab643ec..6a033c0 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ConnectionFactoryWithJGroupsSerializationTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/connection/ConnectionFactoryWithJGroupsSerializationTest.java
@@ -25,9 +25,10 @@ import java.io.Serializable;
 
 import javax.jms.Queue;
 
-import org.apache.activemq.api.core.BroadcastEndpointFactoryConfiguration;
+import org.apache.activemq.api.core.BroadcastEndpointFactory;
+import org.apache.activemq.api.core.ChannelBroadcastEndpointFactory;
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
-import org.apache.activemq.api.core.JGroupsBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.JGroupsFileBroadcastEndpointFactory;
 import org.apache.activemq.api.jms.JMSFactoryType;
 import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
 import org.apache.activemq.tests.util.JMSTestBase;
@@ -93,20 +94,22 @@ public class ConnectionFactoryWithJGroupsSerializationTest extends JMSTestBase
          String channelName1 = "channel1";
          String channelName2 = "channel2";
 
-         JGroupsBroadcastGroupConfiguration jgroupsBroadcastCfg1 = new JGroupsBroadcastGroupConfiguration(channel, channelName1);
-         JGroupsBroadcastGroupConfiguration jgroupsBroadcastCfg2 = new JGroupsBroadcastGroupConfiguration(jgroupsConfigString, channelName2);
+         BroadcastEndpointFactory jgroupsBroadcastCfg1 = new ChannelBroadcastEndpointFactory(channel, channelName1);
+         BroadcastEndpointFactory jgroupsBroadcastCfg2 = new JGroupsFileBroadcastEndpointFactory()
+               .setChannelName(channelName2)
+               .setFile(jgroupsConfigString);
 
          DiscoveryGroupConfiguration dcConfig1 = new DiscoveryGroupConfiguration()
             .setName("dg1")
             .setRefreshTimeout(5000)
             .setDiscoveryInitialWaitTimeout(5000)
-            .setBroadcastEndpointFactoryConfiguration(jgroupsBroadcastCfg1);
+            .setBroadcastEndpointFactory(jgroupsBroadcastCfg1);
 
          DiscoveryGroupConfiguration dcConfig2 = new DiscoveryGroupConfiguration()
             .setName("dg2")
             .setRefreshTimeout(5000)
             .setDiscoveryInitialWaitTimeout(5000)
-            .setBroadcastEndpointFactoryConfiguration(jgroupsBroadcastCfg2);
+            .setBroadcastEndpointFactory(jgroupsBroadcastCfg2);
 
          jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig1.getName(), dcConfig1);
          jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig2.getName(), dcConfig2);
@@ -160,8 +163,8 @@ public class ConnectionFactoryWithJGroupsSerializationTest extends JMSTestBase
       byte[] x = serialize(jmsCf2);
       ActiveMQConnectionFactory jmsCf2Copy = deserialize(x, ActiveMQConnectionFactory.class);
       assertNotNull(jmsCf2Copy);
-      BroadcastEndpointFactoryConfiguration broadcastEndpoint = jmsCf2Copy.getDiscoveryGroupConfiguration().getBroadcastEndpointFactoryConfiguration();
-      assertTrue(broadcastEndpoint instanceof JGroupsBroadcastGroupConfiguration);
+      BroadcastEndpointFactory broadcastEndpoint = jmsCf2Copy.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory();
+      assertTrue(broadcastEndpoint instanceof JGroupsFileBroadcastEndpointFactory);
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/jms/server/JMSServerDeployerTest.java
----------------------------------------------------------------------
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 c3b3de3..2ebaf0e 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
@@ -22,7 +22,7 @@ import javax.naming.Context;
 
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.core.config.Configuration;
 import org.apache.activemq.core.registry.JndiBindingRegistry;
 import org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory;
@@ -126,10 +126,10 @@ public class JMSServerDeployerTest extends ServiceTestBase
          .setName("mygroup")
          .setRefreshTimeout(5432)
          .setDiscoveryInitialWaitTimeout(5432)
-         .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-                                                      .setGroupAddress("243.7.7.7")
-                                                      .setGroupPort(12345)
-                                                      .setLocalBindAddress("172.16.8.10"));
+         .setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory()
+                                            .setGroupAddress("243.7.7.7")
+                                            .setGroupPort(12345)
+                                            .setLocalBindAddress("172.16.8.10"));
 
       config = createBasicConfig()
          .addConnectorConfiguration("netty", new TransportConfiguration(NettyConnectorFactory.class.getName()))

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ActiveMQServerControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ActiveMQServerControlTest.java
index 3016d05..806a3fa 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ActiveMQServerControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ActiveMQServerControlTest.java
@@ -42,6 +42,7 @@ import org.apache.activemq.core.config.Configuration;
 import org.apache.activemq.core.messagecounter.impl.MessageCounterManagerImpl;
 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.invm.TransportConstants;
 import org.apache.activemq.core.server.ActiveMQServer;
 import org.apache.activemq.core.server.ActiveMQServers;
 import org.apache.activemq.core.settings.impl.SlowConsumerPolicy;
@@ -1019,7 +1020,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase
       conf.setSecurityEnabled(false);
       conf.getAcceptorConfigurations().clear();
       HashMap<String, Object> params = new HashMap<String, Object>();
-      params.put("server-id", "2");
+      params.put(TransportConstants.SERVER_ID_PROP_NAME, "2");
       conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName(), params));
       ActiveMQServer server2 = ActiveMQServers.newActiveMQServer(conf, null, true);
       this.conf.getConnectorConfigurations().clear();

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/BroadcastGroupControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/BroadcastGroupControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/BroadcastGroupControlTest.java
index 3462601..ccd41b8 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/BroadcastGroupControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/BroadcastGroupControlTest.java
@@ -25,7 +25,7 @@ import org.junit.Assert;
 
 import org.apache.activemq.api.core.BroadcastGroupConfiguration;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.management.BroadcastGroupControl;
 import org.apache.activemq.core.config.Configuration;
 import org.apache.activemq.core.server.ActiveMQServer;
@@ -50,10 +50,10 @@ public class BroadcastGroupControlTest extends ManagementTestBase
          .setName(RandomUtil.randomString())
          .setBroadcastPeriod(RandomUtil.randomPositiveInt())
          .setConnectorInfos(connectorInfos)
-         .setEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-            .setGroupAddress("231.7.7.7")
-            .setGroupPort(1199)
-            .setLocalBindPort(1198));
+         .setEndpointFactory(new UDPBroadcastEndpointFactory()
+                                   .setGroupAddress("231.7.7.7")
+                                   .setGroupPort(1199)
+                                   .setLocalBindPort(1198));
    }
 
    public static Pair<String, String> randomPair()
@@ -82,7 +82,7 @@ public class BroadcastGroupControlTest extends ManagementTestBase
 
       BroadcastGroupControl broadcastGroupControl = createManagementControl(broadcastGroupConfig.getName());
 
-      UDPBroadcastGroupConfiguration udpCfg = (UDPBroadcastGroupConfiguration) broadcastGroupConfig.getEndpointFactoryConfiguration();
+      UDPBroadcastEndpointFactory udpCfg = (UDPBroadcastEndpointFactory) broadcastGroupConfig.getEndpointFactory();
       Assert.assertEquals(broadcastGroupConfig.getName(), broadcastGroupControl.getName());
       Assert.assertEquals(udpCfg.getGroupAddress(), broadcastGroupControl.getGroupAddress());
       Assert.assertEquals(udpCfg.getGroupPort(), broadcastGroupControl.getGroupPort());

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ClusterConnectionControl2Test.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ClusterConnectionControl2Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ClusterConnectionControl2Test.java
index 93f6e63..8c4341c 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ClusterConnectionControl2Test.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ClusterConnectionControl2Test.java
@@ -33,7 +33,7 @@ import org.junit.Assert;
 import org.apache.activemq.api.core.BroadcastGroupConfiguration;
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.management.ClusterConnectionControl;
 import org.apache.activemq.core.config.ClusterConnectionConfiguration;
 import org.apache.activemq.core.config.Configuration;
@@ -133,17 +133,17 @@ public class ClusterConnectionControl2Test extends ManagementTestBase
          .setName(discoveryName)
          .setBroadcastPeriod(250)
          .setConnectorInfos(connectorInfos)
-         .setEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-            .setGroupAddress(groupAddress)
-            .setGroupPort(groupPort));
+         .setEndpointFactory(new UDPBroadcastEndpointFactory()
+                                   .setGroupAddress(groupAddress)
+                                   .setGroupPort(groupPort));
 
       DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration()
          .setName(discoveryName)
          .setRefreshTimeout(0)
          .setDiscoveryInitialWaitTimeout(0)
-         .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-            .setGroupAddress(groupAddress)
-            .setGroupPort(groupPort));
+         .setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory()
+                                            .setGroupAddress(groupAddress)
+                                            .setGroupPort(groupPort));
 
       clusterConnectionConfig_0 = new ClusterConnectionConfiguration()
          .setName(clusterName)

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ClusterConnectionControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ClusterConnectionControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ClusterConnectionControlTest.java
index c787678..041cd3e 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ClusterConnectionControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/management/ClusterConnectionControlTest.java
@@ -31,7 +31,7 @@ import org.junit.Assert;
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.api.core.SimpleString;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.management.ClusterConnectionControl;
 import org.apache.activemq.api.core.management.CoreNotificationType;
 import org.apache.activemq.api.core.management.ObjectNameBuilder;
@@ -236,9 +236,9 @@ public class ClusterConnectionControlTest extends ManagementTestBase
          .setName(discoveryGroupName)
          .setRefreshTimeout(500)
          .setDiscoveryInitialWaitTimeout(0)
-         .setBroadcastEndpointFactoryConfiguration(new UDPBroadcastGroupConfiguration()
-                                                      .setGroupAddress("230.1.2.3")
-                                                      .setGroupPort(6745));
+         .setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory()
+                                            .setGroupAddress("230.1.2.3")
+                                            .setGroupPort(6745));
 
       Configuration conf_1 = createBasicConfig()
          .addAcceptorConfiguration(acceptorConfig)

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRAClusteredTestBase.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRAClusteredTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRAClusteredTestBase.java
index b33e43d..aeccc02 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRAClusteredTestBase.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ActiveMQRAClusteredTestBase.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
 import org.apache.activemq.api.core.TransportConfiguration;
 import org.apache.activemq.core.config.Configuration;
 import org.apache.activemq.core.config.impl.ConfigurationImpl;
+import org.apache.activemq.core.remoting.impl.invm.TransportConstants;
 import org.apache.activemq.core.server.ActiveMQServer;
 import org.apache.activemq.core.server.ActiveMQServers;
 import org.apache.activemq.jms.server.impl.JMSServerManagerImpl;
@@ -42,7 +43,7 @@ public class ActiveMQRAClusteredTestBase extends ActiveMQRATestBase
 
       primaryConnector = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
       HashMap<String, Object> params = new HashMap();
-      params.put("server-id", "1");
+      params.put(TransportConstants.SERVER_ID_PROP_NAME, "1");
       secondaryConnector = new TransportConfiguration(INVM_CONNECTOR_FACTORY, params);
       Configuration conf = createSecondaryDefaultConfig(true, true);
 
@@ -77,7 +78,7 @@ public class ActiveMQRAClusteredTestBase extends ActiveMQRATestBase
 
       if (secondary)
       {
-         invmMap.put("server-id", "1");
+         invmMap.put(TransportConstants.SERVER_ID_PROP_NAME, "1");
          nettyMap.put("port", "5545");
          primaryConnectorName = "invm";
          secondaryConnectorName = "invm2";


[2/8] activemq-6 git commit: ACTIVEMQ6-7 - Improve Serialization on Connection Factory

Posted by cl...@apache.org.
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ResourceAdapterTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ResourceAdapterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ResourceAdapterTest.java
index 74f2ef1..1b33cc6 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ResourceAdapterTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/ra/ResourceAdapterTest.java
@@ -27,7 +27,7 @@ import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.client.ClientSession;
 import org.apache.activemq.api.core.client.ClientSessionFactory;
 import org.apache.activemq.api.core.client.ServerLocator;
@@ -303,7 +303,7 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
       ActiveMQConnectionFactory factory = adapter.getDefaultActiveMQConnectionFactory();
       long initWait = factory.getDiscoveryGroupConfiguration().getDiscoveryInitialWaitTimeout();
       long refresh = factory.getDiscoveryGroupConfiguration().getRefreshTimeout();
-      int port = ((UDPBroadcastGroupConfiguration) factory.getDiscoveryGroupConfiguration().getBroadcastEndpointFactoryConfiguration()).getGroupPort();
+      int port = ((UDPBroadcastEndpointFactory) factory.getDiscoveryGroupConfiguration().getBroadcastEndpointFactory()).getGroupPort();
 
       // defaults
       assertEquals(10000L, refresh);
@@ -445,7 +445,7 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
       spec.setDestination(MDBQUEUE);
       ActiveMQConnectionFactory fac = qResourceAdapter.createActiveMQConnectionFactory(spec);
       DiscoveryGroupConfiguration dc = fac.getServerLocator().getDiscoveryGroupConfiguration();
-      UDPBroadcastGroupConfiguration udpDg = (UDPBroadcastGroupConfiguration) dc.getBroadcastEndpointFactoryConfiguration();
+      UDPBroadcastEndpointFactory udpDg = (UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory();
       assertEquals(udpDg.getGroupAddress(), "231.6.6.6");
       assertEquals(udpDg.getGroupPort(), 1234);
       assertEquals(dc.getRefreshTimeout(), 1L);
@@ -475,7 +475,7 @@ public class ResourceAdapterTest extends ActiveMQRATestBase
       spec.setDiscoveryRefreshTimeout(1L);
       ActiveMQConnectionFactory fac = qResourceAdapter.createActiveMQConnectionFactory(spec);
       DiscoveryGroupConfiguration dc = fac.getServerLocator().getDiscoveryGroupConfiguration();
-      UDPBroadcastGroupConfiguration udpDg = (UDPBroadcastGroupConfiguration) dc.getBroadcastEndpointFactoryConfiguration();
+      UDPBroadcastEndpointFactory udpDg = (UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory();
       assertEquals(udpDg.getGroupAddress(), "231.6.6.6");
       assertEquals(udpDg.getGroupPort(), 1234);
       assertEquals(dc.getRefreshTimeout(), 1L);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/jms-tests/src/test/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/resources/jndi.properties b/tests/jms-tests/src/test/resources/jndi.properties
index 2bc4d9c..ee3ad0e 100644
--- a/tests/jms-tests/src/test/resources/jndi.properties
+++ b/tests/jms-tests/src/test/resources/jndi.properties
@@ -13,4 +13,5 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
\ No newline at end of file
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+connectionFactory.ConnectionFactory=vm://0
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PTPTestCase.java
----------------------------------------------------------------------
diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PTPTestCase.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PTPTestCase.java
index 7d72a3f..d49d55e 100644
--- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PTPTestCase.java
+++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PTPTestCase.java
@@ -122,8 +122,7 @@ public abstract class PTPTestCase extends JMSTestCase
 
          Hashtable props = new Hashtable<>();
          props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
-         props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, PTPTestCase.QCF_NAME);
-         props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445");
+         props.put("connectionFactory." +  PTPTestCase.QCF_NAME, "tcp://127.0.0.1:5445?type=QUEUE_CF");
          props.put("queue." + PTPTestCase.QUEUE_NAME, PTPTestCase.QUEUE_NAME);
          Context ctx = new InitialContext(props);
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java
----------------------------------------------------------------------
diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java
index fa0282b..8f6666b 100644
--- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java
+++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/PubSubTestCase.java
@@ -122,8 +122,7 @@ public abstract class PubSubTestCase extends JMSTestCase
 
          Hashtable props = new Hashtable<>();
          props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
-         props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, PubSubTestCase.TCF_NAME);
-         props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445");
+         props.put("connectionFactory." + PubSubTestCase.TCF_NAME, "tcp://127.0.0.1:5445?type=TOPIC_CF");
          props.put("topic." + PubSubTestCase.TOPIC_NAME, PubSubTestCase.TOPIC_NAME);
          Context ctx = new InitialContext(props);
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/UnifiedTestCase.java
----------------------------------------------------------------------
diff --git a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/UnifiedTestCase.java b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/UnifiedTestCase.java
index 3264bd5..70d4b5b 100644
--- a/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/UnifiedTestCase.java
+++ b/tests/joram-tests/src/test/java/org/objectweb/jtests/jms/framework/UnifiedTestCase.java
@@ -171,8 +171,9 @@ public abstract class UnifiedTestCase extends JMSTestCase
 
          Hashtable props = new Hashtable<>();
          props.put(Context.INITIAL_CONTEXT_FACTORY, ActiveMQInitialContextFactory.class.getCanonicalName());
-         props.put(ActiveMQInitialContextFactory.CONNECTION_FACTORY_NAMES, UnifiedTestCase.CF_NAME + ", " + UnifiedTestCase.QCF_NAME + ", " + UnifiedTestCase.TCF_NAME);
-         props.put(Context.PROVIDER_URL, "tcp://127.0.0.1:5445");
+         props.put("connectionFactory." + UnifiedTestCase.CF_NAME, "tcp://127.0.0.1:5445");
+         props.put("connectionFactory." + UnifiedTestCase.QCF_NAME, "tcp://127.0.0.1:5445?type=QUEUE_CF");
+         props.put("connectionFactory." + UnifiedTestCase.TCF_NAME, "tcp://127.0.0.1:5445?type=TOPIC_CF");
          props.put("queue." + UnifiedTestCase.DESTINATION_NAME, UnifiedTestCase.DESTINATION_NAME);
          props.put("queue." + UnifiedTestCase.QUEUE_NAME, UnifiedTestCase.QUEUE_NAME);
          props.put("topic." + UnifiedTestCase.TOPIC_NAME, UnifiedTestCase.TOPIC_NAME);

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/3b76ccc9/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ResourceAdapterTest.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ResourceAdapterTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ResourceAdapterTest.java
index 3d524e8..3d1a720 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ResourceAdapterTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/tests/unit/ra/ResourceAdapterTest.java
@@ -23,7 +23,7 @@ import java.util.Map;
 
 import org.apache.activemq.api.core.DiscoveryGroupConfiguration;
 import org.apache.activemq.api.core.TransportConfiguration;
-import org.apache.activemq.api.core.UDPBroadcastGroupConfiguration;
+import org.apache.activemq.api.core.UDPBroadcastEndpointFactory;
 import org.apache.activemq.api.core.client.ClientSession;
 import org.apache.activemq.api.core.client.ClientSessionFactory;
 import org.apache.activemq.api.core.client.ActiveMQClient;
@@ -279,7 +279,7 @@ public class ResourceAdapterTest extends ServiceTestBase
       ActiveMQConnectionFactory defaultFactory = ra.getDefaultActiveMQConnectionFactory();
       Assert.assertNotSame(factory, defaultFactory);
       DiscoveryGroupConfiguration dc = factory.getServerLocator().getDiscoveryGroupConfiguration();
-      UDPBroadcastGroupConfiguration udpDg = (UDPBroadcastGroupConfiguration) dc.getBroadcastEndpointFactoryConfiguration();
+      UDPBroadcastEndpointFactory udpDg = (UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory();
       Assert.assertEquals(udpDg.getLocalBindAddress(), "newAddress");
       Assert.assertEquals(udpDg.getGroupAddress(), "myhost");
       Assert.assertEquals(udpDg.getGroupPort(), 5678);