*/
public ActionForm findOrCreateActionForm(String formName, String scopeName, ModuleConfig moduleConfig)
throws IllegalAccessException, InstantiationException {
Map scope = this.getScope(scopeName);
ActionForm instance;
FormBeanConfig formBeanConfig = moduleConfig.findFormBeanConfig(formName);
if (formBeanConfig == null) {
throw new IllegalArgumentException("No form config found under " + formName + " in module "
+ moduleConfig.getPrefix());
}
instance = (ActionForm) scope.get(formName);
// ISSUE: Can we recycle the existing instance (if any)?
if (instance != null) {
getLogger().trace("Found an instance in scope " + scopeName + "; test for reusability");
if (formBeanConfig.canReuse(instance)) {
return instance;
}
}
ActionForm form = formBeanConfig.createActionForm(this);
// ISSUE: Should we check this call to put?
scope.put(formName, form);
return form;