You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ha...@apache.org on 2001/07/10 19:51:22 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp XSPFormValidatorHelper.java

haul        01/07/10 10:51:22

  Modified:    src/org/apache/cocoon/components/language/markup/xsp
                        XSPFormValidatorHelper.java
  Log:
  examples for formvalidation, documentation fixes
  
  Revision  Changes    Path
  1.7       +36 -36    xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPFormValidatorHelper.java
  
  Index: XSPFormValidatorHelper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPFormValidatorHelper.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XSPFormValidatorHelper.java	2001/07/07 11:43:18	1.6
  +++ XSPFormValidatorHelper.java	2001/07/10 17:51:20	1.7
  @@ -37,7 +37,7 @@
    * The <code>ValidatorActionResult</code> object helper
    *
    * @author <a href="mailto:haul@informatik.tu-darmstadt.de">Christian Haul</a>
  - * @version CVS $Revision: 1.6 $ $Date: 2001/07/07 11:43:18 $
  + * @version CVS $Revision: 1.7 $ $Date: 2001/07/10 17:51:20 $
    */
   public class XSPFormValidatorHelper {
     /**
  @@ -163,12 +163,7 @@
                             Map objectModel
                             )
       {
  -    ValidatorActionResult result = ValidatorActionResult.NOTPRESENT;
  -    Map param_result = (Map) getResults(objectModel);
  -    if (param_result != null ) {
  -        result = (ValidatorActionResult) param_result.get(current_parameter);
  -    }
  -    return result;
  +	return getParamResult(objectModel, current_parameter);
       }
   
   
  @@ -463,36 +458,41 @@
   
           synchronized (XSPFormValidatorHelper.configurations) {
               conf = (ConfigurationHelper) XSPFormValidatorHelper.configurations.get(descriptor);
  -        Source source = null;
  -            SourceHandler sourceHandler = null;
  -        try {
  -            sourceHandler = (SourceHandler) manager.lookup(SourceHandler.ROLE);
  -            source = sourceHandler.getSource(null, descriptor);
  -
  -        if (conf == null || ( reloadable && conf.lastModified < source.getLastModified())) {
  -            logger.debug("XSPFormValidatorHelper.getConfiguration: (Re)Loading " + descriptor);
  -
  -            if (conf == null)
  -            conf = new ConfigurationHelper();
  -
  -            SAXConfigurationHandler builder = new SAXConfigurationHandler();
  -                    source.stream(builder);
  -
  -            conf.lastModified = source.getLastModified();
  -            conf.configuration = builder.getConfiguration();
  -
  -            XSPFormValidatorHelper.cacheConfiguration(descriptor, conf);
  -        } else {
  -            logger.debug("XSPFormValidatorHelper.getConfiguration: Using cached configuration for " + descriptor);
  -        }
  -        } catch (Exception e) {
  -        logger.error("XSPFormValidatorHelper.getConfiguration: Could not configure Database mapping environment", e);
  -        throw new ConfigurationException("Error trying to load configurations for resource: " + source.getSystemId());
  -        } finally {
  -               if (sourceHandler != null) manager.release((Component) sourceHandler);
  -        }
  -        }
   
  +	    if ( reloadable || conf==null ) {
  +		Source source = null;
  +		SourceHandler sourceHandler = null;
  +		try {
  +		    sourceHandler = (SourceHandler) manager.lookup(SourceHandler.ROLE);
  +		    source = sourceHandler.getSource(null, descriptor);
  +
  +		    if (conf == null || conf.lastModified < source.getLastModified()) {
  +			logger.debug("XSPFormValidatorHelper.getConfiguration: (Re)Loading " + descriptor);
  +			
  +			if (conf == null)
  +			    conf = new ConfigurationHelper();
  +
  +			SAXConfigurationHandler builder = new SAXConfigurationHandler();
  +			source.stream(builder);
  +
  +			conf.lastModified = source.getLastModified();
  +			conf.configuration = builder.getConfiguration();
  +
  +			XSPFormValidatorHelper.cacheConfiguration(descriptor, conf);
  +		    } else {
  +			logger.debug("XSPFormValidatorHelper.getConfiguration: Using cached configuration for " + descriptor);
  +		    }
  +		} catch (Exception e) {
  +		    logger.error("XSPFormValidatorHelper.getConfiguration: Could not configure Database mapping environment", e);
  +		    throw new ConfigurationException("Error trying to load configurations for resource: " + source.getSystemId());
  +		} finally {
  +		    if (sourceHandler != null) manager.release((Component) sourceHandler);
  +		}
  +	    } else {
  +		logger.debug("XSPFormValidatorHelper.getConfiguration: Using fixed cached configuration for " + descriptor);
  +	    }
  +	}
  +	
           return conf.configuration;
       }
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org