Java Doc for Controller.java in  » J2EE » Expresso » com » jcorporate » expresso » core » controller » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Expresso » com.jcorporate.expresso.core.controller 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.jcorporate.expresso.core.controller.Controller

All known Subclasses:   com.jcorporate.expresso.core.controller.TilesController,  com.jcorporate.expresso.core.controller.DBController,
Controller
abstract public class Controller extends Action implements Serializable(Code)
A sequence of interaction with a user is defined as a "Controller".

An Expresso controller is best thought of as a finite state machine. The only real difference is that because of the stateless nature of the web, anybody can reach any state with using the "state" parameter in the URL.

Usually for a web deployment environment, you would derive your own controller from DBController, which adds a database-backed Security matrix to the controller's base capabilities. Controllers (and DBControllers) do not necessarily need to be run inside a servlet environment. If they never downcast their ControllerResponse object to ServletControllerResponse, the Controller can also be used in products such as Expresso Webservices, or

See the Expresso Developer's Guide for more information on creating and using a Controller.

A Controller takes a series of parameters (optional) and then provides a series of Blocks, Inputs, Outputs, and Transitions to the client

An Input specifies a piece of information we want FROM the client An Output is a piece of information we supply TO the client A Transition is an action the client can take from this point - e.g. further controllers that are followups to this controller A Block is a collection of Inputs, Outputs, Transitions or other Blocks
See Also:   com.jcorporate.expresso.core.controller.DBController
See Also:   com.jcorporate.expresso.core.controller.SecureIfSetController


Field Summary
final public static  StringCONTROLLER_PARAM_KEY
    
final public static  StringCTL_SUCC_CTL
    
final public static  StringCTL_SUCC_STATE
    
final public static  StringCTL_SUCC_TRAN
    
final public static  StringNEWSTATE_EXCEPTION_KEY
    
final public static  StringORIGINAL_URL_KEY
    
final public static  StringREQUEST_KEY
    
final public static  StringRESPONSE_KEY
    
final public static  StringRETURN_TO_SENDER_TRAN
    
final public static  StringSTATE_ERR_CTL
    
final public static  StringSTATE_ERR_STATE
    
final public static  StringSTATE_ERR_TRAN
    
final public static  StringSTATE_PARAM_KEY
    
final public static  StringSTATE_SUCC_CTL
    
final public static  StringSTATE_SUCC_STATE
    
final public static  StringSTATE_SUCC_TRAN
    
protected  LoggermLog
    

Constructor Summary
public  Controller()
    

Method Summary
protected  voidaddFinalState(State newFinalState)
     The constructor of the child object should call addFinalState to define the last state to be executed for this controller.
protected  voidaddPromptTransitions(State nextState, ControllerResponse response)
     If nextState is a prompt state (as determined by the addStatePairing method) then add a 'next' and 'previous' transitions as required. A 'next' transition will refer to a prompt state's associated validate state. A 'previous' transition will refer to the prompt state that precedes the passed in state.
protected  voidaddRegDomainParamtoSession(HttpServletRequest req, ControllerRequest creq, String regDomain)
    
protected  voidaddRequestedURLtoSession(HttpServletRequest req, ControllerRequest creq)
    
protected  voidaddState(State newState)
     The constructor of the child object should call addState to define each of the states available in this method.
protected  voidaddStatePairing(State promptState, State handleState, String stateFormClass)
     The constructor of the child object should call this method with a pairing of State objects. The sequence of calls to this method determine the runtime ordering of states.
Parameters:
  promptState - The state that is part of the 'prompting' workflow
Parameters:
  handleState - The state that is part of the 'processing' workflow
Parameters:
  stateFormClass - The ActionForm name to use
throws:
  NonHandleableException - if there's an error in pairing.
protected  voidendTimer(long beginTimer, HttpServletRequest request)
     Used for logging time of requests.
public  ActionForwardexecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
     Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it). Return an ActionForward instance describing where and how control should be forwarded, or null if the response has already been completed.
protected  ActionFormfindControllerForm(ControllerRequest request)
     Return the Struts ActionForm associated with this controller as specified in the Struts config file.
protected  StringgenerateToken(ControllerRequest request)
     Generate a new transaction token, to be used for enforcing a single request for a particular transaction.
protected  ActionForwardgetActionForward(ServletControllerRequest req, ActionConfig mapping, ControllerResponse res)
    
protected  TransitiongetControllerChainingTransition()
     Return the transition that will be executed once this controller completes without errors.
protected  TransitiongetControllerSecurityTransition()
     Return the transition that will be executed if any state in this controller cannot be run because the user does not have sufficient authorization.
public  StategetFinalState()
     Return the final state for this controller.
public  StringgetInitialState()
     Get the initial state in a controller.
public synchronized  LoggergetLogger()
     Call from subclass to log into Category with subclass name will create logger with subclass name as necessary.
public static  String[]getParamValues(ServletControllerRequest request, String paramName)
    
protected  StringgetRequestURL(HttpServletRequest req)
    
final protected  StringgetSchema()
    
public synchronized  StackgetSchemaHierarchy()
    
protected  SchemagetSchemaInstance()
    
public synchronized  StackgetSchemaStack()
     Retrieve a stack of all schemas.
final public  StategetState(String stateName)
    
final public  HashtablegetStates()
    
protected  StringgetString(String stringCode)
     Convenience version, uses default locale of default db context

IMPORTANT: in general, if there's a ControllerResponse object available, use ControllerResponse.getString(String) instead, this is able to return the local language by considering the user's locale.

protected  StringgetString(String stringCode, Object[] args)
     Convenience version, uses default locale of default db context

IMPORTANT: In general, if there's a ControllerResponse object available, use ControllerResponse.getString(String) instead, this is able to return the local language by considering the user's locale.
Parameters:
  stringCode - The properties file string code to retrieve
Parameters:
  args - The Object array for i18n formatting.

public  StringgetTitle()
    
protected  voidhandleException(HttpServletRequest req, ControllerRequest creq, String dbName, String userName, Throwable theException)
     Handle an exception error that is not otherwise caught or handled by the Controller instance itself.
public static synchronized  Controllerinstantiate(String className)
     Factory method to create an Controller from it's name Do not call this function directly! Use ConfigManager.getControllerFactory() .getInstance(java.lang.String) instead.
protected  booleanisFinalState(String newState)
     Return True if the passed in state was added to this controller as a final state.
Parameters:
  newState - the state name to use as the final state.
protected  booleanisHandleState(State nextState)
     Return True if the passed in state was added to this controller as a handle state.
protected  booleanisPromptState(State nextState)
     Return True if the passed in state was added to this controller as a prompt state.
protected  booleanisTokenValid(ControllerRequest request)
     Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it.
protected  StateFormloadStateForm(State nextState, ActionForm controllerForm)
     Return the state's form with data from the controller's form. The controller's form is specified in the struts config file.
public  ControllerResponsenewState(String newState, ControllerRequest myRequest)
     This is the method where all of the real work of the controller is done.
protected  StringnextHandleState(State nextState)
     Return the name of the handle state that is associated with the passed in prompt state.
protected  StringnextPromptState(State nextState)
     Return the name of the prompt state that is 'next' to the passed in prompt state in the sequence for this controller.
protected  voidpopulateStateForm(StateForm stateForm, ControllerRequest request)
     Populate the state form with any matching request parameters.
protected  voidpostPerform(State nextState, ControllerRequest request, ControllerResponse response)
     Template Method, allowing a subclass to into actions after the invocation of any state in this controller. For example, a common footer for web pages could be created here, so long as the web pages in question, with the common footer, were all in the same controller which overrides this method.
protected  voidprePerform(State nextState, ControllerRequest request, ControllerResponse response)
     Template Method, allowing a subclass to do an action after any state in this controller is performed.
protected  StringpreviousPromptState(State nextState)
     Return the name of the prompt state that is 'previous' to the passed in prompt state in the sequence for this controller.
protected  voidprocessRequestTransitions(State nextState, ControllerRequest request)
    

This method picks up the following routing parameters from the current request and builds transition objects from them before the state is invoked.

1.

protected  TransitionprocessTransitions(ControllerRequest request, ControllerResponse response, State nextState)
     This method is the traffic cop that determines which transition to execute after a state completes.

1.

protected  voidredirectRequest(HttpServletResponse response, String redirectURL)
    
public  voidredirectRequest(ControllerRequest request, ControllerResponse response, String redirectURL)
    
protected  ForwardConfigremapFromExtension(ForwardConfig fwd, ActionConfig mapping, ServletControllerRequest req)
     if the extension in the current forward is ".xsl" or ".xslt", remap the forward to "xml", and set a parameter for the xsl style sheet. author: Larry Hamel, CodeGuild, Inc.
Parameters:
  fwd - The ForwardConfig object
Parameters:
  mapping - the ActionConfig for the particular controller instance
Parameters:
  req - the ServletControllerRequest for the request.
protected  voidresetToken(ControllerRequest request)
     Reset the saved transaction token in the user's session.
protected  voidsaveToken(ControllerRequest request)
     Save a new transaction token in the user's current session, creating a new session if necessary.
protected  voidsetControllerChainingTransition(Transition newControllerChainingTransition)
     Set the transition that will be executed when this controller completes successfully.
protected  voidsetControllerSecurityTransition(Transition newControllerSecurityTransition)
     Set the transition that will be executed when a user attempts to run a state he doesn't have authorization on.
public  ControllerResponsesetCurrentState(String newState, ControllerRequest params)
     Convenience method to be able to access the state as a property from a JSP.
public  voidsetInitialState(String newInitialState)
     Set what state to invoke if no state parameter is set.
protected  voidsetSchema(String schemaClass)
     Tell this Controller object what Schema it belongs to.
protected  voidsetSchema(Class schemaClass)
     Identical to setSchema(String) but provides a typesafe way of passing parameters.
public  voidsetupDefaultValues(String dbName)
     Allows for DBCreate to set up proper default values for views, etc.
protected  voidsetupReturnToSender(State nextState, ControllerRequest request)
     This method is called before a state executes.
protected synchronized  voidsetupSubclassLog()
     setup a subclass logger separately from the base controller logger.
public  booleanstateAllowed(String newState, ControllerRequest params)
     Is this state allowed for the current user? The generic controller object can't determine this, but the DBController child of this object checks the database to determine which users can access which states.
protected  voidtransition(String newState, ControllerRequest req, ControllerResponse res)
    
protected  voidtransition(String newState, Class externalController, ControllerRequest req, ControllerResponse res)
    
protected  voidtransition(String newState, ControllerRequest req, ControllerResponse res, boolean clear)
     Transition to an internal state.
protected  voidunloadStateForm(StateForm stateForm, ActionForm controllerForm)
     Move the state's form data back into the controller's form. The controller's form is specified in the struts config file.

Field Detail
CONTROLLER_PARAM_KEY
final public static String CONTROLLER_PARAM_KEY(Code)
key for putting controller into parameter map



CTL_SUCC_CTL
final public static String CTL_SUCC_CTL(Code)



CTL_SUCC_STATE
final public static String CTL_SUCC_STATE(Code)



CTL_SUCC_TRAN
final public static String CTL_SUCC_TRAN(Code)



NEWSTATE_EXCEPTION_KEY
final public static String NEWSTATE_EXCEPTION_KEY(Code)
New state exception key



ORIGINAL_URL_KEY
final public static String ORIGINAL_URL_KEY(Code)
Controller original URL key



REQUEST_KEY
final public static String REQUEST_KEY(Code)
Controller request key



RESPONSE_KEY
final public static String RESPONSE_KEY(Code)
Controller response key



RETURN_TO_SENDER_TRAN
final public static String RETURN_TO_SENDER_TRAN(Code)



STATE_ERR_CTL
final public static String STATE_ERR_CTL(Code)



STATE_ERR_STATE
final public static String STATE_ERR_STATE(Code)



STATE_ERR_TRAN
final public static String STATE_ERR_TRAN(Code)



STATE_PARAM_KEY
final public static String STATE_PARAM_KEY(Code)
key for putting state into parameter map



STATE_SUCC_CTL
final public static String STATE_SUCC_CTL(Code)



STATE_SUCC_STATE
final public static String STATE_SUCC_STATE(Code)



STATE_SUCC_TRAN
final public static String STATE_SUCC_TRAN(Code)



mLog
protected Logger mLog(Code)
if subclass calls getLogger(), this will create logger with subclass name




Constructor Detail
Controller
public Controller()(Code)
Default constructor




Method Detail
addFinalState
protected void addFinalState(State newFinalState) throws NonHandleableException(Code)
The constructor of the child object should call addFinalState to define the last state to be executed for this controller. Once the final state is added then no other states can be added via the addStatePairing method.
Parameters:
  newFinalState - the new state to use as your final state.
throws:
  NonHandleableException - if you send it an improper final state.



addPromptTransitions
protected void addPromptTransitions(State nextState, ControllerResponse response) throws ControllerException(Code)
If nextState is a prompt state (as determined by the addStatePairing method) then add a 'next' and 'previous' transitions as required. A 'next' transition will refer to a prompt state's associated validate state. A 'previous' transition will refer to the prompt state that precedes the passed in state. The 'previous' state will not be added to the response if if the passed in state is the first one (iniial state) in this controller.
Parameters:
  nextState - in this controller the new state add
Parameters:
  response - the ControllerResponse that these transitions will beadded to.
throws:
  ControllerException - upon error.



addRegDomainParamtoSession
protected void addRegDomainParamtoSession(HttpServletRequest req, ControllerRequest creq, String regDomain) throws ControllerException(Code)
???????????????????????
Parameters:
  req - ?
Parameters:
  creq - ?
Parameters:
  regDomain - ?



addRequestedURLtoSession
protected void addRequestedURLtoSession(HttpServletRequest req, ControllerRequest creq) throws ControllerException(Code)



addState
protected void addState(State newState)(Code)
The constructor of the child object should call addState to define each of the states available in this method.
Parameters:
  newState - The State object to be added to the list of states for thiscontroller



addStatePairing
protected void addStatePairing(State promptState, State handleState, String stateFormClass) throws NonHandleableException(Code)
The constructor of the child object should call this method with a pairing of State objects. The sequence of calls to this method determine the runtime ordering of states.
Parameters:
  promptState - The state that is part of the 'prompting' workflow
Parameters:
  handleState - The state that is part of the 'processing' workflow
Parameters:
  stateFormClass - The ActionForm name to use
throws:
  NonHandleableException - if there's an error in pairing. Usuallycaused by a java.lang.IllegalArumentException



endTimer
protected void endTimer(long beginTimer, HttpServletRequest request)(Code)
Used for logging time of requests.
Parameters:
  beginTimer - The start execution time
Parameters:
  request - The HTTPServletRequest to instrument



execute
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException(Code)
Process the specified HTTP request, and create the corresponding HTTP response (or forward to another web component that will create it). Return an ActionForward instance describing where and how control should be forwarded, or null if the response has already been completed. Note, that if you wish to run a controller within something other than a HTTP session, then call newState directly.
Parameters:
  mapping - The ActionMapping used to select this instance
Parameters:
  form - The optional ActionForm bean for this request (if any)
Parameters:
  request - The HTTP request we are processing
Parameters:
  response - The HTTP response we are creating The ActionForward or null
throws:
  IOException - if an input/output error occurs
throws:
  ServletException - if a servlet exception occurs



findControllerForm
protected ActionForm findControllerForm(ControllerRequest request) throws ControllerException(Code)
Return the Struts ActionForm associated with this controller as specified in the Struts config file. Struts would have already created and populated this form and put it either in the request or session scope.
Parameters:
  request - The ControllerRequest object The appropriate ActionForm for this controller request
throws:
  ControllerException - if unable to find the Controller Form.



generateToken
protected String generateToken(ControllerRequest request)(Code)
Generate a new transaction token, to be used for enforcing a single request for a particular transaction.

Thanks to "Raul DAVIDOVICH" (R.DAVIDOVICH@caconcology.com)


Parameters:
  request - The request we are processing transaction token usually cryptographically created



getActionForward
protected ActionForward getActionForward(ServletControllerRequest req, ActionConfig mapping, ControllerResponse res) throws NonHandleableException, ControllerException(Code)
Determine the forward appropriate for this controller/state, either from parameters or from configuration files, or from remapping based on past extensions like .xsl
Parameters:
  req - the ServletControllerRequest object
Parameters:
  mapping - the ActionConfig that defines the mapping
Parameters:
  res - the ControllerResponse object that has been handed back tous by Controller.newState() an ActionForward instance.
throws:
  NonHandleableException - upon fatal error
throws:
  ControllerException - upon error



getControllerChainingTransition
protected Transition getControllerChainingTransition()(Code)
Return the transition that will be executed once this controller completes without errors. The controller 'completes' once the final state (as defined using addFinalState) returns without errors in the error collection. The Transition for this controller chaining setup.



getControllerSecurityTransition
protected Transition getControllerSecurityTransition()(Code)
Return the transition that will be executed if any state in this controller cannot be run because the user does not have sufficient authorization. The ControllerSecurity Transition



getFinalState
public State getFinalState()(Code)
Return the final state for this controller. See addFinalState(). the "Final" state for this workflow.



getInitialState
public String getInitialState()(Code)
Get the initial state in a controller. This is the state to use if there is no state parameter specified in the requesting URL or execution container. The name of the State to use as default for this controller



getLogger
public synchronized Logger getLogger()(Code)
Call from subclass to log into Category with subclass name will create logger with subclass name as necessary. org.apache.logj.Logger



getParamValues
public static String[] getParamValues(ServletControllerRequest request, String paramName)(Code)
Fetches array of parameter values from underlying HTTP request; use this in a web app to access the underlying parameters in the HTTP request which have the same name; parameters with the same name are not reflected in the hashtable maintained by ControllerRequest;
Parameters:
  request - cast ControllerRequest to get required type
Parameters:
  paramName - key to look for among all parameters an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.



getRequestURL
protected String getRequestURL(HttpServletRequest req)(Code)
recreate requested URL; never null, though could be empty string



getSchema
final protected String getSchema()(Code)
Get the name of the schema object that this Controller belongs to The schema class name associated with this controller



getSchemaHierarchy
public synchronized Stack getSchemaHierarchy()(Code)
Retrieve a stack of all schemas in a 'derived sense' java.util.Stack with the schema hierarchy ending in ExpressoSchemaat the bottom.



getSchemaInstance
protected Schema getSchemaInstance()(Code)
Retrieve a full instance of the Schema object that is associated with this controller Schema instance.



getSchemaStack
public synchronized Stack getSchemaStack()(Code)
Retrieve a stack of all schemas. hands out actual object instance; singleton for this controller. java.util.Stack with the schema hierarchy ending in ExpressoSchema at the bottom. never null.



getState
final public State getState(String stateName)(Code)
Return a specific state
Parameters:
  stateName - The name of the state to retrieve the Instantiated State.



getStates
final public Hashtable getStates()(Code)
Return the hashtable of valid states for this controller a Hashtable of states for this controller



getString
protected String getString(String stringCode)(Code)
Convenience version, uses default locale of default db context

IMPORTANT: in general, if there's a ControllerResponse object available, use ControllerResponse.getString(String) instead, this is able to return the local language by considering the user's locale.
Parameters:
  stringCode - The properties file string code to retrieve translated string, or if not found, the stringCode




getString
protected String getString(String stringCode, Object[] args)(Code)
Convenience version, uses default locale of default db context

IMPORTANT: In general, if there's a ControllerResponse object available, use ControllerResponse.getString(String) instead, this is able to return the local language by considering the user's locale.
Parameters:
  stringCode - The properties file string code to retrieve
Parameters:
  args - The Object array for i18n formatting. translated string, or if not found, the stringCode




getTitle
public String getTitle()(Code)
Return the title of this Controller java.lang.String The Title of the controller



handleException
protected void handleException(HttpServletRequest req, ControllerRequest creq, String dbName, String userName, Throwable theException) throws ServletException(Code)
Handle an exception error that is not otherwise caught or handled by the Controller instance itself. Typically, these will be reserved for "system failure" type of situations, as anything that the user can reasonable be expected to correct should be reported in the ErrorCollection instead.
Parameters:
  req - The HTTPServletRequest
Parameters:
  creq - The ControllerRequest Object
Parameters:
  dbName - The current data context
Parameters:
  userName - The currently logged in Username
Parameters:
  theException - The java.lang.Throwable object thatwas caught
throws:
  ServletException - upon fatal error for handling the exception



instantiate
public static synchronized Controller instantiate(String className) throws ControllerException(Code)
Factory method to create an Controller from it's name Do not call this function directly! Use ConfigManager.getControllerFactory() .getInstance(java.lang.String) instead.
Parameters:
  className - The classname of the controller to instantiated a fully instantiated Controller Object
throws:
  ControllerException - upon construction failure



isFinalState
protected boolean isFinalState(String newState)(Code)
Return True if the passed in state was added to this controller as a final state.
Parameters:
  newState - the state name to use as the final state. true if this is the final state.



isHandleState
protected boolean isHandleState(State nextState)(Code)
Return True if the passed in state was added to this controller as a handle state.
Parameters:
  nextState - the state name to check against true if it is supposed to handle the state.



isPromptState
protected boolean isPromptState(State nextState)(Code)
Return True if the passed in state was added to this controller as a prompt state.
Parameters:
  nextState - the state name to check against true if it is the prompt state.



isTokenValid
protected boolean isTokenValid(ControllerRequest request)(Code)
Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it. Returns false under any of the following circumstances:
  • No session associated with this request
  • No transaction token saved in the session
  • No transaction token included as a request parameter
  • The included transaction token value does not match the transaction token in the user's session

Parameters:
  request - The servlet request we are processing boolean value if the request transaction token matchedthe stored transaction token.
See Also:   Controller.generateToken
See Also:   Controller.resetToken
See Also:   Controller.saveToken



loadStateForm
protected StateForm loadStateForm(State nextState, ActionForm controllerForm) throws ControllerException(Code)
Return the state's form with data from the controller's form. The controller's form is specified in the struts config file. The state form is specified in the state's stateFormClass attribute.
Parameters:
  nextState - The next state to use
Parameters:
  controllerForm - the ControllerForm as specified in the struts config file. a fully instantiated StateForm
throws:
  ControllerException - if there is an error instantiating the State Form



newState
public ControllerResponse newState(String newState, ControllerRequest myRequest) throws ControllerException, NonHandleableException(Code)
This is the method where all of the real work of the controller is done. The client calls this to indicate what state the controller is transitioning into.

This is normally what is called from the command line when driving a Controller object. If running in a struts environment, this function call is wrapped by execute() method which does the actual running, plus then performs tasks such as finding the next forward etc.


Parameters:
  newState - The new state to transition to
Parameters:
  myRequest - The calling controllerRequest object. a newly instantiated ControllerResponse for this state.
throws:
  ControllerException - on Error
throws:
  NonHandleableException - if the error should not be handledby an error controller



nextHandleState
protected String nextHandleState(State nextState)(Code)
Return the name of the handle state that is associated with the passed in prompt state. Null will be returned if the passed in state is not a prompt state.
Parameters:
  nextState - the next state to check against the name of the 'handle' state paired with the nextState parameter



nextPromptState
protected String nextPromptState(State nextState)(Code)
Return the name of the prompt state that is 'next' to the passed in prompt state in the sequence for this controller. If the passed in state is the last prompt state in this controller then null will be returned.
Parameters:
  nextState - the next state to check against the name of the 'prompt' state paired with the nextState parameter



populateStateForm
protected void populateStateForm(StateForm stateForm, ControllerRequest request) throws ControllerException(Code)
Populate the state form with any matching request parameters.
Parameters:
  stateForm - The name of the state form to populate
Parameters:
  request - The source of the variables for the state form.
throws:
  ControllerException - upon BeanUtils.populate() error



postPerform
protected void postPerform(State nextState, ControllerRequest request, ControllerResponse response) throws ControllerException(Code)
Template Method, allowing a subclass to into actions after the invocation of any state in this controller. For example, a common footer for web pages could be created here, so long as the web pages in question, with the common footer, were all in the same controller which overrides this method. (Multiple controllers which need common pre/post actions could share a common superclass.)
Parameters:
  nextState - the state to be performed
Parameters:
  request - the request object
Parameters:
  response - the response object



prePerform
protected void prePerform(State nextState, ControllerRequest request, ControllerResponse response) throws ControllerException(Code)
Template Method, allowing a subclass to do an action after any state in this controller is performed. For example, a common header for the web pages could be created here, so long as the web pages in question, with the common header, were all in the same controller which overrides this method.
Parameters:
  nextState - the state to be performed
Parameters:
  request - the request object
Parameters:
  response - the response object



previousPromptState
protected String previousPromptState(State nextState)(Code)
Return the name of the prompt state that is 'previous' to the passed in prompt state in the sequence for this controller. If the passed in state is the first prompt state in this controller then null will be returned.
Parameters:
  nextState - The state to check against the previous prompt state



processRequestTransitions
protected void processRequestTransitions(State nextState, ControllerRequest request) throws ControllerException(Code)

This method picks up the following routing parameters from the current request and builds transition objects from them before the state is invoked.

1. "Controller Success" These parameters identify the state that should be run once this controller completes successfully (ie the'final' state has completed without errors). Any controller success parameters will cause this method to put a serialized transition object specific to this controller in session scope.

2. "State Success" These parameters identify the state that should be run if this state completes without errors. Any state success parameters will cause this method to assign a transition object to this currently running state.

3. "State Error" These parameters identify the state that should be run if this state completes with errors. Any state error parameters will cause this method to assign a transition object to this currently running state.

Note, the transition specified at this time can be overridden by the state when it executes.
Parameters:
  nextState - the next state to check process
Parameters:
  request - The controllerRequest object
throws:
  ControllerException - upon error.




processTransitions
protected Transition processTransitions(ControllerRequest request, ControllerResponse response, State nextState) throws ControllerException, NonHandleableException(Code)
This method is the traffic cop that determines which transition to execute after a state completes.

1. "State Error" The state returned with errors in the error collection. The 'error transition' associated with the state is executed. This transition could have been set either in processRequestTransitions() prior to state execution or in the state itself during execution.

2. "State Success" The state returned without errors in the error collection. The following priority is followed: - If the 'success transition' is not null for this state then it is executed. - If the state that just completed is a final state then: - If the 'chaining transition' is not null for this controller then it is executed. - If the 'controller success transition' is not null for this controller then it is executed.


Parameters:
  request - The ControllerRequest Object
Parameters:
  response - The ControllerResponse Object
Parameters:
  nextState - the state to transition to. An instantiated Transition Object
throws:
  NonHandleableException - upon a fatal error.



redirectRequest
protected void redirectRequest(HttpServletResponse response, String redirectURL) throws IOException(Code)
redirect response so that URL changes in client browser
Parameters:
  response - The Servlet Response
Parameters:
  redirectURL - The URL to redirect the browser to.
throws:
  IOException - upon browser error.



redirectRequest
public void redirectRequest(ControllerRequest request, ControllerResponse response, String redirectURL) throws IOException(Code)
redirect response so that URL changes in client browser
Parameters:
  request - The ControllerRquest object.
Parameters:
  response - The ControllerResponse object
Parameters:
  redirectURL - The URL to redirect the browser to.
throws:
  IOException - upon redirect error.



remapFromExtension
protected ForwardConfig remapFromExtension(ForwardConfig fwd, ActionConfig mapping, ServletControllerRequest req) throws ControllerException(Code)
if the extension in the current forward is ".xsl" or ".xslt", remap the forward to "xml", and set a parameter for the xsl style sheet. author: Larry Hamel, CodeGuild, Inc.
Parameters:
  fwd - The ForwardConfig object
Parameters:
  mapping - the ActionConfig for the particular controller instance
Parameters:
  req - the ServletControllerRequest for the request. ForwardConfig instance.
throws:
  ControllerException - upon error



resetToken
protected void resetToken(ControllerRequest request)(Code)
Reset the saved transaction token in the user's session. This indicates that transactional token checking will not be needed on the next request that is submitted.
Parameters:
  request - The servlet request we are processing
See Also:   Controller.saveToken
See Also:   Controller.isTokenValid



saveToken
protected void saveToken(ControllerRequest request)(Code)
Save a new transaction token in the user's current session, creating a new session if necessary.
Parameters:
  request - The servlet request we are processing
See Also:   Controller.resetToken
See Also:   Controller.isTokenValid



setControllerChainingTransition
protected void setControllerChainingTransition(Transition newControllerChainingTransition) throws NonHandleableException(Code)
Set the transition that will be executed when this controller completes successfully. This will not likely be used as often as the runtime 'controller success' routing parameters. However when used, it will relay any 'controller success' parameters onto the next controller so that the return path is not lost.
Parameters:
  newControllerChainingTransition - The new transition for when thecontroller completes successfully.
throws:
  NonHandleableException - upon incorrect parameters.



setControllerSecurityTransition
protected void setControllerSecurityTransition(Transition newControllerSecurityTransition)(Code)
Set the transition that will be executed when a user attempts to run a state he doesn't have authorization on. As always, this transition can have return-to-sender enabled. This could allow a login screen to be called and then control would automatically return to the state whose authorization failed.
Parameters:
  newControllerSecurityTransition - To execute.



setCurrentState
public ControllerResponse setCurrentState(String newState, ControllerRequest params) throws ControllerException, NonHandleableException(Code)
Convenience method to be able to access the state as a property from a JSP.
Parameters:
  newState - The newState to set to.
Parameters:
  params - The ControllerRequest object a newly instantiated ControllerResponse
throws:
  ControllerException - upon error
throws:
  NonHandleableException - upon fatal error



setInitialState
public void setInitialState(String newInitialState)(Code)
Set what state to invoke if no state parameter is set.
Parameters:
  newInitialState - The state to use as the initial state.



setSchema
protected void setSchema(String schemaClass)(Code)
Tell this Controller object what Schema it belongs to. This is used when the Controller tries to use it's "getString(String, Object[])" method to prepare internationalized messages - it passes the call along to the appropriate schema which knows how to locate the proper message file.
Parameters:
  schemaClass - The classname of the Schema to associate with.



setSchema
protected void setSchema(Class schemaClass)(Code)
Identical to setSchema(String) but provides a typesafe way of passing parameters. Example:
setSchema(com.jcorporate.expresso.core.ExpressoSchema .class);

Parameters:
  schemaClass - The Class of the schema to set



setupDefaultValues
public void setupDefaultValues(String dbName) throws DBException(Code)
Allows for DBCreate to set up proper default values for views, etc.
Parameters:
  dbName - the name of the db to add these values to.
throws:
  DBException - upon error



setupReturnToSender
protected void setupReturnToSender(State nextState, ControllerRequest request) throws ControllerException(Code)
This method is called before a state executes. It will assign a return-to-sender transition to the state. This transition will include the parameters that this state is being called with.

If this state causes a transition (with return-to-sender enabled) to be executed, then this state's return-to-sender transition will be serialized and passed to the next controller. This controller will then use this transition (once the controller completes successfull) to return to this state with the same parameters that this state was initally called with.

This method will also check for a request parameter that overrides the return-to-sender transition that would normally be associated with this state. This is useful when the final state reruns all of the controller's handle states. In that case, any transitions should return to the final state and not the handle state that caused the transition.
Parameters:
  nextState - = The state that is about to be executed
Parameters:
  request - The parsed ControllerRequest object
throws:
  ControllerException - upon error.




setupSubclassLog
protected synchronized void setupSubclassLog()(Code)
setup a subclass logger separately from the base controller logger. Is this right? *PP*



stateAllowed
public boolean stateAllowed(String newState, ControllerRequest params) throws ControllerException(Code)
Is this state allowed for the current user? The generic controller object can't determine this, but the DBController child of this object checks the database to determine which users can access which states.
Parameters:
  newState - The name of the state being checked
Parameters:
  params - The ControllerRequestObject True if the state is allowed, else false if it is not
throws:
  ControllerException - upon error



transition
protected void transition(String newState, ControllerRequest req, ControllerResponse res) throws ControllerException, NonHandleableException(Code)



transition
protected void transition(String newState, Class externalController, ControllerRequest req, ControllerResponse res) throws ControllerException, NonHandleableException(Code)
convenience method for transition to other controller
Parameters:
  newState - the new state to transition to
Parameters:
  externalController - the class of the external controller
Parameters:
  req - the ControllerRequest parameter that the state handler has
Parameters:
  res - the ControllerResponse object that was passed to your state method
throws:
  ControllerException - upon error
throws:
  NonHandleableException - upon fatal error



transition
protected void transition(String newState, ControllerRequest req, ControllerResponse res, boolean clear) throws ControllerException, NonHandleableException(Code)
Transition to an internal state. By internal state we mean that this method is used for transitioning to another 'state' inside the same controller class [inherited states not withstanding]. You cannot, however use this method to transfer control between controllers
Parameters:
  newState - the state to transition to
Parameters:
  req - The ControllerRequest object that has been given your statehandler
Parameters:
  res - The ControllerResponse object that has been given to yourstate handler
Parameters:
  clear - Should existing ControllerElements (Input/Output/Block/Transition)be removed from the resulting ControllerResponse (set to true if that is thedesired behavior)
throws:
  ControllerException - upon error
throws:
  NonHandleableException - upon fatal error



unloadStateForm
protected void unloadStateForm(StateForm stateForm, ActionForm controllerForm) throws ControllerException(Code)
Move the state's form data back into the controller's form. The controller's form is specified in the struts config file. The state's form is specified in the state's stateFormClass attribute.
Parameters:
  stateForm - The stateForm to unload
Parameters:
  controllerForm - The associated controllerForm
throws:
  ControllerException - upon error transferring the data betweenthe forms.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.