org.caleigo.security
Class LoginService

java.lang.Object
  extended byorg.caleigo.security.LoginService
All Implemented Interfaces:
IDistributable, ILoginService, IService, java.io.Serializable
Direct Known Subclasses:
LoginService.LoginProxyService

public class LoginService
extends java.lang.Object
implements ILoginService

Version:
1.00
Author:
Mattias Hagstrand
See Also:
Serialized Form

Nested Class Summary
protected static class LoginService.LoginProxyService
           
protected  class LoginService.LoginServiceMessageConsumer
           
 
Nested classes inherited from class org.caleigo.security.ILoginService
ILoginService.LoginMessage, ILoginService.LoginServiceReturnMessage, ILoginService.LogoutMessage, ILoginService.UserLoginInfo
 
Field Summary
protected  java.util.HashMap mLoginHandlers
           
protected  ILoginInfoProvider mLoginInfoProvider
           
protected  IMessageConsumer mMessageConsumer
           
protected  java.lang.Object mServiceIdentity
           
 
Constructor Summary
LoginService(java.lang.Object serviceIdentity)
           
 
Method Summary
 void addLoginHandler(java.lang.Class loginInfoClass, ILoginHandler loginHandler)
          Add a login handler to the loginInfo class.
 void finalizeService()
          This method is always called by the ServiceManager before the service is released.
 IProxyService getCustomProxyService(ITunnel tunnel)
          Returns an IProxyService that is responsible for handling remote invokations of this service.
 int getMaximumNumberOfLoginTries()
          Returns the maximum number of times a user is allowed to try to login before the application exits.
 java.lang.Object getServiceIdentity()
          Returns the URI defining the a unique individual service.
 java.lang.Object getServiceInterface()
          Returns the service object that this service provides.
 java.lang.Class getServiceInterfaceClass()
          Returns the class object the defines the service interface that all services with the same type provides.
 java.lang.Object getServiceType()
          Returns a URI that defines the type of this service.
 void handleError(java.lang.String message)
           
 boolean hasCustomProxyService()
          If this method returns true then the method getCustomProxyService must not return null.
 void initializeService()
          This method is always called by the ServiceManager before any other method in the service is called.
 UserInfo login()
          Tries to log in a user without supplying any login information.
 UserInfo login(java.lang.Object loginInfo)
          This method takes login information supplied in the loginInfo object.
 UserInfo login(java.lang.String username, java.lang.String password)
          This is a helper method that logs in a user based on the supplied username-password pair.
 boolean logout(UserInfo userInfo)
           
 boolean ping()
          Should return true if the service is online and reponding to calls.
 void removeLoginHandler(java.lang.Class loginInfoClass)
          Removes a login handler
 void setLoginInfoProvider(ILoginInfoProvider provider)
          Registers an ILoginInfoProvider to use to provide login information to the login() method.
 void updateUserInfo(UserInfo userInfo)
          Updates an UserInfo object that represents an allready logged in user with relevante user information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mServiceIdentity

protected java.lang.Object mServiceIdentity

mMessageConsumer

protected transient IMessageConsumer mMessageConsumer

mLoginInfoProvider

protected ILoginInfoProvider mLoginInfoProvider

mLoginHandlers

protected transient java.util.HashMap mLoginHandlers
Constructor Detail

LoginService

public LoginService(java.lang.Object serviceIdentity)
Method Detail

setLoginInfoProvider

public void setLoginInfoProvider(ILoginInfoProvider provider)
Description copied from interface: ILoginService
Registers an ILoginInfoProvider to use to provide login information to the login() method.

Specified by:
setLoginInfoProvider in interface ILoginService

addLoginHandler

public void addLoginHandler(java.lang.Class loginInfoClass,
                            ILoginHandler loginHandler)
Description copied from interface: ILoginService
Add a login handler to the loginInfo class. This handler will then be used to authenticate a user when the login(loginInfo) method is called with a parameter of the specific class.

Specified by:
addLoginHandler in interface ILoginService

removeLoginHandler

public void removeLoginHandler(java.lang.Class loginInfoClass)
Description copied from interface: ILoginService
Removes a login handler

Specified by:
removeLoginHandler in interface ILoginService

login

public UserInfo login()
Tries to log in a user without supplying any login information. This method preferably uses descendants of ILoginInfoProvider to figure out the login information for the user. Returns null if the login was canceled.

Specified by:
login in interface ILoginService

login

public UserInfo login(java.lang.Object loginInfo)
This method takes login information supplied in the loginInfo object. There should be a corresponding ILoginHandler that is registered to handle the specific loginInfo class. Returns null if the login was canceled.

Specified by:
login in interface ILoginService

login

public UserInfo login(java.lang.String username,
                      java.lang.String password)
This is a helper method that logs in a user based on the supplied username-password pair. Returns null if the login was canceled.

Specified by:
login in interface ILoginService

logout

public boolean logout(UserInfo userInfo)
Specified by:
logout in interface ILoginService

updateUserInfo

public void updateUserInfo(UserInfo userInfo)
Updates an UserInfo object that represents an allready logged in user with relevante user information.

Specified by:
updateUserInfo in interface ILoginService

handleError

public void handleError(java.lang.String message)
Specified by:
handleError in interface ILoginService

getMaximumNumberOfLoginTries

public int getMaximumNumberOfLoginTries()
Returns the maximum number of times a user is allowed to try to login before the application exits.

Specified by:
getMaximumNumberOfLoginTries in interface ILoginService

initializeService

public void initializeService()
This method is always called by the ServiceManager before any other method in the service is called.

Specified by:
initializeService in interface IService

finalizeService

public void finalizeService()
This method is always called by the ServiceManager before the service is released. No other method calls will then be performed on this instance of the service.

Specified by:
finalizeService in interface IService

ping

public boolean ping()
Should return true if the service is online and reponding to calls. Note that initializeService() must be called prior to this method.

Specified by:
ping in interface IService

getServiceInterface

public java.lang.Object getServiceInterface()
Returns the service object that this service provides. This object should always implement the interface defined by the service interface class.

Specified by:
getServiceInterface in interface IService

getServiceInterfaceClass

public java.lang.Class getServiceInterfaceClass()
Returns the class object the defines the service interface that all services with the same type provides.

Specified by:
getServiceInterfaceClass in interface IService

getServiceType

public java.lang.Object getServiceType()
Returns a URI that defines the type of this service. Note that there can be multiple services implementing the same service type but implementations of a given type must implement the same service interface.

Specified by:
getServiceType in interface IService

getServiceIdentity

public java.lang.Object getServiceIdentity()
Returns the URI defining the a unique individual service.

Specified by:
getServiceIdentity in interface IService

hasCustomProxyService

public boolean hasCustomProxyService()
If this method returns true then the method getCustomProxyService must not return null.

Specified by:
hasCustomProxyService in interface IService

getCustomProxyService

public IProxyService getCustomProxyService(ITunnel tunnel)
Returns an IProxyService that is responsible for handling remote invokations of this service.

Specified by:
getCustomProxyService in interface IService


Copyright © 2005 Caleigo. All Rights Reserved.