mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-11 18:19:38 +02:00
SMACK-279: The XMPPConnection extends the new abstract Connection class
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@11613 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
11a41e79ca
commit
127319a821
102 changed files with 1420 additions and 1194 deletions
|
@ -21,7 +21,7 @@ package org.jivesoftware.smackx.filetransfer;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.OrFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
|
@ -44,11 +44,11 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
|||
|
||||
private StreamNegotiator primaryNegotiator;
|
||||
private StreamNegotiator secondaryNegotiator;
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
private PacketFilter primaryFilter;
|
||||
private PacketFilter secondaryFilter;
|
||||
|
||||
public FaultTolerantNegotiator(XMPPConnection connection, StreamNegotiator primary,
|
||||
public FaultTolerantNegotiator(Connection connection, StreamNegotiator primary,
|
||||
StreamNegotiator secondary) {
|
||||
this.primaryNegotiator = primary;
|
||||
this.secondaryNegotiator = secondary;
|
||||
|
@ -68,7 +68,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {
|
|||
"stream method.");
|
||||
}
|
||||
|
||||
final Packet initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) {
|
||||
final Packet initiateIncomingStream(Connection connection, StreamInitiation initiation) {
|
||||
throw new UnsupportedOperationException("Initiation handled by createIncomingStream " +
|
||||
"method");
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.jivesoftware.smackx.filetransfer;
|
||||
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.filter.AndFilter;
|
||||
import org.jivesoftware.smack.filter.IQTypeFilter;
|
||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||
|
@ -50,15 +50,15 @@ public class FileTransferManager {
|
|||
|
||||
private List<FileTransferListener> listeners;
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
/**
|
||||
* Creates a file transfer manager to initiate and receive file transfers.
|
||||
*
|
||||
* @param connection
|
||||
* The XMPPConnection that the file transfers will use.
|
||||
* The Connection that the file transfers will use.
|
||||
*/
|
||||
public FileTransferManager(XMPPConnection connection) {
|
||||
public FileTransferManager(Connection connection) {
|
||||
this.connection = connection;
|
||||
this.fileTransferNegotiator = FileTransferNegotiator
|
||||
.getInstanceFor(connection);
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.jivesoftware.smackx.filetransfer;
|
|||
|
||||
import org.jivesoftware.smack.ConnectionListener;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
@ -65,8 +65,8 @@ public class FileTransferNegotiator {
|
|||
|
||||
private static final String[] PROTOCOLS = {BYTE_STREAM, INBAND_BYTE_STREAM};
|
||||
|
||||
private static final Map<XMPPConnection, FileTransferNegotiator> transferObject =
|
||||
new ConcurrentHashMap<XMPPConnection, FileTransferNegotiator>();
|
||||
private static final Map<Connection, FileTransferNegotiator> transferObject =
|
||||
new ConcurrentHashMap<Connection, FileTransferNegotiator>();
|
||||
|
||||
private static final String STREAM_INIT_PREFIX = "jsi_";
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class FileTransferNegotiator {
|
|||
* @return The IMFileTransferManager
|
||||
*/
|
||||
public static FileTransferNegotiator getInstanceFor(
|
||||
final XMPPConnection connection) {
|
||||
final Connection connection) {
|
||||
if (connection == null) {
|
||||
throw new IllegalArgumentException("Connection cannot be null");
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class FileTransferNegotiator {
|
|||
* @param connection The connection on which to enable or disable the services.
|
||||
* @param isEnabled True to enable, false to disable.
|
||||
*/
|
||||
public static void setServiceEnabled(final XMPPConnection connection,
|
||||
public static void setServiceEnabled(final Connection connection,
|
||||
final boolean isEnabled) {
|
||||
ServiceDiscoveryManager manager = ServiceDiscoveryManager
|
||||
.getInstanceFor(connection);
|
||||
|
@ -138,7 +138,7 @@ public class FileTransferNegotiator {
|
|||
* @param connection The connection to check
|
||||
* @return True if all related services are enabled, false if they are not.
|
||||
*/
|
||||
public static boolean isServiceEnabled(final XMPPConnection connection) {
|
||||
public static boolean isServiceEnabled(final Connection connection) {
|
||||
for (String ns : NAMESPACE) {
|
||||
if (!ServiceDiscoveryManager.getInstanceFor(connection).includesFeature(ns))
|
||||
return false;
|
||||
|
@ -181,13 +181,13 @@ public class FileTransferNegotiator {
|
|||
|
||||
// non-static
|
||||
|
||||
private final XMPPConnection connection;
|
||||
private final Connection connection;
|
||||
|
||||
private final Socks5TransferNegotiatorManager byteStreamTransferManager;
|
||||
|
||||
private final StreamNegotiator inbandTransferManager;
|
||||
|
||||
private FileTransferNegotiator(final XMPPConnection connection) {
|
||||
private FileTransferNegotiator(final Connection connection) {
|
||||
configureConnection(connection);
|
||||
|
||||
this.connection = connection;
|
||||
|
@ -195,7 +195,7 @@ public class FileTransferNegotiator {
|
|||
inbandTransferManager = new IBBTransferNegotiator(connection);
|
||||
}
|
||||
|
||||
private void configureConnection(final XMPPConnection connection) {
|
||||
private void configureConnection(final Connection connection) {
|
||||
connection.addConnectionListener(new ConnectionListener() {
|
||||
public void connectionClosed() {
|
||||
cleanup(connection);
|
||||
|
@ -219,7 +219,7 @@ public class FileTransferNegotiator {
|
|||
});
|
||||
}
|
||||
|
||||
private void cleanup(final XMPPConnection connection) {
|
||||
private void cleanup(final Connection connection) {
|
||||
if (transferObject.remove(connection) != null) {
|
||||
byteStreamTransferManager.cleanup();
|
||||
inbandTransferManager.cleanup();
|
||||
|
|
|
@ -49,14 +49,14 @@ public class IBBTransferNegotiator extends StreamNegotiator {
|
|||
|
||||
public static final int DEFAULT_BLOCK_SIZE = 4096;
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
/**
|
||||
* The default constructor for the In-Band Bystream Negotiator.
|
||||
*
|
||||
* @param connection The connection which this negotiator works on.
|
||||
*/
|
||||
protected IBBTransferNegotiator(XMPPConnection connection) {
|
||||
protected IBBTransferNegotiator(Connection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.jivesoftware.smackx.filetransfer;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.AndFilter;
|
||||
import org.jivesoftware.smack.filter.FromMatchesFilter;
|
||||
|
@ -79,12 +79,12 @@ public class Socks5TransferNegotiator extends StreamNegotiator {
|
|||
|
||||
public static boolean isAllowLocalProxyHost = true;
|
||||
|
||||
private final XMPPConnection connection;
|
||||
private final Connection connection;
|
||||
|
||||
private Socks5TransferNegotiatorManager transferNegotiatorManager;
|
||||
|
||||
public Socks5TransferNegotiator(Socks5TransferNegotiatorManager transferNegotiatorManager,
|
||||
final XMPPConnection connection)
|
||||
final Connection connection)
|
||||
{
|
||||
this.connection = connection;
|
||||
this.transferNegotiatorManager = transferNegotiatorManager;
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.jivesoftware.smack.util.Cache;
|
|||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smackx.ServiceDiscoveryManager;
|
||||
|
@ -54,13 +54,13 @@ public class Socks5TransferNegotiatorManager implements FileTransferNegotiatorMa
|
|||
private final Cache<String, Integer> addressBlacklist
|
||||
= new Cache<String, Integer>(100, BLACKLIST_LIFETIME);
|
||||
|
||||
private XMPPConnection connection;
|
||||
private Connection connection;
|
||||
|
||||
private List<String> proxies;
|
||||
|
||||
private List<Bytestream.StreamHost> streamHosts;
|
||||
|
||||
public Socks5TransferNegotiatorManager(XMPPConnection connection) {
|
||||
public Socks5TransferNegotiatorManager(Connection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.jivesoftware.smackx.filetransfer;
|
|||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackConfiguration;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
@ -81,7 +81,7 @@ public abstract class StreamNegotiator {
|
|||
return iq;
|
||||
}
|
||||
|
||||
Packet initiateIncomingStream(XMPPConnection connection, StreamInitiation initiation) throws XMPPException {
|
||||
Packet initiateIncomingStream(Connection connection, StreamInitiation initiation) throws XMPPException {
|
||||
StreamInitiation response = createInitiationAccept(initiation,
|
||||
getNamespaces());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue