Package org.davesag.generica.controller

Controllers are application specific business 'control' logic that the various actions and forms call on.

See:
          Description

Interface Summary
ActionController ActionController implementations provide the core business logic for the Struts actions.
Actor An implementation of the Actor interface must be able to perform some action or actions with the map of params provided.
Controller Controller implementations provide the core business logic for the Struts forms and actions.
Creator An implementation of the Creator interface must be able to create an object.
Deleter An implementation of the Deleter interface must be able to delete an object from a peristant store.
FormController FormController implementations provide the core business logic for the Struts forms.
HomepageChooser An implementation of the HomepageChooser interface must be able to direct the user to the appropriate forward based on the kind of user they are.
Lister An implementation of the Lister interface must be able to geneerate a list of summarised objects for use by a GUI or similar.
Loader An implementation of the Loader interface must be able to load an object given a unique indentifier.
PasswordHelperController An implementation of the PasswordHelperController interface must be able to tell if the user provided exists, if an answer to the password helper question was provided, if that answer is correct and it must also be able to reset the user's password.
Presenter An implementation of the Presenter interface must be able to load up the request with information useful for the GUI to present to the user.
Saver An implementation of the Saver interface must be able to save an object to a peristant store.
Summariser An implementation of the Summariser interface must be able to summarise an object for use by a GUI or similar.
TargetActor An implementation of the TargetActor interface must be able to identify an object, or set of objects based on the target string supplied and should do something with that information.
UploadController An implementation of the UploadController interface must be able to write a FormFile to some form of data store.
UserLoginController An implementation of the UserLoginController interface must be able to login the user based on the form details and populate their session.
UserRegistrationController An implementation of the UserLoginController interface must be able to check to see if the username provided is in use, and register the new user based on the supplied form details.
 

Class Summary
AbstractActionController The AbstractActionController is a good root class for all of your ActionController s.
AbstractController The AbstractController is the root class for all controllers.
AbstractHibernateController The AbstractHibernateController adds a utility method to the AbstractActionController for obtaining the current hibernate session.
AbstractUserProfileController AbstractUserProfileController is a base implementation that populates a Generic Form with details from the supplied user object and vice-verca, and performs the necessary summary/presentation logic required that is special for users above other kinds of business objects.
GenericContentSelector This controller manages presentation of SiteCopy for your application.
SimpleUploadController Writes the uploaded data to a file at the path specified.
 

Package org.davesag.generica.controller Description

Controllers are application specific business 'control' logic that the various actions and forms call on. The controller package contains a collection of Controller interfaces and assorted abstract controllers for you to extend.

You extend and implement controllers to provide the business logic for your application. In most circumstances you should never have to write your own Action classes, but instead pass the names of the appropriate controllers to the generica actions via the parameter option in the Action definitions in the struts-config.xml file.

The two main kinds of Controller are the ActionController and the FormController. FormControllers, specified in the param by "form-controller=com.yourdomain.controller.yourformcontrollerimpl" provide logic for populating the form (usually just a GenericForm) with data from the bean you provide. ActionControllers, specified in the param by "action-controller=com.yourdomain.controller.yourcontrollerimpl" provide various methods depending on the actual Controller you are implimenting.

You can also further specify a Presenter which loads application specific information into the request.

An example Generica Action configuration is as follows:


<action
	path="/admin/handlenewsitecopy"
	type="org.davesag.generica.servlet.action.HandleUpdateAction"
	parameter="pipe=newsitecopy;
				form-controller=com.davesag.controller.SiteCopyController;
				saver=com.davesag.controller.SiteCopyController"
	name="sitecopy"
	scope="request"
	validate="true"
	input="/admin/newsitecopy.do">
	<forward name="success" path="thanks.newsitecopy.page"/>
</action>

In this example the Controller com.davesag.controller.SiteCopyController is implementing multiple interfaces and acting as both a FormController and ActionController.

Forms, Actions and the Controllers they use

Form Controller configuration param
GenericForm FormController form-controller
LoginForm    
PasswordHelperForm    
UploadForm FormController form-controller
UserProfileForm FormController form-controller
UserRegistrationForm    

Action Controller configuration param
all actions Presenter presenter0 ... presentern
presentation-param0 ... presentation-paramn
  Actor actor0 ... actorn
actor-param0 ... actor-paramn
ChooseHomepageAction HomepageChooser chooser
DeleteTargetAction Deleter deleter
ForwardAction    
HandlePasswordHelperAction PasswordHelperController controller
HandleRegisterAction UserRegistrationController registrar
HandleUpdateAction Saver saver
  FormController form-controller
  Summariser summariser
  UploadController upload-controller
upload-path
InstantiationAction Creator creator
ListAction Lister lister
  Summariser summariser
LoadCurrentUserAction Summariser summariser
LoadTargetAction Loader loader
  Summariser summariser
LoginAction UserLoginController login-controller
LogoutAction    
TargetAction TargetActor target-actor

Because controllers are simple to plug in and out, and provide atomic bits of reusable business logic, your web application rapidly becomes a suite of controllers and core objects with peripheral helpers, peers and tests. The actions described above cover every conceivable requirement, and in combination with the chainable presenters and actors, allow limitless recombination of additional actions, eg emailing reports, populating the http request with a page specific bread-crumb style page history, and navigation options for the page, that sort of thing.

If you find you can't express your needs using any of the generica actions please let me know and i'll see if i can help.

Since:
Generica 1.0
Version:
Version CVS Revision $Id: package.html,v 1.1 2004/02/25 08:45:27 davesag Exp $


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.