com.opensymphony.webwork.pico
Class PicoObjectFactory

java.lang.Object
  extended by com.opensymphony.xwork.ObjectFactory
      extended by com.opensymphony.webwork.pico.PicoObjectFactory

public class PicoObjectFactory
extends ObjectFactory

XWork ObjectFactory which uses a PicoContainer to create component instances.

Author:
Cyrille Le Clerc, Jonas Engman, Mauro Talevi, Grégory Joseph

Constructor Summary
PicoObjectFactory(org.picocontainer.defaults.ObjectReference objectReference)
          Creates a PicoObjectFactory with given object reference, used to pass the http request to the factory
 
Method Summary
 Object buildAction(String actionName, String namespace, ActionConfig config, Map extraContext)
          Build an instance of the action class to handle a web request
 Object buildBean(Class actionClass)
          Instantiates an action using the PicoContainer found in the request scope.
 Object buildBean(Class clazz, Map extraContext)
          Webwork-2.2 / XWork-1.1 method.
 Object buildBean(String className)
           
 Object buildBean(String className, Map extraContext)
          Webwork-2.2 / XWork-1.1 method.
 Interceptor buildInterceptor(InterceptorConfig interceptorConfig, Map interceptorRefParams)
          Builds an Interceptor from the InterceptorConfig and the Map of parameters from the interceptor reference.
 Result buildResult(ResultConfig resultConfig, Map extraContext)
          Build a Result using the type in the ResultConfig and set the parameters in the ResultConfig.
 Validator buildValidator(String className, Map params, Map extraContext)
          Build a Validator of the given type and set the parameters on it
 Class getClassInstance(String className)
          Webwork-2.2 / XWork-1.1 method.
 boolean isNoArgConstructorRequired()
          Allows for ObjectFactory implementations that support Actions without no-arg constructors.
 
Methods inherited from class com.opensymphony.xwork.ObjectFactory
getContinuationPackage, getObjectFactory, setContinuationPackage, setObjectFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PicoObjectFactory

public PicoObjectFactory(org.picocontainer.defaults.ObjectReference objectReference)
Creates a PicoObjectFactory with given object reference, used to pass the http request to the factory

Parameters:
objectReference - the ObjectReference
Method Detail

isNoArgConstructorRequired

public boolean isNoArgConstructorRequired()
Description copied from class: ObjectFactory
Allows for ObjectFactory implementations that support Actions without no-arg constructors.

Overrides:
isNoArgConstructorRequired in class ObjectFactory
Returns:
true if no-arg constructor is required, false otherwise

buildBean

public Object buildBean(Class clazz,
                        Map extraContext)
                 throws Exception
Webwork-2.2 / XWork-1.1 method. ExtraContext can be ignored.

Overrides:
buildBean in class ObjectFactory
Parameters:
clazz - the type of Object to build
extraContext - a Map of extra context which uses the same keys as the ActionContext
Throws:
Exception

buildBean

public Object buildBean(String className,
                        Map extraContext)
                 throws Exception
Webwork-2.2 / XWork-1.1 method. ExtraContext can be ignored.

Overrides:
buildBean in class ObjectFactory
Parameters:
className - the type of Object to build
extraContext - a Map of extra context which uses the same keys as the ActionContext
Throws:
Exception

getClassInstance

public Class getClassInstance(String className)
                       throws ClassNotFoundException
Webwork-2.2 / XWork-1.1 method. Used to validate a class be loaded. Using actionsContainerFactory for consistency with build methods.

Overrides:
getClassInstance in class ObjectFactory
Parameters:
className - The fully qualified name of the class to return
Returns:
The class itself
Throws:
ClassNotFoundException

buildAction

public Object buildAction(String actionName,
                          String namespace,
                          ActionConfig config,
                          Map extraContext)
                   throws Exception
Description copied from class: ObjectFactory
Build an instance of the action class to handle a web request

Overrides:
buildAction in class ObjectFactory
Parameters:
actionName - the name the action configuration is set up with in the configuration
namespace - the namespace the action is configured in
config - the action configuration found in the config for the actionName / namespace
extraContext - a Map of extra context which uses the same keys as the ActionContext
Returns:
instance of the action class to handle a web request
Throws:
Exception

buildInterceptor

public Interceptor buildInterceptor(InterceptorConfig interceptorConfig,
                                    Map interceptorRefParams)
                             throws ConfigurationException
Description copied from class: ObjectFactory
Builds an Interceptor from the InterceptorConfig and the Map of parameters from the interceptor reference. Implementations of this method should ensure that the Interceptor is parameterized with both the parameters from the Interceptor config and the interceptor ref Map (the interceptor ref params take precedence), and that the Interceptor.init() method is called on the Interceptor instance before it is returned.

Overrides:
buildInterceptor in class ObjectFactory
Parameters:
interceptorConfig - the InterceptorConfig from the configuration
interceptorRefParams - a Map of params provided in the Interceptor reference in the Action mapping or InterceptorStack definition
Throws:
ConfigurationException

buildResult

public Result buildResult(ResultConfig resultConfig,
                          Map extraContext)
                   throws Exception
Description copied from class: ObjectFactory
Build a Result using the type in the ResultConfig and set the parameters in the ResultConfig.

Overrides:
buildResult in class ObjectFactory
Parameters:
resultConfig - the ResultConfig found for the action with the result code returned
extraContext - a Map of extra context which uses the same keys as the ActionContext
Throws:
Exception

buildValidator

public Validator buildValidator(String className,
                                Map params,
                                Map extraContext)
                         throws Exception
Description copied from class: ObjectFactory
Build a Validator of the given type and set the parameters on it

Overrides:
buildValidator in class ObjectFactory
Parameters:
className - the type of Validator to build
params - property name -> value Map to set onto the Validator instance
extraContext - a Map of extra context which uses the same keys as the ActionContext
Throws:
Exception

buildBean

public Object buildBean(Class actionClass)
                 throws Exception
Instantiates an action using the PicoContainer found in the request scope.

Throws:
Exception

buildBean

public Object buildBean(String className)
                 throws Exception
Throws:
Exception

WebWork Project Page