Saros
Distributed Collaborative Editing and Distributed Party Programming
|
Public Member Functions | |
XMPPConnectionService (@Nullable IUPnPService upnpService,@Nullable IStunService stunService) | |
synchronized void | configure (final String resource, final boolean enableDebug, final boolean proxyEnabled, final int proxyPort, final Collection< String > proxyAddresses, final String gatewayDeviceID, final boolean useExternalGatewayDeviceAddress, final String stunServer, final int stunPort, boolean enablePortMapping) |
JID | getJID () |
Roster | getRoster () |
synchronized void | connect (ConnectionConfiguration connectionConfiguration, String username, String password) throws XMPPException |
synchronized void | disconnect () |
boolean | isConnected () |
ConnectionState | getConnectionState () |
Exception | getConnectionError () |
Connection | getConnection () |
void | addListener (IConnectionListener listener) |
void | removeListener (IConnectionListener listener) |
This class is responsible for establishing XMPP connections and notifying registered listeners about the state of the current connection.
In addition it will also setup an Socks5 server if configured and use UPnP if possible to ensure that the Socks5 server is reachable.
de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.XMPPConnectionService | ( | @Nullable IUPnPService | upnpService, |
@Nullable IStunService | stunService | ||
) |
void de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.addListener | ( | IConnectionListener | listener | ) |
synchronized void de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.configure | ( | final String | resource, |
final boolean | enableDebug, | ||
final boolean | proxyEnabled, | ||
final int | proxyPort, | ||
final Collection< String > | proxyAddresses, | ||
final String | gatewayDeviceID, | ||
final boolean | useExternalGatewayDeviceAddress, | ||
final String | stunServer, | ||
final int | stunPort, | ||
boolean | enablePortMapping | ||
) |
Configures the service. Must be at least called once before connect is called.
resource | the resource qualifier for a running connection |
enableDebug | true to show Smack Debug Window upon XMPP connection |
proxyEnabled | true to enable Socks5Proxy |
proxyPort | Socks5Proxy port |
proxyAddresses | collection of addresses (either host name or ip address) for the local Socks5 proxy, if null the addresses will be determined automatically at proxy start |
gatewayDeviceID | the USN of a UPNP compatible gateways device to perform port mapping on or null |
useExternalGatewayDeviceAddress | if true the external (ip) address of the gateway will be included into the Socks5 proxy addresses |
stunServer | STUN server address or null if STUN discovery should not be performed |
stunPort | STUN server port if 0 the default stun port will be used |
synchronized void de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.connect | ( | ConnectionConfiguration | connectionConfiguration, |
String | username, | ||
String | password | ||
) | throws XMPPException |
Connects the service to a XMPP server using the given configuration and credentials.
connectionConfiguration | ConnectionConfiguration Configuration for connecting to the server. |
username | the username of the XMPP account |
password | the password of the XMPP Account |
synchronized void de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.disconnect | ( | ) |
Disconnects the service from the current XMPP server if not already disconnected.
Connection de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.getConnection | ( | ) |
Returns the currently used connection.
null
if there is noneit is strictly forbidden to call Connection.disconnect()} on the returned instance
Exception de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.getConnectionError | ( | ) |
Returns the exception that occurred due to a connection failure. The exception can only be retrieved during a ConnectionState.ERROR} callback and is null
otherwise.
null
if not applicable. ConnectionState de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.getConnectionState | ( | ) |
Returns the current ConnectionState connection state} of the service.
JID de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.getJID | ( | ) |
The JID resource qualified JID} of the local user if currently ConnectionState.CONNECTED connected} to a XMPP server. The JID is also available in the states ConnectionState.ERROR error}, ConnectionState.DISCONNECTING disconnecting} and ConnectionState.NOT_CONNECTED disconnected} during a IConnectionListener.connectionStateChanged listener} notification if and only if a successful login was performed before.
null
if not connected to a server Roster de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.getRoster | ( | ) |
Returns the Roster roster} of the established connection or null
if not connected.
boolean de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.isConnected | ( | ) |
Returns whether the service is currently connected to a XMPP server.
void de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.removeListener | ( | IConnectionListener | listener | ) |