http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/config/PersistedJNDI.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/config/PersistedJNDI.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/config/PersistedJNDI.java
new file mode 100644
index 0000000..0a2feb0
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/config/PersistedJNDI.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.persistence.config;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.core.journal.EncodingSupport;
+import org.apache.activemq6.utils.BufferHelper;
+import org.apache.activemq6.utils.DataConstants;
+
+/**
+ * A PersistedJNDI
+ *
+ * @author <a href="mailto:[email protected]";>Clebert Suconic</a>
+ */
+public class PersistedJNDI implements EncodingSupport
+{
+
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private long id;
+
+   private PersistedType type;
+
+   private String name;
+
+   private ArrayList<String> jndi = new ArrayList<String>();
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public PersistedJNDI()
+   {
+   }
+
+   /**
+    * @param type
+    * @param name
+    */
+   public PersistedJNDI(PersistedType type, String name)
+   {
+      super();
+      this.type = type;
+      this.name = name;
+   }
+
+   // Public --------------------------------------------------------
+   @Override
+   public void decode(HornetQBuffer buffer)
+   {
+      type = PersistedType.getType(buffer.readByte());
+      name = buffer.readSimpleString().toString();
+      int jndiArraySize = buffer.readInt();
+      jndi = new ArrayList<String>(jndiArraySize);
+
+      for (int i = 0; i < jndiArraySize; i++)
+      {
+         jndi.add(buffer.readSimpleString().toString());
+      }
+   }
+
+   @Override
+   public void encode(HornetQBuffer buffer)
+   {
+      buffer.writeByte(type.getType());
+      BufferHelper.writeAsSimpleString(buffer, name);
+      buffer.writeInt(jndi.size());
+      for (String jndiEl : jndi)
+      {
+         BufferHelper.writeAsSimpleString(buffer, jndiEl);
+      }
+   }
+
+   @Override
+   public int getEncodeSize()
+   {
+      return DataConstants.SIZE_BYTE +
+         BufferHelper.sizeOfSimpleString(name) +
+         sizeOfJNDI();
+   }
+
+   private int sizeOfJNDI()
+   {
+      int size = DataConstants.SIZE_INT; // for the number of elements written
+
+      for (String str : jndi)
+      {
+         size += BufferHelper.sizeOfSimpleString(str);
+      }
+
+      return size;
+   }
+
+   /**
+    * @return the id
+    */
+   public long getId()
+   {
+      return id;
+   }
+
+   /**
+    * @param id the id to set
+    */
+   public void setId(long id)
+   {
+      this.id = id;
+   }
+
+   /**
+    * @return the type
+    */
+   public PersistedType getType()
+   {
+      return type;
+   }
+
+   /**
+    * @return the name
+    */
+   public String getName()
+   {
+      return name;
+   }
+
+   /**
+    * @return the jndi
+    */
+   public List<String> getJndi()
+   {
+      return jndi;
+   }
+
+   public void addJNDI(String address)
+   {
+      jndi.add(address);
+   }
+
+   public void deleteJNDI(String address)
+   {
+      jndi.remove(address);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/config/PersistedType.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/config/PersistedType.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/config/PersistedType.java
new file mode 100644
index 0000000..c3bbbd3
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/config/PersistedType.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.persistence.config;
+
+/**
+ * A PersistedType
+ *
+ * @author <a href="mailto:[email protected]";>Clebert Suconic</a>
+ */
+public enum PersistedType
+{
+   ConnectionFactory, Topic, Queue;
+
+   public byte getType()
+   {
+      switch (this)
+      {
+         case ConnectionFactory:
+            return 0;
+         case Topic:
+            return 1;
+         case Queue:
+            return 2;
+         default:
+            return -1;
+      }
+   }
+
+   public static PersistedType getType(byte type)
+   {
+      switch (type)
+      {
+         case 0:
+            return ConnectionFactory;
+         case 1:
+            return Topic;
+         case 2:
+            return Queue;
+         default:
+            return null;
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
new file mode 100644
index 0000000..829f080
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
@@ -0,0 +1,362 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.persistence.impl.journal;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.api.core.HornetQBuffers;
+import org.apache.activemq6.api.core.Pair;
+import org.apache.activemq6.core.config.Configuration;
+import org.apache.activemq6.core.journal.Journal;
+import org.apache.activemq6.core.journal.PreparedTransactionInfo;
+import org.apache.activemq6.core.journal.RecordInfo;
+import org.apache.activemq6.core.journal.SequentialFileFactory;
+import org.apache.activemq6.core.journal.impl.JournalImpl;
+import org.apache.activemq6.core.journal.impl.NIOSequentialFileFactory;
+import org.apache.activemq6.core.replication.ReplicatedJournal;
+import org.apache.activemq6.core.replication.ReplicationManager;
+import org.apache.activemq6.core.server.JournalType;
+import org.apache.activemq6.jms.persistence.JMSStorageManager;
+import org.apache.activemq6.jms.persistence.config.PersistedConnectionFactory;
+import org.apache.activemq6.jms.persistence.config.PersistedDestination;
+import org.apache.activemq6.jms.persistence.config.PersistedJNDI;
+import org.apache.activemq6.jms.persistence.config.PersistedType;
+import org.apache.activemq6.utils.IDGenerator;
+
+/**
+ * A JournalJMSStorageManagerImpl
+ *
+ * @author <a href="mailto:[email protected]";>Clebert Suconic</a>
+ */
+public final class JMSJournalStorageManagerImpl implements JMSStorageManager
+{
+
+   // Constants -----------------------------------------------------
+
+   public static final byte CF_RECORD = 1;
+
+   public static final byte DESTINATION_RECORD = 2;
+
+   public static final byte JNDI_RECORD = 3;
+
+   // Attributes ----------------------------------------------------
+
+   private final IDGenerator idGenerator;
+
+   private final String journalDir;
+
+   private final boolean createDir;
+
+   private final Journal jmsJournal;
+
+   private volatile boolean started;
+
+   private final Map<String, PersistedConnectionFactory> mapFactories = new 
ConcurrentHashMap<String, PersistedConnectionFactory>();
+
+   private final Map<Pair<PersistedType, String>, PersistedDestination> 
destinations = new ConcurrentHashMap<Pair<PersistedType, String>, 
PersistedDestination>();
+
+   private final Map<Pair<PersistedType, String>, PersistedJNDI> mapJNDI = new 
ConcurrentHashMap<Pair<PersistedType, String>, PersistedJNDI>();
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+   public JMSJournalStorageManagerImpl(final IDGenerator idGenerator,
+                                       final Configuration config,
+                                       final ReplicationManager replicator)
+   {
+      if (config.getJournalType() != JournalType.NIO && 
config.getJournalType() != JournalType.ASYNCIO)
+      {
+         throw new IllegalArgumentException("Only NIO and AsyncIO are 
supported journals");
+      }
+
+      // Will use the same place as the bindings directory from the core 
journal
+      journalDir = config.getBindingsDirectory();
+
+      if (journalDir == null)
+      {
+         throw new NullPointerException("bindings-dir is null");
+      }
+
+      createDir = config.isCreateBindingsDir();
+
+      SequentialFileFactory bindingsJMS = new 
NIOSequentialFileFactory(journalDir);
+
+      Journal localJMS = new JournalImpl(1024 * 1024,
+                                         2,
+                                         config.getJournalCompactMinFiles(),
+                                         config.getJournalCompactPercentage(),
+                                         bindingsJMS,
+                                         "hornetq-jms",
+                                         "jms",
+                                         1);
+
+      if (replicator != null)
+      {
+         jmsJournal = new ReplicatedJournal((byte) 2, localJMS, replicator);
+      }
+      else
+      {
+         jmsJournal = localJMS;
+      }
+
+      this.idGenerator = idGenerator;
+   }
+
+
+   // Public --------------------------------------------------------
+   @Override
+   public List<PersistedConnectionFactory> recoverConnectionFactories()
+   {
+      List<PersistedConnectionFactory> cfs = new 
ArrayList<PersistedConnectionFactory>(mapFactories.values());
+      return cfs;
+   }
+
+   @Override
+   public void storeConnectionFactory(final PersistedConnectionFactory 
connectionFactory) throws Exception
+   {
+      deleteConnectionFactory(connectionFactory.getName());
+      long id = idGenerator.generateID();
+      connectionFactory.setId(id);
+      jmsJournal.appendAddRecord(id, CF_RECORD, connectionFactory, true);
+      mapFactories.put(connectionFactory.getName(), connectionFactory);
+   }
+
+   public void deleteConnectionFactory(final String cfName) throws Exception
+   {
+      PersistedConnectionFactory oldCF = mapFactories.remove(cfName);
+      if (oldCF != null)
+      {
+         jmsJournal.appendDeleteRecord(oldCF.getId(), false);
+      }
+   }
+
+   @Override
+   public List<PersistedDestination> recoverDestinations()
+   {
+      List<PersistedDestination> destinations = new 
ArrayList<PersistedDestination>(this.destinations.values());
+      return destinations;
+   }
+
+   @Override
+   public void storeDestination(final PersistedDestination destination) throws 
Exception
+   {
+      deleteDestination(destination.getType(), destination.getName());
+      long id = idGenerator.generateID();
+      destination.setId(id);
+      jmsJournal.appendAddRecord(id, DESTINATION_RECORD, destination, true);
+      destinations.put(new Pair<PersistedType, String>(destination.getType(), 
destination.getName()), destination);
+   }
+
+   public List<PersistedJNDI> recoverPersistedJNDI() throws Exception
+   {
+      ArrayList<PersistedJNDI> list = new 
ArrayList<PersistedJNDI>(mapJNDI.values());
+      return list;
+   }
+
+   public void addJNDI(PersistedType type, String name, String... address) 
throws Exception
+   {
+      Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, 
name);
+
+      long tx = idGenerator.generateID();
+
+      PersistedJNDI currentJNDI = mapJNDI.get(key);
+      if (currentJNDI != null)
+      {
+         jmsJournal.appendDeleteRecordTransactional(tx, currentJNDI.getId());
+      }
+      else
+      {
+         currentJNDI = new PersistedJNDI(type, name);
+      }
+
+      mapJNDI.put(key, currentJNDI);
+
+      for (String adItem : address)
+      {
+         currentJNDI.addJNDI(adItem);
+      }
+
+
+      long newId = idGenerator.generateID();
+
+      currentJNDI.setId(newId);
+
+      jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, 
currentJNDI);
+
+      jmsJournal.appendCommitRecord(tx, true);
+   }
+
+   public void deleteJNDI(PersistedType type, String name, String address) 
throws Exception
+   {
+      Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, 
name);
+
+      long tx = idGenerator.generateID();
+
+      PersistedJNDI currentJNDI = mapJNDI.get(key);
+      if (currentJNDI == null)
+      {
+         return;
+      }
+      else
+      {
+         jmsJournal.appendDeleteRecordTransactional(tx, currentJNDI.getId());
+      }
+
+      currentJNDI.deleteJNDI(address);
+
+      if (currentJNDI.getJndi().size() == 0)
+      {
+         mapJNDI.remove(key);
+      }
+      else
+      {
+         long newId = idGenerator.generateID();
+         currentJNDI.setId(newId);
+         jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, 
currentJNDI);
+      }
+
+      jmsJournal.appendCommitRecord(tx, true);
+   }
+
+
+   public void deleteJNDI(PersistedType type, String name) throws Exception
+   {
+      Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, 
name);
+
+      PersistedJNDI currentJNDI = mapJNDI.remove(key);
+
+      if (currentJNDI != null)
+      {
+         jmsJournal.appendDeleteRecord(currentJNDI.getId(), true);
+      }
+   }
+
+   public void deleteDestination(final PersistedType type, final String name) 
throws Exception
+   {
+      PersistedDestination destination = destinations.remove(new 
Pair<PersistedType, String>(type, name));
+      if (destination != null)
+      {
+         jmsJournal.appendDeleteRecord(destination.getId(), false);
+      }
+   }
+
+   @Override
+   public boolean isStarted()
+   {
+      return started;
+   }
+
+
+   @Override
+   public void start() throws Exception
+   {
+
+      checkAndCreateDir(journalDir, createDir);
+
+      jmsJournal.start();
+
+      started = true;
+   }
+
+   @Override
+   public void stop() throws Exception
+   {
+      this.started = false;
+      jmsJournal.stop();
+   }
+
+   public void load() throws Exception
+   {
+      mapFactories.clear();
+
+      List<RecordInfo> data = new ArrayList<RecordInfo>();
+
+      ArrayList<PreparedTransactionInfo> list = new 
ArrayList<PreparedTransactionInfo>();
+
+      jmsJournal.load(data, list, null);
+
+      for (RecordInfo record : data)
+      {
+         long id = record.id;
+
+         HornetQBuffer buffer = HornetQBuffers.wrappedBuffer(record.data);
+
+         byte rec = record.getUserRecordType();
+
+         if (rec == CF_RECORD)
+         {
+            PersistedConnectionFactory cf = new PersistedConnectionFactory();
+            cf.decode(buffer);
+            cf.setId(id);
+            mapFactories.put(cf.getName(), cf);
+         }
+         else if (rec == DESTINATION_RECORD)
+         {
+            PersistedDestination destination = new PersistedDestination();
+            destination.decode(buffer);
+            destination.setId(id);
+            destinations.put(new Pair<PersistedType, 
String>(destination.getType(), destination.getName()), destination);
+         }
+         else if (rec == JNDI_RECORD)
+         {
+            PersistedJNDI jndi = new PersistedJNDI();
+            jndi.decode(buffer);
+            jndi.setId(id);
+            Pair<PersistedType, String> key = new Pair<PersistedType, 
String>(jndi.getType(), jndi.getName());
+            mapJNDI.put(key, jndi);
+         }
+         else
+         {
+            throw new IllegalStateException("Invalid record type " + rec);
+         }
+
+      }
+
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+
+   private void checkAndCreateDir(final String dir, final boolean create)
+   {
+      File f = new File(dir);
+
+      if (!f.exists())
+      {
+         if (create)
+         {
+            if (!f.mkdirs())
+            {
+               throw new IllegalStateException("Failed to create directory " + 
dir);
+            }
+         }
+         else
+         {
+            throw new IllegalArgumentException("Directory " + dir + " does not 
exist and will not create it");
+         }
+      }
+   }
+
+
+   // Inner classes -------------------------------------------------
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
new file mode 100644
index 0000000..095bc80
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/persistence/impl/nullpm/NullJMSStorageManagerImpl.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.persistence.impl.nullpm;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.activemq6.jms.persistence.JMSStorageManager;
+import org.apache.activemq6.jms.persistence.config.PersistedConnectionFactory;
+import org.apache.activemq6.jms.persistence.config.PersistedDestination;
+import org.apache.activemq6.jms.persistence.config.PersistedJNDI;
+import org.apache.activemq6.jms.persistence.config.PersistedType;
+
+/**
+ * A NullJMSStorageManagerImpl
+ *
+ * @author <a href="mailto:[email protected]";>Clebert Suconic</a>
+ *
+ *
+ */
+public class NullJMSStorageManagerImpl implements JMSStorageManager
+{
+
+   @Override
+   public void deleteConnectionFactory(String connectionFactory) throws 
Exception
+   {
+
+   }
+
+   @Override
+   public List<PersistedConnectionFactory> recoverConnectionFactories()
+   {
+      return Collections.emptyList();
+   }
+
+   @Override
+   public List<PersistedDestination> recoverDestinations()
+   {
+      return Collections.emptyList();
+   }
+
+   @Override
+   public void storeConnectionFactory(PersistedConnectionFactory 
connectionFactory) throws Exception
+   {
+   }
+
+   @Override
+   public void storeDestination(PersistedDestination destination)
+   {
+   }
+
+   @Override
+   public boolean isStarted()
+   {
+      return true;
+   }
+
+   @Override
+   public void start() throws Exception
+   {
+   }
+
+   @Override
+   public void stop() throws Exception
+   {
+   }
+
+   @Override
+   public void addJNDI(PersistedType type, String name, String ... address) 
throws Exception
+   {
+   }
+
+   @Override
+   public void deleteJNDI(PersistedType type, String name, String address) 
throws Exception
+   {
+   }
+
+   @Override
+   public void deleteDestination(PersistedType type, String name) throws 
Exception
+   {
+   }
+
+   @Override
+   public void deleteJNDI(PersistedType type, String name) throws Exception
+   {
+   }
+
+   @Override
+   public List<PersistedJNDI> recoverPersistedJNDI() throws Exception
+   {
+      return Collections.emptyList();
+   }
+
+   @Override
+   public void load() throws Exception
+   {
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/HornetQJMSServerBundle.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/HornetQJMSServerBundle.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/HornetQJMSServerBundle.java
new file mode 100644
index 0000000..b607b98
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/HornetQJMSServerBundle.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.server;
+
+
+import org.apache.activemq6.api.core.HornetQAddressExistsException;
+import org.apache.activemq6.api.core.HornetQIllegalStateException;
+import org.apache.activemq6.api.core.HornetQInternalErrorException;
+import org.jboss.logging.annotations.Cause;
+import org.jboss.logging.annotations.Message;
+import org.jboss.logging.annotations.MessageBundle;
+import org.jboss.logging.Messages;
+
+/**
+ * @author <a href="mailto:[email protected]";>Andy Taylor</a>
+ *         3/12/12
+ *
+ * Logger Code 12
+ *
+ * each message id must be 6 digits long starting with 10, the 3rd digit 
should be 9
+ *
+ * so 129000 to 129999
+ */
+@MessageBundle(projectCode = "HQ")
+public interface HornetQJMSServerBundle
+{
+   HornetQJMSServerBundle BUNDLE = 
Messages.getBundle(HornetQJMSServerBundle.class);
+
+   @Message(id = 129000, value =  "Connection Factory {0} does not exist" , 
format = Message.Format.MESSAGE_FORMAT)
+   HornetQInternalErrorException cfDoesntExist(String name);
+
+   @Message(id = 129001, value =  "Invalid signature {0} parsing Connection 
Factory" , format = Message.Format.MESSAGE_FORMAT)
+   HornetQInternalErrorException invalidSignatureParsingCF(String sig);
+
+   @Message(id = 129002, value = "Invalid node {0} parsing Connection 
Factory", format = Message.Format.MESSAGE_FORMAT)
+   HornetQInternalErrorException invalidNodeParsingCF(String name);
+
+   @Message(id = 129003, value = "Discovery Group ''{0}'' does not exist on 
main config", format = Message.Format.MESSAGE_FORMAT)
+   HornetQIllegalStateException discoveryGroupDoesntExist(String name);
+
+   @Message(id = 129004, value = "No Connector name configured on create 
ConnectionFactory", format = Message.Format.MESSAGE_FORMAT)
+   HornetQIllegalStateException noConnectorNameOnCF();
+
+   @Message(id = 129005, value = "Connector ''{0}'' not found on the main 
configuration file" , format = Message.Format.MESSAGE_FORMAT)
+   HornetQIllegalStateException noConnectorNameConfiguredOnCF(String name);
+
+   @Message(id = 129006, value =  "JNDI {0} is already being used by another 
connection factory", format = Message.Format.MESSAGE_FORMAT)
+   HornetQAddressExistsException cfJndiExists(String name);
+
+   @Message(id = 129007, value = "Error decoding password using codec 
instance", format = Message.Format.MESSAGE_FORMAT)
+   HornetQIllegalStateException errorDecodingPassword(@Cause Exception e);
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/HornetQJMSServerLogger.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/HornetQJMSServerLogger.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/HornetQJMSServerLogger.java
new file mode 100644
index 0000000..1077a29
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/HornetQJMSServerLogger.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.server;
+
+import org.apache.activemq6.api.core.client.ClientSessionFactory;
+import org.apache.activemq6.jms.server.recovery.XARecoveryConfig;
+import org.jboss.logging.BasicLogger;
+import org.jboss.logging.Logger;
+import org.jboss.logging.annotations.Cause;
+import org.jboss.logging.annotations.LogMessage;
+import org.jboss.logging.annotations.Message;
+import org.jboss.logging.annotations.MessageLogger;
+import org.w3c.dom.Node;
+
+/**
+ * @author <a href="mailto:[email protected]";>Andy Taylor</a>
+ * @author <a href="mailto:[email protected]";>Martyn Taylor</a>
+ *
+ * Logger Code 12
+ *
+ * each message id must be 6 digits long starting with 12, the 3rd digit 
donates the level so
+ *
+ * INF0  1
+ * WARN  2
+ * DEBUG 3
+ * ERROR 4
+ * TRACE 5
+ * FATAL 6
+ *
+ * so an INFO message would be 121000 to 121999
+ */
+@MessageLogger(projectCode = "HQ")
+public interface HornetQJMSServerLogger extends BasicLogger
+{
+   /**
+    * The default logger.
+    */
+   HornetQJMSServerLogger LOGGER = 
Logger.getMessageLogger(HornetQJMSServerLogger.class, 
HornetQJMSServerLogger.class.getPackage().getName());
+
+   @LogMessage(level = Logger.Level.INFO)
+   @Message(id = 121003, value = "JMS Server Manager Running cached command 
for {0}" , format = Message.Format.MESSAGE_FORMAT)
+   void serverRunningCachedCommand(Runnable run);
+
+   @LogMessage(level = Logger.Level.INFO)
+   @Message(id = 121004, value = "JMS Server Manager Caching command for {0} 
since the JMS Server is not active yet",
+            format = Message.Format.MESSAGE_FORMAT)
+   void serverCachingCommand(Object runnable);
+
+   @LogMessage(level = Logger.Level.INFO)
+   @Message(id = 121005, value = "Invalid \"host\" value \"0.0.0.0\" detected 
for \"{0}\" connector. Switching to \"{1}\". If this new address is incorrect 
please manually configure the connector to use the proper one.",
+            format = Message.Format.MESSAGE_FORMAT)
+   void invalidHostForConnector(String name, String newHost);
+
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 122007, value = "Queue {0} does not exist on the topic {1}. 
It was deleted manually probably." , format = Message.Format.MESSAGE_FORMAT)
+   void noQueueOnTopic(String queueName, String name);
+
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 122008, value = "XA Recovery can not connect to any hornetq 
server on recovery {0}"  , format = Message.Format.MESSAGE_FORMAT)
+   void recoveryConnectFailed(String s);
+
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 122011, value = "error unbinding {0} from JNDI" , format = 
Message.Format.MESSAGE_FORMAT)
+   void jndiUnbindError(@Cause Exception e, String key);
+
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 122012, value = "JMS Server Manager error" , format = 
Message.Format.MESSAGE_FORMAT)
+   void jmsServerError(@Cause Exception e);
+
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 122013, value = "Error in XA Recovery recover" , format = 
Message.Format.MESSAGE_FORMAT)
+   void xaRecoverError(@Cause Exception e);
+
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 122014, value = "Notified of connection failure in xa 
recovery connectionFactory for provider {0} will attempt reconnect on next 
pass",
+            format = Message.Format.MESSAGE_FORMAT)
+   void xaRecoverConnectionError(@Cause Exception e, ClientSessionFactory csf);
+
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 122015, value = "Can not connect to {0} on auto-generated 
resource recovery",
+            format = Message.Format.MESSAGE_FORMAT)
+   void xaRecoverAutoConnectionError(@Cause Throwable e, XARecoveryConfig csf);
+
+   @LogMessage(level = Logger.Level.DEBUG)
+   @Message(id = 122016, value = "Error in XA Recovery" , format = 
Message.Format.MESSAGE_FORMAT)
+   void xaRecoveryError(@Cause Exception e);
+
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 122017, value = "Tried to correct invalid \"host\" value 
\"0.0.0.0\" for \"{0}\" connector, but received an exception.",
+            format = Message.Format.MESSAGE_FORMAT)
+   void failedToCorrectHost(@Cause Exception e, String name);
+
+   @LogMessage(level = Logger.Level.WARN)
+   @Message(id = 122018, value = "Could not start recovery discovery on {0}, 
we will retry every recovery scan until the server is available",
+            format = Message.Format.MESSAGE_FORMAT)
+   void xaRecoveryStartError(XARecoveryConfig e);
+
+   @LogMessage(level = Logger.Level.ERROR)
+   @Message(id = 124000, value = "key attribute missing for JMS configuration 
{0}" , format = Message.Format.MESSAGE_FORMAT)
+   void jmsConfigMissingKey(Node e);
+
+   @LogMessage(level = Logger.Level.ERROR)
+   @Message(id = 124002, value = "Failed to start JMS deployer" , format = 
Message.Format.MESSAGE_FORMAT)
+   void jmsDeployerStartError(@Cause Exception e);
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/JMSServerConfigParser.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/JMSServerConfigParser.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/JMSServerConfigParser.java
new file mode 100644
index 0000000..4071d6e
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/JMSServerConfigParser.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.server;
+
+import java.io.InputStream;
+
+import org.apache.activemq6.jms.server.config.ConnectionFactoryConfiguration;
+import org.apache.activemq6.jms.server.config.JMSConfiguration;
+import org.apache.activemq6.jms.server.config.JMSQueueConfiguration;
+import org.apache.activemq6.jms.server.config.TopicConfiguration;
+import org.w3c.dom.Node;
+
+/**
+ * A JMSServerConfigParser
+ *
+ * @author <a href="mailto:[email protected]";>Clebert Suconic</a>
+ *
+ *
+ */
+public interface JMSServerConfigParser
+{
+   /**
+    * Parse the JMS Configuration XML as a JMSConfiguration object
+    */
+   JMSConfiguration parseConfiguration(final InputStream stream) throws 
Exception;
+
+   /**
+    * Parse the JMS Configuration XML as a JMSConfiguration object
+    */
+   JMSConfiguration parseConfiguration(final Node rootnode) throws Exception;
+
+   /**
+    * Parse the topic node as a TopicConfiguration object
+    * @param node
+    * @return {@link TopicConfiguration} parsed from the node
+    * @throws Exception
+    */
+   TopicConfiguration parseTopicConfiguration(final Node node) throws 
Exception;
+
+   /**
+    * Parse the Queue Configuration node as a QueueConfiguration object
+    * @param node
+    * @return {@link JMSQueueConfiguration} parsed from the node
+    * @throws Exception
+    */
+   JMSQueueConfiguration parseQueueConfiguration(final Node node) throws 
Exception;
+
+   /**
+    * Parse the Connection Configuration node as a 
ConnectionFactoryConfiguration object
+    * @param node
+    * @return
+    * @throws Exception
+    */
+   ConnectionFactoryConfiguration parseConnectionFactoryConfiguration(final 
Node node) throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/JMSServerManager.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/JMSServerManager.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/JMSServerManager.java
new file mode 100644
index 0000000..6261521
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/JMSServerManager.java
@@ -0,0 +1,319 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.server;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.naming.Context;
+
+import org.apache.activemq6.api.jms.JMSFactoryType;
+import org.apache.activemq6.core.security.Role;
+import org.apache.activemq6.core.server.HornetQComponent;
+import org.apache.activemq6.core.server.HornetQServer;
+import org.apache.activemq6.core.settings.impl.AddressSettings;
+import org.apache.activemq6.jms.client.HornetQConnectionFactory;
+import org.apache.activemq6.jms.server.config.ConnectionFactoryConfiguration;
+import org.apache.activemq6.spi.core.naming.BindingRegistry;
+
+/**
+ * The JMS Management interface.
+ *
+ * @author <a href="[email protected]">Andy Taylor</a>
+ * @author <a href="[email protected]">Jeff Mesnil</a>
+ * @author <a href="mailto:[email protected]";>Tim Fox</a>
+ */
+public interface JMSServerManager extends HornetQComponent
+{
+   String getVersion();
+
+   /**
+    * Has the Server been started.
+    *
+    * @return true if the server us running
+    */
+   boolean isStarted();
+
+   /**
+    * Creates a JMS Queue.
+    *
+    * @param queueName
+    *           The name of the queue to create
+    * @param selectorString
+    * @param durable
+    * @return true if the queue is created or if it existed and was added to
+    *         JNDI
+    * @throws Exception
+    *            if problems were encountered creating the queue.
+    */
+   boolean createQueue(boolean storeConfig, String queueName, String 
selectorString, boolean durable, String ...bindings) throws Exception;
+
+   boolean addTopicToJndi(final String topicName, final String binding) throws 
Exception;
+
+   boolean addQueueToJndi(final String queueName, final String binding) throws 
Exception;
+
+   boolean addConnectionFactoryToJNDI(final String name, final String binding) 
throws Exception;
+
+   /**
+    * Creates a JMS Topic
+    *
+    * @param topicName
+    *           the name of the topic
+    * @param bindings
+    *           the names of the binding for JNDI or BindingRegistry
+    * @return true if the topic was created or if it existed and was added to
+    *         JNDI
+    * @throws Exception
+    *            if a problem occurred creating the topic
+    */
+   boolean createTopic(boolean storeConfig, String topicName, String ... 
bindings) throws Exception;
+
+   /**
+    * Remove the topic from JNDI or BindingRegistry.
+    * Calling this method does <em>not</em> destroy the destination.
+    *
+    * @param name
+    *           the name of the destination to remove from JNDI or 
BindingRegistry
+    * @return true if removed
+    * @throws Exception
+    *            if a problem occurred removing the destination
+    */
+   boolean removeTopicFromJNDI(String name, String binding) throws Exception;
+
+   /**
+    * Remove the topic from JNDI or BindingRegistry.
+    * Calling this method does <em>not</em> destroy the destination.
+    *
+    * @param name
+    *           the name of the destination to remove from JNDI or 
BindingRegistry
+    * @return true if removed
+    * @throws Exception
+    *            if a problem occurred removing the destination
+    */
+   boolean removeTopicFromJNDI(String name) throws Exception;
+
+   /**
+    * Remove the queue from JNDI or BindingRegistry.
+    * Calling this method does <em>not</em> destroy the destination.
+    *
+    * @param name
+    *           the name of the destination to remove from JNDI or 
BindingRegistry
+    * @return true if removed
+    * @throws Exception
+    *            if a problem occurred removing the destination
+    */
+   boolean removeQueueFromJNDI(String name, String binding) throws Exception;
+
+   /**
+    * Remove the queue from JNDI or BindingRegistry.
+    * Calling this method does <em>not</em> destroy the destination.
+    *
+    * @param name
+    *           the name of the destination to remove from JNDI or 
BindingRegistry
+    * @return true if removed
+    * @throws Exception
+    *            if a problem occurred removing the destination
+    */
+   boolean removeQueueFromJNDI(String name) throws Exception;
+
+   boolean removeConnectionFactoryFromJNDI(String name, String binding) throws 
Exception;
+
+   boolean removeConnectionFactoryFromJNDI(String name) throws Exception;
+
+   /**
+    * destroys a queue and removes it from JNDI or BindingRegistry
+    *
+    * @param name
+    *           the name of the queue to destroy
+    * @return true if destroyed
+    * @throws Exception
+    *            if a problem occurred destroying the queue
+    */
+   boolean destroyQueue(String name) throws Exception;
+
+   /**
+    * destroys a queue and removes it from JNDI or BindingRegistry.
+    * disconnects any consumers connected to the queue.
+    *
+    * @param name
+    *           the name of the queue to destroy
+    * @return true if destroyed
+    * @throws Exception
+    *            if a problem occurred destroying the queue
+    */
+   boolean destroyQueue(String name, boolean removeConsumers) throws Exception;
+
+   String[] getJNDIOnQueue(String queue);
+
+   String[] getJNDIOnTopic(String topic);
+
+   String[] getJNDIOnConnectionFactory(String factoryName);
+
+   /**
+    * destroys a topic and removes it from JNDI  or BindingRegistry
+    *
+    * @param name
+    *           the name of the topic to destroy
+    * @return true if the topic was destroyed
+    * @throws Exception
+    *            if a problem occurred destroying the topic
+    */
+   boolean destroyTopic(String name, boolean removeConsumers) throws Exception;
+
+   /**
+    * destroys a topic and removes it from JNDI  or BindingRegistry
+    *
+    * @param name
+    *           the name of the topic to destroy
+    * @return true if the topic was destroyed
+    * @throws Exception
+    *            if a problem occurred destroying the topic
+    */
+   boolean destroyTopic(String name) throws Exception;
+
+   /** Call this method to have a CF rebound to JNDI and stored on the Journal
+    * @throws Exception */
+   HornetQConnectionFactory recreateCF(String name,  
ConnectionFactoryConfiguration cf) throws Exception;
+
+   void createConnectionFactory(String name, boolean ha, JMSFactoryType 
cfType, String discoveryGroupName, String ... jndiBindings) throws Exception;
+
+   void createConnectionFactory(String name,
+                                boolean ha,
+                                JMSFactoryType cfType,
+                                List<String> connectorNames,
+                                String ... bindings) throws Exception;
+
+   void createConnectionFactory(String name,
+                                boolean ha,
+                                JMSFactoryType cfType,
+                                List<String> connectorNames,
+                                String clientID,
+                                long clientFailureCheckPeriod,
+                                long connectionTTL,
+                                long callTimeout,
+                                long callFailoverTimeout,
+                                boolean cacheLargeMessagesClient,
+                                int minLargeMessageSize,
+                                boolean compressLargeMessage,
+                                int consumerWindowSize,
+                                int consumerMaxRate,
+                                int confirmationWindowSize,
+                                int producerWindowSize,
+                                int producerMaxRate,
+                                boolean blockOnAcknowledge,
+                                boolean blockOnDurableSend,
+                                boolean blockOnNonDurableSend,
+                                boolean autoGroup,
+                                boolean preAcknowledge,
+                                String loadBalancingPolicyClassName,
+                                int transactionBatchSize,
+                                int dupsOKBatchSize,
+                                boolean useGlobalPools,
+                                int scheduledThreadPoolMaxSize,
+                                int threadPoolMaxSize,
+                                long retryInterval,
+                                double retryIntervalMultiplier,
+                                long maxRetryInterval,
+                                int reconnectAttempts,
+                                boolean failoverOnInitialConnection,
+                                String groupId,
+                                String ... bindings) throws Exception;
+
+   void createConnectionFactory(String name,
+                                boolean ha,
+                                JMSFactoryType cfType,
+                                String discoveryGroupName,
+                                String clientID,
+                                long clientFailureCheckPeriod,
+                                long connectionTTL,
+                                long callTimeout,
+                                long callFailoverTimeout,
+                                boolean cacheLargeMessagesClient,
+                                int minLargeMessageSize,
+                                boolean compressLargeMessages,
+                                int consumerWindowSize,
+                                int consumerMaxRate,
+                                int confirmationWindowSize,
+                                int producerWindowSize,
+                                int producerMaxRate,
+                                boolean blockOnAcknowledge,
+                                boolean blockOnDurableSend,
+                                boolean blockOnNonDurableSend,
+                                boolean autoGroup,
+                                boolean preAcknowledge,
+                                String loadBalancingPolicyClassName,
+                                int transactionBatchSize,
+                                int dupsOKBatchSize,
+                                boolean useGlobalPools,
+                                int scheduledThreadPoolMaxSize,
+                                int threadPoolMaxSize,
+                                long retryInterval,
+                                double retryIntervalMultiplier,
+                                long maxRetryInterval,
+                                int reconnectAttempts,
+                                boolean failoverOnInitialConnection,
+                                String groupId,
+                                String ... bindings) throws Exception;
+
+   void createConnectionFactory(boolean storeConfig, 
ConnectionFactoryConfiguration cfConfig, String... bindings) throws Exception;
+
+   /**
+    * destroys a connection factory.
+    *
+    * @param name
+    *           the name of the connection factory to destroy
+    * @return true if the connection factory was destroyed
+    * @throws Exception
+    *            if a problem occurred destroying the connection factory
+    */
+   boolean destroyConnectionFactory(String name) throws Exception;
+
+   String[] listRemoteAddresses() throws Exception;
+
+   String[] listRemoteAddresses(String ipAddress) throws Exception;
+
+   boolean closeConnectionsForAddress(String ipAddress) throws Exception;
+
+   boolean closeConsumerConnectionsForAddress(String address) throws Exception;
+
+   boolean closeConnectionsForUser(String address) throws Exception;
+
+   String[] listConnectionIDs() throws Exception;
+
+   String[] listSessions(String connectionID) throws Exception;
+
+   String listPreparedTransactionDetailsAsJSON() throws Exception;
+
+   String listPreparedTransactionDetailsAsHTML() throws Exception;
+
+   void setContext(final Context context);
+
+   HornetQServer getHornetQServer();
+
+   void addAddressSettings(String address, AddressSettings addressSettings);
+
+   AddressSettings getAddressSettings(String address);
+
+   void addSecurity(String addressMatch, Set<Role> roles);
+
+   Set<Role> getSecurity(final String addressMatch);
+
+   BindingRegistry getRegistry();
+
+   /**
+    * Set this property if you want something other than JNDI for your registry
+    *
+    * @param registry
+    */
+   void setRegistry(BindingRegistry registry);
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/ConnectionFactoryConfiguration.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/ConnectionFactoryConfiguration.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/ConnectionFactoryConfiguration.java
new file mode 100644
index 0000000..7948fe3
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/ConnectionFactoryConfiguration.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.server.config;
+
+import java.util.List;
+
+import org.apache.activemq6.api.jms.JMSFactoryType;
+import org.apache.activemq6.core.journal.EncodingSupport;
+
+/**
+ * A ConnectionFactoryConfiguration for {@link javax.jms.ConnectionFactory} 
objects.
+ *
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+public interface ConnectionFactoryConfiguration extends EncodingSupport
+{
+   boolean isPersisted();
+
+   String getName();
+
+   ConnectionFactoryConfiguration setName(String name);
+
+   String[] getBindings();
+
+   ConnectionFactoryConfiguration setBindings(String... bindings);
+
+   String getDiscoveryGroupName();
+
+   ConnectionFactoryConfiguration setDiscoveryGroupName(String 
discoveryGroupName);
+
+   List<String> getConnectorNames();
+
+   ConnectionFactoryConfiguration setConnectorNames(List<String> 
connectorNames);
+
+   boolean isHA();
+
+   ConnectionFactoryConfiguration setHA(boolean ha);
+
+   String getClientID();
+
+   ConnectionFactoryConfiguration setClientID(String clientID);
+
+   long getClientFailureCheckPeriod();
+
+   ConnectionFactoryConfiguration setClientFailureCheckPeriod(long 
clientFailureCheckPeriod);
+
+   long getConnectionTTL();
+
+   ConnectionFactoryConfiguration setConnectionTTL(long connectionTTL);
+
+   long getCallTimeout();
+
+   ConnectionFactoryConfiguration setCallTimeout(long callTimeout);
+
+   long getCallFailoverTimeout();
+
+   ConnectionFactoryConfiguration setCallFailoverTimeout(long 
callFailoverTimeout);
+
+   boolean isCacheLargeMessagesClient();
+
+   ConnectionFactoryConfiguration setCacheLargeMessagesClient(boolean 
cacheLargeMessagesClient);
+
+   int getMinLargeMessageSize();
+
+   ConnectionFactoryConfiguration setMinLargeMessageSize(int 
minLargeMessageSize);
+
+   boolean isCompressLargeMessages();
+
+   ConnectionFactoryConfiguration setCompressLargeMessages(boolean 
avoidLargeMessages);
+
+   int getConsumerWindowSize();
+
+   ConnectionFactoryConfiguration setConsumerWindowSize(int 
consumerWindowSize);
+
+   int getConsumerMaxRate();
+
+   ConnectionFactoryConfiguration setConsumerMaxRate(int consumerMaxRate);
+
+   int getConfirmationWindowSize();
+
+   ConnectionFactoryConfiguration setConfirmationWindowSize(int 
confirmationWindowSize);
+
+   int getProducerWindowSize();
+
+   ConnectionFactoryConfiguration setProducerWindowSize(int 
producerWindowSize);
+
+   int getProducerMaxRate();
+
+   ConnectionFactoryConfiguration setProducerMaxRate(int producerMaxRate);
+
+   boolean isBlockOnAcknowledge();
+
+   ConnectionFactoryConfiguration setBlockOnAcknowledge(boolean 
blockOnAcknowledge);
+
+   boolean isBlockOnDurableSend();
+
+   ConnectionFactoryConfiguration setBlockOnDurableSend(boolean 
blockOnDurableSend);
+
+   boolean isBlockOnNonDurableSend();
+
+   ConnectionFactoryConfiguration setBlockOnNonDurableSend(boolean 
blockOnNonDurableSend);
+
+   boolean isAutoGroup();
+
+   ConnectionFactoryConfiguration setAutoGroup(boolean autoGroup);
+
+   boolean isPreAcknowledge();
+
+   ConnectionFactoryConfiguration setPreAcknowledge(boolean preAcknowledge);
+
+   String getLoadBalancingPolicyClassName();
+
+   ConnectionFactoryConfiguration setLoadBalancingPolicyClassName(String 
loadBalancingPolicyClassName);
+
+   int getTransactionBatchSize();
+
+   ConnectionFactoryConfiguration setTransactionBatchSize(int 
transactionBatchSize);
+
+   int getDupsOKBatchSize();
+
+   ConnectionFactoryConfiguration setDupsOKBatchSize(int dupsOKBatchSize);
+
+   boolean isUseGlobalPools();
+
+   ConnectionFactoryConfiguration setUseGlobalPools(boolean useGlobalPools);
+
+   int getScheduledThreadPoolMaxSize();
+
+   ConnectionFactoryConfiguration setScheduledThreadPoolMaxSize(int 
scheduledThreadPoolMaxSize);
+
+   int getThreadPoolMaxSize();
+
+   ConnectionFactoryConfiguration setThreadPoolMaxSize(int threadPoolMaxSize);
+
+   long getRetryInterval();
+
+   ConnectionFactoryConfiguration setRetryInterval(long retryInterval);
+
+   double getRetryIntervalMultiplier();
+
+   ConnectionFactoryConfiguration setRetryIntervalMultiplier(double 
retryIntervalMultiplier);
+
+   long getMaxRetryInterval();
+
+   ConnectionFactoryConfiguration setMaxRetryInterval(long maxRetryInterval);
+
+   int getReconnectAttempts();
+
+   ConnectionFactoryConfiguration setReconnectAttempts(int reconnectAttempts);
+
+   boolean isFailoverOnInitialConnection();
+
+   ConnectionFactoryConfiguration setFailoverOnInitialConnection(boolean 
failover);
+
+   String getGroupID();
+
+   ConnectionFactoryConfiguration setGroupID(String groupID);
+
+   ConnectionFactoryConfiguration setFactoryType(JMSFactoryType factType);
+
+   JMSFactoryType getFactoryType();
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/JMSConfiguration.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/JMSConfiguration.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/JMSConfiguration.java
new file mode 100644
index 0000000..63c98fe
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/JMSConfiguration.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.server.config;
+
+import java.util.List;
+
+import javax.naming.Context;
+
+/**
+ * A JMSConfiguration
+ *
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ *
+ *
+ */
+public interface JMSConfiguration
+{
+   JMSConfiguration setContext(Context context);
+
+   Context getContext();
+
+   List<JMSQueueConfiguration> getQueueConfigurations();
+
+   JMSConfiguration setQueueConfigurations(List<JMSQueueConfiguration> 
queueConfigurations);
+
+   List<TopicConfiguration> getTopicConfigurations();
+
+   JMSConfiguration setTopicConfigurations(List<TopicConfiguration> 
topicConfigurations);
+
+   List<ConnectionFactoryConfiguration> getConnectionFactoryConfigurations();
+
+   JMSConfiguration 
setConnectionFactoryConfigurations(List<ConnectionFactoryConfiguration> 
connectionFactoryConfigurations);
+
+   String getDomain();
+
+   JMSConfiguration setDomain(String domain);
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/JMSQueueConfiguration.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/JMSQueueConfiguration.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/JMSQueueConfiguration.java
new file mode 100644
index 0000000..cf0a387
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/JMSQueueConfiguration.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.server.config;
+
+/**
+ * A QeueConfiguration
+ *
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ *
+ *
+ */
+public interface JMSQueueConfiguration
+{
+   String getName();
+
+   JMSQueueConfiguration setName(String name);
+
+   String getSelector();
+
+   JMSQueueConfiguration setSelector(String selector);
+
+   boolean isDurable();
+
+   JMSQueueConfiguration setDurable(boolean durable);
+
+   String[] getBindings();
+
+   JMSQueueConfiguration setBindings(String[] bindings);
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/TopicConfiguration.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/TopicConfiguration.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/TopicConfiguration.java
new file mode 100644
index 0000000..96f047c
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/TopicConfiguration.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.server.config;
+
+/**
+ * A TopicConfiguration
+ *
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+public interface TopicConfiguration
+{
+   String getName();
+
+   TopicConfiguration setName(String name);
+
+   String[] getBindings();
+
+   TopicConfiguration setBindings(String... bindings);
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
new file mode 100644
index 0000000..2951708
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
@@ -0,0 +1,847 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.server.config.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.activemq6.api.core.HornetQBuffer;
+import org.apache.activemq6.api.core.SimpleString;
+import org.apache.activemq6.api.core.client.HornetQClient;
+import org.apache.activemq6.api.jms.JMSFactoryType;
+import org.apache.activemq6.jms.server.config.ConnectionFactoryConfiguration;
+import org.apache.activemq6.utils.BufferHelper;
+import org.apache.activemq6.utils.DataConstants;
+
+/**
+ * This class contains the configuration properties of a connection factory.
+ * <p>
+ * It is also persisted on the journal at the time of management is used to 
created a connection factory and set to store.
+ * <p>
+ * Every property on this class has to be also set through encoders through 
EncodingSupport implementation at this class.
+ *
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+public class ConnectionFactoryConfigurationImpl implements 
ConnectionFactoryConfiguration
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private String name = null;
+
+   private boolean persisted = false;
+
+   private String[] bindings = null;
+
+   private List<String> connectorNames = null;
+
+   private String discoveryGroupName = null;
+
+   private String clientID = null;
+
+   private boolean ha = HornetQClient.DEFAULT_HA;
+
+   private long clientFailureCheckPeriod = 
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD;
+
+   private long connectionTTL = HornetQClient.DEFAULT_CONNECTION_TTL;
+
+   private long callTimeout = HornetQClient.DEFAULT_CALL_TIMEOUT;
+
+   private long callFailoverTimeout = 
HornetQClient.DEFAULT_CALL_FAILOVER_TIMEOUT;
+
+   private boolean cacheLargeMessagesClient = 
HornetQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT;
+
+   private int minLargeMessageSize = 
HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+
+   private boolean compressLargeMessage = 
HornetQClient.DEFAULT_COMPRESS_LARGE_MESSAGES;
+
+   private int consumerWindowSize = HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE;
+
+   private int consumerMaxRate = HornetQClient.DEFAULT_CONSUMER_MAX_RATE;
+
+   private int confirmationWindowSize = 
HornetQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE;
+
+   private int producerWindowSize = HornetQClient.DEFAULT_PRODUCER_WINDOW_SIZE;
+
+   private int producerMaxRate = HornetQClient.DEFAULT_PRODUCER_MAX_RATE;
+
+   private boolean blockOnAcknowledge = 
HornetQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE;
+
+   private boolean blockOnDurableSend = 
HornetQClient.DEFAULT_BLOCK_ON_DURABLE_SEND;
+
+   private boolean blockOnNonDurableSend = 
HornetQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND;
+
+   private boolean autoGroup = HornetQClient.DEFAULT_AUTO_GROUP;
+
+   private boolean preAcknowledge = HornetQClient.DEFAULT_PRE_ACKNOWLEDGE;
+
+   private String loadBalancingPolicyClassName = 
HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+
+   private int transactionBatchSize = HornetQClient.DEFAULT_ACK_BATCH_SIZE;
+
+   private int dupsOKBatchSize = HornetQClient.DEFAULT_ACK_BATCH_SIZE;
+
+   private long initialWaitTimeout = 
HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT;
+
+   private boolean useGlobalPools = HornetQClient.DEFAULT_USE_GLOBAL_POOLS;
+
+   private int scheduledThreadPoolMaxSize = 
HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE;
+
+   private int threadPoolMaxSize = HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE;
+
+   private long retryInterval = HornetQClient.DEFAULT_RETRY_INTERVAL;
+
+   private double retryIntervalMultiplier = 
HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+
+   private long maxRetryInterval = HornetQClient.DEFAULT_MAX_RETRY_INTERVAL;
+
+   private int reconnectAttempts = HornetQClient.DEFAULT_RECONNECT_ATTEMPTS;
+
+   private boolean failoverOnInitialConnection = 
HornetQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION;
+
+   private String groupID = null;
+
+   private JMSFactoryType factoryType = JMSFactoryType.CF;
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   public ConnectionFactoryConfigurationImpl()
+   {
+   }
+
+   // ConnectionFactoryConfiguration implementation -----------------
+
+   public String[] getBindings()
+   {
+      return bindings;
+   }
+
+   public ConnectionFactoryConfiguration setBindings(final String... bindings)
+   {
+      this.bindings = bindings;
+      return this;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public ConnectionFactoryConfiguration setName(String name)
+   {
+      this.name = name;
+      return this;
+   }
+
+   public boolean isPersisted()
+   {
+      return persisted;
+   }
+
+   /**
+    * @return the discoveryGroupName
+    */
+   public String getDiscoveryGroupName()
+   {
+      return discoveryGroupName;
+   }
+
+   /**
+    * @param discoveryGroupName the discoveryGroupName to set
+    */
+   public ConnectionFactoryConfiguration setDiscoveryGroupName(String 
discoveryGroupName)
+   {
+      this.discoveryGroupName = discoveryGroupName;
+      return this;
+   }
+
+   public List<String> getConnectorNames()
+   {
+      return connectorNames;
+   }
+
+   public ConnectionFactoryConfiguration setConnectorNames(final List<String> 
connectorNames)
+   {
+      this.connectorNames = connectorNames;
+      return this;
+   }
+
+   public boolean isHA()
+   {
+      return ha;
+   }
+
+   public ConnectionFactoryConfiguration setHA(final boolean ha)
+   {
+      this.ha = ha;
+      return this;
+   }
+
+   public String getClientID()
+   {
+      return clientID;
+   }
+
+   public ConnectionFactoryConfiguration setClientID(final String clientID)
+   {
+      this.clientID = clientID;
+      return this;
+   }
+
+   public long getClientFailureCheckPeriod()
+   {
+      return clientFailureCheckPeriod;
+   }
+
+   public ConnectionFactoryConfiguration setClientFailureCheckPeriod(final 
long clientFailureCheckPeriod)
+   {
+      this.clientFailureCheckPeriod = clientFailureCheckPeriod;
+      return this;
+   }
+
+   public long getConnectionTTL()
+   {
+      return connectionTTL;
+   }
+
+   public ConnectionFactoryConfiguration setConnectionTTL(final long 
connectionTTL)
+   {
+      this.connectionTTL = connectionTTL;
+      return this;
+   }
+
+   public long getCallTimeout()
+   {
+      return callTimeout;
+   }
+
+   public ConnectionFactoryConfiguration setCallTimeout(final long callTimeout)
+   {
+      this.callTimeout = callTimeout;
+      return this;
+   }
+
+   public long getCallFailoverTimeout()
+   {
+      return callFailoverTimeout;
+   }
+
+   public ConnectionFactoryConfiguration setCallFailoverTimeout(long 
callFailoverTimeout)
+   {
+      this.callFailoverTimeout = callFailoverTimeout;
+      return this;
+   }
+
+   public boolean isCacheLargeMessagesClient()
+   {
+      return cacheLargeMessagesClient;
+   }
+
+   public ConnectionFactoryConfiguration setCacheLargeMessagesClient(final 
boolean cacheLargeMessagesClient)
+   {
+      this.cacheLargeMessagesClient = cacheLargeMessagesClient;
+      return this;
+   }
+
+   public int getMinLargeMessageSize()
+   {
+      return minLargeMessageSize;
+   }
+
+   public ConnectionFactoryConfiguration setMinLargeMessageSize(final int 
minLargeMessageSize)
+   {
+      this.minLargeMessageSize = minLargeMessageSize;
+      return this;
+   }
+
+   public int getConsumerWindowSize()
+   {
+      return consumerWindowSize;
+   }
+
+   public ConnectionFactoryConfiguration setConsumerWindowSize(final int 
consumerWindowSize)
+   {
+      this.consumerWindowSize = consumerWindowSize;
+      return this;
+   }
+
+   public int getConsumerMaxRate()
+   {
+      return consumerMaxRate;
+   }
+
+   public ConnectionFactoryConfiguration setConsumerMaxRate(final int 
consumerMaxRate)
+   {
+      this.consumerMaxRate = consumerMaxRate;
+      return this;
+   }
+
+   public int getConfirmationWindowSize()
+   {
+      return confirmationWindowSize;
+   }
+
+   public ConnectionFactoryConfiguration setConfirmationWindowSize(final int 
confirmationWindowSize)
+   {
+      this.confirmationWindowSize = confirmationWindowSize;
+      return this;
+   }
+
+   public int getProducerMaxRate()
+   {
+      return producerMaxRate;
+   }
+
+   public ConnectionFactoryConfiguration setProducerMaxRate(final int 
producerMaxRate)
+   {
+      this.producerMaxRate = producerMaxRate;
+      return this;
+   }
+
+   public int getProducerWindowSize()
+   {
+      return producerWindowSize;
+   }
+
+   public ConnectionFactoryConfiguration setProducerWindowSize(final int 
producerWindowSize)
+   {
+      this.producerWindowSize = producerWindowSize;
+      return this;
+   }
+
+   public boolean isBlockOnAcknowledge()
+   {
+      return blockOnAcknowledge;
+   }
+
+   public ConnectionFactoryConfiguration setBlockOnAcknowledge(final boolean 
blockOnAcknowledge)
+   {
+      this.blockOnAcknowledge = blockOnAcknowledge;
+      return this;
+   }
+
+   public boolean isBlockOnDurableSend()
+   {
+      return blockOnDurableSend;
+   }
+
+   public ConnectionFactoryConfiguration setBlockOnDurableSend(final boolean 
blockOnDurableSend)
+   {
+      this.blockOnDurableSend = blockOnDurableSend;
+      return this;
+   }
+
+   public boolean isBlockOnNonDurableSend()
+   {
+      return blockOnNonDurableSend;
+   }
+
+   public ConnectionFactoryConfiguration setBlockOnNonDurableSend(final 
boolean blockOnNonDurableSend)
+   {
+      this.blockOnNonDurableSend = blockOnNonDurableSend;
+      return this;
+   }
+
+   public boolean isAutoGroup()
+   {
+      return autoGroup;
+   }
+
+   public ConnectionFactoryConfiguration setAutoGroup(final boolean autoGroup)
+   {
+      this.autoGroup = autoGroup;
+      return this;
+   }
+
+   public boolean isPreAcknowledge()
+   {
+      return preAcknowledge;
+   }
+
+   public ConnectionFactoryConfiguration setPreAcknowledge(final boolean 
preAcknowledge)
+   {
+      this.preAcknowledge = preAcknowledge;
+      return this;
+   }
+
+   public String getLoadBalancingPolicyClassName()
+   {
+      return loadBalancingPolicyClassName;
+   }
+
+   public ConnectionFactoryConfiguration setLoadBalancingPolicyClassName(final 
String loadBalancingPolicyClassName)
+   {
+      this.loadBalancingPolicyClassName = loadBalancingPolicyClassName;
+      return this;
+   }
+
+   public int getTransactionBatchSize()
+   {
+      return transactionBatchSize;
+   }
+
+   public ConnectionFactoryConfiguration setTransactionBatchSize(final int 
transactionBatchSize)
+   {
+      this.transactionBatchSize = transactionBatchSize;
+      return this;
+   }
+
+   public int getDupsOKBatchSize()
+   {
+      return dupsOKBatchSize;
+   }
+
+   public ConnectionFactoryConfiguration setDupsOKBatchSize(final int 
dupsOKBatchSize)
+   {
+      this.dupsOKBatchSize = dupsOKBatchSize;
+      return this;
+   }
+
+   public long getInitialWaitTimeout()
+   {
+      return initialWaitTimeout;
+   }
+
+   public ConnectionFactoryConfiguration setInitialWaitTimeout(final long 
initialWaitTimeout)
+   {
+      this.initialWaitTimeout = initialWaitTimeout;
+      return this;
+   }
+
+   public boolean isUseGlobalPools()
+   {
+      return useGlobalPools;
+   }
+
+   public ConnectionFactoryConfiguration setUseGlobalPools(final boolean 
useGlobalPools)
+   {
+      this.useGlobalPools = useGlobalPools;
+      return this;
+   }
+
+   public int getScheduledThreadPoolMaxSize()
+   {
+      return scheduledThreadPoolMaxSize;
+   }
+
+   public ConnectionFactoryConfiguration setScheduledThreadPoolMaxSize(final 
int scheduledThreadPoolMaxSize)
+   {
+      this.scheduledThreadPoolMaxSize = scheduledThreadPoolMaxSize;
+      return this;
+   }
+
+   public int getThreadPoolMaxSize()
+   {
+      return threadPoolMaxSize;
+   }
+
+   public ConnectionFactoryConfiguration setThreadPoolMaxSize(final int 
threadPoolMaxSize)
+   {
+      this.threadPoolMaxSize = threadPoolMaxSize;
+      return this;
+   }
+
+   public long getRetryInterval()
+   {
+      return retryInterval;
+   }
+
+   public ConnectionFactoryConfiguration setRetryInterval(final long 
retryInterval)
+   {
+      this.retryInterval = retryInterval;
+      return this;
+   }
+
+   public double getRetryIntervalMultiplier()
+   {
+      return retryIntervalMultiplier;
+   }
+
+   public ConnectionFactoryConfiguration setRetryIntervalMultiplier(final 
double retryIntervalMultiplier)
+   {
+      this.retryIntervalMultiplier = retryIntervalMultiplier;
+      return this;
+   }
+
+   public long getMaxRetryInterval()
+   {
+      return maxRetryInterval;
+   }
+
+   public ConnectionFactoryConfiguration setMaxRetryInterval(final long 
maxRetryInterval)
+   {
+      this.maxRetryInterval = maxRetryInterval;
+      return this;
+   }
+
+   public int getReconnectAttempts()
+   {
+      return reconnectAttempts;
+   }
+
+   public ConnectionFactoryConfiguration setReconnectAttempts(final int 
reconnectAttempts)
+   {
+      this.reconnectAttempts = reconnectAttempts;
+      return this;
+   }
+
+   public boolean isFailoverOnInitialConnection()
+   {
+      return failoverOnInitialConnection;
+   }
+
+   public ConnectionFactoryConfiguration setFailoverOnInitialConnection(final 
boolean failover)
+   {
+      failoverOnInitialConnection = failover;
+      return this;
+   }
+
+   public String getGroupID()
+   {
+      return groupID;
+   }
+
+   public ConnectionFactoryConfiguration setGroupID(final String groupID)
+   {
+      this.groupID = groupID;
+      return this;
+   }
+
+   // Encoding Support Implementation 
--------------------------------------------------------------
+
+   @Override
+   public void decode(final HornetQBuffer buffer)
+   {
+      persisted = true;
+
+      name = buffer.readSimpleString().toString();
+
+      discoveryGroupName = 
BufferHelper.readNullableSimpleStringAsString(buffer);
+
+      int nConnectors = buffer.readInt();
+
+      if (nConnectors > 0)
+      {
+         connectorNames = new ArrayList<String>(nConnectors);
+
+         for (int i = 0; i < nConnectors; i++)
+         {
+            SimpleString str = buffer.readSimpleString();
+
+            connectorNames.add(str.toString());
+         }
+      }
+
+      ha = buffer.readBoolean();
+
+      clientID = BufferHelper.readNullableSimpleStringAsString(buffer);
+
+      clientFailureCheckPeriod = buffer.readLong();
+
+      connectionTTL = buffer.readLong();
+
+      callTimeout = buffer.readLong();
+
+      cacheLargeMessagesClient = buffer.readBoolean();
+
+      minLargeMessageSize = buffer.readInt();
+
+      consumerWindowSize = buffer.readInt();
+
+      consumerMaxRate = buffer.readInt();
+
+      confirmationWindowSize = buffer.readInt();
+
+      producerWindowSize = buffer.readInt();
+
+      producerMaxRate = buffer.readInt();
+
+      blockOnAcknowledge = buffer.readBoolean();
+
+      blockOnDurableSend = buffer.readBoolean();
+
+      blockOnNonDurableSend = buffer.readBoolean();
+
+      autoGroup = buffer.readBoolean();
+
+      preAcknowledge = buffer.readBoolean();
+
+      loadBalancingPolicyClassName = buffer.readSimpleString().toString();
+
+      transactionBatchSize = buffer.readInt();
+
+      dupsOKBatchSize = buffer.readInt();
+
+      initialWaitTimeout = buffer.readLong();
+
+      useGlobalPools = buffer.readBoolean();
+
+      scheduledThreadPoolMaxSize = buffer.readInt();
+
+      threadPoolMaxSize = buffer.readInt();
+
+      retryInterval = buffer.readLong();
+
+      retryIntervalMultiplier = buffer.readDouble();
+
+      maxRetryInterval = buffer.readLong();
+
+      reconnectAttempts = buffer.readInt();
+
+      failoverOnInitialConnection = buffer.readBoolean();
+
+      compressLargeMessage = buffer.readBoolean();
+
+      groupID = BufferHelper.readNullableSimpleStringAsString(buffer);
+
+      factoryType = JMSFactoryType.valueOf(buffer.readInt());
+   }
+
+   @Override
+   public void encode(final HornetQBuffer buffer)
+   {
+      persisted = true;
+
+      BufferHelper.writeAsSimpleString(buffer, name);
+
+      BufferHelper.writeAsNullableSimpleString(buffer, discoveryGroupName);
+
+      if (this.connectorNames == null)
+      {
+         buffer.writeInt(0);
+      }
+      else
+      {
+         buffer.writeInt(connectorNames.size());
+
+         for (String tc : connectorNames)
+         {
+            BufferHelper.writeAsSimpleString(buffer, tc);
+         }
+      }
+
+      buffer.writeBoolean(ha);
+
+      BufferHelper.writeAsNullableSimpleString(buffer, clientID);
+
+      buffer.writeLong(clientFailureCheckPeriod);
+
+      buffer.writeLong(connectionTTL);
+
+      buffer.writeLong(callTimeout);
+
+      buffer.writeBoolean(cacheLargeMessagesClient);
+
+      buffer.writeInt(minLargeMessageSize);
+
+      buffer.writeInt(consumerWindowSize);
+
+      buffer.writeInt(consumerMaxRate);
+
+      buffer.writeInt(confirmationWindowSize);
+
+      buffer.writeInt(producerWindowSize);
+
+      buffer.writeInt(producerMaxRate);
+
+      buffer.writeBoolean(blockOnAcknowledge);
+
+      buffer.writeBoolean(blockOnDurableSend);
+
+      buffer.writeBoolean(blockOnNonDurableSend);
+
+      buffer.writeBoolean(autoGroup);
+
+      buffer.writeBoolean(preAcknowledge);
+
+      BufferHelper.writeAsSimpleString(buffer, loadBalancingPolicyClassName);
+
+      buffer.writeInt(transactionBatchSize);
+
+      buffer.writeInt(dupsOKBatchSize);
+
+      buffer.writeLong(initialWaitTimeout);
+
+      buffer.writeBoolean(useGlobalPools);
+
+      buffer.writeInt(scheduledThreadPoolMaxSize);
+
+      buffer.writeInt(threadPoolMaxSize);
+
+      buffer.writeLong(retryInterval);
+
+      buffer.writeDouble(retryIntervalMultiplier);
+
+      buffer.writeLong(maxRetryInterval);
+
+      buffer.writeInt(reconnectAttempts);
+
+      buffer.writeBoolean(failoverOnInitialConnection);
+
+      buffer.writeBoolean(compressLargeMessage);
+
+      BufferHelper.writeAsNullableSimpleString(buffer, groupID);
+
+      buffer.writeInt(factoryType.intValue());
+   }
+
+   @Override
+   public int getEncodeSize()
+   {
+      int size = BufferHelper.sizeOfSimpleString(name) +
+
+         BufferHelper.sizeOfNullableSimpleString(discoveryGroupName);
+
+      size += DataConstants.SIZE_INT;
+
+      if (this.connectorNames != null)
+      {
+         for (String tc : connectorNames)
+         {
+            size += BufferHelper.sizeOfSimpleString(tc);
+         }
+      }
+
+      size += BufferHelper.sizeOfNullableSimpleString(clientID) +
+
+         DataConstants.SIZE_BOOLEAN +
+         // ha
+
+         DataConstants.SIZE_LONG +
+         // clientFailureCheckPeriod
+
+         DataConstants.SIZE_LONG +
+         // connectionTTL
+
+         DataConstants.SIZE_LONG +
+         // callTimeout
+
+         DataConstants.SIZE_BOOLEAN +
+         // cacheLargeMessagesClient
+
+         DataConstants.SIZE_INT +
+         // minLargeMessageSize
+
+         DataConstants.SIZE_INT +
+         // consumerWindowSize
+
+         DataConstants.SIZE_INT +
+         // consumerMaxRate
+
+         DataConstants.SIZE_INT +
+         // confirmationWindowSize
+
+         DataConstants.SIZE_INT +
+         // producerWindowSize
+
+         DataConstants.SIZE_INT +
+         // producerMaxRate
+
+         DataConstants.SIZE_BOOLEAN +
+         // blockOnAcknowledge
+
+         DataConstants.SIZE_BOOLEAN +
+         // blockOnDurableSend
+
+         DataConstants.SIZE_BOOLEAN +
+         // blockOnNonDurableSend
+
+         DataConstants.SIZE_BOOLEAN +
+         // autoGroup
+
+         DataConstants.SIZE_BOOLEAN +
+         // preAcknowledge
+
+         BufferHelper.sizeOfSimpleString(loadBalancingPolicyClassName) +
+
+         DataConstants.SIZE_INT +
+         // transactionBatchSize
+
+         DataConstants.SIZE_INT +
+         // dupsOKBatchSize
+
+         DataConstants.SIZE_LONG +
+         // initialWaitTimeout
+
+         DataConstants.SIZE_BOOLEAN +
+         // useGlobalPools
+
+         DataConstants.SIZE_INT +
+         // scheduledThreadPoolMaxSize
+
+         DataConstants.SIZE_INT +
+         // threadPoolMaxSize
+
+         DataConstants.SIZE_LONG +
+         // retryInterval
+
+         DataConstants.SIZE_DOUBLE +
+         // retryIntervalMultiplier
+
+         DataConstants.SIZE_LONG +
+         // maxRetryInterval
+
+         DataConstants.SIZE_INT +
+         // reconnectAttempts
+
+         DataConstants.SIZE_BOOLEAN +
+         // failoverOnInitialConnection
+
+         DataConstants.SIZE_BOOLEAN +
+         // compress-large-message
+
+         BufferHelper.sizeOfNullableSimpleString(groupID) +
+
+         DataConstants.SIZE_INT; // factoryType
+
+      return size;
+   }
+
+   public ConnectionFactoryConfiguration setFactoryType(final JMSFactoryType 
factoryType)
+   {
+      this.factoryType = factoryType;
+      return this;
+   }
+
+   public JMSFactoryType getFactoryType()
+   {
+      return factoryType;
+   }
+
+   @Override
+   public ConnectionFactoryConfiguration setCompressLargeMessages(boolean 
compressLargeMessage)
+   {
+      this.compressLargeMessage = compressLargeMessage;
+      return this;
+   }
+
+   @Override
+   public boolean isCompressLargeMessages()
+   {
+      return this.compressLargeMessage;
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/23e8edd9/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/impl/JMSConfigurationImpl.java
----------------------------------------------------------------------
diff --git 
a/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/impl/JMSConfigurationImpl.java
 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/impl/JMSConfigurationImpl.java
new file mode 100644
index 0000000..91508aa
--- /dev/null
+++ 
b/activemq6-jms-server/src/main/java/org/apache/activemq6/jms/server/config/impl/JMSConfigurationImpl.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2005-2014 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.  See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+package org.apache.activemq6.jms.server.config.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.Context;
+
+import org.apache.activemq6.api.config.HornetQDefaultConfiguration;
+import org.apache.activemq6.jms.server.config.ConnectionFactoryConfiguration;
+import org.apache.activemq6.jms.server.config.JMSConfiguration;
+import org.apache.activemq6.jms.server.config.JMSQueueConfiguration;
+import org.apache.activemq6.jms.server.config.TopicConfiguration;
+
+
+/**
+ * A JMSConfigurationImpl
+ * @author <a href="mailto:[email protected]";>Jeff Mesnil</a>
+ */
+public class JMSConfigurationImpl implements JMSConfiguration
+{
+   private List<ConnectionFactoryConfiguration> 
connectionFactoryConfigurations = new 
ArrayList<ConnectionFactoryConfiguration>();
+
+   private List<JMSQueueConfiguration> queueConfigurations = new 
ArrayList<JMSQueueConfiguration>();
+
+   private List<TopicConfiguration> topicConfigurations = new 
ArrayList<TopicConfiguration>();
+
+   private String domain = HornetQDefaultConfiguration.getDefaultJmxDomain();
+
+   private Context context = null;
+
+   // JMSConfiguration implementation -------------------------------
+
+   public JMSConfigurationImpl()
+   {
+   }
+
+   public List<ConnectionFactoryConfiguration> 
getConnectionFactoryConfigurations()
+   {
+      return connectionFactoryConfigurations;
+   }
+
+   public JMSConfigurationImpl 
setConnectionFactoryConfigurations(List<ConnectionFactoryConfiguration> 
connectionFactoryConfigurations)
+   {
+      this.connectionFactoryConfigurations = connectionFactoryConfigurations;
+      return this;
+   }
+
+   public List<JMSQueueConfiguration> getQueueConfigurations()
+   {
+      return queueConfigurations;
+   }
+
+   public JMSConfigurationImpl 
setQueueConfigurations(List<JMSQueueConfiguration> queueConfigurations)
+   {
+      this.queueConfigurations = queueConfigurations;
+      return this;
+   }
+
+   public List<TopicConfiguration> getTopicConfigurations()
+   {
+      return topicConfigurations;
+   }
+
+   public JMSConfigurationImpl setTopicConfigurations(List<TopicConfiguration> 
topicConfigurations)
+   {
+      this.topicConfigurations = topicConfigurations;
+      return this;
+   }
+
+   public Context getContext()
+   {
+      return context;
+   }
+
+   public JMSConfigurationImpl setContext(final Context context)
+   {
+      this.context = context;
+      return this;
+   }
+
+   public String getDomain()
+   {
+      return domain;
+   }
+
+   public JMSConfigurationImpl setDomain(final String domain)
+   {
+      this.domain = domain;
+      return this;
+   }
+}

Reply via email to