You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2014/09/06 06:58:41 UTC

[08/29] git commit: Move Jms*Manager classes to manager package.

Move Jms*Manager classes to manager package.

git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/branches/messaging-module@1608330 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/a117d38a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/a117d38a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/a117d38a

Branch: refs/heads/master
Commit: a117d38a13b978a0be13d303d8b5a72730b9167e
Parents: 91d879a
Author: mattsicker <ma...@unknown>
Authored: Mon Jul 7 03:26:46 2014 +0000
Committer: mattsicker <ma...@unknown>
Committed: Mon Jul 7 03:26:46 2014 +0000

----------------------------------------------------------------------
 .../mom/jms/appender/JmsQueueAppender.java      |   2 +-
 .../mom/jms/appender/JmsTopicAppender.java      |   2 +-
 .../mom/jms/manager/AbstractJmsManager.java     | 156 ++++++++++++
 .../log4j/mom/jms/manager/JmsQueueManager.java  | 237 +++++++++++++++++++
 .../log4j/mom/jms/manager/JmsTopicManager.java  | 237 +++++++++++++++++++
 .../mom/jms/receiver/AbstractJmsManager.java    | 155 ------------
 .../log4j/mom/jms/receiver/JmsQueueManager.java | 237 -------------------
 .../log4j/mom/jms/receiver/JmsTopicManager.java | 237 -------------------
 8 files changed, 632 insertions(+), 631 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a117d38a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/appender/JmsQueueAppender.java
----------------------------------------------------------------------
diff --git a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/appender/JmsQueueAppender.java b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/appender/JmsQueueAppender.java
index 284e1f6..aa4fd95 100644
--- a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/appender/JmsQueueAppender.java
+++ b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/appender/JmsQueueAppender.java
@@ -28,7 +28,7 @@ import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 import org.apache.logging.log4j.core.layout.SerializedLayout;
-import org.apache.logging.log4j.mom.jms.receiver.JmsQueueManager;
+import org.apache.logging.log4j.mom.jms.manager.JmsQueueManager;
 import org.apache.logging.log4j.core.util.Booleans;
 
 /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a117d38a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/appender/JmsTopicAppender.java
----------------------------------------------------------------------
diff --git a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/appender/JmsTopicAppender.java b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/appender/JmsTopicAppender.java
index 9985746..6b1e16f 100644
--- a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/appender/JmsTopicAppender.java
+++ b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/appender/JmsTopicAppender.java
@@ -28,7 +28,7 @@ import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 import org.apache.logging.log4j.core.layout.SerializedLayout;
-import org.apache.logging.log4j.mom.jms.receiver.JmsTopicManager;
+import org.apache.logging.log4j.mom.jms.manager.JmsTopicManager;
 import org.apache.logging.log4j.core.util.Booleans;
 
 /**

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a117d38a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/AbstractJmsManager.java
----------------------------------------------------------------------
diff --git a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/AbstractJmsManager.java b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/AbstractJmsManager.java
new file mode 100644
index 0000000..e53b175
--- /dev/null
+++ b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/AbstractJmsManager.java
@@ -0,0 +1,156 @@
+/*
+ * 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.logging.log4j.mom.jms.manager;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+
+import org.apache.logging.log4j.core.appender.AbstractManager;
+
+/**
+ * Base Class for Managers of JMS connections.
+ */
+public abstract class AbstractJmsManager extends AbstractManager {
+
+    /**
+     * The Constructor.
+     * @param name The name of the Appender.
+     */
+    public AbstractJmsManager(final String name) {
+        super(name);
+    }
+
+    /**
+     * Create the InitialContext.
+     * @param factoryName The fully qualified class name of the InitialContextFactory.
+     * @param providerURL The URL of the provider to use.
+     * @param urlPkgPrefixes A colon-separated list of package prefixes for the class name of the factory class that
+     * will create a URL context factory
+     * @param securityPrincipalName The name of the identity of the Principal.
+     * @param securityCredentials The security credentials of the Principal.
+     * @return the InitialContext.
+     * @throws NamingException if a naming error occurs.
+     */
+    protected static Context createContext(final String factoryName, final String providerURL,
+                                           final String urlPkgPrefixes, final String securityPrincipalName,
+                                           final String securityCredentials)
+        throws NamingException {
+
+        final Properties props = getEnvironment(factoryName, providerURL, urlPkgPrefixes, securityPrincipalName,
+                                          securityCredentials);
+        return new InitialContext(props);
+    }
+
+    /**
+     * Looks up the name in the context.
+     * @param ctx The Context.
+     * @param name The name to locate.
+     * @return The object to be located.
+     * @throws NamingException If an error occurs locating the name.
+     */
+    protected static Object lookup(final Context ctx, final String name) throws NamingException {
+        try {
+            return ctx.lookup(name);
+        } catch (final NameNotFoundException e) {
+            LOGGER.warn("Could not find name [{}].", name);
+            throw e;
+        }
+    }
+
+    /**
+     * Sets up the properties to pass to the InitialContext.
+     * @param factoryName The fully qualified class name of the InitialContextFactory.
+     * @param providerURL The URL of the provider to use.
+     * @param urlPkgPrefixes A colon-separated list of package prefixes for the class name of the factory class that
+     * will create a URL context factory
+     * @param securityPrincipalName The name of the identity of the Principal.
+     * @param securityCredentials The security credentials of the Principal.
+     * @return The Properties.
+     * @see javax.naming.Context
+     */
+    protected static Properties getEnvironment(final String factoryName, final String providerURL,
+                                               final String urlPkgPrefixes, final String securityPrincipalName,
+                                               final String securityCredentials) {
+        final Properties props = new Properties();
+        if (factoryName != null) {
+            props.setProperty(Context.INITIAL_CONTEXT_FACTORY, factoryName);
+            if (providerURL != null) {
+                props.setProperty(Context.PROVIDER_URL, providerURL);
+            } else {
+                LOGGER.warn("The InitialContext factory name has been provided without a ProviderURL. " +
+                    "This is likely to cause problems");
+            }
+            if (urlPkgPrefixes != null) {
+                props.setProperty(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
+            }
+            if (securityPrincipalName != null) {
+                props.setProperty(Context.SECURITY_PRINCIPAL, securityPrincipalName);
+                if (securityCredentials != null) {
+                    props.setProperty(Context.SECURITY_CREDENTIALS, securityCredentials);
+                } else {
+                    LOGGER.warn("SecurityPrincipalName has been set without SecurityCredentials. " +
+                        "This is likely to cause problems.");
+                }
+            }
+            return props;
+        }
+        return null;
+    }
+
+    /**
+     * Send the message.
+     * @param object The Object to sent.
+     * @throws Exception if an error occurs.
+     */
+    public abstract void send(Serializable object) throws Exception;
+
+    /**
+     * Send the Object.
+     * @param object The Object to send.
+     * @param session The Session.
+     * @param producer The MessageProducer.
+     * @throws Exception if an error occurs.
+     */
+    public synchronized void send(final Serializable object, final Session session, final MessageProducer producer)
+        throws Exception {
+        try {
+            Message msg;
+            if (object instanceof String) {
+                msg = session.createTextMessage();
+                ((TextMessage) msg).setText((String) object);
+            } else {
+                msg = session.createObjectMessage();
+                ((ObjectMessage) msg).setObject(object);
+            }
+            producer.send(msg);
+        } catch (final JMSException ex) {
+            LOGGER.error("Could not publish message via JMS {}", getName());
+            throw ex;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a117d38a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/JmsQueueManager.java
----------------------------------------------------------------------
diff --git a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/JmsQueueManager.java b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/JmsQueueManager.java
new file mode 100644
index 0000000..fd00c03
--- /dev/null
+++ b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/JmsQueueManager.java
@@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.mom.jms.manager;
+
+import java.io.Serializable;
+
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.apache.logging.log4j.core.appender.ManagerFactory;
+
+/**
+ * Manager for a JMS Queue.
+ */
+public class JmsQueueManager extends AbstractJmsManager {
+
+    private static final JMSQueueManagerFactory FACTORY = new JMSQueueManagerFactory();
+
+    private QueueInfo info;
+    private final String factoryBindingName;
+    private final String queueBindingName;
+    private final String userName;
+    private final String password;
+    private final Context context;
+
+    /**
+     * The Constructor.
+     * @param name The unique name of the connection.
+     * @param context The context.
+     * @param factoryBindingName The factory binding name.
+     * @param queueBindingName The queue binding name.
+     * @param userName The user name.
+     * @param password The credentials for the user.
+     * @param info The Queue connection info.
+     */
+    protected JmsQueueManager(final String name, final Context context, final String factoryBindingName,
+                              final String queueBindingName, final String userName, final String password,
+                              final QueueInfo info) {
+        super(name);
+        this.context = context;
+        this.factoryBindingName = factoryBindingName;
+        this.queueBindingName = queueBindingName;
+        this.userName = userName;
+        this.password = password;
+        this.info = info;
+    }
+
+    /**
+     * Obtain a JmsQueueManager.
+     * @param factoryName The fully qualified class name of the InitialContextFactory.
+     * @param providerURL The URL of the provider to use.
+     * @param urlPkgPrefixes A colon-separated list of package prefixes for the class name of the factory class that
+     * will create a URL context factory
+     * @param securityPrincipalName The name of the identity of the Principal.
+     * @param securityCredentials The security credentials of the Principal.
+     * @param factoryBindingName The name to locate in the Context that provides the QueueConnectionFactory.
+     * @param queueBindingName The name to use to locate the Queue.
+     * @param userName The userid to use to create the Queue Connection.
+     * @param password The password to use to create the Queue Connection.
+     * @return The JmsQueueManager.
+     */
+    public static JmsQueueManager getJmsQueueManager(final String factoryName, final String providerURL,
+                                                     final String urlPkgPrefixes, final String securityPrincipalName,
+                                                     final String securityCredentials, final String factoryBindingName,
+                                                     final String queueBindingName, final String userName,
+                                                     final String password) {
+
+        if (factoryBindingName == null) {
+            LOGGER.error("No factory name provided for JmsQueueManager");
+            return null;
+        }
+        if (queueBindingName == null) {
+            LOGGER.error("No topic name provided for JmsQueueManager");
+            return null;
+        }
+
+        final String name = "JMSQueue:" + factoryBindingName + '.' + queueBindingName;
+        return getManager(name, FACTORY, new FactoryData(factoryName, providerURL, urlPkgPrefixes,
+            securityPrincipalName, securityCredentials, factoryBindingName, queueBindingName, userName, password));
+    }
+
+    @Override
+    public synchronized void send(final Serializable object) throws Exception {
+        if (info == null) {
+            info = connect(context, factoryBindingName, queueBindingName, userName, password, false);
+        }
+        try {
+            super.send(object, info.session, info.sender);
+        } catch (final Exception ex) {
+            cleanup(true);
+            throw ex;
+        }
+    }
+
+    @Override
+    public void releaseSub() {
+        if (info != null) {
+            cleanup(false);
+        }
+    }
+
+    private void cleanup(final boolean quiet) {
+        try {
+            info.session.close();
+        } catch (final Exception e) {
+            if (!quiet) {
+                LOGGER.error("Error closing session for " + getName(), e);
+            }
+        }
+        try {
+            info.conn.close();
+        } catch (final Exception e) {
+            if (!quiet) {
+                LOGGER.error("Error closing connection for " + getName(), e);
+            }
+        }
+        info = null;
+    }
+
+    /**
+     * Data for the factory.
+     */
+    private static class FactoryData {
+        private final String factoryName;
+        private final String providerURL;
+        private final String urlPkgPrefixes;
+        private final String securityPrincipalName;
+        private final String securityCredentials;
+        private final String factoryBindingName;
+        private final String queueBindingName;
+        private final String userName;
+        private final String password;
+
+        public FactoryData(final String factoryName, final String providerURL, final String urlPkgPrefixes,
+                           final String securityPrincipalName, final String securityCredentials,
+                           final String factoryBindingName, final String queueBindingName, final String userName,
+                           final String password) {
+            this.factoryName = factoryName;
+            this.providerURL = providerURL;
+            this.urlPkgPrefixes = urlPkgPrefixes;
+            this.securityPrincipalName = securityPrincipalName;
+            this.securityCredentials = securityCredentials;
+            this.factoryBindingName = factoryBindingName;
+            this.queueBindingName = queueBindingName;
+            this.userName = userName;
+            this.password = password;
+        }
+    }
+
+    private static QueueInfo connect(final Context context, final String factoryBindingName,
+                                     final String queueBindingName, final String userName, final String password,
+                                     final boolean suppress) throws Exception {
+        try {
+            final QueueConnectionFactory factory = (QueueConnectionFactory) lookup(context, factoryBindingName);
+            QueueConnection conn;
+            if (userName != null) {
+                conn = factory.createQueueConnection(userName, password);
+            } else {
+                conn = factory.createQueueConnection();
+            }
+            final QueueSession sess = conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+            final Queue queue = (Queue) lookup(context, queueBindingName);
+            final QueueSender sender = sess.createSender(queue);
+            conn.start();
+            return new QueueInfo(conn, sess, sender);
+        } catch (final NamingException ex) {
+            LOGGER.warn("Unable to locate connection factory " + factoryBindingName, ex);
+            if (!suppress) {
+                throw ex;
+            }
+        } catch (final JMSException ex) {
+            LOGGER.warn("Unable to create connection to queue " + queueBindingName, ex);
+            if (!suppress) {
+                throw ex;
+            }
+        }
+        return null;
+    }
+
+    /** Queue connection information */
+    private static class QueueInfo {
+        private final QueueConnection conn;
+        private final QueueSession session;
+        private final QueueSender sender;
+
+        public QueueInfo(final QueueConnection conn, final QueueSession session, final QueueSender sender) {
+            this.conn = conn;
+            this.session = session;
+            this.sender = sender;
+        }
+    }
+
+    /**
+     * Factory to create the JmsQueueManager.
+     */
+    private static class JMSQueueManagerFactory implements ManagerFactory<JmsQueueManager, FactoryData> {
+
+        @Override
+        public JmsQueueManager createManager(final String name, final FactoryData data) {
+            try {
+                final Context ctx = createContext(data.factoryName, data.providerURL, data.urlPkgPrefixes,
+                                            data.securityPrincipalName, data.securityCredentials);
+                final QueueInfo info = connect(ctx, data.factoryBindingName, data.queueBindingName, data.userName,
+                    data.password, true);
+                return new JmsQueueManager(name, ctx, data.factoryBindingName, data.queueBindingName,
+                    data.userName, data.password, info);
+            } catch (final NamingException ex) {
+                LOGGER.error("Unable to locate resource", ex);
+            } catch (final Exception ex) {
+                LOGGER.error("Unable to connect", ex);
+            }
+
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a117d38a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/JmsTopicManager.java
----------------------------------------------------------------------
diff --git a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/JmsTopicManager.java b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/JmsTopicManager.java
new file mode 100644
index 0000000..9f45b72
--- /dev/null
+++ b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/manager/JmsTopicManager.java
@@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.mom.jms.manager;
+
+import java.io.Serializable;
+
+import javax.jms.JMSException;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.apache.logging.log4j.core.appender.ManagerFactory;
+
+/**
+ * Manager for JMS Topic connections.
+ */
+public class JmsTopicManager extends AbstractJmsManager {
+
+    private static final JMSTopicManagerFactory FACTORY = new JMSTopicManagerFactory();
+
+    private TopicInfo info;
+    private final String factoryBindingName;
+    private final String topicBindingName;
+    private final String userName;
+    private final String password;
+    private final Context context;
+    /**
+     * Constructor.
+     * @param name The unique name of the connection.
+     * @param context The context.
+     * @param factoryBindingName The factory binding name.
+     * @param topicBindingName The queue binding name.
+     * @param userName The user name.
+     * @param password The credentials for the user.
+     * @param info The Queue connection info.
+     */
+    protected JmsTopicManager(final String name, final Context context, final String factoryBindingName,
+                              final String topicBindingName, final String userName, final String password,
+                              final TopicInfo info) {
+        super(name);
+        this.context = context;
+        this.factoryBindingName = factoryBindingName;
+        this.topicBindingName = topicBindingName;
+        this.userName = userName;
+        this.password = password;
+        this.info = info;
+    }
+
+    /**
+     * Obtain a JSMTopicManager.
+     * @param factoryName The fully qualified class name of the InitialContextFactory.
+     * @param providerURL The URL of the provider to use.
+     * @param urlPkgPrefixes A colon-separated list of package prefixes for the class name of the factory class that
+     * will create a URL context factory
+     * @param securityPrincipalName The name of the identity of the Principal.
+     * @param securityCredentials The security credentials of the Principal.
+     * @param factoryBindingName The name to locate in the Context that provides the TopicConnectionFactory.
+     * @param topicBindingName The name to use to locate the Topic.
+     * @param userName The userid to use to create the Topic Connection.
+     * @param password The password to use to create the Topic Connection.
+     * @return A JmsTopicManager.
+     */
+    public static JmsTopicManager getJmsTopicManager(final String factoryName, final String providerURL,
+                                                     final String urlPkgPrefixes, final String securityPrincipalName,
+                                                     final String securityCredentials, final String factoryBindingName,
+                                                     final String topicBindingName, final String userName,
+                                                     final String password) {
+
+        if (factoryBindingName == null) {
+            LOGGER.error("No factory name provided for JmsTopicManager");
+            return null;
+        }
+        if (topicBindingName == null) {
+            LOGGER.error("No topic name provided for JmsTopicManager");
+            return null;
+        }
+
+        final String name = "JMSTopic:" + factoryBindingName + '.' + topicBindingName;
+        return getManager(name, FACTORY, new FactoryData(factoryName, providerURL, urlPkgPrefixes,
+            securityPrincipalName, securityCredentials, factoryBindingName, topicBindingName, userName, password));
+    }
+
+
+    @Override
+    public void send(final Serializable object) throws Exception {
+        if (info == null) {
+            info = connect(context, factoryBindingName, topicBindingName, userName, password, false);
+        }
+        try {
+            super.send(object, info.session, info.publisher);
+        } catch (final Exception ex) {
+            cleanup(true);
+            throw ex;
+        }
+    }
+
+    @Override
+    public void releaseSub() {
+        if (info != null) {
+            cleanup(false);
+        }
+    }
+
+    private void cleanup(final boolean quiet) {
+        try {
+            info.session.close();
+        } catch (final Exception e) {
+            if (!quiet) {
+                LOGGER.error("Error closing session for " + getName(), e);
+            }
+        }
+        try {
+            info.conn.close();
+        } catch (final Exception e) {
+            if (!quiet) {
+                LOGGER.error("Error closing connection for " + getName(), e);
+            }
+        }
+        info = null;
+    }
+
+    /**
+     * Data for the factory.
+     */
+    private static class FactoryData {
+        private final String factoryName;
+        private final String providerURL;
+        private final String urlPkgPrefixes;
+        private final String securityPrincipalName;
+        private final String securityCredentials;
+        private final String factoryBindingName;
+        private final String topicBindingName;
+        private final String userName;
+        private final String password;
+
+        public FactoryData(final String factoryName, final String providerURL, final String urlPkgPrefixes,
+                           final String securityPrincipalName, final String securityCredentials,
+                           final String factoryBindingName, final String topicBindingName,
+                           final String userName, final String password) {
+            this.factoryName = factoryName;
+            this.providerURL = providerURL;
+            this.urlPkgPrefixes = urlPkgPrefixes;
+            this.securityPrincipalName = securityPrincipalName;
+            this.securityCredentials = securityCredentials;
+            this.factoryBindingName = factoryBindingName;
+            this.topicBindingName = topicBindingName;
+            this.userName = userName;
+            this.password = password;
+        }
+    }
+
+    private static TopicInfo connect(final Context context, final String factoryBindingName,
+                                     final String queueBindingName, final String userName, final String password,
+                                     final boolean suppress) throws Exception {
+        try {
+            final TopicConnectionFactory factory = (TopicConnectionFactory) lookup(context, factoryBindingName);
+            TopicConnection conn;
+            if (userName != null) {
+                conn = factory.createTopicConnection(userName, password);
+            } else {
+                conn = factory.createTopicConnection();
+            }
+            final TopicSession sess = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+            final Topic topic = (Topic) lookup(context, queueBindingName);
+            final TopicPublisher publisher = sess.createPublisher(topic);
+            conn.start();
+            return new TopicInfo(conn, sess, publisher);
+        } catch (final NamingException ex) {
+            LOGGER.warn("Unable to locate connection factory " + factoryBindingName, ex);
+            if (!suppress) {
+                throw ex;
+            }
+        } catch (final JMSException ex) {
+            LOGGER.warn("Unable to create connection to queue " + queueBindingName, ex);
+            if (!suppress) {
+                throw ex;
+            }
+        }
+        return null;
+    }
+
+    /** Topic connection information */
+    private static class TopicInfo {
+        private final TopicConnection conn;
+        private final TopicSession session;
+        private final TopicPublisher publisher;
+
+        public TopicInfo(final TopicConnection conn, final TopicSession session, final TopicPublisher publisher) {
+            this.conn = conn;
+            this.session = session;
+            this.publisher = publisher;
+        }
+    }
+
+    /**
+     * Factory to create the JmsQueueManager.
+     */
+    private static class JMSTopicManagerFactory implements ManagerFactory<JmsTopicManager, FactoryData> {
+
+        @Override
+        public JmsTopicManager createManager(final String name, final FactoryData data) {
+            try {
+                final Context ctx = createContext(data.factoryName, data.providerURL, data.urlPkgPrefixes,
+                    data.securityPrincipalName, data.securityCredentials);
+                final TopicInfo info = connect(ctx, data.factoryBindingName, data.topicBindingName, data.userName,
+                    data.password, true);
+                return new JmsTopicManager(name, ctx, data.factoryBindingName, data.topicBindingName,
+                    data.userName, data.password, info);
+            } catch (final NamingException ex) {
+                LOGGER.error("Unable to locate resource", ex);
+            } catch (final Exception ex) {
+                LOGGER.error("Unable to connect", ex);
+            }
+
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a117d38a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/AbstractJmsManager.java
----------------------------------------------------------------------
diff --git a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/AbstractJmsManager.java b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/AbstractJmsManager.java
deleted file mode 100644
index d3ae2a3..0000000
--- a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/AbstractJmsManager.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.mom.jms.receiver;
-
-import java.io.Serializable;
-import java.util.Properties;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-import org.apache.logging.log4j.core.appender.AbstractManager;
-
-/**
- * Base Class for Managers of JMS connections.
- */
-public abstract class AbstractJmsManager extends AbstractManager {
-
-    /**
-     * The Constructor.
-     * @param name The name of the Appender.
-     */
-    public AbstractJmsManager(final String name) {
-        super(name);
-    }
-
-    /**
-     * Create the InitialContext.
-     * @param factoryName The fully qualified class name of the InitialContextFactory.
-     * @param providerURL The URL of the provider to use.
-     * @param urlPkgPrefixes A colon-separated list of package prefixes for the class name of the factory class that
-     * will create a URL context factory
-     * @param securityPrincipalName The name of the identity of the Principal.
-     * @param securityCredentials The security credentials of the Principal.
-     * @return the InitialContext.
-     * @throws NamingException if a naming error occurs.
-     */
-    protected static Context createContext(final String factoryName, final String providerURL,
-                                           final String urlPkgPrefixes, final String securityPrincipalName,
-                                           final String securityCredentials)
-        throws NamingException {
-
-        final Properties props = getEnvironment(factoryName, providerURL, urlPkgPrefixes, securityPrincipalName,
-                                          securityCredentials);
-        return new InitialContext(props);
-    }
-
-    /**
-     * Looks up the name in the context.
-     * @param ctx The Context.
-     * @param name The name to locate.
-     * @return The object to be located.
-     * @throws NamingException If an error occurs locating the name.
-     */
-    protected static Object lookup(final Context ctx, final String name) throws NamingException {
-        try {
-            return ctx.lookup(name);
-        } catch (final NameNotFoundException e) {
-            LOGGER.warn("Could not find name [{}].", name);
-            throw e;
-        }
-    }
-
-    /**
-     * Sets up the properties to pass to the InitialContext.
-     * @param factoryName The fully qualified class name of the InitialContextFactory.
-     * @param providerURL The URL of the provider to use.
-     * @param urlPkgPrefixes A colon-separated list of package prefixes for the class name of the factory class that
-     * will create a URL context factory
-     * @param securityPrincipalName The name of the identity of the Principal.
-     * @param securityCredentials The security credentials of the Principal.
-     * @return The Properties.
-     */
-    protected static Properties getEnvironment(final String factoryName, final String providerURL,
-                                               final String urlPkgPrefixes, final String securityPrincipalName,
-                                               final String securityCredentials) {
-        final Properties props = new Properties();
-        if (factoryName != null) {
-            props.put(Context.INITIAL_CONTEXT_FACTORY, factoryName);
-            if (providerURL != null) {
-                props.put(Context.PROVIDER_URL, providerURL);
-            } else {
-                LOGGER.warn("The InitialContext factory name has been provided without a ProviderURL. " +
-                    "This is likely to cause problems");
-            }
-            if (urlPkgPrefixes != null) {
-                props.put(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
-            }
-            if (securityPrincipalName != null) {
-                props.put(Context.SECURITY_PRINCIPAL, securityPrincipalName);
-                if (securityCredentials != null) {
-                    props.put(Context.SECURITY_CREDENTIALS, securityCredentials);
-                } else {
-                    LOGGER.warn("SecurityPrincipalName has been set without SecurityCredentials. " +
-                        "This is likely to cause problems.");
-                }
-            }
-            return props;
-        }
-        return null;
-    }
-
-    /**
-     * Send the message.
-     * @param object The Object to sent.
-     * @throws Exception if an error occurs.
-     */
-    public abstract void send(Serializable object) throws Exception;
-
-    /**
-     * Send the Object.
-     * @param object The Object to send.
-     * @param session The Session.
-     * @param producer The MessageProducer.
-     * @throws Exception if an error occurs.
-     */
-    public synchronized void send(final Serializable object, final Session session, final MessageProducer producer)
-        throws Exception {
-        try {
-            Message msg;
-            if (object instanceof String) {
-                msg = session.createTextMessage();
-                ((TextMessage) msg).setText((String) object);
-            } else {
-                msg = session.createObjectMessage();
-                ((ObjectMessage) msg).setObject(object);
-            }
-            producer.send(msg);
-        } catch (final JMSException ex) {
-            LOGGER.error("Could not publish message via JMS {}", getName());
-            throw ex;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a117d38a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/JmsQueueManager.java
----------------------------------------------------------------------
diff --git a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/JmsQueueManager.java b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/JmsQueueManager.java
deleted file mode 100644
index 6825282..0000000
--- a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/JmsQueueManager.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.mom.jms.receiver;
-
-import java.io.Serializable;
-
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-import org.apache.logging.log4j.core.appender.ManagerFactory;
-
-/**
- * Manager for a JMS Queue.
- */
-public class JmsQueueManager extends AbstractJmsManager {
-
-    private static final JMSQueueManagerFactory FACTORY = new JMSQueueManagerFactory();
-
-    private QueueInfo info;
-    private final String factoryBindingName;
-    private final String queueBindingName;
-    private final String userName;
-    private final String password;
-    private final Context context;
-
-    /**
-     * The Constructor.
-     * @param name The unique name of the connection.
-     * @param context The context.
-     * @param factoryBindingName The factory binding name.
-     * @param queueBindingName The queue binding name.
-     * @param userName The user name.
-     * @param password The credentials for the user.
-     * @param info The Queue connection info.
-     */
-    protected JmsQueueManager(final String name, final Context context, final String factoryBindingName,
-                              final String queueBindingName, final String userName, final String password,
-                              final QueueInfo info) {
-        super(name);
-        this.context = context;
-        this.factoryBindingName = factoryBindingName;
-        this.queueBindingName = queueBindingName;
-        this.userName = userName;
-        this.password = password;
-        this.info = info;
-    }
-
-    /**
-     * Obtain a JmsQueueManager.
-     * @param factoryName The fully qualified class name of the InitialContextFactory.
-     * @param providerURL The URL of the provider to use.
-     * @param urlPkgPrefixes A colon-separated list of package prefixes for the class name of the factory class that
-     * will create a URL context factory
-     * @param securityPrincipalName The name of the identity of the Principal.
-     * @param securityCredentials The security credentials of the Principal.
-     * @param factoryBindingName The name to locate in the Context that provides the QueueConnectionFactory.
-     * @param queueBindingName The name to use to locate the Queue.
-     * @param userName The userid to use to create the Queue Connection.
-     * @param password The password to use to create the Queue Connection.
-     * @return The JmsQueueManager.
-     */
-    public static JmsQueueManager getJmsQueueManager(final String factoryName, final String providerURL,
-                                                     final String urlPkgPrefixes, final String securityPrincipalName,
-                                                     final String securityCredentials, final String factoryBindingName,
-                                                     final String queueBindingName, final String userName,
-                                                     final String password) {
-
-        if (factoryBindingName == null) {
-            LOGGER.error("No factory name provided for JmsQueueManager");
-            return null;
-        }
-        if (queueBindingName == null) {
-            LOGGER.error("No topic name provided for JmsQueueManager");
-            return null;
-        }
-
-        final String name = "JMSQueue:" + factoryBindingName + '.' + queueBindingName;
-        return getManager(name, FACTORY, new FactoryData(factoryName, providerURL, urlPkgPrefixes,
-            securityPrincipalName, securityCredentials, factoryBindingName, queueBindingName, userName, password));
-    }
-
-    @Override
-    public synchronized void send(final Serializable object) throws Exception {
-        if (info == null) {
-            info = connect(context, factoryBindingName, queueBindingName, userName, password, false);
-        }
-        try {
-            super.send(object, info.session, info.sender);
-        } catch (final Exception ex) {
-            cleanup(true);
-            throw ex;
-        }
-    }
-
-    @Override
-    public void releaseSub() {
-        if (info != null) {
-            cleanup(false);
-        }
-    }
-
-    private void cleanup(final boolean quiet) {
-        try {
-            info.session.close();
-        } catch (final Exception e) {
-            if (!quiet) {
-                LOGGER.error("Error closing session for " + getName(), e);
-            }
-        }
-        try {
-            info.conn.close();
-        } catch (final Exception e) {
-            if (!quiet) {
-                LOGGER.error("Error closing connection for " + getName(), e);
-            }
-        }
-        info = null;
-    }
-
-    /**
-     * Data for the factory.
-     */
-    private static class FactoryData {
-        private final String factoryName;
-        private final String providerURL;
-        private final String urlPkgPrefixes;
-        private final String securityPrincipalName;
-        private final String securityCredentials;
-        private final String factoryBindingName;
-        private final String queueBindingName;
-        private final String userName;
-        private final String password;
-
-        public FactoryData(final String factoryName, final String providerURL, final String urlPkgPrefixes,
-                           final String securityPrincipalName, final String securityCredentials,
-                           final String factoryBindingName, final String queueBindingName, final String userName,
-                           final String password) {
-            this.factoryName = factoryName;
-            this.providerURL = providerURL;
-            this.urlPkgPrefixes = urlPkgPrefixes;
-            this.securityPrincipalName = securityPrincipalName;
-            this.securityCredentials = securityCredentials;
-            this.factoryBindingName = factoryBindingName;
-            this.queueBindingName = queueBindingName;
-            this.userName = userName;
-            this.password = password;
-        }
-    }
-
-    private static QueueInfo connect(final Context context, final String factoryBindingName,
-                                     final String queueBindingName, final String userName, final String password,
-                                     final boolean suppress) throws Exception {
-        try {
-            final QueueConnectionFactory factory = (QueueConnectionFactory) lookup(context, factoryBindingName);
-            QueueConnection conn;
-            if (userName != null) {
-                conn = factory.createQueueConnection(userName, password);
-            } else {
-                conn = factory.createQueueConnection();
-            }
-            final QueueSession sess = conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
-            final Queue queue = (Queue) lookup(context, queueBindingName);
-            final QueueSender sender = sess.createSender(queue);
-            conn.start();
-            return new QueueInfo(conn, sess, sender);
-        } catch (final NamingException ex) {
-            LOGGER.warn("Unable to locate connection factory " + factoryBindingName, ex);
-            if (!suppress) {
-                throw ex;
-            }
-        } catch (final JMSException ex) {
-            LOGGER.warn("Unable to create connection to queue " + queueBindingName, ex);
-            if (!suppress) {
-                throw ex;
-            }
-        }
-        return null;
-    }
-
-    /** Queue connection information */
-    private static class QueueInfo {
-        private final QueueConnection conn;
-        private final QueueSession session;
-        private final QueueSender sender;
-
-        public QueueInfo(final QueueConnection conn, final QueueSession session, final QueueSender sender) {
-            this.conn = conn;
-            this.session = session;
-            this.sender = sender;
-        }
-    }
-
-    /**
-     * Factory to create the JmsQueueManager.
-     */
-    private static class JMSQueueManagerFactory implements ManagerFactory<JmsQueueManager, FactoryData> {
-
-        @Override
-        public JmsQueueManager createManager(final String name, final FactoryData data) {
-            try {
-                final Context ctx = createContext(data.factoryName, data.providerURL, data.urlPkgPrefixes,
-                                            data.securityPrincipalName, data.securityCredentials);
-                final QueueInfo info = connect(ctx, data.factoryBindingName, data.queueBindingName, data.userName,
-                    data.password, true);
-                return new JmsQueueManager(name, ctx, data.factoryBindingName, data.queueBindingName,
-                    data.userName, data.password, info);
-            } catch (final NamingException ex) {
-                LOGGER.error("Unable to locate resource", ex);
-            } catch (final Exception ex) {
-                LOGGER.error("Unable to connect", ex);
-            }
-
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/a117d38a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/JmsTopicManager.java
----------------------------------------------------------------------
diff --git a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/JmsTopicManager.java b/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/JmsTopicManager.java
deleted file mode 100644
index 08d7128..0000000
--- a/log4j-mom/src/main/java/org/apache/logging/log4j/mom/jms/receiver/JmsTopicManager.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.mom.jms.receiver;
-
-import java.io.Serializable;
-
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicConnectionFactory;
-import javax.jms.TopicPublisher;
-import javax.jms.TopicSession;
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-import org.apache.logging.log4j.core.appender.ManagerFactory;
-
-/**
- * Manager for JMS Topic connections.
- */
-public class JmsTopicManager extends AbstractJmsManager {
-
-    private static final JMSTopicManagerFactory FACTORY = new JMSTopicManagerFactory();
-
-    private TopicInfo info;
-    private final String factoryBindingName;
-    private final String topicBindingName;
-    private final String userName;
-    private final String password;
-    private final Context context;
-    /**
-     * Constructor.
-     * @param name The unique name of the connection.
-     * @param context The context.
-     * @param factoryBindingName The factory binding name.
-     * @param topicBindingName The queue binding name.
-     * @param userName The user name.
-     * @param password The credentials for the user.
-     * @param info The Queue connection info.
-     */
-    protected JmsTopicManager(final String name, final Context context, final String factoryBindingName,
-                              final String topicBindingName, final String userName, final String password,
-                              final TopicInfo info) {
-        super(name);
-        this.context = context;
-        this.factoryBindingName = factoryBindingName;
-        this.topicBindingName = topicBindingName;
-        this.userName = userName;
-        this.password = password;
-        this.info = info;
-    }
-
-    /**
-     * Obtain a JSMTopicManager.
-     * @param factoryName The fully qualified class name of the InitialContextFactory.
-     * @param providerURL The URL of the provider to use.
-     * @param urlPkgPrefixes A colon-separated list of package prefixes for the class name of the factory class that
-     * will create a URL context factory
-     * @param securityPrincipalName The name of the identity of the Principal.
-     * @param securityCredentials The security credentials of the Principal.
-     * @param factoryBindingName The name to locate in the Context that provides the TopicConnectionFactory.
-     * @param topicBindingName The name to use to locate the Topic.
-     * @param userName The userid to use to create the Topic Connection.
-     * @param password The password to use to create the Topic Connection.
-     * @return A JmsTopicManager.
-     */
-    public static JmsTopicManager getJmsTopicManager(final String factoryName, final String providerURL,
-                                                     final String urlPkgPrefixes, final String securityPrincipalName,
-                                                     final String securityCredentials, final String factoryBindingName,
-                                                     final String topicBindingName, final String userName,
-                                                     final String password) {
-
-        if (factoryBindingName == null) {
-            LOGGER.error("No factory name provided for JmsTopicManager");
-            return null;
-        }
-        if (topicBindingName == null) {
-            LOGGER.error("No topic name provided for JmsTopicManager");
-            return null;
-        }
-
-        final String name = "JMSTopic:" + factoryBindingName + '.' + topicBindingName;
-        return getManager(name, FACTORY, new FactoryData(factoryName, providerURL, urlPkgPrefixes,
-            securityPrincipalName, securityCredentials, factoryBindingName, topicBindingName, userName, password));
-    }
-
-
-    @Override
-    public void send(final Serializable object) throws Exception {
-        if (info == null) {
-            info = connect(context, factoryBindingName, topicBindingName, userName, password, false);
-        }
-        try {
-            super.send(object, info.session, info.publisher);
-        } catch (final Exception ex) {
-            cleanup(true);
-            throw ex;
-        }
-    }
-
-    @Override
-    public void releaseSub() {
-        if (info != null) {
-            cleanup(false);
-        }
-    }
-
-    private void cleanup(final boolean quiet) {
-        try {
-            info.session.close();
-        } catch (final Exception e) {
-            if (!quiet) {
-                LOGGER.error("Error closing session for " + getName(), e);
-            }
-        }
-        try {
-            info.conn.close();
-        } catch (final Exception e) {
-            if (!quiet) {
-                LOGGER.error("Error closing connection for " + getName(), e);
-            }
-        }
-        info = null;
-    }
-
-    /**
-     * Data for the factory.
-     */
-    private static class FactoryData {
-        private final String factoryName;
-        private final String providerURL;
-        private final String urlPkgPrefixes;
-        private final String securityPrincipalName;
-        private final String securityCredentials;
-        private final String factoryBindingName;
-        private final String topicBindingName;
-        private final String userName;
-        private final String password;
-
-        public FactoryData(final String factoryName, final String providerURL, final String urlPkgPrefixes,
-                           final String securityPrincipalName, final String securityCredentials,
-                           final String factoryBindingName, final String topicBindingName,
-                           final String userName, final String password) {
-            this.factoryName = factoryName;
-            this.providerURL = providerURL;
-            this.urlPkgPrefixes = urlPkgPrefixes;
-            this.securityPrincipalName = securityPrincipalName;
-            this.securityCredentials = securityCredentials;
-            this.factoryBindingName = factoryBindingName;
-            this.topicBindingName = topicBindingName;
-            this.userName = userName;
-            this.password = password;
-        }
-    }
-
-    private static TopicInfo connect(final Context context, final String factoryBindingName,
-                                     final String queueBindingName, final String userName, final String password,
-                                     final boolean suppress) throws Exception {
-        try {
-            final TopicConnectionFactory factory = (TopicConnectionFactory) lookup(context, factoryBindingName);
-            TopicConnection conn;
-            if (userName != null) {
-                conn = factory.createTopicConnection(userName, password);
-            } else {
-                conn = factory.createTopicConnection();
-            }
-            final TopicSession sess = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
-            final Topic topic = (Topic) lookup(context, queueBindingName);
-            final TopicPublisher publisher = sess.createPublisher(topic);
-            conn.start();
-            return new TopicInfo(conn, sess, publisher);
-        } catch (final NamingException ex) {
-            LOGGER.warn("Unable to locate connection factory " + factoryBindingName, ex);
-            if (!suppress) {
-                throw ex;
-            }
-        } catch (final JMSException ex) {
-            LOGGER.warn("Unable to create connection to queue " + queueBindingName, ex);
-            if (!suppress) {
-                throw ex;
-            }
-        }
-        return null;
-    }
-
-    /** Topic connection information */
-    private static class TopicInfo {
-        private final TopicConnection conn;
-        private final TopicSession session;
-        private final TopicPublisher publisher;
-
-        public TopicInfo(final TopicConnection conn, final TopicSession session, final TopicPublisher publisher) {
-            this.conn = conn;
-            this.session = session;
-            this.publisher = publisher;
-        }
-    }
-
-    /**
-     * Factory to create the JmsQueueManager.
-     */
-    private static class JMSTopicManagerFactory implements ManagerFactory<JmsTopicManager, FactoryData> {
-
-        @Override
-        public JmsTopicManager createManager(final String name, final FactoryData data) {
-            try {
-                final Context ctx = createContext(data.factoryName, data.providerURL, data.urlPkgPrefixes,
-                    data.securityPrincipalName, data.securityCredentials);
-                final TopicInfo info = connect(ctx, data.factoryBindingName, data.topicBindingName, data.userName,
-                    data.password, true);
-                return new JmsTopicManager(name, ctx, data.factoryBindingName, data.topicBindingName,
-                    data.userName, data.password, info);
-            } catch (final NamingException ex) {
-                LOGGER.error("Unable to locate resource", ex);
-            } catch (final Exception ex) {
-                LOGGER.error("Unable to connect", ex);
-            }
-
-            return null;
-        }
-    }
-}