activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [35/37] activemq-6 git commit: ACTIVEMQ6-51 Example server bootstrapping
Date Wed, 10 Dec 2014 16:12:01 GMT
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/TestClusterManagerMBean.java
----------------------------------------------------------------------
diff --git a/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/TestClusterManagerMBean.java b/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/TestClusterManagerMBean.java
new file mode 100644
index 0000000..001e7a8
--- /dev/null
+++ b/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/TestClusterManagerMBean.java
@@ -0,0 +1,29 @@
+/**
+ * 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.maven;
+
+import java.io.IOException;
+
+public interface TestClusterManagerMBean
+{
+   int getNumNodes();
+
+   void registerNode(String nodeId, String workingDir,
+                     String hornetqConfigurationDirt);
+
+   void killNode(int i) throws IOException;
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/TestNode.java
----------------------------------------------------------------------
diff --git a/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/TestNode.java b/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/TestNode.java
new file mode 100644
index 0000000..ba31c50
--- /dev/null
+++ b/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/TestNode.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.maven;
+
+import java.io.File;
+import java.io.IOException;
+
+public class TestNode
+{
+   String nodeId;
+   String workingDir;
+   String configDir;
+
+   public TestNode(String nodeId, String workingDir,
+                   String configDir)
+   {
+      this.nodeId = nodeId;
+      this.workingDir = workingDir;
+      this.configDir = configDir;
+   }
+
+   public void kill() throws IOException
+   {
+      File file = new File(configDir, "KILL_ME");
+      file.createNewFile();
+      try
+      {
+         Thread.sleep(3000);
+      }
+      catch (InterruptedException e)
+      {
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/activemq-maven-plugin/src/main/java/org/apache/activemq/server/ActiveMQBootstrap.java
----------------------------------------------------------------------
diff --git a/activemq-maven-plugin/src/main/java/org/apache/activemq/server/ActiveMQBootstrap.java b/activemq-maven-plugin/src/main/java/org/apache/activemq/server/ActiveMQBootstrap.java
new file mode 100644
index 0000000..49b16c8
--- /dev/null
+++ b/activemq-maven-plugin/src/main/java/org/apache/activemq/server/ActiveMQBootstrap.java
@@ -0,0 +1,258 @@
+/**
+ * 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.server;
+
+import java.io.File;
+import java.lang.management.ManagementFactory;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.apache.activemq.core.config.Configuration;
+import org.apache.activemq.core.config.HAPolicyConfiguration;
+import org.apache.activemq.core.config.impl.ConfigurationImpl;
+import org.apache.activemq.core.config.impl.FileConfiguration;
+import org.apache.activemq.core.server.ActiveMQServer;
+import org.apache.activemq.core.server.JournalType;
+import org.apache.activemq.core.server.NodeManager;
+import org.apache.activemq.core.server.impl.ActiveMQServerImpl;
+import org.apache.activemq.core.server.impl.InVMNodeManager;
+import org.apache.activemq.jms.server.JMSServerManager;
+import org.apache.activemq.jms.server.impl.JMSServerManagerImpl;
+import org.apache.activemq.maven.InVMNodeManagerServer;
+import org.apache.activemq.spi.core.security.ActiveMQSecurityManager;
+import org.apache.activemq.spi.core.security.ActiveMQSecurityManagerImpl;
+
+/**
+ * This will bootstrap the HornetQ Server and also the naming server if required
+ *
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class ActiveMQBootstrap
+{
+   private final String configurationDir;
+
+   private final Boolean waitOnStart;
+
+   private final String nodeId;
+
+   private static Map<String, NodeManager> managerMap = new HashMap<String, NodeManager>();
+
+   private boolean spawned = false;
+
+   private ActiveMQServer server;
+
+   private Configuration configuration;
+
+   private JMSServerManager manager;
+
+   private ActiveMQSecurityManager securityManager;
+
+
+   public ActiveMQBootstrap(String configurationDir, Boolean waitOnStart, String nodeId, ActiveMQSecurityManager securityManager)
+   {
+      this.configurationDir = configurationDir;
+      this.waitOnStart = waitOnStart;
+      this.nodeId = nodeId;
+      this.securityManager = securityManager;
+   }
+
+   public ActiveMQBootstrap(String[] args)
+   {
+      this.configurationDir = args[0];
+      this.waitOnStart = Boolean.valueOf(args[1]);
+      this.nodeId = args[2];
+      spawned = true;
+   }
+
+   public void execute() throws Exception
+   {
+      try
+      {
+         if (configurationDir != null)
+         {
+            //extendPluginClasspath(configurationDir);
+            configuration = new FileConfiguration();
+            File file = new File(configurationDir + "/" + "activemq-configuration.xml");
+            ((FileConfiguration) configuration).setConfigurationUrl(file.toURI().toURL().toExternalForm());
+            ((FileConfiguration) configuration).start();
+         }
+         else
+         {
+            configuration = new ConfigurationImpl();
+            configuration.setJournalType(JournalType.NIO);
+         }
+
+         createServer(configuration);
+
+         if (waitOnStart)
+         {
+            String dirName = System.getProperty("activemq.config.dir", ".");
+            final File file = new File(dirName + "/STOP_ME");
+            if (file.exists())
+            {
+               file.delete();
+            }
+
+            while (!file.exists())
+            {
+               Thread.sleep(500);
+            }
+
+            manager.stop();
+            file.delete();
+         }
+         else
+         {
+            String dirName = configurationDir != null ? configurationDir : ".";
+            final File stopFile = new File(dirName + "/STOP_ME");
+            if (stopFile.exists())
+            {
+               stopFile.delete();
+            }
+            final File killFile = new File(dirName + "/KILL_ME");
+            if (killFile.exists())
+            {
+               killFile.delete();
+            }
+            final File restartFile = new File(dirName + "/RESTART_ME");
+            if (restartFile.exists())
+            {
+               restartFile.delete();
+            }
+            final Timer timer = new Timer("ActiveMQ Server Shutdown Timer", true);
+            timer.scheduleAtFixedRate(new ServerStopTimerTask(stopFile, killFile, restartFile, timer), 500, 500);
+         }
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+         throw new Exception(e.getMessage());
+      }
+   }
+
+   private void createServer(Configuration configuration) throws Exception
+   {
+      if (nodeId != null && !nodeId.equals("") && !nodeId.equals("null"))
+      {
+         InVMNodeManager nodeManager = (InVMNodeManager) managerMap.get(nodeId);
+         if (nodeManager == null)
+         {
+            boolean replicatedBackup = configuration.getHAPolicyConfiguration().getType() == HAPolicyConfiguration.TYPE.REPLICA;
+            nodeManager = new InVMNodeManager(replicatedBackup, configuration.getJournalDirectory());
+            managerMap.put(nodeId, nodeManager);
+         }
+         server = new InVMNodeManagerServer(configuration, ManagementFactory.getPlatformMBeanServer(),
+                                            securityManager != null ? securityManager : new ActiveMQSecurityManagerImpl(), nodeManager);
+      }
+      else
+      {
+         server = new ActiveMQServerImpl(configuration, ManagementFactory.getPlatformMBeanServer(),
+                                         securityManager != null ? securityManager : new ActiveMQSecurityManagerImpl());
+      }
+
+      manager = new JMSServerManagerImpl(server);
+      manager.start();
+   }
+
+   private class ServerStopTimerTask extends TimerTask
+   {
+      private final File stopFile;
+      private final Timer timer;
+      private final File killFile;
+      private final File restartFile;
+
+      public ServerStopTimerTask(File stopFile, File killFile, File restartFile, Timer timer)
+      {
+         this.stopFile = stopFile;
+         this.killFile = killFile;
+         this.restartFile = restartFile;
+         this.timer = timer;
+      }
+
+      @Override
+      public void run()
+      {
+         if (stopFile.exists())
+         {
+            try
+            {
+               timer.cancel();
+            }
+            finally
+            {
+               try
+               {
+                  if (manager != null)
+                  {
+                     manager.stop();
+                     manager = null;
+                  }
+                  server = null;
+                  stopFile.delete();
+               }
+               catch (Exception e)
+               {
+                  e.printStackTrace();
+               }
+            }
+            if (spawned)
+            {
+               Runtime.getRuntime()
+                  .halt(666);
+            }
+         }
+         else if (killFile.exists())
+         {
+            try
+            {
+               if (!spawned)
+               {
+                  manager.getActiveMQServer()
+                     .stop(true);
+                  manager.stop();
+                  manager = null;
+                  server = null;
+                  killFile.delete();
+               }
+               else
+               {
+                  killFile.delete();
+                  Runtime.getRuntime().halt(777);
+               }
+            }
+            catch (Exception e)
+            {
+               e.printStackTrace();
+            }
+         }
+         else if (restartFile.exists())
+         {
+            try
+            {
+               createServer(configuration);
+               restartFile.delete();
+            }
+            catch (Exception e)
+            {
+               e.printStackTrace();
+            }
+         }
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/activemq-maven-plugin/src/main/java/org/apache/activemq/server/SpawnedActiveMQBootstrap.java
----------------------------------------------------------------------
diff --git a/activemq-maven-plugin/src/main/java/org/apache/activemq/server/SpawnedActiveMQBootstrap.java b/activemq-maven-plugin/src/main/java/org/apache/activemq/server/SpawnedActiveMQBootstrap.java
new file mode 100644
index 0000000..8ce8505
--- /dev/null
+++ b/activemq-maven-plugin/src/main/java/org/apache/activemq/server/SpawnedActiveMQBootstrap.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.server;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ *         5/14/12
+ *
+ *         This class will be spawned in a new vm and will call the bootstrap
+ */
+public class SpawnedActiveMQBootstrap
+{
+   public static void main(final String[] args)
+   {
+      ActiveMQBootstrap bootstrap;
+      try
+      {
+         bootstrap = new ActiveMQBootstrap(args);
+         bootstrap.execute();
+         System.out.println("STARTED::");
+      }
+      catch (Throwable e)
+      {
+         System.out.println("FAILED::" + e.getMessage());
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/activemq-maven-plugin/src/main/java/org/apache/activemq/server/SpawnedVMSupport.java
----------------------------------------------------------------------
diff --git a/activemq-maven-plugin/src/main/java/org/apache/activemq/server/SpawnedVMSupport.java b/activemq-maven-plugin/src/main/java/org/apache/activemq/server/SpawnedVMSupport.java
new file mode 100644
index 0000000..55782d2
--- /dev/null
+++ b/activemq-maven-plugin/src/main/java/org/apache/activemq/server/SpawnedVMSupport.java
@@ -0,0 +1,257 @@
+/**
+ * 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.server;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.maven.artifact.DefaultArtifact;
+
+/**
+ * @author <a href="mailto:ovidiu@feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ * @author <a href="mailto:csuconic@redhat.com">Clebert Suconic</a>
+ */
+public class SpawnedVMSupport
+{
+   public static Process spawnVM(List<DefaultArtifact> arts,
+                                 final String logName,
+                                 final String className,
+                                 final Properties properties,
+                                 final boolean logOutput,
+                                 final String success,
+                                 final String failure,
+                                 final String workDir,
+                                 final String configDir,
+                                 boolean debug,
+                                 final String... args) throws Exception
+   {
+      StringBuffer sb = new StringBuffer();
+
+      sb.append("java")
+         .append(' ');
+      StringBuffer props = new StringBuffer();
+      if (properties != null)
+      {
+         for (Map.Entry<Object, Object> entry : properties.entrySet())
+         {
+            props.append("-D")
+               .append(entry.getKey())
+               .append("=")
+               .append(entry.getValue())
+               .append(" ");
+         }
+      }
+      String vmarg = props.toString();
+      String osName = System.getProperty("os.name");
+      osName = (osName != null) ? osName.toLowerCase() : "";
+      boolean isWindows = osName.contains("win");
+      if (isWindows)
+      {
+         vmarg = vmarg.replaceAll("/", "\\\\");
+      }
+      sb.append(vmarg)
+         .append(" ");
+      String pathSeparater = System.getProperty("path.separator");
+      StringBuilder classpath = new StringBuilder();
+      for (DefaultArtifact artifact : arts)
+      {
+         classpath.append(artifact.getFile()
+                             .getAbsolutePath())
+            .append(pathSeparater);
+      }
+      classpath.append(configDir)
+         .append(pathSeparater);
+
+      if (isWindows)
+      {
+         sb.append("-cp")
+            .append(" \"")
+            .append(classpath.toString())
+            .append("\" ");
+      }
+      else
+      {
+         sb.append("-cp")
+            .append(" ")
+            .append(classpath.toString())
+            .append(" ");
+      }
+
+      // FIXME - not good to assume path separator
+      String libPath = "-Djava.library.path=" + System.getProperty("java.library.path", "./native/bin");
+      if (isWindows)
+      {
+         libPath = libPath.replaceAll("/", "\\\\");
+         libPath = "\"" + libPath + "\"";
+      }
+      sb.append("-Djava.library.path=")
+         .append(libPath)
+         .append(" ");
+      if (debug)
+      {
+         sb.append("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 ");
+      }
+
+      sb.append(className)
+         .append(' ');
+
+      for (String arg : args)
+      {
+         sb.append(arg)
+            .append(' ');
+      }
+
+      String commandLine = sb.toString();
+
+      //SpawnedVMSupport.log.trace("command line: " + commandLine);
+
+      Process process = Runtime.getRuntime()
+         .exec(commandLine, null, new File(workDir));
+
+      //SpawnedVMSupport.log.trace("process: " + process);
+
+      CountDownLatch latch = new CountDownLatch(1);
+
+      ProcessLogger outputLogger = new ProcessLogger(logOutput,
+                                                     process.getInputStream(),
+                                                     logName,
+                                                     false,
+                                                     success,
+                                                     failure,
+                                                     latch);
+      outputLogger.start();
+
+      // Adding a reader to System.err, so the VM won't hang on a System.err.println as identified on this forum thread:
+      // http://www.jboss.org/index.html?module=bb&op=viewtopic&t=151815
+      ProcessLogger errorLogger = new ProcessLogger(true,
+                                                    process.getErrorStream(),
+                                                    logName,
+                                                    true,
+                                                    success,
+                                                    failure,
+                                                    latch);
+      errorLogger.start();
+
+      if (!latch.await(60, TimeUnit.SECONDS))
+      {
+         process.destroy();
+         throw new RuntimeException("Timed out waiting for server to start");
+      }
+
+      if (outputLogger.failed || errorLogger.failed)
+      {
+         try
+         {
+            process.destroy();
+         }
+         catch (Throwable e)
+         {
+         }
+         throw new RuntimeException("server failed to start");
+      }
+      return process;
+   }
+
+   /**
+    * Redirect the input stream to a logger (as debug logs)
+    */
+   static class ProcessLogger extends Thread
+   {
+      private final InputStream is;
+
+      private final String logName;
+
+      private final boolean print;
+
+      private final boolean sendToErr;
+
+      private final String success;
+
+      private final String failure;
+
+      private final CountDownLatch latch;
+
+      boolean failed = false;
+
+      ProcessLogger(final boolean print,
+                    final InputStream is,
+                    final String logName,
+                    final boolean sendToErr,
+                    final String success,
+                    final String failure,
+                    final CountDownLatch latch) throws ClassNotFoundException
+      {
+         this.is = is;
+         this.print = print;
+         this.logName = logName;
+         this.sendToErr = sendToErr;
+         this.success = success;
+         this.failure = failure;
+         this.latch = latch;
+         setDaemon(false);
+      }
+
+      @Override
+      public void run()
+      {
+         try
+         {
+            InputStreamReader isr = new InputStreamReader(is);
+            BufferedReader br = new BufferedReader(isr);
+            String line;
+            while ((line = br.readLine()) != null)
+            {
+               if (line.startsWith(success))
+               {
+                  failed = false;
+                  latch.countDown();
+               }
+               else if (line.startsWith(failure))
+               {
+                  failed = true;
+                  latch.countDown();
+               }
+               if (print)
+               {
+                  if (sendToErr)
+                  {
+                     System.err.println(logName + " err:" + line);
+                  }
+                  else
+                  {
+                     System.out.println(logName + " out:" + line);
+                  }
+               }
+            }
+         }
+         catch (IOException e)
+         {
+            // ok, stream closed
+         }
+
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/core/perf/pom.xml
----------------------------------------------------------------------
diff --git a/examples/core/perf/pom.xml b/examples/core/perf/pom.xml
index 6db15e9..67c9388 100644
--- a/examples/core/perf/pom.xml
+++ b/examples/core/perf/pom.xml
@@ -63,7 +63,7 @@
                         </goals>
                         <configuration>
                            <waitOnStart>true</waitOnStart>
-                           <hornetqConfigurationDir>${basedir}/target/classes/server0</hornetqConfigurationDir>
+                           <configurationDir>${basedir}/target/classes/server0</configurationDir>
                            <systemProperties>
                               <property>
                                  <name>build.directory</name>
@@ -75,7 +75,7 @@
                   </executions>
                   <configuration>
                      <waitOnStart>false</waitOnStart>
-                     <hornetqConfigurationDir>${basedir}/target/classes/server0</hornetqConfigurationDir>
+                     <configurationDir>${basedir}/target/classes/server0</configurationDir>
                   </configuration>
                   <dependencies>
                      <dependency>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/core/vertx-connector/pom.xml
----------------------------------------------------------------------
diff --git a/examples/core/vertx-connector/pom.xml b/examples/core/vertx-connector/pom.xml
index c12f66a..937c49a 100644
--- a/examples/core/vertx-connector/pom.xml
+++ b/examples/core/vertx-connector/pom.xml
@@ -161,7 +161,7 @@
                   </dependencies>
             <configuration>
                <waitOnStart>false</waitOnStart>
-               <hornetqConfigurationDir>${basedir}/target/classes/server0</hornetqConfigurationDir>
+               <configurationDir>${basedir}/target/classes/server0</configurationDir>
             </configuration>
                </plugin>
             </plugins>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/activemq-jms-examples-common/src/main/java/org/apache/activemq/common/example/ActiveMQExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/activemq-jms-examples-common/src/main/java/org/apache/activemq/common/example/ActiveMQExample.java b/examples/jms/activemq-jms-examples-common/src/main/java/org/apache/activemq/common/example/ActiveMQExample.java
index 86059b6..6527893 100644
--- a/examples/jms/activemq-jms-examples-common/src/main/java/org/apache/activemq/common/example/ActiveMQExample.java
+++ b/examples/jms/activemq-jms-examples-common/src/main/java/org/apache/activemq/common/example/ActiveMQExample.java
@@ -43,12 +43,11 @@ import org.apache.activemq.jms.client.ActiveMQConnectionFactory;
  */
 public abstract class ActiveMQExample
 {
-   protected static final Logger log = Logger.getLogger(ActiveMQExample.class
-         .getName());
+   protected static final Logger log = Logger.getLogger(ActiveMQExample.class.getName());
 
    protected boolean failure = false;
 
-   private String[] args;
+   protected String[] args;
 
    public abstract boolean runExample() throws Exception;
 
@@ -176,17 +175,6 @@ public abstract class ActiveMQExample
       }
    }
 
-   protected InitialContext getContext(final int serverId) throws Exception
-   {
-      ActiveMQExample.log.info("using " + args[serverId] + " for jndi");
-      Properties props = new Properties();
-      props.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
-      props.put("java.naming.provider.url", args[serverId]);
-      props.put("queue.queue/exampleQueue", "exampleQueue");
-      props.put("topic.topic/exampleTopic", "exampleTopic");
-      return new InitialContext(props);
-   }
-
    protected int getServer(Connection connection)
    {
       ClientSession session = ((ActiveMQConnection) connection).getInitialSession();

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/aerogear/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/aerogear/pom.xml b/examples/jms/aerogear/pom.xml
index 516d13f..558f395 100644
--- a/examples/jms/aerogear/pom.xml
+++ b/examples/jms/aerogear/pom.xml
@@ -125,7 +125,7 @@
             </dependencies>
             <configuration>
                <waitOnStart>false</waitOnStart>
-               <hornetqConfigurationDir>${basedir}/target/classes/activemq/server0</hornetqConfigurationDir>
+               <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
             </configuration>
          </plugin>
       </plugins>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/aerogear/readme.html
----------------------------------------------------------------------
diff --git a/examples/jms/aerogear/readme.html b/examples/jms/aerogear/readme.html
index cd3c15b..f05abce 100644
--- a/examples/jms/aerogear/readme.html
+++ b/examples/jms/aerogear/readme.html
@@ -65,8 +65,8 @@
         <pre class="prettyprint">
            <code>
    &lt;queues>
-       &lt;queue name="jms.queue.aerogearQueue">
-           &lt;address>jms.queue.aerogearQueue&lt;/address>
+       &lt;queue name="jms.queue.exampleQueue">
+           &lt;address>jms.queue.exampleQueue&lt;/address>
        &lt;/queue>
    &lt;/queues>
 
@@ -74,7 +74,7 @@
        &lt;connector-service name="aerogear-connector">
            &lt;factory-class>org.apache.activemq.integration.aerogear.AeroGearConnectorServiceFactory&lt;/factory-class>
            &lt;param key="endpoint" value="${endpoint}"/>
-           &lt;param key="queue" value="jms.queue.aerogearQueue"/>
+           &lt;param key="queue" value="jms.queue.exampleQueue"/>
            &lt;param key="application-id" value="${applicationid}"/>
            &lt;param key="master-secret" value="${mastersecret}"/>
        &lt;/connector-service>
@@ -105,7 +105,7 @@
   <p>Now lets look at a snippet of code we used to send the message for our JMS client</p>
   <pre class="prettyprint">
       <code>
-  Queue queue = (Queue)initialContext.lookup("/queue/aerogearQueue");
+  Queue queue = (Queue)initialContext.lookup("queue/exampleQueue");
 
   // Step 3. Perform a lookup on the Connection Factory
   ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/aerogear/src/main/java/org/apache/activemq/jms/example/AerogearExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/aerogear/src/main/java/org/apache/activemq/jms/example/AerogearExample.java b/examples/jms/aerogear/src/main/java/org/apache/activemq/jms/example/AerogearExample.java
index 1c4ec67..2c47863 100644
--- a/examples/jms/aerogear/src/main/java/org/apache/activemq/jms/example/AerogearExample.java
+++ b/examples/jms/aerogear/src/main/java/org/apache/activemq/jms/example/AerogearExample.java
@@ -48,7 +48,7 @@ public class AerogearExample extends ActiveMQExample
       try
       {
          // Step 1. Create an initial context to perform the JNDI lookup.
-         initialContext = getContext(0);
+         initialContext = new InitialContext();
 
          // Step 2. Perfom a lookup on the queue
          Queue queue = (Queue)initialContext.lookup("queue/exampleQueue");

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-configuration.xml
----------------------------------------------------------------------
diff --git a/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-configuration.xml b/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-configuration.xml
new file mode 100644
index 0000000..b891603
--- /dev/null
+++ b/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-configuration.xml
@@ -0,0 +1,52 @@
+<configuration xmlns="urn:activemq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
+
+   <bindings-directory>${build.directory}/server0/data/messaging/bindings</bindings-directory>
+
+   <journal-directory>${build.directory}/server0/data/messaging/journal</journal-directory>
+
+   <large-messages-directory>${build.directory}/server0/data/messaging/largemessages</large-messages-directory>
+
+   <paging-directory>${build.directory}/server0/data/messaging/paging</paging-directory>
+   
+   <!-- Acceptors -->
+   <acceptors>
+      <acceptor name="netty-acceptor">
+         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+      </acceptor>
+   </acceptors>
+
+    <!-- We need to create a core queue for the JMS queue explicitly because the connector will be deployed
+     before the JMS queue is deployed, so the first time, it otherwise won't find the queue -->
+    <queues>
+        <queue name="jms.queue.exampleQueue">
+            <address>jms.queue.exampleQueue</address>
+        </queue>
+    </queues>
+
+    <connector-services>
+        <connector-service name="aerogear-connector">
+            <factory-class>org.apache.activemq.integration.aerogear.AeroGearConnectorServiceFactory</factory-class>
+            <param key="endpoint" value="${endpoint}"/>
+            <param key="queue" value="jms.queue.exampleQueue"/>
+            <param key="application-id" value="${applicationid}"/>
+            <param key="master-secret" value="${mastersecret}"/>
+        </connector-service>
+    </connector-services>
+
+   <!-- Other config -->
+
+   <security-settings>
+      <!--security for example queue-->
+      <security-setting match="jms.queue.exampleQueue">
+         <permission type="createDurableQueue" roles="guest"/>
+         <permission type="deleteDurableQueue" roles="guest"/>
+         <permission type="createNonDurableQueue" roles="guest"/>
+         <permission type="deleteNonDurableQueue" roles="guest"/>
+         <permission type="consume" roles="guest"/>
+         <permission type="send" roles="guest"/>
+      </security-setting>
+   </security-settings>
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-jms.xml
----------------------------------------------------------------------
diff --git a/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-jms.xml b/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-jms.xml
new file mode 100644
index 0000000..0d5c953
--- /dev/null
+++ b/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-jms.xml
@@ -0,0 +1,8 @@
+<configuration xmlns="urn:activemq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
+
+   <!--the queue used by the example-->
+   <queue name="exampleQueue"/>
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-users.xml
----------------------------------------------------------------------
diff --git a/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-users.xml b/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-users.xml
new file mode 100644
index 0000000..ae30546
--- /dev/null
+++ b/examples/jms/aerogear/src/main/resources/activemq/server0/activemq-users.xml
@@ -0,0 +1,7 @@
+<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
+   <!-- the default user.  this is used where username is null-->
+   <defaultuser name="guest" password="guest">
+      <role name="guest"/>
+   </defaultuser>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-configuration.xml
----------------------------------------------------------------------
diff --git a/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-configuration.xml b/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-configuration.xml
deleted file mode 100644
index b3596f3..0000000
--- a/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-configuration.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<configuration xmlns="urn:activemq"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
-
-   <bindings-directory>${build.directory}/server0/data/messaging/bindings</bindings-directory>
-
-   <journal-directory>${build.directory}/server0/data/messaging/journal</journal-directory>
-
-   <large-messages-directory>${build.directory}/server0/data/messaging/largemessages</large-messages-directory>
-
-   <paging-directory>${build.directory}/server0/data/messaging/paging</paging-directory>
-
-
-   <!-- Connectors -->
-
-   <connectors>
-      <connector name="netty-connector">
-         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
-      </connector>
-   </connectors>
-   
-   <!-- Acceptors -->
-   <acceptors>
-      <acceptor name="netty-acceptor">
-         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
-      </acceptor>
-   </acceptors>
-
-    <!-- We need to create a core queue for the JMS queue explicitly because the connector will be deployed
-     before the JMS queue is deployed, so the first time, it otherwise won't find the queue -->
-    <queues>
-        <queue name="jms.queue.aerogearQueue">
-            <address>jms.queue.aerogearQueue</address>
-        </queue>
-    </queues>
-
-    <connector-services>
-        <connector-service name="aerogear-connector">
-            <factory-class>org.apache.activemq.integration.aerogear.AeroGearConnectorServiceFactory</factory-class>
-            <param key="endpoint" value="${endpoint}"/>
-            <param key="queue" value="jms.queue.aerogearQueue"/>
-            <param key="application-id" value="${applicationid}"/>
-            <param key="master-secret" value="${mastersecret}"/>
-        </connector-service>
-    </connector-services>
-
-   <!-- Other config -->
-
-   <security-settings>
-      <!--security for example queue-->
-      <security-setting match="jms.queue.aerogearQueue">
-         <permission type="createDurableQueue" roles="guest"/>
-         <permission type="deleteDurableQueue" roles="guest"/>
-         <permission type="createNonDurableQueue" roles="guest"/>
-         <permission type="deleteNonDurableQueue" roles="guest"/>
-         <permission type="consume" roles="guest"/>
-         <permission type="send" roles="guest"/>
-      </security-setting>
-   </security-settings>
-
-</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-jms.xml
----------------------------------------------------------------------
diff --git a/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-jms.xml
deleted file mode 100644
index 2483255..0000000
--- a/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-jms.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<configuration xmlns="urn:activemq"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
-
-   <!--the queue used by the example-->
-   <queue name="aerogearQueue"/>
-
-</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-users.xml
----------------------------------------------------------------------
diff --git a/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-users.xml b/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-users.xml
deleted file mode 100644
index ae30546..0000000
--- a/examples/jms/aerogear/src/main/resources/hornetq/server0/activemq-users.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
-   <!-- the default user.  this is used where username is null-->
-   <defaultuser name="guest" password="guest">
-      <role name="guest"/>
-   </defaultuser>
-</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/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
new file mode 100644
index 0000000..d9b5c6a
--- /dev/null
+++ b/examples/jms/aerogear/src/main/resources/jndi.properties
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:5445
+queue.queue/exampleQueue=exampleQueue
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/applet/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/applet/pom.xml b/examples/jms/applet/pom.xml
index 4a2a261..a15d5f9 100644
--- a/examples/jms/applet/pom.xml
+++ b/examples/jms/applet/pom.xml
@@ -40,7 +40,7 @@
                      <goal>start</goal>
                   </goals>
                   <configuration>
-                     <hornetqConfigurationDir>${basedir}/target/classes/activemq/server0</hornetqConfigurationDir>
+                     <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
                   </configuration>
                </execution>
                <execution>
@@ -67,7 +67,7 @@
                      <goal>stop</goal>
                   </goals>
                   <configuration>
-                     <hornetqConfigurationDir>${basedir}/target/classes/activemq/server0</hornetqConfigurationDir>
+                     <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
                   </configuration>
                </execution>
             </executions>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServer.java
----------------------------------------------------------------------
diff --git a/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServer.java b/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServer.java
index 25c900b..3626819 100644
--- a/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServer.java
+++ b/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServer.java
@@ -20,8 +20,8 @@ import java.net.InetSocketAddress;
 import java.util.concurrent.Executors;
 
 import org.apache.activemq.common.example.ActiveMQExample;
-import org.jboss.netty.bootstrap.ServerBootstrap;
-import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.socket.nio.NioServerSocketChannelFactory;
 
 /**
  * A HttpServer

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServerHandler.java
----------------------------------------------------------------------
diff --git a/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServerHandler.java b/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServerHandler.java
index 744f423..6443ef9 100644
--- a/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServerHandler.java
+++ b/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServerHandler.java
@@ -22,24 +22,24 @@ import java.io.RandomAccessFile;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelFuture;
-import org.jboss.netty.channel.ChannelFutureListener;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ChannelPipelineCoverage;
-import org.jboss.netty.channel.ExceptionEvent;
-import org.jboss.netty.channel.MessageEvent;
-import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
-import org.jboss.netty.handler.codec.frame.TooLongFrameException;
-import org.jboss.netty.handler.codec.http.DefaultHttpResponse;
-import org.jboss.netty.handler.codec.http.HttpHeaders;
-import org.jboss.netty.handler.codec.http.HttpMethod;
-import org.jboss.netty.handler.codec.http.HttpRequest;
-import org.jboss.netty.handler.codec.http.HttpResponse;
-import org.jboss.netty.handler.codec.http.HttpResponseStatus;
-import org.jboss.netty.handler.codec.http.HttpVersion;
-import org.jboss.netty.handler.stream.ChunkedFile;
+import io.netty.buffer.ChannelBuffers;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelFutureListener;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelPipelineCoverage;
+import io.netty.channel.ExceptionEvent;
+import io.netty.channel.MessageEvent;
+import io.netty.channel.SimpleChannelUpstreamHandler;
+import io.netty.handler.codec.frame.TooLongFrameException;
+import io.netty.handler.codec.http.DefaultHttpResponse;
+import io.netty.handler.codec.http.HttpHeaders;
+import io.netty.handler.codec.http.HttpMethod;
+import io.netty.handler.codec.http.HttpRequest;
+import io.netty.handler.codec.http.HttpResponse;
+import io.netty.handler.codec.http.HttpResponseStatus;
+import io.netty.handler.codec.http.HttpVersion;
+import io.netty.handler.stream.ChunkedFile;
 
 /**
  * A HttpStaticFileServerHandler

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServerPipelineFactory.java
----------------------------------------------------------------------
diff --git a/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServerPipelineFactory.java b/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServerPipelineFactory.java
index 22ae149..d4744f3 100644
--- a/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServerPipelineFactory.java
+++ b/examples/jms/applet/src/main/java/org/apache/activemq/jms/example/HttpStaticFileServerPipelineFactory.java
@@ -16,12 +16,12 @@
  */
 package org.apache.activemq.jms.example;
 
-import org.jboss.netty.channel.ChannelPipeline;
-import org.jboss.netty.channel.ChannelPipelineFactory;
-import org.jboss.netty.channel.Channels;
-import org.jboss.netty.handler.codec.http.HttpRequestDecoder;
-import org.jboss.netty.handler.codec.http.HttpResponseEncoder;
-import org.jboss.netty.handler.stream.ChunkedWriteHandler;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.ChannelPipelineFactory;
+import io.netty.channel.Channels;
+import io.netty.handler.codec.http.HttpRequestDecoder;
+import io.netty.handler.codec.http.HttpResponseEncoder;
+import io.netty.handler.stream.ChunkedWriteHandler;
 
 /**
  * A HttpStaticFileServerPipelineFactory

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/applet/src/main/resources/activemq/server0/activemq-configuration.xml
----------------------------------------------------------------------
diff --git a/examples/jms/applet/src/main/resources/activemq/server0/activemq-configuration.xml b/examples/jms/applet/src/main/resources/activemq/server0/activemq-configuration.xml
new file mode 100644
index 0000000..7e6a27d
--- /dev/null
+++ b/examples/jms/applet/src/main/resources/activemq/server0/activemq-configuration.xml
@@ -0,0 +1,34 @@
+<configuration xmlns="urn:activemq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
+
+   <bindings-directory>${build.directory}/server0/data/messaging/bindings</bindings-directory>
+
+   <journal-directory>${build.directory}/server0/data/messaging/journal</journal-directory>
+
+   <large-messages-directory>${build.directory}/server0/data/messaging/largemessages</large-messages-directory>
+
+   <paging-directory>${build.directory}/server0/data/messaging/paging</paging-directory>
+   
+   <!-- Acceptors -->
+   <acceptors>
+      <acceptor name="netty-acceptor">
+         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+      </acceptor>
+   </acceptors>
+
+   <!-- Other config -->
+
+   <security-settings>
+      <!--security for example topic-->
+      <security-setting match="jms.topic.exampleTopic">
+         <permission type="createDurableQueue" roles="guest"/>
+         <permission type="deleteDurableQueue" roles="guest"/>
+         <permission type="createNonDurableQueue" roles="guest"/>
+         <permission type="deleteNonDurableQueue" roles="guest"/>
+         <permission type="consume" roles="guest"/>
+         <permission type="send" roles="guest"/>
+      </security-setting>
+   </security-settings>
+   
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/applet/src/main/resources/activemq/server0/activemq-jms.xml
----------------------------------------------------------------------
diff --git a/examples/jms/applet/src/main/resources/activemq/server0/activemq-jms.xml b/examples/jms/applet/src/main/resources/activemq/server0/activemq-jms.xml
new file mode 100644
index 0000000..ab4841d
--- /dev/null
+++ b/examples/jms/applet/src/main/resources/activemq/server0/activemq-jms.xml
@@ -0,0 +1,8 @@
+<configuration xmlns="urn:activemq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
+
+   <!--the topic used by the example-->
+   <topic name="exampleTopic"/>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/applet/src/main/resources/activemq/server0/activemq-users.xml
----------------------------------------------------------------------
diff --git a/examples/jms/applet/src/main/resources/activemq/server0/activemq-users.xml b/examples/jms/applet/src/main/resources/activemq/server0/activemq-users.xml
new file mode 100644
index 0000000..ae30546
--- /dev/null
+++ b/examples/jms/applet/src/main/resources/activemq/server0/activemq-users.xml
@@ -0,0 +1,7 @@
+<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
+   <!-- the default user.  this is used where username is null-->
+   <defaultuser name="guest" password="guest">
+      <role name="guest"/>
+   </defaultuser>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/applet/src/main/resources/hornetq/server0/activemq-configuration.xml
----------------------------------------------------------------------
diff --git a/examples/jms/applet/src/main/resources/hornetq/server0/activemq-configuration.xml b/examples/jms/applet/src/main/resources/hornetq/server0/activemq-configuration.xml
deleted file mode 100644
index ea0fb02..0000000
--- a/examples/jms/applet/src/main/resources/hornetq/server0/activemq-configuration.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<configuration xmlns="urn:activemq"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
-
-   <bindings-directory>${build.directory}/server0/data/messaging/bindings</bindings-directory>
-
-   <journal-directory>${build.directory}/server0/data/messaging/journal</journal-directory>
-
-   <large-messages-directory>${build.directory}/server0/data/messaging/largemessages</large-messages-directory>
-
-   <paging-directory>${build.directory}/server0/data/messaging/paging</paging-directory>
-
-   <!-- Connectors -->
-   <connectors>
-      <connector name="netty-connector">
-         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
-      </connector>
-   </connectors>
-   
-   <!-- Acceptors -->
-   <acceptors>
-      <acceptor name="netty-acceptor">
-         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
-      </acceptor>
-   </acceptors>
-
-   <!-- Other config -->
-
-   <security-settings>
-      <!--security for example topic-->
-      <security-setting match="jms.topic.exampleTopic">
-         <permission type="createDurableQueue" roles="guest"/>
-         <permission type="deleteDurableQueue" roles="guest"/>
-         <permission type="createNonDurableQueue" roles="guest"/>
-         <permission type="deleteNonDurableQueue" roles="guest"/>
-         <permission type="consume" roles="guest"/>
-         <permission type="send" roles="guest"/>
-      </security-setting>
-   </security-settings>
-   
-</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/applet/src/main/resources/hornetq/server0/activemq-jms.xml
----------------------------------------------------------------------
diff --git a/examples/jms/applet/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/applet/src/main/resources/hornetq/server0/activemq-jms.xml
deleted file mode 100644
index ab4841d..0000000
--- a/examples/jms/applet/src/main/resources/hornetq/server0/activemq-jms.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<configuration xmlns="urn:activemq"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
-
-   <!--the topic used by the example-->
-   <topic name="exampleTopic"/>
-
-</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/applet/src/main/resources/hornetq/server0/activemq-users.xml
----------------------------------------------------------------------
diff --git a/examples/jms/applet/src/main/resources/hornetq/server0/activemq-users.xml b/examples/jms/applet/src/main/resources/hornetq/server0/activemq-users.xml
deleted file mode 100644
index ae30546..0000000
--- a/examples/jms/applet/src/main/resources/hornetq/server0/activemq-users.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
-   <!-- the default user.  this is used where username is null-->
-   <defaultuser name="guest" password="guest">
-      <role name="guest"/>
-   </defaultuser>
-</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/pom.xml b/examples/jms/application-layer-failover/pom.xml
index c9cfb1a..08fe255 100644
--- a/examples/jms/application-layer-failover/pom.xml
+++ b/examples/jms/application-layer-failover/pom.xml
@@ -36,7 +36,7 @@
                      <goal>start</goal>
                   </goals>
                   <configuration>
-                     <hornetqConfigurationDir>${basedir}/target/classes/activemq/server0</hornetqConfigurationDir>
+                     <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
                   </configuration>
                </execution>
                <execution>
@@ -45,10 +45,8 @@
                      <goal>start</goal>
                   </goals>
                   <configuration>
-                     <jndiPort>1199</jndiPort>
-                     <jndiRmiPort>1198</jndiRmiPort>
-                     <hornetqConfigurationDir>${basedir}/target/classes/activemq/server1</hornetqConfigurationDir>
-                     <serverStartString>INFO: HQ221034</serverStartString>
+                     <configurationDir>${basedir}/target/classes/activemq/server1</configurationDir>
+                     <serverStartString>INFO: AMQ221001</serverStartString>
                      <fork>true</fork>
                   </configuration>
                </execution>
@@ -77,7 +75,7 @@
                      <goal>stop</goal>
                   </goals>
                   <configuration>
-                     <hornetqConfigurationDir>${basedir}/target/classes/activemq/server0</hornetqConfigurationDir>
+                     <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
                   </configuration>
                </execution>
                <execution>
@@ -86,7 +84,7 @@
                      <goal>stop</goal>
                   </goals>
                   <configuration>
-                     <hornetqConfigurationDir>${basedir}/target/classes/activemq/server1</hornetqConfigurationDir>
+                     <configurationDir>${basedir}/target/classes/activemq/server1</configurationDir>
                   </configuration>
                </execution>
             </executions>
@@ -129,7 +127,7 @@
             </dependencies>
             <configuration>
                <waitOnStart>false</waitOnStart>
-               <hornetqConfigurationDir>${basedir}/target/classes/activemq/server0</hornetqConfigurationDir>
+               <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
             </configuration>
          </plugin>
       </plugins>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/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 2887e4c..0c6e023 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
@@ -16,6 +16,9 @@
  */
 package org.apache.activemq.jms.example;
 
+import java.lang.Object;
+import java.lang.String;
+import java.util.Hashtable;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -149,7 +152,11 @@ public class ApplicationLayerFailoverExample extends ActiveMQExample
    private void createJMSObjects(final int server) throws Exception
    {
       // Step 1. Get an initial context for looking up JNDI from the server
-      initialContext = getContext(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("queue.queue/exampleQueue", "exampleQueue");
+      initialContext = new InitialContext(properties);
 
       // Step 2. Look-up the JMS Queue object from JNDI
       Queue queue = (Queue)initialContext.lookup("queue/exampleQueue");

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-configuration.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-configuration.xml b/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-configuration.xml
new file mode 100644
index 0000000..acd98cb
--- /dev/null
+++ b/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-configuration.xml
@@ -0,0 +1,30 @@
+<configuration xmlns="urn:activemq"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
+
+   <!-- Acceptors -->
+   <acceptors>
+      <acceptor name="netty-acceptor">
+         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+         <param key="port" value="5445"/>
+      </acceptor>
+   </acceptors>
+
+   <!-- Other config -->
+
+   <security-settings>
+      <!--security for example queue-->
+      <security-setting match="jms.queue.exampleQueue">
+         <permission type="createDurableQueue" roles="guest"/>
+         <permission type="deleteDurableQueue" roles="guest"/>
+         <permission type="createNonDurableQueue" roles="guest"/>
+         <permission type="deleteNonDurableQueue" roles="guest"/>
+         <permission type="consume" roles="guest"/>
+         <permission type="send" roles="guest"/>
+      </security-setting>
+   </security-settings>
+
+   <journal-directory>target/data/journal</journal-directory>
+   <bindings-directory>target/data/bindings</bindings-directory>
+   <large-messages-directory>target/data/large-messages</large-messages-directory>
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-jms.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-jms.xml b/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-jms.xml
new file mode 100644
index 0000000..0d5c953
--- /dev/null
+++ b/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-jms.xml
@@ -0,0 +1,8 @@
+<configuration xmlns="urn:activemq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
+
+   <!--the queue used by the example-->
+   <queue name="exampleQueue"/>
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-users.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-users.xml b/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-users.xml
new file mode 100644
index 0000000..ae30546
--- /dev/null
+++ b/examples/jms/application-layer-failover/src/main/resources/activemq/server0/activemq-users.xml
@@ -0,0 +1,7 @@
+<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
+   <!-- the default user.  this is used where username is null-->
+   <defaultuser name="guest" password="guest">
+      <role name="guest"/>
+   </defaultuser>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-configuration.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-configuration.xml b/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-configuration.xml
new file mode 100644
index 0000000..74fe0a6
--- /dev/null
+++ b/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-configuration.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration xmlns="urn:activemq"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
+
+   <!-- Acceptors -->
+   <acceptors>
+      <acceptor name="netty-acceptor">
+         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+         <param key="port" value="5446"/>
+      </acceptor>
+   </acceptors>
+
+   <!-- Other config -->
+
+   <security-settings>
+      <!--security for example queue-->
+      <security-setting match="jms.queue.exampleQueue">
+         <permission type="createDurableQueue" roles="guest"/>
+         <permission type="deleteDurableQueue" roles="guest"/>
+         <permission type="createNonDurableQueue" roles="guest"/>
+         <permission type="deleteNonDurableQueue" roles="guest"/>
+         <permission type="consume" roles="guest"/>
+         <permission type="send" roles="guest"/>
+      </security-setting>
+   </security-settings>
+
+   <journal-directory>target/data/journal</journal-directory>
+   <bindings-directory>target/data/bindings</bindings-directory>
+   <large-messages-directory>target/data/large-messages</large-messages-directory>
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-jms.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-jms.xml b/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-jms.xml
new file mode 100644
index 0000000..0d5c953
--- /dev/null
+++ b/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-jms.xml
@@ -0,0 +1,8 @@
+<configuration xmlns="urn:activemq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
+
+   <!--the queue used by the example-->
+   <queue name="exampleQueue"/>
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-users.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-users.xml b/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-users.xml
new file mode 100644
index 0000000..ae30546
--- /dev/null
+++ b/examples/jms/application-layer-failover/src/main/resources/activemq/server1/activemq-users.xml
@@ -0,0 +1,7 @@
+<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
+   <!-- the default user.  this is used where username is null-->
+   <defaultuser name="guest" password="guest">
+      <role name="guest"/>
+   </defaultuser>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-configuration.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-configuration.xml b/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-configuration.xml
deleted file mode 100644
index a667163..0000000
--- a/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-configuration.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<configuration xmlns="urn:activemq"
-               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-               xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
-
-   <!-- Connectors -->
-   <connectors>
-      <connector name="netty-connector">
-         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
-         <param key="port" value="5445"/>
-      </connector>
-   </connectors>
-
-   <!-- Acceptors -->
-
-   <acceptors>
-      <acceptor name="netty-acceptor">
-         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
-         <param key="port" value="5445"/>
-      </acceptor>
-   </acceptors>
-
-   <!-- Other config -->
-
-   <security-settings>
-      <!--security for example queue-->
-      <security-setting match="jms.queue.exampleQueue">
-         <permission type="createDurableQueue" roles="guest"/>
-         <permission type="deleteDurableQueue" roles="guest"/>
-         <permission type="createNonDurableQueue" roles="guest"/>
-         <permission type="deleteNonDurableQueue" roles="guest"/>
-         <permission type="consume" roles="guest"/>
-         <permission type="send" roles="guest"/>
-      </security-setting>
-   </security-settings>
-
-   <journal-directory>target/data/journal</journal-directory>
-   <bindings-directory>target/data/bindings</bindings-directory>
-   <large-messages-directory>target/data/large-messages</large-messages-directory>
-</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-jms.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-jms.xml b/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-jms.xml
deleted file mode 100644
index 0d5c953..0000000
--- a/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-jms.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<configuration xmlns="urn:activemq"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
-
-   <!--the queue used by the example-->
-   <queue name="exampleQueue"/>
-
-</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-users.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-users.xml b/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-users.xml
deleted file mode 100644
index ae30546..0000000
--- a/examples/jms/application-layer-failover/src/main/resources/hornetq/server0/activemq-users.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
-   <!-- the default user.  this is used where username is null-->
-   <defaultuser name="guest" password="guest">
-      <role name="guest"/>
-   </defaultuser>
-</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-configuration.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-configuration.xml b/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-configuration.xml
deleted file mode 100644
index 7845578..0000000
--- a/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-configuration.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration xmlns="urn:activemq"
-               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-               xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
-
-   <!-- Connectors -->
-
-   <connectors>
-      <connector name="netty-connector">
-         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
-         <param key="port" value="5446"/>
-      </connector>
-   </connectors>
-
-   <!-- Acceptors -->
-   <acceptors>
-      <acceptor name="netty-acceptor">
-         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
-         <param key="port" value="5446"/>
-      </acceptor>
-   </acceptors>
-
-   <!-- Other config -->
-
-   <security-settings>
-      <!--security for example queue-->
-      <security-setting match="jms.queue.exampleQueue">
-         <permission type="createDurableQueue" roles="guest"/>
-         <permission type="deleteDurableQueue" roles="guest"/>
-         <permission type="createNonDurableQueue" roles="guest"/>
-         <permission type="deleteNonDurableQueue" roles="guest"/>
-         <permission type="consume" roles="guest"/>
-         <permission type="send" roles="guest"/>
-      </security-setting>
-   </security-settings>
-
-   <journal-directory>target/data/journal</journal-directory>
-   <bindings-directory>target/data/bindings</bindings-directory>
-   <large-messages-directory>target/data/large-messages</large-messages-directory>
-</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-jms.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-jms.xml b/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-jms.xml
deleted file mode 100644
index 0d5c953..0000000
--- a/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-jms.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<configuration xmlns="urn:activemq"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
-
-   <!--the queue used by the example-->
-   <queue name="exampleQueue"/>
-
-</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-users.xml
----------------------------------------------------------------------
diff --git a/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-users.xml b/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-users.xml
deleted file mode 100644
index ae30546..0000000
--- a/examples/jms/application-layer-failover/src/main/resources/hornetq/server1/activemq-users.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
-   <!-- the default user.  this is used where username is null-->
-   <defaultuser name="guest" password="guest">
-      <role name="guest"/>
-   </defaultuser>
-</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/bridge/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/bridge/pom.xml b/examples/jms/bridge/pom.xml
index 0c7b49c..1189fc0 100644
--- a/examples/jms/bridge/pom.xml
+++ b/examples/jms/bridge/pom.xml
@@ -41,7 +41,7 @@
                      <goal>start</goal>
                   </goals>
                   <configuration>
-                     <hornetqConfigurationDir>${basedir}/target/classes/activemq/server0</hornetqConfigurationDir>
+                     <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
                   </configuration>
                </execution>
                <execution>
@@ -52,7 +52,7 @@
                   <configuration>
                      <jndiPort>1199</jndiPort>
                      <jndiRmiPort>1198</jndiRmiPort>
-                     <hornetqConfigurationDir>${basedir}/target/classes/activemq/server1</hornetqConfigurationDir>
+                     <configurationDir>${basedir}/target/classes/activemq/server1</configurationDir>
                      <fork>true</fork>
                   </configuration>
                </execution>
@@ -81,7 +81,7 @@
                      <goal>stop</goal>
                   </goals>
                   <configuration>
-                     <hornetqConfigurationDir>${basedir}/target/classes/activemq/server0</hornetqConfigurationDir>
+                     <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
                   </configuration>
                </execution>
                <execution>
@@ -90,7 +90,7 @@
                      <goal>stop</goal>
                   </goals>
                   <configuration>
-                     <hornetqConfigurationDir>${basedir}/target/classes/activemq/server1</hornetqConfigurationDir>
+                     <configurationDir>${basedir}/target/classes/activemq/server1</configurationDir>
                   </configuration>
                </execution>
             </executions>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/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 fcf8719..4f235b3 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
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.jms.example;
 
+import java.util.Hashtable;
+
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.Message;
@@ -55,11 +57,15 @@ public class BridgeExample extends ActiveMQExample
       {
          // Step 1 - we create an initial context for looking up JNDI on node 0
 
-         ic0 = getContext(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", "tcp://127.0.0.1:5445");
+         properties.put("queue.queue/sausage-factory", "sausage-factory");
+         ic0 = new InitialContext(properties);
 
          // Step 2 - we look up the sausage-factory queue from node 0
 
-         Queue sausageFactory = (Queue)ic0.lookup("queue/exampleQueue");
+         Queue sausageFactory = (Queue)ic0.lookup("queue/sausage-factory");
 
          // Step 3 - we look up a JMS ConnectionFactory object from node 0
 
@@ -67,11 +73,15 @@ public class BridgeExample extends ActiveMQExample
 
          // Step 4 - we create an initial context for looking up JNDI on node 1
 
-         ic1 = getContext(1);
+         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("queue.queue/mincing-machine", "mincing-machine");
+         ic1 = new InitialContext(properties);
 
          // Step 5 - we look up the mincing-machine queue on node 1
 
-         Queue mincingMachine = (Queue)ic1.lookup("queue/exampleQueue1");
+         Queue mincingMachine = (Queue)ic1.lookup("queue/mincing-machine");
 
          // Step 6 - we look up a JMS ConnectionFactory object from node 1
 

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/bridge/src/main/resources/activemq/server0/activemq-configuration.xml
----------------------------------------------------------------------
diff --git a/examples/jms/bridge/src/main/resources/activemq/server0/activemq-configuration.xml b/examples/jms/bridge/src/main/resources/activemq/server0/activemq-configuration.xml
new file mode 100644
index 0000000..9256360
--- /dev/null
+++ b/examples/jms/bridge/src/main/resources/activemq/server0/activemq-configuration.xml
@@ -0,0 +1,67 @@
+<configuration xmlns="urn:activemq"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
+
+   <bindings-directory>${build.directory}/server0/data/messaging/bindings</bindings-directory>
+
+   <journal-directory>${build.directory}/server0/data/messaging/journal</journal-directory>
+
+   <large-messages-directory>${build.directory}/server0/data/messaging/largemessages</large-messages-directory>
+
+   <paging-directory>${build.directory}/server0/data/messaging/paging</paging-directory>
+
+   <!-- Connectors -->
+   <connectors>
+      <!-- Connector to the other node -->
+      <connector name="remote-connector">
+         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+         <param key="port" value="5446"/>
+      </connector>
+   </connectors>
+   
+   <!-- Acceptors -->     
+   <acceptors>
+      <acceptor name="netty-acceptor">
+         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+         <param key="port" value="5445"/>
+      </acceptor>
+   </acceptors>
+   
+   <!-- We need to create a core queue for the JMS queue explicitly because the bridge will be deployed
+   before the JMS queue is deployed, so the first time, it otherwise won't find the queue --> 
+   <queues>   
+      <queue name="jms.queue.sausage-factory">
+         <address>jms.queue.sausage-factory</address>
+      </queue>
+  </queues>
+
+   <!-- We set-up a bridge that forwards from a queue on this node to an address on another node.
+   We specify a filter with the bridge, and a transformer too. The filter and transformer are optional -->
+   <bridges>
+      <bridge name="my-bridge">
+          <queue-name>jms.queue.sausage-factory</queue-name>
+          <forwarding-address>jms.queue.mincing-machine</forwarding-address>
+          <filter string="name='aardvark'"/>
+          <transformer-class-name>org.apache.activemq.jms.example.HatColourChangeTransformer</transformer-class-name>
+          <reconnect-attempts>-1</reconnect-attempts> 
+          <static-connectors>
+             <connector-ref>remote-connector</connector-ref>
+          </static-connectors>
+       </bridge>
+   </bridges>
+
+   <!-- Other config -->
+
+   <security-settings>
+      <!--security for example queue-->
+      <security-setting match="jms.queue.#">
+         <permission type="createDurableQueue" roles="guest"/>
+         <permission type="deleteDurableQueue" roles="guest"/>
+         <permission type="createNonDurableQueue" roles="guest"/>
+         <permission type="deleteNonDurableQueue" roles="guest"/>
+         <permission type="consume" roles="guest"/>
+         <permission type="send" roles="guest"/>
+      </security-setting>
+   </security-settings>
+   
+</configuration>

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/bridge/src/main/resources/activemq/server0/activemq-jms.xml
----------------------------------------------------------------------
diff --git a/examples/jms/bridge/src/main/resources/activemq/server0/activemq-jms.xml b/examples/jms/bridge/src/main/resources/activemq/server0/activemq-jms.xml
new file mode 100644
index 0000000..3f96251
--- /dev/null
+++ b/examples/jms/bridge/src/main/resources/activemq/server0/activemq-jms.xml
@@ -0,0 +1,8 @@
+<configuration xmlns="urn:activemq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
+
+   <!--the queue used by the example-->
+   <queue name="sausage-factory"/>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/bridge/src/main/resources/activemq/server0/activemq-users.xml
----------------------------------------------------------------------
diff --git a/examples/jms/bridge/src/main/resources/activemq/server0/activemq-users.xml b/examples/jms/bridge/src/main/resources/activemq/server0/activemq-users.xml
new file mode 100644
index 0000000..ae30546
--- /dev/null
+++ b/examples/jms/bridge/src/main/resources/activemq/server0/activemq-users.xml
@@ -0,0 +1,7 @@
+<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
+   <!-- the default user.  this is used where username is null-->
+   <defaultuser name="guest" password="guest">
+      <role name="guest"/>
+   </defaultuser>
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/bridge/src/main/resources/activemq/server1/activemq-configuration.xml
----------------------------------------------------------------------
diff --git a/examples/jms/bridge/src/main/resources/activemq/server1/activemq-configuration.xml b/examples/jms/bridge/src/main/resources/activemq/server1/activemq-configuration.xml
new file mode 100644
index 0000000..91b6131
--- /dev/null
+++ b/examples/jms/bridge/src/main/resources/activemq/server1/activemq-configuration.xml
@@ -0,0 +1,35 @@
+<configuration xmlns="urn:activemq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-configuration.xsd">
+
+   <bindings-directory>${build.directory}/server1/data/messaging/bindings</bindings-directory>
+
+   <journal-directory>${build.directory}/server1/data/messaging/journal</journal-directory>
+
+   <large-messages-directory>${build.directory}/server1/data/messaging/largemessages</large-messages-directory>
+
+   <paging-directory>${build.directory}/server1/data/messaging/paging</paging-directory>
+   
+   <!-- Acceptors -->
+   <acceptors>
+      <acceptor name="netty-acceptor">
+         <factory-class>org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+         <param key="port" value="5446"/>
+      </acceptor>
+   </acceptors>
+   
+   <!-- Other config -->
+   
+   <security-settings>
+      <!--security for example queue-->
+      <security-setting match="jms.queue.#">
+         <permission type="createDurableQueue" roles="guest"/>
+         <permission type="deleteDurableQueue" roles="guest"/>
+         <permission type="createNonDurableQueue" roles="guest"/>
+         <permission type="deleteNonDurableQueue" roles="guest"/>
+         <permission type="consume" roles="guest"/>
+         <permission type="send" roles="guest"/>
+      </security-setting>
+   </security-settings>
+   
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/bridge/src/main/resources/activemq/server1/activemq-jms.xml
----------------------------------------------------------------------
diff --git a/examples/jms/bridge/src/main/resources/activemq/server1/activemq-jms.xml b/examples/jms/bridge/src/main/resources/activemq/server1/activemq-jms.xml
new file mode 100644
index 0000000..e4fe85a
--- /dev/null
+++ b/examples/jms/bridge/src/main/resources/activemq/server1/activemq-jms.xml
@@ -0,0 +1,8 @@
+<configuration xmlns="urn:activemq"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-jms.xsd">
+
+   <!--the queue used by the example-->
+   <queue name="mincing-machine"/>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/a102983d/examples/jms/bridge/src/main/resources/activemq/server1/activemq-users.xml
----------------------------------------------------------------------
diff --git a/examples/jms/bridge/src/main/resources/activemq/server1/activemq-users.xml b/examples/jms/bridge/src/main/resources/activemq/server1/activemq-users.xml
new file mode 100644
index 0000000..ae30546
--- /dev/null
+++ b/examples/jms/bridge/src/main/resources/activemq/server1/activemq-users.xml
@@ -0,0 +1,7 @@
+<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:activemq /schema/activemq-users.xsd">
+   <!-- the default user.  this is used where username is null-->
+   <defaultuser name="guest" password="guest">
+      <role name="guest"/>
+   </defaultuser>
+</configuration>
\ No newline at end of file


Mime
View raw message