g-Eclipse
Release 1.0.0

eu.geclipse.ui
Class UIAuthTokenProvider

java.lang.Object
  extended by CheatSheetListener
      extended by eu.geclipse.ui.UIAuthTokenProvider
All Implemented Interfaces:
IAuthTokenProvider

public class UIAuthTokenProvider
extends CheatSheetListener
implements IAuthTokenProvider

The UIAuthTokenProvider is the main point where Plugins should request their authentication tokens. It should be used instead of the AuthenticationTokenManager whenever possible. It provides methods to request any token or tokens of a special type. It also takes responsibility for the user interactions with respect to new token wizards, question dialogs and error dialogs. Therefore it makes the request for a new token very easy.


Constructor Summary
UIAuthTokenProvider()
          Standard constructor for the UIAuthTokenProvider.
UIAuthTokenProvider(Shell shell)
          Construct a new UIAuthTokenProvider.
 
Method Summary
 void cheatSheetEvent(ICheatSheetEvent event)
           
 IAuthenticationToken requestToken()
          Request any authentication token.
 IAuthenticationToken requestToken(AuthTokenRequest request)
          Request an authentication token that fits the specified description.
 boolean showNewTokenWizard(java.lang.String tokenWizardId, boolean forceWizardId, IAuthenticationTokenDescription description)
          Show the new token wizard.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UIAuthTokenProvider

public UIAuthTokenProvider()
Standard constructor for the UIAuthTokenProvider.


UIAuthTokenProvider

public UIAuthTokenProvider(Shell shell)
Construct a new UIAuthTokenProvider.

Parameters:
shell - The shell that is used to create wizards and dialogs.
Method Detail

requestToken

public IAuthenticationToken requestToken()
                                  throws ProblemException
Request any authentication token. This is the same as requestToken(null).

Specified by:
requestToken in interface IAuthTokenProvider
Returns:
Any token that could be found.
Throws:
ProblemException - If the token request was canceled by the user.
See Also:
requestToken(AuthTokenRequest)

requestToken

public IAuthenticationToken requestToken(AuthTokenRequest request)
                                  throws ProblemException
Request an authentication token that fits the specified description. At the moment the token has only to fit the supported type of the description. So if a GridProxy is requested an empty GridProxyDescription should be passed to this method.

Internally this method queries the AuthenticationTokenManager. The first step therefore is always to look for the default token. If the default token is of the specified type it is returned. The second step is to look for all currently registered tokens. If one of these fits it is returned. If no token could be found up to here the new token wizard is launched to create a new token that fits the description. The newly created token is afterwards added to the token managers managed tokens.

If the found token is not the default token a message box will pop up to ask if the token should be set as default token. If the found token is not valid or not active it is validated and respectively activated. If something wents wrong during this process an error message will pop up.

Specified by:
requestToken in interface IAuthTokenProvider
Parameters:
request - An AuthTokenRequest that describes the token that is requested.
Returns:
A token of the type that is described by the specified description or null if no such token could be found or created.
Throws:
ProblemException - If the token request was canceled by the user.

showNewTokenWizard

public boolean showNewTokenWizard(java.lang.String tokenWizardId,
                                  boolean forceWizardId,
                                  IAuthenticationTokenDescription description)
Show the new token wizard. If the specified description is not null the wizard will be started with the wizard page belonging to the specified description. Otherwise it will be started with the token type page as starting page where the user can choose the type of the he wants to create.

Parameters:
tokenWizardId - The ID of the token type that should be created or null.
forceWizardId -
description - Token description passed to the token specific wizard pages in order to allow initialisation for a predefined token type.
Returns:
True if the token dialog was closed with status Window#OK.

cheatSheetEvent

public void cheatSheetEvent(ICheatSheetEvent event)

g-Eclipse
Release 1.0.0