Saros
Distributed Collaborative Editing and Distributed Party Programming
de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService Class Reference

List of all members.

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)

Detailed Description

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.


Constructor & Destructor Documentation

de.fu_berlin.inf.dpp.net.xmpp.XMPPConnectionService.XMPPConnectionService ( @Nullable IUPnPService  upnpService,
@Nullable IStunService  stunService 
)

Member Function Documentation

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.

Parameters:
resourcethe resource qualifier for a running connection
enableDebugtrue to show Smack Debug Window upon XMPP connection
proxyEnabledtrue to enable Socks5Proxy
proxyPortSocks5Proxy port
proxyAddressescollection of addresses (either host name or ip address) for the local Socks5 proxy, if null the addresses will be determined automatically at proxy start
gatewayDeviceIDthe USN of a UPNP compatible gateways device to perform port mapping on or null
useExternalGatewayDeviceAddressif true the external (ip) address of the gateway will be included into the Socks5 proxy addresses
stunServerSTUN server address or null if STUN discovery should not be performed
stunPortSTUN 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.

Parameters:
connectionConfigurationConnectionConfiguration Configuration for connecting to the server.
usernamethe username of the XMPP account
passwordthe 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.

Returns:
the currently used connection or null if there is none

it 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.

See also:
IConnectionListener.connectionStateChanged(Connection, ConnectionState)
Returns:
exception that occurred during recent connection failure or 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.

Returns:
the resource qualified JID of the current connection or 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)
 All Classes Namespaces Files Functions Variables Enumerations