You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2015/01/22 00:03:01 UTC

qpid-jms git commit: Some transport refactoring and some initial work on Netty based SSL transport. Remove the JMS SSL ConnectionFactory and use only java options or transport URI options to configure the SSL bits.

Repository: qpid-jms
Updated Branches:
  refs/heads/master 02c5377b2 -> 06141c5d4


Some transport refactoring and some initial work on Netty based SSL
transport.  Remove the JMS SSL ConnectionFactory and use only java
options or transport URI options to configure the SSL bits. 

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/06141c5d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/06141c5d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/06141c5d

Branch: refs/heads/master
Commit: 06141c5d41cc03a275580fe7037b04ddf517a3fe
Parents: 02c5377
Author: Timothy Bish <ta...@gmail.com>
Authored: Wed Jan 21 18:02:49 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Wed Jan 21 18:02:49 2015 -0500

----------------------------------------------------------------------
 .../qpid/jms/JmsSslConnectionFactory.java       |  93 -----------
 .../java/org/apache/qpid/jms/JmsSslContext.java | 100 -----------
 .../jms/provider/failover/FailoverProvider.java |   4 -
 .../qpid/jms/transports/TransportFactory.java   |  50 +++++-
 .../qpid/jms/transports/TransportOptions.java   |  18 ++
 .../jms/transports/TransportSslOptions.java     | 166 +++++++++++++++++++
 .../jms/transports/netty/NettySslTransport.java |  55 ++++++
 .../netty/NettySslTransportFactory.java         |  44 +++++
 .../jms/transports/netty/NettyTcpTransport.java |   6 +-
 .../netty/NettyTcpTransportFactory.java         |  27 +--
 .../plain/PlainTcpTransportFactory.java         |  27 +--
 .../qpid/jms/transports/vertx/SslTransport.java |  29 +---
 .../transports/vertx/SslTransportFactory.java   |  16 +-
 .../qpid/jms/transports/vertx/TcpTransport.java |   6 +-
 .../transports/vertx/TcpTransportFactory.java   |  27 +--
 15 files changed, 359 insertions(+), 309 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSslConnectionFactory.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSslConnectionFactory.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSslConnectionFactory.java
deleted file mode 100644
index cefe491..0000000
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSslConnectionFactory.java
+++ /dev/null
@@ -1,93 +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.qpid.jms;
-
-import java.net.URI;
-
-import org.apache.qpid.jms.provider.Provider;
-
-/**
- * SSL Aware Factory class that allows for configuration of the SSL values used
- * in the Provider transports that are SSL aware.
- */
-public class JmsSslConnectionFactory extends JmsConnectionFactory {
-
-    private final JmsSslContext configured = JmsSslContext.getCurrentSslContext();
-
-    public JmsSslConnectionFactory() {
-    }
-
-    public JmsSslConnectionFactory(String username, String password) {
-        super(username, password);
-    }
-
-    public JmsSslConnectionFactory(String brokerURI) {
-        super(brokerURI);
-    }
-
-    public JmsSslConnectionFactory(URI brokerURI) {
-        super(brokerURI);
-    }
-
-    public JmsSslConnectionFactory(String username, String password, URI brokerURI) {
-        super(username, password, brokerURI);
-    }
-
-    public JmsSslConnectionFactory(String username, String password, String brokerURI) {
-        super(username, password, brokerURI);
-    }
-
-    @Override
-    protected Provider createProvider(URI brokerURI) throws Exception {
-        // Create and set a new instance as the current JmsSslContext for this thread
-        // based on current configuration settings.
-        JmsSslContext.setCurrentSslContext(configured.copy());
-        return super.createProvider(brokerURI);
-    }
-
-    public String getKeyStoreLocation() {
-        return configured.getKeyStoreLocation();
-    }
-
-    public void setKeyStoreLocation(String keyStoreLocation) {
-        this.configured.setKeyStoreLocation(keyStoreLocation);
-    }
-
-    public String getKeyStorePassword() {
-        return configured.getKeyStorePassword();
-    }
-
-    public void setKeyStorePassword(String keyStorePassword) {
-        this.configured.setKeyStorePassword(keyStorePassword);
-    }
-
-    public String getTrustStoreLocation() {
-        return configured.getTrustStoreLocation();
-    }
-
-    public void setTrustStoreLocation(String trustStoreLocation) {
-        this.configured.setTrustStoreLocation(trustStoreLocation);
-    }
-
-    public String getTrustStorePassword() {
-        return configured.getTrustStorePassword();
-    }
-
-    public void setTrustStorePassword(String trustStorePassword) {
-        this.configured.setTrustStorePassword(trustStorePassword);
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSslContext.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSslContext.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSslContext.java
deleted file mode 100644
index feca77c..0000000
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSslContext.java
+++ /dev/null
@@ -1,100 +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.qpid.jms;
-
-/**
- * Provides a wrapper around the SSL settings that are used by Provider transport
- * instances that use an SSL encryption layer.
- */
-public class JmsSslContext {
-
-    private String keyStoreLocation;
-    private String keyStorePassword;
-    private String trustStoreLocation;
-    private String trustStorePassword;
-
-    private static final JmsSslContext initial = new JmsSslContext();
-    private static final ThreadLocal<JmsSslContext> current;
-
-    static {
-
-        initial.setKeyStoreLocation(System.getProperty("javax.net.ssl.keyStore"));
-        initial.setKeyStorePassword(System.getProperty("javax.net.ssl.keyStorePassword"));
-        initial.setTrustStoreLocation(System.getProperty("javax.net.ssl.trustStore"));
-        initial.setTrustStorePassword(System.getProperty("javax.net.ssl.keyStorePassword"));
-
-        current = new ThreadLocal<JmsSslContext>() {
-
-            @Override
-            protected JmsSslContext initialValue() {
-                return initial;
-            }
-        };
-    }
-
-    protected JmsSslContext() {
-    }
-
-    public JmsSslContext copy() {
-        JmsSslContext result = new JmsSslContext();
-        result.setKeyStoreLocation(keyStoreLocation);
-        result.setKeyStorePassword(keyStorePassword);
-        result.setTrustStoreLocation(trustStoreLocation);
-        result.setTrustStorePassword(trustStorePassword);
-        return result;
-    }
-
-    static public void setCurrentSslContext(JmsSslContext bs) {
-        current.set(bs);
-    }
-
-    static public JmsSslContext getCurrentSslContext() {
-        return current.get();
-    }
-
-    public String getKeyStoreLocation() {
-        return keyStoreLocation;
-    }
-
-    public void setKeyStoreLocation(String keyStoreLocation) {
-        this.keyStoreLocation = keyStoreLocation;
-    }
-
-    public String getKeyStorePassword() {
-        return keyStorePassword;
-    }
-
-    public void setKeyStorePassword(String keyStorePassword) {
-        this.keyStorePassword = keyStorePassword;
-    }
-
-    public String getTrustStoreLocation() {
-        return trustStoreLocation;
-    }
-
-    public void setTrustStoreLocation(String trustStoreLocation) {
-        this.trustStoreLocation = trustStoreLocation;
-    }
-
-    public String getTrustStorePassword() {
-        return trustStorePassword;
-    }
-
-    public void setTrustStorePassword(String trustStorePassword) {
-        this.trustStorePassword = trustStorePassword;
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
index 968519e..3d0e6ce 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
@@ -33,7 +33,6 @@ import java.util.concurrent.atomic.AtomicReference;
 
 import javax.jms.JMSException;
 
-import org.apache.qpid.jms.JmsSslContext;
 import org.apache.qpid.jms.message.JmsInboundMessageDispatch;
 import org.apache.qpid.jms.message.JmsMessageFactory;
 import org.apache.qpid.jms.message.JmsOutboundMessageDispatch;
@@ -76,7 +75,6 @@ public class FailoverProvider extends DefaultProviderListener implements Provide
     private final AtomicLong requestId = new AtomicLong();
     private final Map<Long, FailoverRequest> requests = new LinkedHashMap<Long, FailoverRequest>();
     private final DefaultProviderListener closedListener = new DefaultProviderListener();
-    private final JmsSslContext sslContext;
     private final AtomicReference<JmsMessageFactory> messageFactory = new AtomicReference<JmsMessageFactory>();
 
     // Current state of connection / reconnection
@@ -111,7 +109,6 @@ public class FailoverProvider extends DefaultProviderListener implements Provide
 
     public FailoverProvider(URI[] uris, Map<String, String> nestedOptions) {
         this.uris = new FailoverUriPool(uris, nestedOptions);
-        this.sslContext = JmsSslContext.getCurrentSslContext();
 
         this.serializer = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
 
@@ -544,7 +541,6 @@ public class FailoverProvider extends DefaultProviderListener implements Provide
                 if (target != null) {
                     try {
                         LOG.debug("Connection attempt:[{}] to: {} in-progress", reconnectAttempts, target);
-                        JmsSslContext.setCurrentSslContext(sslContext);
                         Provider provider = ProviderFactory.create(target);
                         provider.connect();
                         initializeNewConnection(provider);

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportFactory.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportFactory.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportFactory.java
index 463adfb..da0c4f5 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportFactory.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportFactory.java
@@ -18,8 +18,10 @@ package org.apache.qpid.jms.transports;
 
 import java.io.IOException;
 import java.net.URI;
+import java.util.Map;
 
 import org.apache.qpid.jms.util.FactoryFinder;
+import org.apache.qpid.jms.util.PropertyUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -39,13 +41,57 @@ public abstract class TransportFactory {
      * properties set on the given remote broker URI.
      *
      * @param remoteURI
-     *        The URI used to connect to a remote Broker.
+     *        The URI used to connect to a remote Peer.
      *
      * @return a new Transport instance.
      *
      * @throws Exception if an error occurs while creating the Transport instance.
      */
-    public abstract Transport createTransport(URI remoteURI) throws Exception;
+    public Transport createTransport(URI remoteURI) throws Exception {
+        Map<String, String> map = PropertyUtil.parseQuery(remoteURI.getQuery());
+        Map<String, String> transportURIOptions = PropertyUtil.filterProperties(map, "transport.");
+
+        remoteURI = PropertyUtil.replaceQuery(remoteURI, map);
+
+        TransportOptions transportOptions = doCreateTransportOptions();
+
+        if (!PropertyUtil.setProperties(transportOptions, transportURIOptions)) {
+            String msg = " Not all transport options could be set on the " + getName() +
+                         " Transport. Check the options are spelled correctly." +
+                         " Given parameters=[" + transportURIOptions + "]." +
+                         " This provider instance cannot be started.";
+            throw new IllegalArgumentException(msg);
+        }
+
+        Transport result = doCreateTransport(remoteURI, transportOptions);
+
+        return result;
+    }
+
+    /**
+     * Create and return an instance of TransportOptions appropriate for the Transport
+     * type that this factory will return.
+     *
+     * @return a newly allocated TransportOptions instance appropriate to the factory.
+     */
+    protected TransportOptions doCreateTransportOptions() {
+        return new TransportOptions();
+    }
+
+    /**
+     * Create the actual Transport instance for this factory using the provided URI and
+     * TransportOptions instances.
+     *
+     * @param remoteURI
+     *        The URI used to connect to a remote Peer.
+     * @param transportOptions
+     *        The TransportOptions used to configure the new Transport.
+     *
+     * @return a newly created and configured Transport instance.
+     *
+     * @throws Exception if an error occurs while creating the Transport instance.
+     */
+    protected abstract Transport doCreateTransport(URI remoteURI, TransportOptions transportOptions) throws Exception;
 
     /**
      * @return the name of this Transport.

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportOptions.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportOptions.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportOptions.java
index f0e34ca..a0e9789 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportOptions.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportOptions.java
@@ -152,4 +152,22 @@ public class TransportOptions {
     public void setConnectTimeout(int connectTimeout) {
         this.connectTimeout = connectTimeout;
     }
+
+    @Override
+    public TransportOptions clone() {
+        return copyOptions(new TransportOptions());
+    }
+
+    protected TransportOptions copyOptions(TransportOptions copy) {
+        copy.setConnectTimeout(getConnectTimeout());
+        copy.setReceiveBufferSize(getReceiveBufferSize());
+        copy.setSendBufferSize(getSendBufferSize());
+        copy.setSoLinger(getSoLinger());
+        copy.setSoTimeout(getSoTimeout());
+        copy.setTcpKeepAlive(isTcpKeepAlive());
+        copy.setTcpNoDelay(isTcpNoDelay());
+        copy.setTrafficClass(getTrafficClass());
+
+        return copy;
+    }
 }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportSslOptions.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportSslOptions.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportSslOptions.java
new file mode 100644
index 0000000..f169c78
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/TransportSslOptions.java
@@ -0,0 +1,166 @@
+/**
+ * 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.qpid.jms.transports;
+
+/**
+ * Holds the defined SSL options for connections that operate over a secure
+ * transport.  Options are read from the environment and can be overridden by
+ * specifying them on the connection URI.
+ */
+public class TransportSslOptions extends TransportOptions {
+
+    private static final String[] DEFAULT_ENABLED_PROTOCOLS = {"SSLv2Hello", "TLSv1", "TLSv1.1", "TLSv1.2"};
+    private static final String DEFAULT_STORE_TYPE = "JKS";
+
+    public static final TransportSslOptions INSTANCE = new TransportSslOptions();
+
+    private String keyStoreLocation;
+    private String keyStorePassword;
+    private String trustStoreLocation;
+    private String trustStorePassword;
+    private String storeType = DEFAULT_STORE_TYPE;
+    private String[] enabledCipherSuites;
+    private String[] enabledProtocols = DEFAULT_ENABLED_PROTOCOLS;
+
+    static {
+        INSTANCE.setKeyStoreLocation(System.getProperty("javax.net.ssl.keyStore"));
+        INSTANCE.setKeyStorePassword(System.getProperty("javax.net.ssl.keyStorePassword"));
+        INSTANCE.setTrustStoreLocation(System.getProperty("javax.net.ssl.trustStore"));
+        INSTANCE.setTrustStorePassword(System.getProperty("javax.net.ssl.keyStorePassword"));
+    }
+
+    /**
+     * @return the keyStoreLocation currently configured.
+     */
+    public String getKeyStoreLocation() {
+        return keyStoreLocation;
+    }
+
+    /**
+     * Sets the location on disk of the key store to use.
+     *
+     * @param keyStoreLocation
+     *        the keyStoreLocation to use to create the key manager.
+     */
+    public void setKeyStoreLocation(String keyStoreLocation) {
+        this.keyStoreLocation = keyStoreLocation;
+    }
+
+    /**
+     * @return the keyStorePassword
+     */
+    public String getKeyStorePassword() {
+        return keyStorePassword;
+    }
+
+    /**
+     * @param keyStorePassword the keyStorePassword to set
+     */
+    public void setKeyStorePassword(String keyStorePassword) {
+        this.keyStorePassword = keyStorePassword;
+    }
+
+    /**
+     * @return the trustStoreLocation
+     */
+    public String getTrustStoreLocation() {
+        return trustStoreLocation;
+    }
+
+    /**
+     * @param trustStoreLocation the trustStoreLocation to set
+     */
+    public void setTrustStoreLocation(String trustStoreLocation) {
+        this.trustStoreLocation = trustStoreLocation;
+    }
+
+    /**
+     * @return the trustStorePassword
+     */
+    public String getTrustStorePassword() {
+        return trustStorePassword;
+    }
+
+    /**
+     * @param trustStorePassword the trustStorePassword to set
+     */
+    public void setTrustStorePassword(String trustStorePassword) {
+        this.trustStorePassword = trustStorePassword;
+    }
+
+    /**
+     * @return the storeType
+     */
+    public String getStoreType() {
+        return storeType;
+    }
+
+    /**
+     * @param storeType
+     *        the format that the store files are encoded in.
+     */
+    public void setStoreType(String storeType) {
+        this.storeType = storeType;
+    }
+
+    /**
+     * @return the enabledCipherSuites
+     */
+    public String[] getEnabledCipherSuites() {
+        return enabledCipherSuites;
+    }
+
+    /**
+     * @param enabledCipherSuites the enabledCipherSuites to set
+     */
+    public void setEnabledCipherSuites(String[] enabledCipherSuites) {
+        this.enabledCipherSuites = enabledCipherSuites;
+    }
+
+    /**
+     * @return the enabledProtocols
+     */
+    public String[] getEnabledProtocols() {
+        return enabledProtocols;
+    }
+
+    /**
+     * @param enabledProtocols the enabledProtocols to set
+     */
+    public void setEnabledProtocols(String[] enabledProtocols) {
+        this.enabledProtocols = enabledProtocols;
+    }
+
+    @Override
+    public TransportSslOptions clone() {
+        return copyOptions(new TransportSslOptions());
+    }
+
+    protected TransportSslOptions copyOptions(TransportSslOptions copy) {
+        super.copyOptions(copy);
+
+        copy.setKeyStoreLocation(getKeyStoreLocation());
+        copy.setKeyStorePassword(getKeyStorePassword());
+        copy.setTrustStoreLocation(getTrustStoreLocation());
+        copy.setTrustStorePassword(getTrustStorePassword());
+        copy.setStoreType(getStoreType());
+        copy.setEnabledCipherSuites(getEnabledCipherSuites());
+        copy.setEnabledProtocols(getEnabledProtocols());
+
+        return copy;
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettySslTransport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettySslTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettySslTransport.java
new file mode 100644
index 0000000..3a959dc
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettySslTransport.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.transports.netty;
+
+import java.net.URI;
+
+import org.apache.qpid.jms.transports.TransportListener;
+import org.apache.qpid.jms.transports.TransportOptions;
+
+/**
+ * Extends the Netty based TCP transport to add SSL support.
+ */
+public class NettySslTransport extends NettyTcpTransport {
+
+    /**
+     * Create a new transport instance
+     *
+     * @param remoteLocation
+     *        the URI that defines the remote resource to connect to.
+     * @param options
+     *        the transport options used to configure the socket connection.
+     */
+    public NettySslTransport(URI remoteLocation, TransportOptions options) {
+        this(null, remoteLocation, options);
+    }
+
+    /**
+     * Create a new transport instance
+     *
+     * @param listener
+     *        the TransportListener that will receive events from this Transport.
+     * @param remoteLocation
+     *        the URI that defines the remote resource to connect to.
+     * @param options
+     *        the transport options used to configure the socket connection.
+     */
+    public NettySslTransport(TransportListener listener, URI remoteLocation, TransportOptions options) {
+        super(listener, remoteLocation, options);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettySslTransportFactory.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettySslTransportFactory.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettySslTransportFactory.java
new file mode 100644
index 0000000..1470921
--- /dev/null
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettySslTransportFactory.java
@@ -0,0 +1,44 @@
+/**
+ * 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.qpid.jms.transports.netty;
+
+import java.net.URI;
+
+import org.apache.qpid.jms.transports.TransportFactory;
+import org.apache.qpid.jms.transports.TransportOptions;
+import org.apache.qpid.jms.transports.TransportSslOptions;
+
+/**
+ * Creates a Netty based SSL transport.
+ */
+public class NettySslTransportFactory extends TransportFactory {
+
+    @Override
+    protected TransportOptions doCreateTransportOptions() {
+        return TransportSslOptions.INSTANCE.clone();
+    }
+
+    @Override
+    protected NettyTcpTransport doCreateTransport(URI remoteURI, TransportOptions transportOptions) throws Exception {
+        return new NettySslTransport(remoteURI, transportOptions);
+    }
+
+    @Override
+    public String getName() {
+        return "SSL";
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java
index b9832ce..f881481 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransport.java
@@ -103,7 +103,7 @@ public class NettyTcpTransport implements Transport {
             @Override
             public void initChannel(Channel connectedChannel) throws Exception {
                 channel = connectedChannel;
-                channel.pipeline().addLast(new NettyTcpTransportHandler());
+                configureChannel(channel);
             }
         });
 
@@ -193,6 +193,10 @@ public class NettyTcpTransport implements Transport {
         }
     }
 
+    protected void configureChannel(Channel channel) {
+        channel.pipeline().addLast(new NettyTcpTransportHandler());
+    }
+
     private void checkConnected() throws IOException {
         if (!connected.get()) {
             throw new IOException("Cannot send to a non-connected transport.");

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportFactory.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportFactory.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportFactory.java
index d51013c..3a10c28 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportFactory.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/netty/NettyTcpTransportFactory.java
@@ -17,12 +17,9 @@
 package org.apache.qpid.jms.transports.netty;
 
 import java.net.URI;
-import java.util.Map;
 
-import org.apache.qpid.jms.transports.TransportOptions;
-import org.apache.qpid.jms.transports.Transport;
 import org.apache.qpid.jms.transports.TransportFactory;
-import org.apache.qpid.jms.util.PropertyUtil;
+import org.apache.qpid.jms.transports.TransportOptions;
 
 /**
  * Factory for creating the Netty based TCP Transport.
@@ -30,28 +27,6 @@ import org.apache.qpid.jms.util.PropertyUtil;
 public class NettyTcpTransportFactory extends TransportFactory {
 
     @Override
-    public Transport createTransport(URI remoteURI) throws Exception {
-
-        Map<String, String> map = PropertyUtil.parseQuery(remoteURI.getQuery());
-        Map<String, String> transportURIOptions = PropertyUtil.filterProperties(map, "transport.");
-
-        remoteURI = PropertyUtil.replaceQuery(remoteURI, map);
-
-        TransportOptions transportOptions = new TransportOptions();
-
-        if (!PropertyUtil.setProperties(transportOptions, transportURIOptions)) {
-            String msg = " Not all transport options could be set on the Transport." +
-                         " Check the options are spelled correctly." +
-                         " Given parameters=[" + transportURIOptions + "]." +
-                         " This provider instance cannot be started.";
-            throw new IllegalArgumentException(msg);
-        }
-
-        Transport result = doCreateTransport(remoteURI, transportOptions);
-
-        return result;
-    }
-
     protected NettyTcpTransport doCreateTransport(URI remoteURI, TransportOptions transportOptions) throws Exception {
         return new NettyTcpTransport(remoteURI, transportOptions);
     }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/plain/PlainTcpTransportFactory.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/plain/PlainTcpTransportFactory.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/plain/PlainTcpTransportFactory.java
index 3894408..05d68c5 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/plain/PlainTcpTransportFactory.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/plain/PlainTcpTransportFactory.java
@@ -17,12 +17,9 @@
 package org.apache.qpid.jms.transports.plain;
 
 import java.net.URI;
-import java.util.Map;
 
-import org.apache.qpid.jms.transports.TransportOptions;
-import org.apache.qpid.jms.transports.Transport;
 import org.apache.qpid.jms.transports.TransportFactory;
-import org.apache.qpid.jms.util.PropertyUtil;
+import org.apache.qpid.jms.transports.TransportOptions;
 
 /**
  * Factory for creating the Plain TCP transport.
@@ -30,28 +27,6 @@ import org.apache.qpid.jms.util.PropertyUtil;
 public class PlainTcpTransportFactory extends TransportFactory {
 
     @Override
-    public Transport createTransport(URI remoteURI) throws Exception {
-
-        Map<String, String> map = PropertyUtil.parseQuery(remoteURI.getQuery());
-        Map<String, String> transportURIOptions = PropertyUtil.filterProperties(map, "transport.");
-
-        remoteURI = PropertyUtil.replaceQuery(remoteURI, map);
-
-        TransportOptions transportOptions = new TransportOptions();
-
-        if (!PropertyUtil.setProperties(transportOptions, transportURIOptions)) {
-            String msg = " Not all transport options could be set on the Transport." +
-                         " Check the options are spelled correctly." +
-                         " Given parameters=[" + transportURIOptions + "]." +
-                         " This provider instance cannot be started.";
-            throw new IllegalArgumentException(msg);
-        }
-
-        Transport result = doCreateTransport(remoteURI, transportOptions);
-
-        return result;
-    }
-
     protected PlainTcpTransport doCreateTransport(URI remoteURI, TransportOptions transportOptions) throws Exception {
         return new PlainTcpTransport(remoteURI, transportOptions);
     }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/SslTransport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/SslTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/SslTransport.java
index fd312f8..5ae5248 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/SslTransport.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/SslTransport.java
@@ -19,9 +19,9 @@ package org.apache.qpid.jms.transports.vertx;
 import java.io.IOException;
 import java.net.URI;
 
-import org.apache.qpid.jms.JmsSslContext;
-import org.apache.qpid.jms.transports.TransportOptions;
 import org.apache.qpid.jms.transports.TransportListener;
+import org.apache.qpid.jms.transports.TransportOptions;
+import org.apache.qpid.jms.transports.TransportSslOptions;
 import org.vertx.java.core.net.NetClient;
 
 /**
@@ -30,9 +30,6 @@ import org.vertx.java.core.net.NetClient;
  */
 public class SslTransport extends TcpTransport {
 
-    // TODO - remove with SSL configuration placed in Transport options.
-    private JmsSslContext context;
-
     /**
      * Create a new transport instance
      *
@@ -64,23 +61,13 @@ public class SslTransport extends TcpTransport {
         super.configureNetClient(client, options);
 
         client.setSSL(true);
-        client.setKeyStorePath(context.getKeyStoreLocation());
-        client.setKeyStorePassword(context.getKeyStorePassword());
-        client.setTrustStorePath(context.getTrustStoreLocation());
-        client.setTrustStorePassword(context.getTrustStorePassword());
+        client.setKeyStorePath(getSslOptions().getKeyStoreLocation());
+        client.setKeyStorePassword(getSslOptions().getKeyStorePassword());
+        client.setTrustStorePath(getSslOptions().getTrustStoreLocation());
+        client.setTrustStorePassword(getSslOptions().getTrustStorePassword());
     }
 
-    /**
-     * @return the context
-     */
-    public JmsSslContext getContext() {
-        return context;
-    }
-
-    /**
-     * @param context the context to set
-     */
-    public void setContext(JmsSslContext context) {
-        this.context = context;
+    private TransportSslOptions getSslOptions() {
+        return (TransportSslOptions) options;
     }
 }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/SslTransportFactory.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/SslTransportFactory.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/SslTransportFactory.java
index b7c738c..924f6a5 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/SslTransportFactory.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/SslTransportFactory.java
@@ -18,21 +18,23 @@ package org.apache.qpid.jms.transports.vertx;
 
 import java.net.URI;
 
-import org.apache.qpid.jms.JmsSslContext;
+import org.apache.qpid.jms.transports.TransportFactory;
 import org.apache.qpid.jms.transports.TransportOptions;
+import org.apache.qpid.jms.transports.TransportSslOptions;
 
 /**
  * Create an SslTransport instance.
  */
-public class SslTransportFactory extends TcpTransportFactory {
+public class SslTransportFactory extends TransportFactory {
 
     @Override
-    protected TcpTransport doCreateTransport(URI remoteURI, TransportOptions transportOptions) throws Exception {
-        SslTransport transport = new SslTransport(remoteURI, transportOptions);
-
-        transport.setContext(JmsSslContext.getCurrentSslContext());
+    protected TransportOptions doCreateTransportOptions() {
+        return TransportSslOptions.INSTANCE.clone();
+    }
 
-        return transport;
+    @Override
+    protected TcpTransport doCreateTransport(URI remoteURI, TransportOptions transportOptions) throws Exception {
+        return new SslTransport(remoteURI, transportOptions);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/TcpTransport.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/TcpTransport.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/TcpTransport.java
index 4207fd9..e90bd0b 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/TcpTransport.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/TcpTransport.java
@@ -53,9 +53,9 @@ public class TcpTransport implements Transport {
     private final AtomicBoolean closed = new AtomicBoolean();
     private final AtomicReference<Throwable> connectionError = new AtomicReference<Throwable>();
 
-    private NetSocket socket;
-    private TransportListener listener;
-    private TransportOptions options;
+    protected NetSocket socket;
+    protected TransportListener listener;
+    protected TransportOptions options;
 
     /**
      * Create a new transport instance

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/06141c5d/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/TcpTransportFactory.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/TcpTransportFactory.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/TcpTransportFactory.java
index 8385dff..e6a2dce 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/TcpTransportFactory.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/transports/vertx/TcpTransportFactory.java
@@ -17,12 +17,9 @@
 package org.apache.qpid.jms.transports.vertx;
 
 import java.net.URI;
-import java.util.Map;
 
-import org.apache.qpid.jms.transports.TransportOptions;
-import org.apache.qpid.jms.transports.Transport;
 import org.apache.qpid.jms.transports.TransportFactory;
-import org.apache.qpid.jms.util.PropertyUtil;
+import org.apache.qpid.jms.transports.TransportOptions;
 
 /**
  * Factory for creating the Vert.x based TCP Transport
@@ -30,28 +27,6 @@ import org.apache.qpid.jms.util.PropertyUtil;
 public class TcpTransportFactory extends TransportFactory {
 
     @Override
-    public Transport createTransport(URI remoteURI) throws Exception {
-
-        Map<String, String> map = PropertyUtil.parseQuery(remoteURI.getQuery());
-        Map<String, String> transportURIOptions = PropertyUtil.filterProperties(map, "transport.");
-
-        remoteURI = PropertyUtil.replaceQuery(remoteURI, map);
-
-        TransportOptions transportOptions = new TransportOptions();
-
-        if (!PropertyUtil.setProperties(transportOptions, transportURIOptions)) {
-            String msg = " Not all transport options could be set on the Transport." +
-                         " Check the options are spelled correctly." +
-                         " Given parameters=[" + transportURIOptions + "]." +
-                         " This provider instance cannot be started.";
-            throw new IllegalArgumentException(msg);
-        }
-
-        Transport result = doCreateTransport(remoteURI, transportOptions);
-
-        return result;
-    }
-
     protected TcpTransport doCreateTransport(URI remoteURI, TransportOptions transportOptions) throws Exception {
         return new TcpTransport(remoteURI, transportOptions);
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org