Expresso 5-6

com.jcorporate.expresso.core.controller
Class DefaultControllerFactory

java.lang.Object
  extended bycom.jcorporate.expresso.core.controller.DefaultControllerFactory
All Implemented Interfaces:
ControllerFactory

public class DefaultControllerFactory
extends Object
implements ControllerFactory

This version of Controller Factory acts dumb. If the controller hasn't been create already, it creates it. It is often used for Command Line operations where we don't use the Struts Action Servlet

Author:
Michael Rimov

Field Summary
protected  org.apache.oro.util.CacheLRU controllerCache
          Class Instantiation.
 
Constructor Summary
DefaultControllerFactory()
          Do nothing constructor
 
Method Summary
 Controller getController(ControllerRequest request)
          Retrieve the Action controller that matches the class name The Struts 1.1 modules are ignored for this implementation.
 Controller getController(String className)
          Retrieve the Action controller that matches the class name
 Controller getController(String moduleName, String className)
          Retrieve the Action controller that matches the class name The moduleName is ignored for this implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

controllerCache

protected org.apache.oro.util.CacheLRU controllerCache
Class Instantiation. Stores the last 20 controllers created. Helps to keep down memory hogs for non-webserver systems.

Constructor Detail

DefaultControllerFactory

public DefaultControllerFactory()
Do nothing constructor

Method Detail

getController

public Controller getController(String className)
                         throws ControllerException
Retrieve the Action controller that matches the class name

Specified by:
getController in interface ControllerFactory
Parameters:
className - The className to instantiate
Returns:
a constructed controller
Throws:
ControllerException - if there's an error instantiating the controller

getController

public Controller getController(String moduleName,
                                String className)
                         throws ControllerException
Retrieve the Action controller that matches the class name The moduleName is ignored for this implementation.

Specified by:
getController in interface ControllerFactory
Parameters:
className - The className to instantiate
moduleName - The module to instantiate
Returns:
a constructed controller
Throws:
ControllerException - if there's an error instantiating the controller

getController

public Controller getController(ControllerRequest request)
                         throws ControllerException
Retrieve the Action controller that matches the class name The Struts 1.1 modules are ignored for this implementation.

Specified by:
getController in interface ControllerFactory
Parameters:
request - The ControllerRequest that has all the parameters we need to construct the appropriate controller.

Additional notes by Peter Pilgrim Sun Feb 16 13:53:07 GMT 2003

Struts 1.1 introduces the concept of Modules to further complicate the idea of instantiating an action controller. It is assume that this method retrieve a controller specifically from the named module. If such an implementation aims to support modules. Since the controller factory could retrieve an HttpServletRequest from the ControllerRequest and then find the appropriate module name, therefore no extra parameter was required for this method.

Returns:
instantiated controller
Throws:
ControllerException - if there's an error instantiating the controller

Expresso 5-6

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