Expresso 5-6

com.jcorporate.expresso.core.controller
Class SecureIfSetController

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended bycom.jcorporate.expresso.core.controller.Controller
          extended bycom.jcorporate.expresso.core.controller.DBController
              extended bycom.jcorporate.expresso.core.controller.SecureIfSetController
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CreateSettingsWizard, UpgradeSettingsWizard

public abstract class SecureIfSetController
extends DBController

Controller that uses security if the security system is available.

There are a class of controllers that are unique in that they need database security working ONLY if the database has already been set up. Otherwise, data components need to be able to be installed, tables created etc.

This base class fills the gap by checking to see if there are available connections to the database, checks normal ControllerSecurity if the connections are up and running, but automatically returns true to stateAllowed() queries if there is no up and runnin persistence layer. [Or there is a problem accessing ControllerSecurity]

Author:
Michael Rimov
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jcorporate.expresso.core.controller.Controller
CONTROLLER_PARAM_KEY, CTL_SUCC_CTL, CTL_SUCC_STATE, CTL_SUCC_TRAN, mLog, NEWSTATE_EXCEPTION_KEY, ORIGINAL_URL_KEY, REQUEST_KEY, RESPONSE_KEY, RETURN_TO_SENDER_TRAN, STATE_ERR_CTL, STATE_ERR_STATE, STATE_ERR_TRAN, STATE_PARAM_KEY, STATE_SUCC_CTL, STATE_SUCC_STATE, STATE_SUCC_TRAN
 
Fields inherited from class org.apache.struts.action.Action
ACTION_SERVLET_KEY, APPLICATION_KEY, DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGE_KEY, MESSAGES_KEY, MULTIPART_KEY, PLUG_INS_KEY, REQUEST_PROCESSOR_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY
 
Constructor Summary
SecureIfSetController()
          Default constructor.
 
Method Summary
 boolean isDBConnectionAvailable(String dataContext)
          Is a proper database connection available.
 boolean stateAllowed(String newState, ControllerRequest params)
          Similar to DBController's EXCEPT that if there is no installed Database connections then the state is allowed.
 
Methods inherited from class com.jcorporate.expresso.core.controller.DBController
getString, isAllowed
 
Methods inherited from class com.jcorporate.expresso.core.controller.Controller
addFinalState, addPromptTransitions, addRegDomainParamtoSession, addRequestedURLtoSession, addState, addStatePairing, endTimer, execute, findControllerForm, generateToken, getActionForward, getControllerChainingTransition, getControllerSecurityTransition, getFinalState, getInitialState, getLogger, getParamValues, getRequestURL, getSchema, getSchemaHierarchy, getSchemaInstance, getSchemaStack, getState, getStates, getString, getString, getTitle, handleException, instantiate, isFinalState, isHandleState, isPromptState, isTokenValid, loadStateForm, newState, nextHandleState, nextPromptState, populateStateForm, postPerform, prePerform, previousPromptState, processRequestTransitions, processTransitions, redirectRequest, redirectRequest, remapFromExtension, resetToken, saveToken, setControllerChainingTransition, setControllerSecurityTransition, setCurrentState, setInitialState, setSchema, setSchema, setupDefaultValues, setupReturnToSender, setupSubclassLog, transition, transition, transition, unloadStateForm
 
Methods inherited from class org.apache.struts.action.Action
execute, generateToken, getDataSource, getDataSource, getLocale, getResources, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, perform, perform, resetToken, saveErrors, saveMessages, saveToken, setLocale, setServlet, toHex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecureIfSetController

public SecureIfSetController()
Default constructor.

Method Detail

stateAllowed

public boolean stateAllowed(String newState,
                            ControllerRequest params)
                     throws ControllerException
Similar to DBController's EXCEPT that if there is no installed Database connections then the state is allowed. This is useful for setup user interfaces such as DBCreate.

Overrides:
stateAllowed in class DBController
Parameters:
newState - the state being transferred to.
params - the state parameters
Returns:
true if the state is allowed
Throws:
ControllerException - upon error

isDBConnectionAvailable

public boolean isDBConnectionAvailable(String dataContext)
Is a proper database connection available. Specific checks vary with the implementation version of Expresso.

Parameters:
dataContext - the datacontext to check
Returns:
true if a DBConnection appears to be set up and available.

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.