qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject qpid-jms git commit: https://issues.apache.org/jira/browse/QPIDJMS-55
Date Thu, 21 May 2015 16:54:21 GMT
Repository: qpid-jms
Updated Branches:
  refs/heads/master 6b7320052 -> cb0f1914c


https://issues.apache.org/jira/browse/QPIDJMS-55

Default to standard AMQP port values to TCP and SSL if none is present
in the given remote URI. 

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

Branch: refs/heads/master
Commit: cb0f1914cedbb98e0d38f8d4ccc67ef286483520
Parents: 6b73200
Author: Timothy Bish <tabish121@gmail.com>
Authored: Thu May 21 12:46:53 2015 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Thu May 21 12:46:53 2015 -0400

----------------------------------------------------------------------
 .../org/apache/qpid/jms/transports/TransportOptions.java  | 10 ++++++++++
 .../apache/qpid/jms/transports/TransportSslOptions.java   | 10 ++++++++++
 .../qpid/jms/transports/netty/NettySslTransport.java      |  5 +++++
 .../qpid/jms/transports/netty/NettyTcpTransport.java      | 10 +++++++++-
 4 files changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/cb0f1914/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 4ed10fa..834a290 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
@@ -29,6 +29,7 @@ public class TransportOptions {
     public static final int DEFAULT_SO_LINGER = Integer.MIN_VALUE;
     public static final int DEFAULT_SO_TIMEOUT = -1;
     public static final int DEFAULT_CONNECT_TIMEOUT = 60000;
+    public static final int DEFAULT_TCP_PORT = 5672;
 
     public static final TransportOptions INSTANCE = new TransportOptions();
 
@@ -40,6 +41,7 @@ public class TransportOptions {
     private int soLinger = DEFAULT_SO_LINGER;
     private boolean tcpKeepAlive = DEFAULT_TCP_KEEP_ALIVE;
     private boolean tcpNoDelay = DEFAULT_TCP_NO_DELAY;
+    private int defaultTcpPort = DEFAULT_TCP_PORT;
 
     /**
      * @return the currently set send buffer size in bytes.
@@ -153,6 +155,14 @@ public class TransportOptions {
         this.connectTimeout = connectTimeout;
     }
 
+    public int getDefaultTcpPort() {
+        return defaultTcpPort;
+    }
+
+    public void setDefaultTcpPort(int defaultTcpPort) {
+        this.defaultTcpPort = defaultTcpPort;
+    }
+
     @Override
     public TransportOptions clone() {
         return copyOptions(new TransportOptions());

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/cb0f1914/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
index 616e0c2..837f616 100644
--- 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
@@ -33,6 +33,7 @@ public class TransportSslOptions extends TransportOptions {
     public static final boolean DEFAULT_TRUST_ALL = false;
     public static final boolean DEFAULT_VERIFY_HOST = true;
     public static final List<String> DEFAULT_DISABLED_PROTOCOLS = Collections.unmodifiableList(Arrays.asList(new
String[]{"SSLv2Hello", "SSLv3"}));
+    public static final int DEFAULT_SSL_PORT = 5671;
 
     public static final TransportSslOptions INSTANCE = new TransportSslOptions();
 
@@ -50,6 +51,7 @@ public class TransportSslOptions extends TransportOptions {
     private boolean trustAll = DEFAULT_TRUST_ALL;
     private boolean verifyHost = DEFAULT_VERIFY_HOST;
     private String keyAlias;
+    private int defaultSslPort = DEFAULT_SSL_PORT;
 
     static {
         INSTANCE.setKeyStoreLocation(System.getProperty("javax.net.ssl.keyStore"));
@@ -252,6 +254,14 @@ public class TransportSslOptions extends TransportOptions {
         this.keyAlias = keyAlias;
     }
 
+    public int getDefaultSslPort() {
+        return defaultSslPort;
+    }
+
+    public void setDefaultSslPort(int defaultSslPort) {
+        this.defaultSslPort = defaultSslPort;
+    }
+
     @Override
     public TransportSslOptions clone() {
         return copyOptions(new TransportSslOptions());

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/cb0f1914/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
index cf57715..a190e21 100644
--- 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
@@ -98,6 +98,11 @@ public class NettySslTransport extends NettyTcpTransport {
         return options;
     }
 
+    @Override
+    protected int getRemotePort() {
+        return remote.getPort() != -1 ? remote.getPort() : getSslOptions().getDefaultSslPort();
+    }
+
     private TransportSslOptions getSslOptions() {
         return (TransportSslOptions) getTransportOptions();
     }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/cb0f1914/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 b6bb387..08be1f7 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
@@ -115,7 +115,7 @@ public class NettyTcpTransport implements Transport {
 
         configureNetty(bootstrap, getTransportOptions());
 
-        ChannelFuture future = bootstrap.connect(remote.getHost(), remote.getPort());
+        ChannelFuture future = bootstrap.connect(getRemoteHost(), getRemotePort());
         future.addListener(new ChannelFutureListener() {
 
             @Override
@@ -216,6 +216,14 @@ public class NettyTcpTransport implements Transport {
 
     //----- Internal implementation details, can be overridden as needed --//
 
+    protected String getRemoteHost() {
+        return remote.getHost();
+    }
+
+    protected int getRemotePort() {
+        return remote.getPort() != -1 ? remote.getPort() : getTransportOptions().getDefaultTcpPort();
+    }
+
     protected void configureNetty(Bootstrap bootstrap, TransportOptions options) {
         bootstrap.option(ChannelOption.TCP_NODELAY, options.isTcpNoDelay());
         bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, options.getConnectTimeout());


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


Mime
View raw message