From a3e64bab187de9f9901acf5ac7ec135746c5f1b5 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 1 Mar 2014 14:27:20 +0100 Subject: [PATCH] Created 'tcp' subproject for TCPConnection Renamed XMPPConnection to TCPConnection, since the other connection type is also called BOSHConnection. --- build.gradle | 32 ++++++++++++------- .../smackx/jingle/mediaimpl/demo/Demo.java | 0 settings.gradle | 1 + .../org/jivesoftware/smack/PacketReader.java | 4 +-- .../org/jivesoftware/smack/PacketWriter.java | 4 +-- .../org/jivesoftware/smack/TCPConnection.java | 11 +++---- .../jivesoftware/smack/RosterOfflineTest.java | 2 +- 7 files changed, 32 insertions(+), 22 deletions(-) rename jingle/src/{main => demo}/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java (100%) rename {core => tcp}/src/main/java/org/jivesoftware/smack/PacketReader.java (99%) rename {core => tcp}/src/main/java/org/jivesoftware/smack/PacketWriter.java (98%) rename core/src/main/java/org/jivesoftware/smack/XMPPConnection.java => tcp/src/main/java/org/jivesoftware/smack/TCPConnection.java (99%) rename {core => tcp}/src/test/java/org/jivesoftware/smack/RosterOfflineTest.java (98%) diff --git a/build.gradle b/build.gradle index a48b8062b..aac59ad6c 100644 --- a/build.gradle +++ b/build.gradle @@ -251,6 +251,27 @@ since Java7.""" } } +project(':tcp') { + description = """\ +Smack for standard XMPP connections over TCP.""" + + dependencies { + compile project(':core') + testCompile project(':core').sourceSets.test.runtimeClasspath + } +} + +project(':bosh') { + description = """\ +Smack BOSH API. +This API is considered beta quality.""" + + dependencies { + compile project(':core') + compile 'org.igniterealtime.jbosh:jbosh:0.7.0' + } +} + // Now the "real" Smack sub-projects // Note that test dependencies (junit, …) are interfered from the sourceSet.test of the core sub-project @@ -318,17 +339,6 @@ Warning: This API is beta, outdated and currenlty unmaintained.""" } } -project(':bosh') { - description = """\ -Smack BOSH API. -This API is considered beta quality.""" - - dependencies { - compile project(':core') - compile 'org.igniterealtime.jbosh:jbosh:0.7.0' - } -} - (subprojects - project(':core'))*.jar { manifest { attributes('Bundle-SymbolicName': project.group + '-' + appendix, diff --git a/jingle/src/main/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java b/jingle/src/demo/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java similarity index 100% rename from jingle/src/main/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java rename to jingle/src/demo/java/org/jivesoftware/smackx/jingle/mediaimpl/demo/Demo.java diff --git a/settings.gradle b/settings.gradle index 2ef0e6b2e..ee10de317 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,5 @@ include 'core', + 'tcp', 'extensions', 'experimental', 'debug', diff --git a/core/src/main/java/org/jivesoftware/smack/PacketReader.java b/tcp/src/main/java/org/jivesoftware/smack/PacketReader.java similarity index 99% rename from core/src/main/java/org/jivesoftware/smack/PacketReader.java rename to tcp/src/main/java/org/jivesoftware/smack/PacketReader.java index 0241cf2c0..45242d850 100644 --- a/core/src/main/java/org/jivesoftware/smack/PacketReader.java +++ b/tcp/src/main/java/org/jivesoftware/smack/PacketReader.java @@ -49,13 +49,13 @@ class PacketReader { private Thread readerThread; private ExecutorService listenerExecutor; - private XMPPConnection connection; + private TCPConnection connection; private XmlPullParser parser; volatile boolean done; private String connectionID = null; - protected PacketReader(final XMPPConnection connection) { + protected PacketReader(final TCPConnection connection) { this.connection = connection; this.init(); } diff --git a/core/src/main/java/org/jivesoftware/smack/PacketWriter.java b/tcp/src/main/java/org/jivesoftware/smack/PacketWriter.java similarity index 98% rename from core/src/main/java/org/jivesoftware/smack/PacketWriter.java rename to tcp/src/main/java/org/jivesoftware/smack/PacketWriter.java index f1ff4d958..9a33a651f 100644 --- a/core/src/main/java/org/jivesoftware/smack/PacketWriter.java +++ b/tcp/src/main/java/org/jivesoftware/smack/PacketWriter.java @@ -41,7 +41,7 @@ class PacketWriter { private Thread writerThread; private Writer writer; - private XMPPConnection connection; + private TCPConnection connection; private final BlockingQueue queue; volatile boolean done; @@ -50,7 +50,7 @@ class PacketWriter { * * @param connection the connection. */ - protected PacketWriter(XMPPConnection connection) { + protected PacketWriter(TCPConnection connection) { this.queue = new ArrayBlockingQueue(500, true); this.connection = connection; init(); diff --git a/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/tcp/src/main/java/org/jivesoftware/smack/TCPConnection.java similarity index 99% rename from core/src/main/java/org/jivesoftware/smack/XMPPConnection.java rename to tcp/src/main/java/org/jivesoftware/smack/TCPConnection.java index 06d6992d2..2a7f4ac95 100644 --- a/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java +++ b/tcp/src/main/java/org/jivesoftware/smack/TCPConnection.java @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.jivesoftware.smack; import org.jivesoftware.smack.compression.XMPPInputOutputStream; @@ -60,7 +59,7 @@ import java.util.List; * @see Connection * @author Matt Tucker */ -public class XMPPConnection extends Connection { +public class TCPConnection extends Connection { /** * The socket which is used for this connection. @@ -126,7 +125,7 @@ public class XMPPConnection extends Connection { * @param serviceName the name of the XMPP server to connect to; e.g. example.com. * @param callbackHandler the CallbackHandler used to prompt for the password to the keystore. */ - public XMPPConnection(String serviceName, CallbackHandler callbackHandler) { + public TCPConnection(String serviceName, CallbackHandler callbackHandler) { // Create the configuration for this new connection super(new ConnectionConfiguration(serviceName)); config.setCompressionEnabled(false); @@ -142,7 +141,7 @@ public class XMPPConnection extends Connection { * * @param serviceName the name of the XMPP server to connect to; e.g. example.com. */ - public XMPPConnection(String serviceName) { + public TCPConnection(String serviceName) { // Create the configuration for this new connection super(new ConnectionConfiguration(serviceName)); config.setCompressionEnabled(false); @@ -158,7 +157,7 @@ public class XMPPConnection extends Connection { * * @param config the connection configuration. */ - public XMPPConnection(ConnectionConfiguration config) { + public TCPConnection(ConnectionConfiguration config) { super(config); } @@ -180,7 +179,7 @@ public class XMPPConnection extends Connection { * @param config the connection configuration. * @param callbackHandler the CallbackHandler used to prompt for the password to the keystore. */ - public XMPPConnection(ConnectionConfiguration config, CallbackHandler callbackHandler) { + public TCPConnection(ConnectionConfiguration config, CallbackHandler callbackHandler) { super(config); config.setCallbackHandler(callbackHandler); } diff --git a/core/src/test/java/org/jivesoftware/smack/RosterOfflineTest.java b/tcp/src/test/java/org/jivesoftware/smack/RosterOfflineTest.java similarity index 98% rename from core/src/test/java/org/jivesoftware/smack/RosterOfflineTest.java rename to tcp/src/test/java/org/jivesoftware/smack/RosterOfflineTest.java index 2091c9fa8..93e42e942 100644 --- a/core/src/test/java/org/jivesoftware/smack/RosterOfflineTest.java +++ b/tcp/src/test/java/org/jivesoftware/smack/RosterOfflineTest.java @@ -39,7 +39,7 @@ public class RosterOfflineTest { @Before public void setup() { - this.connection = new XMPPConnection("localhost"); + this.connection = new TCPConnection("localhost"); assertFalse(connection.isConnected()); roster = connection.getRoster();