mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
Refactoring: All connection classes begin with XMPP now
This commit renames classes as follows: * TCPConnection --> XMPPTCPConnection * BOSHConnection --> XMPPBOSHConnection There are two reasons for this rename. First, it is there to indicate that the classes actually _are_ XMPP connections, using different transport mechanisms. Second, it makes auto-completion in IDEs easier, the developer can type XMPP<complete> and choose the right backend.
This commit is contained in:
parent
c86d6e3b61
commit
ab70cfec24
31 changed files with 120 additions and 120 deletions
|
@ -51,13 +51,13 @@ class PacketReader {
|
|||
|
||||
private Thread readerThread;
|
||||
|
||||
private TCPConnection connection;
|
||||
private XMPPTCPConnection connection;
|
||||
private XmlPullParser parser;
|
||||
volatile boolean done;
|
||||
|
||||
private String connectionID = null;
|
||||
|
||||
protected PacketReader(final TCPConnection connection) {
|
||||
protected PacketReader(final XMPPTCPConnection connection) {
|
||||
this.connection = connection;
|
||||
this.init();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class PacketWriter {
|
|||
|
||||
private Thread writerThread;
|
||||
private Writer writer;
|
||||
private TCPConnection connection;
|
||||
private XMPPTCPConnection connection;
|
||||
private final BlockingQueue<Packet> queue;
|
||||
volatile boolean done;
|
||||
|
||||
|
@ -50,7 +50,7 @@ class PacketWriter {
|
|||
*
|
||||
* @param connection the connection.
|
||||
*/
|
||||
protected PacketWriter(TCPConnection connection) {
|
||||
protected PacketWriter(XMPPTCPConnection connection) {
|
||||
this.queue = new ArrayBlockingQueue<Packet>(500, true);
|
||||
this.connection = connection;
|
||||
init();
|
||||
|
|
|
@ -63,7 +63,7 @@ import java.util.Locale;
|
|||
* @see XMPPConnection
|
||||
* @author Matt Tucker
|
||||
*/
|
||||
public class TCPConnection extends XMPPConnection {
|
||||
public class XMPPTCPConnection extends XMPPConnection {
|
||||
|
||||
/**
|
||||
* The socket which is used for this connection.
|
||||
|
@ -74,7 +74,7 @@ public class TCPConnection extends XMPPConnection {
|
|||
private String user = null;
|
||||
private boolean connected = false;
|
||||
// socketClosed is used concurrent
|
||||
// by TCPConnection, PacketReader, PacketWriter
|
||||
// by XMPPTCPConnection, PacketReader, PacketWriter
|
||||
private volatile boolean socketClosed = false;
|
||||
|
||||
/**
|
||||
|
@ -115,9 +115,9 @@ public class TCPConnection extends XMPPConnection {
|
|||
* <p/>
|
||||
* This is the simplest constructor for connecting to an XMPP server. Alternatively,
|
||||
* you can get fine-grained control over connection settings using the
|
||||
* {@link #TCPConnection(ConnectionConfiguration)} constructor.<p>
|
||||
* {@link #XMPPTCPConnection(ConnectionConfiguration)} constructor.<p>
|
||||
* <p/>
|
||||
* Note that TCPConnection constructors do not establish a connection to the server
|
||||
* Note that XMPPTCPConnection constructors do not establish a connection to the server
|
||||
* and you must call {@link #connect()}.<p>
|
||||
* <p/>
|
||||
* The CallbackHandler will only be used if the connection requires the client provide
|
||||
|
@ -127,27 +127,27 @@ public class TCPConnection extends XMPPConnection {
|
|||
* @param serviceName the name of the XMPP server to connect to; e.g. <tt>example.com</tt>.
|
||||
* @param callbackHandler the CallbackHandler used to prompt for the password to the keystore.
|
||||
*/
|
||||
public TCPConnection(String serviceName, CallbackHandler callbackHandler) {
|
||||
public XMPPTCPConnection(String serviceName, CallbackHandler callbackHandler) {
|
||||
// Create the configuration for this new connection
|
||||
super(new ConnectionConfiguration(serviceName));
|
||||
config.setCallbackHandler(callbackHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new XMPP connection in the same way {@link #TCPConnection(String,CallbackHandler)} does, but
|
||||
* Creates a new XMPP connection in the same way {@link #XMPPTCPConnection(String,CallbackHandler)} does, but
|
||||
* with no callback handler for password prompting of the keystore. This will work
|
||||
* in most cases, provided the client is not required to provide a certificate to
|
||||
* the server.
|
||||
*
|
||||
* @param serviceName the name of the XMPP server to connect to; e.g. <tt>example.com</tt>.
|
||||
*/
|
||||
public TCPConnection(String serviceName) {
|
||||
public XMPPTCPConnection(String serviceName) {
|
||||
// Create the configuration for this new connection
|
||||
super(new ConnectionConfiguration(serviceName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new XMPP connection in the same way {@link #TCPConnection(ConnectionConfiguration,CallbackHandler)} does, but
|
||||
* Creates a new XMPP connection in the same way {@link #XMPPTCPConnection(ConnectionConfiguration,CallbackHandler)} does, but
|
||||
* with no callback handler for password prompting of the keystore. This will work
|
||||
* in most cases, provided the client is not required to provide a certificate to
|
||||
* the server.
|
||||
|
@ -155,7 +155,7 @@ public class TCPConnection extends XMPPConnection {
|
|||
*
|
||||
* @param config the connection configuration.
|
||||
*/
|
||||
public TCPConnection(ConnectionConfiguration config) {
|
||||
public XMPPTCPConnection(ConnectionConfiguration config) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
|
@ -164,9 +164,9 @@ public class TCPConnection extends XMPPConnection {
|
|||
* <p/>
|
||||
* Manually specifying connection configuration information is suitable for
|
||||
* advanced users of the API. In many cases, using the
|
||||
* {@link #TCPConnection(String)} constructor is a better approach.<p>
|
||||
* {@link #XMPPTCPConnection(String)} constructor is a better approach.<p>
|
||||
* <p/>
|
||||
* Note that TCPConnection constructors do not establish a connection to the server
|
||||
* Note that XMPPTCPConnection constructors do not establish a connection to the server
|
||||
* and you must call {@link #connect()}.<p>
|
||||
* <p/>
|
||||
*
|
||||
|
@ -177,7 +177,7 @@ public class TCPConnection extends XMPPConnection {
|
|||
* @param config the connection configuration.
|
||||
* @param callbackHandler the CallbackHandler used to prompt for the password to the keystore.
|
||||
*/
|
||||
public TCPConnection(ConnectionConfiguration config, CallbackHandler callbackHandler) {
|
||||
public XMPPTCPConnection(ConnectionConfiguration config, CallbackHandler callbackHandler) {
|
||||
super(config);
|
||||
config.setCallbackHandler(callbackHandler);
|
||||
}
|
|
@ -34,7 +34,7 @@ public class RosterOfflineTest {
|
|||
|
||||
@Before
|
||||
public void setup() throws XMPPException, SmackException {
|
||||
this.connection = new TCPConnection("localhost");
|
||||
this.connection = new XMPPTCPConnection("localhost");
|
||||
assertFalse(connection.isConnected());
|
||||
|
||||
roster = connection.getRoster();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue