pl.mn.communicator
Class DefaultLoginService

java.lang.Object
  extended by pl.mn.communicator.DefaultLoginService
All Implemented Interfaces:
java.util.EventListener, UserListener, ILoginService

public class DefaultLoginService
extends java.lang.Object
implements ILoginService, UserListener

The default implementation of ILoginService.

Created on 2004-11-28

Version:
$Id: DefaultLoginService.java,v 1.1 2005/11/05 23:34:52 winnetou25 Exp $
Author:
Mateusz Szczap

Nested Class Summary
 
Nested classes/interfaces inherited from interface pl.mn.communicator.event.UserListener
UserListener.Stub
 
Constructor Summary
DefaultLoginService(Session session)
           
 
Method Summary
 void addLoginListener(LoginListener loginListener)
          Adds LoginListener instance to the list that will be notified of login related events.
 LoginContext getLoginContext()
           
 boolean isLoggedIn()
           
 void localStatusChanged(ILocalStatus localStatus)
           
 void login(LoginContext loginContext)
          Invocation of this method tries to log in user to currently connected server.
 void logout()
          Invocation of this method tries to log out user from the currently connected the server.
 void logout(java.lang.String description, java.util.Date returnTime)
          Invocation of this method tries to log out user from the currently connected server.
protected  void notifyLoggedOut()
           
protected  void notifyLoginFailed(LoginFailedEvent loginFailedEvent)
           
protected  void notifyLoginOK()
           
 void removeLoginListener(LoginListener loginListener)
          Remove LoginListener instance from the list that will be notified of login related events.
 void userStatusChanged(IUser user, IRemoteStatus newStatus)
          The notification that the user changed the status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLoginService

DefaultLoginService(Session session)
Method Detail

login

public void login(LoginContext loginContext)
           throws GGException
Description copied from interface: ILoginService
Invocation of this method tries to log in user to currently connected server.

The uin and password that is used in logging in process is retrieved from the LoginContext instance.

Specified by:
login in interface ILoginService
Throws:
GGException - if an error occurs while logging in.
GGSessionException - if there is an incorrect session state.
See Also:
pl.mn.communicator.ILoginService#login()

logout

public void logout()
            throws GGException
Description copied from interface: ILoginService
Invocation of this method tries to log out user from the currently connected the server.

It sets user's status to inavailable.

Specified by:
logout in interface ILoginService
Throws:
GGException - if error occurs while logging out.
GGSessionException - if there is an incorrect session state.
See Also:
ILoginService.logout()

logout

public void logout(java.lang.String description,
                   java.util.Date returnTime)
            throws GGException
Description copied from interface: ILoginService
Invocation of this method tries to log out user from the currently connected server.

It sets user's status to inavailable with description. Note that returnTime can be null.

Specified by:
logout in interface ILoginService
Parameters:
description - the description that will be set.
returnTime - the time the user will be back.
Throws:
GGException - if error occurs while logging out.
GGSessionException - if there is an incorrect session state.
See Also:
ILoginService.logout(java.lang.String, java.util.Date returnTime)

getLoginContext

public LoginContext getLoginContext()
Specified by:
getLoginContext in interface ILoginService
See Also:
ILoginService.getLoginContext()

isLoggedIn

public boolean isLoggedIn()
Specified by:
isLoggedIn in interface ILoginService
See Also:
ILoginService.isLoggedIn()

addLoginListener

public void addLoginListener(LoginListener loginListener)
Description copied from interface: ILoginService
Adds LoginListener instance to the list that will be notified of login related events.

Specified by:
addLoginListener in interface ILoginService
Parameters:
loginListener - the LoginListener instance to be notified.
See Also:
ILoginService.addLoginListener(pl.mn.communicator.event.LoginListener)

removeLoginListener

public void removeLoginListener(LoginListener loginListener)
Description copied from interface: ILoginService
Remove LoginListener instance from the list that will be notified of login related events.

Specified by:
removeLoginListener in interface ILoginService
Parameters:
loginListener - the LoginListener instance that will no longer be notified.
See Also:
ILoginService.removeLoginListener(pl.mn.communicator.event.LoginListener)

notifyLoginOK

protected void notifyLoginOK()
                      throws GGException
Throws:
GGException

notifyLoginFailed

protected void notifyLoginFailed(LoginFailedEvent loginFailedEvent)
                          throws GGException
Throws:
GGException

notifyLoggedOut

protected void notifyLoggedOut()
                        throws GGException
Throws:
GGException

localStatusChanged

public void localStatusChanged(ILocalStatus localStatus)
                        throws GGException
Specified by:
localStatusChanged in interface UserListener
Throws:
GGException
See Also:
UserListener.localStatusChanged(pl.mn.communicator.ILocalStatus)

userStatusChanged

public void userStatusChanged(IUser user,
                              IRemoteStatus newStatus)
                       throws GGException
Description copied from interface: UserListener
The notification that the user changed the status.

Specified by:
userStatusChanged in interface UserListener
Parameters:
user - the Gadu-Gadu user that changed the status.
newStatus - the new status of the user.
Throws:
GGException
See Also:
UserListener.userStatusChanged(pl.mn.communicator.IUser, pl.mn.communicator.IRemoteStatus)


Copyright 2004-2004-2005 SourceForge.net. All Rights Reserved.