Search in sources :

Example 6 with ContainerDisconnectedEvent

use of org.eclipse.ecf.core.events.ContainerDisconnectedEvent in project ecf by eclipse.

the class XMPPContainer method disconnect.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ecf.provider.generic.ClientSOContainer#disconnect()
	 */
public void disconnect() {
    final ID groupID = getConnectedID();
    fireContainerEvent(new ContainerDisconnectingEvent(this.getID(), groupID));
    synchronized (getConnectLock()) {
        // If we are currently connected
        if (isConnected()) {
            XmppPlugin.getDefault().unregisterService(this);
            final ISynchAsynchConnection conn = getConnection();
            synchronized (conn) {
                synchronized (getGroupMembershipLock()) {
                    handleLeave(groupID, conn);
                }
            }
        }
        this.connection = null;
        remoteServerID = null;
        accountManager.setConnection(null);
        chatRoomManager.setConnection(null, null, null);
        outgoingFileTransferContainerAdapter.setConnection(null);
        presenceHelper.disconnect();
        getSharedObjectManager().removeSharedObject(presenceHelperID);
    }
    // notify listeners
    fireContainerEvent(new ContainerDisconnectedEvent(this.getID(), groupID));
}
Also used : ISynchAsynchConnection(org.eclipse.ecf.provider.comm.ISynchAsynchConnection) XMPPID(org.eclipse.ecf.provider.xmpp.identity.XMPPID) ID(org.eclipse.ecf.core.identity.ID) ContainerDisconnectingEvent(org.eclipse.ecf.core.events.ContainerDisconnectingEvent) ContainerDisconnectedEvent(org.eclipse.ecf.core.events.ContainerDisconnectedEvent)

Aggregations

ContainerDisconnectedEvent (org.eclipse.ecf.core.events.ContainerDisconnectedEvent)6 ContainerDisconnectingEvent (org.eclipse.ecf.core.events.ContainerDisconnectingEvent)6 ID (org.eclipse.ecf.core.identity.ID)4 IOException (java.io.IOException)1 Iterator (java.util.Iterator)1 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)1 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)1 SharedObjectAddException (org.eclipse.ecf.core.sharedobject.SharedObjectAddException)1 ECFException (org.eclipse.ecf.core.util.ECFException)1 ChatSession (org.eclipse.ecf.protocol.msn.ChatSession)1 ConnectionCreateException (org.eclipse.ecf.provider.comm.ConnectionCreateException)1 ISynchAsynchConnection (org.eclipse.ecf.provider.comm.ISynchAsynchConnection)1 XMPPID (org.eclipse.ecf.provider.xmpp.identity.XMPPID)1 XMPPRoomID (org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID)1 IRemoteServiceID (org.eclipse.ecf.remoteservice.IRemoteServiceID)1 XMPPException (org.jivesoftware.smack.XMPPException)1