org.eclipse.emf.emfstore.client.sessionprovider
Class ESAbstractSessionProvider

java.lang.Object
  extended by org.eclipse.emf.emfstore.client.sessionprovider.ESAbstractSessionProvider
Direct Known Subclasses:
BasicSessionProvider, BasicUISessionProvider

public abstract class ESAbstractSessionProvider
extends Object

This is the abstract super class for SessionProviders. All session providers should extend this class. SessionProvider derives a user session for a given server request (ESServerCall). When overriding provideUsersession(ESServerCall) , it is possible to gain more context for the ESUsersession selection.

However, in most usecases most, users will use the session provider to open a login dialog of some kind. For this purpose it is better to use provideUsersession(ESServer). SessionProviders can be registered via an extension point.

NOTE: Implementations of SessionProviders must not assume that they are executed within the UI-Thread.

Author:
wesendon

Constructor Summary
ESAbstractSessionProvider()
           
 
Method Summary
abstract  ESUsersession login(ESUsersession usersession)
           This method is called by the SessionManager in order to login a given user session.
abstract  ESUsersession provideUsersession(ESServer server)
           This is the template method for provideUsersession(ESServer).
 ESUsersession provideUsersession(ESServerCall serverCall)
           The SessionManager calls this method in order to obtain a user session.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ESAbstractSessionProvider

public ESAbstractSessionProvider()
Method Detail

provideUsersession

public ESUsersession provideUsersession(ESServerCall serverCall)
                                 throws ESException

The SessionManager calls this method in order to obtain a user session. In its default implementation it first looks for specified user session in the ESServerCall, then it checks whether the local project is associated with a user session (e.g. in case of update). If there is still no user session, provideUsersession(ESServer) is called, which is meant to be used when implementing an UI to select a UI.

In most cases it is sufficient to implement provideUsersession(ESServer). There should be no need to change this implementation.

Parameters:
serverCall - current server call
Returns:
an user session. It is not specified whether this session is logged in or logged out.
Throws:
ESException - in case an exception occurred while obtaining the user session

provideUsersession

public abstract ESUsersession provideUsersession(ESServer server)
                                          throws ESException

This is the template method for provideUsersession(ESServer). It is called, if the latter couldn't determine a suitable user session. Use this in order to implement a session selection UI or a headless selection logic.

Parameters:
server - This parameter is a hint from the ESServer. For that reason it can be null. A common example is share, where the user first has to select the server before logging in. If ESServer is set you should allow the user to select the account for the given server.
Returns:
an user session. It is not specified whether this session is logged in or logged out.
Throws:
ESException - in case an exception occurred while obtaining the user session

login

public abstract ESUsersession login(ESUsersession usersession)
                             throws ESException

This method is called by the SessionManager in order to login a given user session. If the given session can not be logged in, it is the provider's responsibility to either throw an exception or to provide another valid session, e.g. by means of calling a login hdialog that will create a new session.

Parameters:
usersession - the session to be logged in
Returns:
a logged in user session, possibly another one as the one passed in. It is the provider's responsibility to determine whether the passed in session and the one that is returned need to differ
Throws:
ESException - in case an exception occurred while logging in the given session


Copyright © 2015. All Rights Reserved.