Saros
Distributed Collaborative Editing and Distributed Party Programming
de.fu_berlin.inf.dpp.communication.connection.ConnectionHandler Class Reference

List of all members.

Public Member Functions

 ConnectionHandler (final XMPPConnectionService connectionService, final TCPServer tcpServer, final MDNSService mDNSService, final IConnectionManager transferManager,@Nullable final IProxyResolver proxyResolver, final Preferences preferences)
ConnectionState getConnectionState ()
Exception getConnectionError ()
String getConnectionID ()
boolean isConnected ()
void addConnectionStateListener (IConnectionStateListener listener)
void removeConnectionStateListener (IConnectionStateListener listener)
void connect (final XMPPAccount account, final boolean failSilently)
void disconnect ()
void setCallback (IConnectingFailureCallback callback)

Detailed Description

Facade for handling connection establishment and connection events. This facade should be preferred over XMPPConnectionService and should always be used in UI components and widgets.


Constructor & Destructor Documentation

de.fu_berlin.inf.dpp.communication.connection.ConnectionHandler.ConnectionHandler ( final XMPPConnectionService  connectionService,
final TCPServer  tcpServer,
final MDNSService  mDNSService,
final IConnectionManager  transferManager,
@Nullable final IProxyResolver  proxyResolver,
final Preferences  preferences 
)

Member Function Documentation

void de.fu_berlin.inf.dpp.communication.connection.ConnectionHandler.addConnectionStateListener ( IConnectionStateListener  listener)
void de.fu_berlin.inf.dpp.communication.connection.ConnectionHandler.connect ( final XMPPAccount  account,
final boolean  failSilently 
)

Connects to the a XMPP server with the given account. If a connection establishment (connect or disconnect) is already in progress this connection attempt will be ignored.

If there is already an established connection this connection will be disconnected.

Parameters:
accountthe account to connect with
failSilentlyif set to true a connection failure will not be reported to the IConnectingFailureCallback callback} this method may block for several seconds
void de.fu_berlin.inf.dpp.communication.connection.ConnectionHandler.disconnect ( )
Exception de.fu_berlin.inf.dpp.communication.connection.ConnectionHandler.getConnectionError ( )

Returns the latest connection error.

Returns:
the connection error or null
String de.fu_berlin.inf.dpp.communication.connection.ConnectionHandler.getConnectionID ( )

Returns a unique id for the current connection.

Returns:
a unique id for the current connection or null if no connection is established or the connection has no unique id
ConnectionState de.fu_berlin.inf.dpp.communication.connection.ConnectionHandler.getConnectionState ( )

Returns the current connection state.

boolean de.fu_berlin.inf.dpp.communication.connection.ConnectionHandler.isConnected ( )

Checks if a connection is currently established.

Returns:
true if a connection is established, false otherwise
void de.fu_berlin.inf.dpp.communication.connection.ConnectionHandler.removeConnectionStateListener ( IConnectionStateListener  listener)
void de.fu_berlin.inf.dpp.communication.connection.ConnectionHandler.setCallback ( IConnectingFailureCallback  callback)
 All Classes Namespaces Files Functions Variables Enumerations