org.appfuse.webapp.spring
Class ValidatorExtensionPostProcessor

java.lang.Object
  extended by org.appfuse.webapp.spring.ValidatorExtensionPostProcessor
All Implemented Interfaces:
org.springframework.beans.factory.config.BeanFactoryPostProcessor

public class ValidatorExtensionPostProcessor
extends java.lang.Object
implements org.springframework.beans.factory.config.BeanFactoryPostProcessor

Adds commons validator configuration files to an existing Spring commons Validator Factory bean, possibly defined within a seperate Spring configuration file in a seperate jar file. By using this extension factory developers can add validation configuration for their own persistent classes to an AppFuse application without modifying any of the existing AppFuse Spring configuration or jar distribution files.

As an example consider the following Spring bean configuration:

 <bean class="org.appfuse.webapp.spring.ValidatorExtensionPostProcessor">
   <property name="validationConfigLocations">
     <list>
       <value>/WEB-INF/foo-validation.xml</value>
     </list>
   </property>
 </bean>
 

The sample adds a single validation configuration file (foo-validation.xml) to an existing Spring commons Validator Factory bean (a bean of class org.springmodules.validation.commons.DefaultValidatorFactory). Assuming the validator extension is included in a Spring configuration file called applicationContext-foo-validation.xml, and that this configuration file is added directly below WEB-INF in the Foo web project, then the normal war overlay process coupled with AppFuse's configuration file auto detection will ensure that the validation extension is automatically included into the application without requiring any modification of AppFuse's existing config files.

Author:
Michael Horwitz

Constructor Summary
ValidatorExtensionPostProcessor()
           
 
Method Summary
 void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory configurableListableBeanFactory)
          Adds the validation configuration files to the list already held in the validator factory bean configuration.
 void setValidationConfigLocations(java.util.List validationConfigLocations)
          The list of validation config locations to be added to the validator factory.
 void setValidatorFactoryBeanName(java.lang.String validatorFactoryBeanName)
          Set the name of the validator factory bean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidatorExtensionPostProcessor

public ValidatorExtensionPostProcessor()
Method Detail

postProcessBeanFactory

public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory configurableListableBeanFactory)
                            throws org.springframework.beans.BeansException
Adds the validation configuration files to the list already held in the validator factory bean configuration.

Specified by:
postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
Throws:
org.springframework.beans.BeansException

setValidatorFactoryBeanName

public void setValidatorFactoryBeanName(java.lang.String validatorFactoryBeanName)
Set the name of the validator factory bean. This defaults to "validatorFactory"

Parameters:
validatorFactoryBeanName - The validator factory bean name.

setValidationConfigLocations

public void setValidationConfigLocations(java.util.List validationConfigLocations)
The list of validation config locations to be added to the validator factory.

Parameters:
validationConfigLocations - The list of additional validation configuration locations.


Copyright © 2003-2007. All Rights Reserved.