|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pt.digitalis.dif.controller.AbstractDIFDispatcher
public abstract class AbstractDIFDispatcher
This class is the heart of the framework. Its responsibilities include receive and validate the incoming DIFRequest,
the request processing (if the request is valid) and the routing of the stage-generated DIFResponse.
AbstractDIFDispatcher implements the TEMPLATE METHOD design pattern (see GoF's "Design Patterns: Elements of Reusable
Object-Oriented Software"). As such, the executeTaskSteps()
method is declared final. This method
defines the dispatching-cycle steps, and these steps must be always run in the same order to all the requests. There
is a set of protected methods that correspond to the aforementioned dispatching-cycle steps. These methods can be
overridden in derived classes if one wants to modify the behavior associated with a given step. ChALs should call a
particular controller so this class (the superclass) is declared abstract
to inhibit instantiation.
Field Summary | |
---|---|
protected ControllerException |
authenticationException
If an authentication error has occurred |
protected IDIFContext |
difContext
The execution context. |
static String |
INVALID_STAGE_ERROR_MESSAGE
The messae for invalid stage requests |
protected IAuthenticationManager |
theAuthenticationManager
The Authentication Manager |
protected IAuthorizationManager |
theAuthorizationManager
The authorization manager. |
protected pt.digitalis.utils.config.IConfigurations |
theConfigurations
The configuration manager. |
protected IIdentityManager |
theIdentityManager
The identity manager. |
protected ISessionManager |
theSessionManager
The session manager. |
protected IStage |
theStage
The stage to be executed. |
Constructor Summary | |
---|---|
AbstractDIFDispatcher(IIdentityManager theIdentityManager,
IAuthenticationManager theAuthenticationManager,
IAuthorizationManager theAuthorizationManager,
ISessionManager theSessionManager,
pt.digitalis.utils.config.IConfigurations theConfigurationManager)
Default constructor. |
Method Summary | |
---|---|
protected void |
authenticate()
Authenticates a user on the framework. |
protected void |
authorize()
Check the user permissions to run a given stage. |
protected boolean |
checkLicense()
This method checks if the license is valid. |
protected void |
conclude()
Concludes the execution cycle. |
protected DIFResponse |
createResponse(IStageInstance stageInstance)
Generates the response that will be sent back to AbstractChAL from the request's execution context. |
DIFResponse |
dispatch(IDIFRequest difRequest)
This method serves as an interface between the AbstractDIFDispatcher and the calling AbstractChAL. |
protected void |
doAfterLogin(SSOInfo ssoInfo)
Actions to perform after a successful login |
protected void |
doAfterLogout(SSOInfo ssoInfo)
Actions to perform after a successful logout |
protected IStageInstance |
execute()
Executes the appropriate tasks to serve the request. |
ControllerException |
getAuthenticationException()
|
String |
getChannelID()
|
protected IDIFContext |
getContext()
Inspector for the execution context. |
protected IIdentityManager |
getIdentityManager()
Inspector for the identity manager. |
protected Map<String,String> |
getMessages()
Lazy loading getter of messages |
protected SSOInfo |
getSSOInfo()
Used to inject the SSO Info for the dispatcher authentication process |
protected boolean |
handleException(Exception exception)
Handles the occurred exception to redirect to a given handler and perform cleanup actions |
protected abstract void |
handleNonAuthorizedAccess(IStageInstance stageInstance,
ControllerException exception)
Handles a non authorized access |
protected DispatcherAuthenticationResult |
performAuthentication()
Implements the authentication execution logic |
static void |
performCleanup(IDIFContext context,
boolean success)
Perform any clean up tasks that have been contributed by ... |
protected void |
postAuthentication(DispatcherAuthenticationResult result)
Post Authentication execution |
protected void |
preAuthentication()
Pre Authentication execution |
void |
setAuthenticationException(ControllerException authenticationException)
|
protected void |
validate(Boolean isRedirection)
Validates the session and the stage. |
protected boolean |
validateUserCredentials(String userId,
String password)
Validate the user credentials |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String INVALID_STAGE_ERROR_MESSAGE
protected ControllerException authenticationException
protected IDIFContext difContext
protected IAuthenticationManager theAuthenticationManager
protected IAuthorizationManager theAuthorizationManager
protected pt.digitalis.utils.config.IConfigurations theConfigurations
protected IIdentityManager theIdentityManager
protected ISessionManager theSessionManager
protected IStage theStage
Constructor Detail |
---|
public AbstractDIFDispatcher(IIdentityManager theIdentityManager, IAuthenticationManager theAuthenticationManager, IAuthorizationManager theAuthorizationManager, ISessionManager theSessionManager, pt.digitalis.utils.config.IConfigurations theConfigurationManager)
theIdentityManager
- the identity managertheAuthenticationManager
- the authentication managertheAuthorizationManager
- the authorization managertheSessionManager
- the authentication managertheConfigurationManager
- the configurations managerMethod Detail |
---|
public static final void performCleanup(IDIFContext context, boolean success) throws ControllerException
context
- the contextsuccess
- T if the stage was successfully executed
ControllerException
protected void authenticate() throws ControllerException
ControllerException
- when any runtime exception is thrown or the authentication process has failedprotected void authorize() throws ControllerException
ControllerException
- when any runtime exception is thrownprotected boolean checkLicense()
protected void conclude() throws ControllerException
java.lang.Object's finalize()
method.
ControllerException
- when any runtime exception is thrownprotected DIFResponse createResponse(IStageInstance stageInstance) throws ControllerException
stageInstance
- the executed stage instance
ControllerException
- if an exception has occurredpublic final DIFResponse dispatch(IDIFRequest difRequest) throws BusinessFlowException, ControllerException
IDIFDispatcher
dispatch
in interface IDIFDispatcher
difRequest
- The AbstractChAL-originated DIFRequest object
BusinessFlowException
- when an exception is thrown by the stage's init/execute steps
ControllerException
- when any runtime exception is thrown in a controller stepIDIFDispatcher.dispatch(pt.digitalis.dif.controller.interfaces.IDIFRequest)
protected void doAfterLogin(SSOInfo ssoInfo)
ssoInfo
- the single sign-on objectprotected void doAfterLogout(SSOInfo ssoInfo)
ssoInfo
- the single sign-on objectprotected IStageInstance execute() throws BusinessFlowException, ControllerException
BusinessFlowException
- when an exception is thrown by the stage's init/execute steps
ControllerException
- when any runtime exception is thrownpublic ControllerException getAuthenticationException()
public String getChannelID()
getChannelID
in interface IDIFDispatcher
Channel
annotationprotected IDIFContext getContext()
protected IIdentityManager getIdentityManager()
protected Map<String,String> getMessages()
protected SSOInfo getSSOInfo()
protected boolean handleException(Exception exception) throws BusinessFlowException, ControllerException
exception
- the raised exception
BusinessFlowException
ControllerException
protected abstract void handleNonAuthorizedAccess(IStageInstance stageInstance, ControllerException exception) throws ControllerException
stageInstance
- the stage instance requestedexception
- the exception thrown
ControllerException
- if the error was not a non authorized accessprotected DispatcherAuthenticationResult performAuthentication() throws ControllerException
ControllerException
protected void postAuthentication(DispatcherAuthenticationResult result)
result
- the DispatcherAuthenticationResultprotected void preAuthentication()
public void setAuthenticationException(ControllerException authenticationException)
authenticationException
- the authenticationException to setprotected final void validate(Boolean isRedirection) throws ControllerException
final
. Session validation includes checking if the stage is active and hasn't timed out. Stage
validation includes checking if the stage is registrable and if so checks if the license is valid.
isRedirection
-
ControllerException
- when any runtime exception is thrownprotected boolean validateUserCredentials(String userId, String password) throws IdentityManagerException, ControllerException
userId
- the userIdpassword
- the password
IdentityManagerException
- if a IdentityManager Exception occurs.
ControllerException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |