org.apache.cocoon.components.language.markup.xsp
Class XSPFormValidatorHelper

java.lang.Object
  |
  +--org.apache.cocoon.components.language.markup.xsp.XSPFormValidatorHelper

public class XSPFormValidatorHelper
extends java.lang.Object

The ValidatorActionResult object helper

Version:
CVS $Id: XSPFormValidatorHelper.java,v 1.7 2002/02/22 07:00:08 cziegeler Exp $
Author:
Christian Haul

Constructor Summary
XSPFormValidatorHelper(java.lang.String descriptor, boolean reloadable, org.apache.log.Logger logger, org.apache.avalon.framework.component.ComponentManager manager)
           
XSPFormValidatorHelper(java.lang.String descriptor, boolean reloadable, org.apache.log.Logger logger, org.apache.avalon.framework.component.ComponentManager manager, java.lang.String constraintset)
           
 
Method Summary
static java.lang.Object getAttribute(java.util.Map objectModel, java.lang.String name)
          Get the specified attribute
protected static org.apache.avalon.framework.configuration.Configuration getConfiguration(java.lang.String descriptor, org.apache.avalon.framework.component.ComponentManager manager, boolean reloadable, org.apache.log.Logger logger)
          Set up the complementary configuration file.
protected static org.apache.avalon.framework.configuration.Configuration getConfigurationByName(org.apache.avalon.framework.configuration.Configuration[] conf, java.lang.String name, org.apache.log.Logger logger)
          Iterate over a set of configurations and return the one whose name matches the given one.
 java.lang.String getParameterAttribute(java.lang.String attribute)
          Get an attribute for the context's current parameter as specified in descriptor.xml.
 java.lang.String getParameterAttribute(java.lang.String parameter, java.lang.String attribute)
          Get an attribute for a parameter as specified in descriptor.xml.
static java.lang.String getParameterAttributes(java.lang.String descriptor, org.apache.avalon.framework.component.ComponentManager manager, boolean reloadable, java.lang.String constraintset, java.lang.String parameter, java.lang.String attribute, org.apache.log.Logger logger)
          Get an attribute for a parameter as specified in descriptor.xml.
 ValidatorActionResult getParamResult(java.util.Map objectModel)
          Extracts the validation results from the request attribute for the context's current request parameter
static ValidatorActionResult getParamResult(java.util.Map objectModel, java.lang.String name)
          Extracts the validation results from the request attribute for a specific request parameter
static java.util.Map getResults(java.util.Map objectModel)
          Extracts the validation results from the request attribute
 boolean isError(java.util.Map objectModel)
          Test whether the validation returned an error for the context's current parameter.
static boolean isError(java.util.Map objectModel, java.lang.String name)
          Test whether the validation returned an error for this parameter.
 boolean isNoMatch(java.util.Map objectModel)
          Test whether the context's current parameter wasn't matched by the requested regular expression.
static boolean isNoMatch(java.util.Map objectModel, java.lang.String name)
          Test whether the validated parameter wasn't matched by the requested regular expression.
 boolean isNotPresent(java.util.Map objectModel)
          Test whether the context's current parameter wasn't validated
static boolean isNotPresent(java.util.Map objectModel, java.lang.String name)
          Test whether the validated parameter wasn't validated
 boolean isNull(java.util.Map objectModel)
          Test whether the context's current parameter as validated was null but wasn't allowed to.
static boolean isNull(java.util.Map objectModel, java.lang.String name)
          Test whether the validated parameter was null but wasn't allowed to.
 boolean isOK(java.util.Map objectModel)
          Test whether the validation returned no error for the context's current parameter.
static boolean isOK(java.util.Map objectModel, java.lang.String name)
          Test whether the validation returned no error for this parameter.
 boolean isTooLarge(java.util.Map objectModel)
          Test whether the context's current parameter was too large.
static boolean isTooLarge(java.util.Map objectModel, java.lang.String name)
          Test whether the validated parameter was too large.
 boolean isTooSmall(java.util.Map objectModel)
          Test whether the context's current parameter was too small.
static boolean isTooSmall(java.util.Map objectModel, java.lang.String name)
          Test whether the validated parameter was too small.
 void setConstraintSet(java.lang.String constraintset)
          keep track of current constraint-set context (probably this is not needed?)
 void setParameter(java.lang.String parameter)
          keep track of current parameter context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSPFormValidatorHelper

public XSPFormValidatorHelper(java.lang.String descriptor,
                              boolean reloadable,
                              org.apache.log.Logger logger,
                              org.apache.avalon.framework.component.ComponentManager manager)

XSPFormValidatorHelper

public XSPFormValidatorHelper(java.lang.String descriptor,
                              boolean reloadable,
                              org.apache.log.Logger logger,
                              org.apache.avalon.framework.component.ComponentManager manager,
                              java.lang.String constraintset)
Method Detail

setParameter

public void setParameter(java.lang.String parameter)
keep track of current parameter context

setConstraintSet

public void setConstraintSet(java.lang.String constraintset)
keep track of current constraint-set context (probably this is not needed?)

getAttribute

public static java.lang.Object getAttribute(java.util.Map objectModel,
                                            java.lang.String name)
Get the specified attribute
Parameters:
objectModel - The Map objectModel
name - The parameter name

getResults

public static java.util.Map getResults(java.util.Map objectModel)
Extracts the validation results from the request attribute
Parameters:
objectModel - The Map objectModel
Returns:
Map with ValidatorActionResults
See Also:
ValidatorActionResult

getParamResult

public static ValidatorActionResult getParamResult(java.util.Map objectModel,
                                                   java.lang.String name)
Extracts the validation results from the request attribute for a specific request parameter
Parameters:
objectModel - The Map objectModel
name - Request parameter's name
See Also:
ValidatorActionResult

getParamResult

public ValidatorActionResult getParamResult(java.util.Map objectModel)
Extracts the validation results from the request attribute for the context's current request parameter
Parameters:
objectModel - The Map objectModel
See Also:
ValidatorActionResult

isOK

public static boolean isOK(java.util.Map objectModel,
                           java.lang.String name)
Test whether the validation returned no error for this parameter.
Parameters:
objectModel - The Map objectModel
name - Request parameter's name
Returns:
true only if the parameter was validated and the validation did not return an error.

isOK

public boolean isOK(java.util.Map objectModel)
Test whether the validation returned no error for the context's current parameter.
Parameters:
objectModel - The Map objectModel
Returns:
true only if the parameter was validated and the validation did not return an error.

isError

public static boolean isError(java.util.Map objectModel,
                              java.lang.String name)
Test whether the validation returned an error for this parameter.
Parameters:
objectModel - The Map objectModel
name - Request parameter's name
Returns:
true if the parameter was either not validated or the validation returned an error.

isError

public boolean isError(java.util.Map objectModel)
Test whether the validation returned an error for the context's current parameter.
Parameters:
objectModel - The Map objectModel
Returns:
true if the parameter was either not validated or the validation returned an error.

isNull

public static boolean isNull(java.util.Map objectModel,
                             java.lang.String name)
Test whether the validated parameter was null but wasn't allowed to.
Parameters:
objectModel - The Map objectModel
name - Request parameter's name
Returns:
true if the parameter was validated and the validation returned an error because the parameter was null but wasn't allowd to.

isNull

public boolean isNull(java.util.Map objectModel)
Test whether the context's current parameter as validated was null but wasn't allowed to.
Parameters:
objectModel - The Map objectModel
Returns:
true if the parameter was validated and the validation returned an error because the parameter was null but wasn't allowd to.

isTooSmall

public static boolean isTooSmall(java.util.Map objectModel,
                                 java.lang.String name)
Test whether the validated parameter was too small.
Parameters:
objectModel - The Map objectModel
name - Request parameter's name
Returns:
true if the parameter was validated and the validation returned an error because either its value or its length was too small.

isTooSmall

public boolean isTooSmall(java.util.Map objectModel)
Test whether the context's current parameter was too small.
Parameters:
objectModel - The Map objectModel
Returns:
true if the parameter was validated and the validation returned an error because either its value or its length was too small.

isTooLarge

public static boolean isTooLarge(java.util.Map objectModel,
                                 java.lang.String name)
Test whether the validated parameter was too large.
Parameters:
objectModel - The Map objectModel
name - Request parameter's name
Returns:
true if the parameter was validated and the validation returned an error because either its value or its length was too large.

isTooLarge

public boolean isTooLarge(java.util.Map objectModel)
Test whether the context's current parameter was too large.
Parameters:
objectModel - The Map objectModel
Returns:
true if the parameter was validated and the validation returned an error because either its value or its length was too large.

isNoMatch

public static boolean isNoMatch(java.util.Map objectModel,
                                java.lang.String name)
Test whether the validated parameter wasn't matched by the requested regular expression.
Parameters:
objectModel - The Map objectModel
name - Request parameter's name
Returns:
true if the parameter was validated and the validation returned an error because its value wasn't matched by the requested regular expression.

isNoMatch

public boolean isNoMatch(java.util.Map objectModel)
Test whether the context's current parameter wasn't matched by the requested regular expression.
Parameters:
objectModel - The Map objectModel
Returns:
true if the parameter was validated and the validation returned an error because its value wasn't matched by the requested regular expression.

isNotPresent

public static boolean isNotPresent(java.util.Map objectModel,
                                   java.lang.String name)
Test whether the validated parameter wasn't validated
Parameters:
objectModel - The Map objectModel
name - Request parameter's name
Returns:
true if the parameter was not validated.

isNotPresent

public boolean isNotPresent(java.util.Map objectModel)
Test whether the context's current parameter wasn't validated
Parameters:
objectModel - The Map objectModel
Returns:
true if the parameter was not validated.

getConfiguration

protected static org.apache.avalon.framework.configuration.Configuration getConfiguration(java.lang.String descriptor,
                                                                                          org.apache.avalon.framework.component.ComponentManager manager,
                                                                                          boolean reloadable,
                                                                                          org.apache.log.Logger logger)
                                                                                   throws org.apache.avalon.framework.configuration.ConfigurationException
Set up the complementary configuration file. Please note that multiple Actions can share the same configurations. By using this approach, we can limit the number of config files. Also note that the configuration file does not have to be a file. This is based on the similar named functions in org.apache.cocoon.acting.AbstractComplimentaryConfigurableAction with the addition of reloadable configuration files, reloadable flagg, manager, and logger parameter.
Parameters:
descriptor - URL of descriptor.xml file @see org.apache.cocoon.acting.AbstractComplimentaryConfigurableAction
manager -  
reloadable - set to true if changes of descriptor should trigger a reload. Note that this only works if Source is able to determine the modification time @see org.apache.cocoon.environment.Source
logger - used to send debug and error messages to
Returns:
up-to-date configuration, either (re)loaded or cached.

getConfigurationByName

protected static org.apache.avalon.framework.configuration.Configuration getConfigurationByName(org.apache.avalon.framework.configuration.Configuration[] conf,
                                                                                                java.lang.String name,
                                                                                                org.apache.log.Logger logger)
Iterate over a set of configurations and return the one whose name matches the given one.
Parameters:
conf - set of configurations
name - name of configuration
logger -  
Returns:
specified configuration or null if not found.

getParameterAttributes

public static java.lang.String getParameterAttributes(java.lang.String descriptor,
                                                      org.apache.avalon.framework.component.ComponentManager manager,
                                                      boolean reloadable,
                                                      java.lang.String constraintset,
                                                      java.lang.String parameter,
                                                      java.lang.String attribute,
                                                      org.apache.log.Logger logger)
Get an attribute for a parameter as specified in descriptor.xml.
Parameters:
descriptor - URL of descriptor.xml file @see org.apache.cocoon.acting.AbstractComplimentaryConfigurableAction
manager -  
reloadable - set to true if changes of descriptor should trigger a reload. Note that this only works if Source is able to determine the modification time @see org.apache.cocoon.environment.Source
logger - used to send debug and error messages to
attribute - attribute name
Returns:
attribute value or null

getParameterAttribute

public java.lang.String getParameterAttribute(java.lang.String attribute)
Get an attribute for the context's current parameter as specified in descriptor.xml.
Parameters:
attribute - attribute name
Returns:
attribute value or null

getParameterAttribute

public java.lang.String getParameterAttribute(java.lang.String parameter,
                                              java.lang.String attribute)
Get an attribute for a parameter as specified in descriptor.xml.
Parameters:
attribute - attribute name
Returns:
attribute value or null


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.