cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r215991 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/ src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ src/blocks/forms/java/org/apache/cocoon/forms/validation/ src...
Date Tue, 12 Jul 2005 18:55:47 GMT
Author: cziegeler
Date: Tue Jul 12 11:55:45 2005
New Revision: 215991

URL: http://svn.apache.org/viewcvs?rev=215991&view=rev
Log:
Make all WidgetValidatorBuilders ThreadSafe. Reset validation errors
before validating a field.

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/WidgetValidatorBuilder.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/AssertValidatorBuilder.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/EmailValidatorBuilder.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/JavaScriptValidatorBuilder.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/LengthValidatorBuilder.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/Mod10ValidatorBuilder.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/RangeValidatorBuilder.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/RegExpValidatorBuilder.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/ValueCountValidatorBuilder.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/AbstractValidationRuleBuilder.java
Tue Jul 12 11:55:45 2005
@@ -24,6 +24,7 @@
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.excalibur.xml.sax.XMLizable;
 import org.w3c.dom.Element;
 import org.outerj.expression.Expression;
@@ -34,10 +35,15 @@
  *
  * @version $Id$
  */
-public abstract class AbstractValidationRuleBuilder implements ValidationRuleBuilder, Serviceable,
Disposable {
+public abstract class AbstractValidationRuleBuilder 
+    implements ValidationRuleBuilder, Serviceable, Disposable {
+
     protected ExpressionManager expressionManager;
     protected ServiceManager serviceManager;
 
+    /**
+     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+     */
     public void service(ServiceManager serviceManager) throws ServiceException {
         this.serviceManager = serviceManager;
         this.expressionManager = (ExpressionManager)serviceManager.lookup(ExpressionManager.ROLE);

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java
Tue Jul 12 11:55:45 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -272,6 +272,9 @@
         }
     }
 
+    /**
+     * @see org.apache.cocoon.forms.formmodel.Widget#validate()
+     */
     public boolean validate() {
         if (!getCombinedState().isValidatingValues()) {
             this.wasValid = true;
@@ -350,6 +353,9 @@
 
         // Go to transient validating state
         this.valueState = VALUE_VALIDATING;
+
+        // reset validation errot
+        this.validationError = null;
 
         try {
             if (this.value == null && getFieldDefinition().isRequired()) {

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/WidgetValidatorBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/WidgetValidatorBuilder.java?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/WidgetValidatorBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/WidgetValidatorBuilder.java
Tue Jul 12 11:55:45 2005
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,14 +19,14 @@
 import org.w3c.dom.Element;
 
 /**
- * 
+ *
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
  * @version $Id$
  */
 public interface WidgetValidatorBuilder {
-    
-    static final String ROLE = WidgetValidatorBuilder.class.getName();
-    
+
+    String ROLE = WidgetValidatorBuilder.class.getName();
+
     /**
      * Builds a {@link WidgetValidator} for a particular widget definition.
      * 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/AssertValidatorBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/AssertValidatorBuilder.java?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/AssertValidatorBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/AssertValidatorBuilder.java
Tue Jul 12 11:55:45 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.forms.validation.impl;
 
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.forms.datatype.validationruleimpl.AssertValidationRuleBuilder;
 import org.apache.cocoon.forms.formmodel.WidgetDefinition;
 import org.apache.cocoon.forms.validation.WidgetValidator;
@@ -27,8 +28,12 @@
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
  * @version $Id$
  */
-public class AssertValidatorBuilder extends AssertValidationRuleBuilder implements WidgetValidatorBuilder
{
+public class AssertValidatorBuilder extends AssertValidationRuleBuilder
+    implements WidgetValidatorBuilder, ThreadSafe {
 
+    /**
+     * @see org.apache.cocoon.forms.validation.WidgetValidatorBuilder#build(org.w3c.dom.Element,
org.apache.cocoon.forms.formmodel.WidgetDefinition)
+     */
     public WidgetValidator build(Element validationRuleElement, WidgetDefinition definition)
throws Exception {
         return new ValidationRuleValidator(super.build(validationRuleElement));
     }    

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/EmailValidatorBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/EmailValidatorBuilder.java?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/EmailValidatorBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/EmailValidatorBuilder.java
Tue Jul 12 11:55:45 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.forms.validation.impl;
 
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.forms.datatype.validationruleimpl.EmailValidationRuleBuilder;
 import org.apache.cocoon.forms.formmodel.WidgetDefinition;
 import org.apache.cocoon.forms.validation.WidgetValidator;
@@ -27,8 +28,12 @@
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
  * @version $Id$
  */
-public class EmailValidatorBuilder extends EmailValidationRuleBuilder implements WidgetValidatorBuilder
{
+public class EmailValidatorBuilder extends EmailValidationRuleBuilder 
+    implements WidgetValidatorBuilder, ThreadSafe {
 
+    /**
+     * @see org.apache.cocoon.forms.validation.WidgetValidatorBuilder#build(org.w3c.dom.Element,
org.apache.cocoon.forms.formmodel.WidgetDefinition)
+     */
     public WidgetValidator build(Element validationRuleElement, WidgetDefinition definition)
throws Exception {
         return new ValidationRuleValidator(super.build(validationRuleElement));
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/JavaScriptValidatorBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/JavaScriptValidatorBuilder.java?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/JavaScriptValidatorBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/JavaScriptValidatorBuilder.java
Tue Jul 12 11:55:45 2005
@@ -33,8 +33,9 @@
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
  * @version $Id$
  */
-public class JavaScriptValidatorBuilder implements WidgetValidatorBuilder, Contextualizable,
ThreadSafe {
-    
+public class JavaScriptValidatorBuilder 
+    implements WidgetValidatorBuilder, Contextualizable, ThreadSafe {
+
     private Context avalonContext;
     
     private static final String[] ARG_NAMES = {"widget"};

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/LengthValidatorBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/LengthValidatorBuilder.java?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/LengthValidatorBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/LengthValidatorBuilder.java
Tue Jul 12 11:55:45 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.forms.validation.impl;
 
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.forms.datatype.validationruleimpl.LengthValidationRuleBuilder;
 import org.apache.cocoon.forms.formmodel.WidgetDefinition;
 import org.apache.cocoon.forms.validation.WidgetValidator;
@@ -27,8 +28,13 @@
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
  * @version $Id$
  */
-public class LengthValidatorBuilder extends LengthValidationRuleBuilder implements WidgetValidatorBuilder
{
+public class LengthValidatorBuilder 
+    extends LengthValidationRuleBuilder
+    implements WidgetValidatorBuilder, ThreadSafe {
 
+    /**
+     * @see org.apache.cocoon.forms.validation.WidgetValidatorBuilder#build(org.w3c.dom.Element,
org.apache.cocoon.forms.formmodel.WidgetDefinition)
+     */
     public WidgetValidator build(Element validationRuleElement, WidgetDefinition definition)
throws Exception {
         return new ValidationRuleValidator(super.build(validationRuleElement));
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/Mod10ValidatorBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/Mod10ValidatorBuilder.java?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/Mod10ValidatorBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/Mod10ValidatorBuilder.java
Tue Jul 12 11:55:45 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.forms.validation.impl;
 
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.forms.datatype.validationruleimpl.Mod10ValidationRuleBuilder;
 import org.apache.cocoon.forms.formmodel.WidgetDefinition;
 import org.apache.cocoon.forms.validation.WidgetValidator;
@@ -27,8 +28,13 @@
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
  * @version $Id$
  */
-public class Mod10ValidatorBuilder extends Mod10ValidationRuleBuilder implements WidgetValidatorBuilder
{
+public class Mod10ValidatorBuilder 
+    extends Mod10ValidationRuleBuilder
+    implements WidgetValidatorBuilder, ThreadSafe {
 
+    /**
+     * @see org.apache.cocoon.forms.validation.WidgetValidatorBuilder#build(org.w3c.dom.Element,
org.apache.cocoon.forms.formmodel.WidgetDefinition)
+     */
     public WidgetValidator build(Element validationRuleElement, WidgetDefinition definition)
throws Exception {
         return new ValidationRuleValidator(super.build(validationRuleElement));
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/RangeValidatorBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/RangeValidatorBuilder.java?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/RangeValidatorBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/RangeValidatorBuilder.java
Tue Jul 12 11:55:45 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.forms.validation.impl;
 
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.forms.datatype.validationruleimpl.RangeValidationRuleBuilder;
 import org.apache.cocoon.forms.formmodel.WidgetDefinition;
 import org.apache.cocoon.forms.validation.WidgetValidator;
@@ -27,8 +28,13 @@
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
  * @version $Id$
  */
-public class RangeValidatorBuilder extends RangeValidationRuleBuilder implements WidgetValidatorBuilder
{
+public class RangeValidatorBuilder 
+    extends RangeValidationRuleBuilder
+    implements WidgetValidatorBuilder, ThreadSafe {
 
+    /**
+     * @see org.apache.cocoon.forms.validation.WidgetValidatorBuilder#build(org.w3c.dom.Element,
org.apache.cocoon.forms.formmodel.WidgetDefinition)
+     */
     public WidgetValidator build(Element validationRuleElement, WidgetDefinition definition)
throws Exception {
         return new ValidationRuleValidator(super.build(validationRuleElement));
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/RegExpValidatorBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/RegExpValidatorBuilder.java?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/RegExpValidatorBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/RegExpValidatorBuilder.java
Tue Jul 12 11:55:45 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.forms.validation.impl;
 
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.forms.datatype.validationruleimpl.RegExpValidationRuleBuilder;
 import org.apache.cocoon.forms.formmodel.WidgetDefinition;
 import org.apache.cocoon.forms.validation.WidgetValidator;
@@ -27,8 +28,13 @@
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
  * @version $Id$
  */
-public class RegExpValidatorBuilder extends RegExpValidationRuleBuilder implements WidgetValidatorBuilder
{
+public class RegExpValidatorBuilder
+    extends RegExpValidationRuleBuilder
+    implements WidgetValidatorBuilder, ThreadSafe {
 
+    /**
+     * @see org.apache.cocoon.forms.validation.WidgetValidatorBuilder#build(org.w3c.dom.Element,
org.apache.cocoon.forms.formmodel.WidgetDefinition)
+     */
     public WidgetValidator build(Element validationRuleElement, WidgetDefinition definition)
throws Exception {
         return new ValidationRuleValidator(super.build(validationRuleElement));
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/ValueCountValidatorBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/ValueCountValidatorBuilder.java?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/ValueCountValidatorBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/validation/impl/ValueCountValidatorBuilder.java
Tue Jul 12 11:55:45 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.forms.validation.impl;
 
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.forms.datatype.validationruleimpl.ValueCountValidationRuleBuilder;
 import org.apache.cocoon.forms.formmodel.WidgetDefinition;
 import org.apache.cocoon.forms.validation.WidgetValidator;
@@ -27,8 +28,13 @@
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
  * @version $Id$
  */
-public class ValueCountValidatorBuilder extends ValueCountValidationRuleBuilder implements
WidgetValidatorBuilder {
+public class ValueCountValidatorBuilder
+    extends ValueCountValidationRuleBuilder
+    implements WidgetValidatorBuilder, ThreadSafe {
 
+    /**
+     * @see org.apache.cocoon.forms.validation.WidgetValidatorBuilder#build(org.w3c.dom.Element,
org.apache.cocoon.forms.formmodel.WidgetDefinition)
+     */
     public WidgetValidator build(Element validationRuleElement, WidgetDefinition definition)
throws Exception {
         return new ValidationRuleValidator(super.build(validationRuleElement));
     }

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=215991&r1=215990&r2=215991&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Tue Jul 12 11:55:45 2005
@@ -197,6 +197,10 @@
   <changes>
   <release version="@version@" date="@date@">
     <action dev="CZ" type="add">
+      CForms block: Make all WidgetValidatorBuilders ThreadSafe. Reset validation errors
+                    before validating a field.
+    </action>     
+    <action dev="CZ" type="add">
       Portal block: Add portal manager aspects for more flexible portal processing.
     </action>     
     <action dev="CZ" type="add">



Mime
View raw message