Author: drobiazko
Date: Thu Oct 22 19:22:08 2009
New Revision: 828823

URL: http://svn.apache.org/viewvc?rev=828823&view=rev
Log:
TAP5-895: Tracking issue for Tapestry/JSR-303 integration

Added:
    tapestry/tapestry5/trunk/tapestry-beanvalidator/pom.xml   (with props)
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorConfigurer.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorGroupSource.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorSource.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanFieldValidatorDefaultSource.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidationGroupSourceImpl.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidatorSourceImpl.java
   (with props)
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/apache/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java
   (with props)
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/User.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/BeanEditFormValidationDemo.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/FormValidationDemo.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/Index.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/Foo.java
   (with props)
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/BeanEditFormValidationDemo.tml
    
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/FormValidationDemo.tml
    tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/Index.tml
Modified:
    tapestry/tapestry5/trunk/tapestry-beanvalidator/   (props changed)

Propchange: tapestry/tapestry5/trunk/tapestry-beanvalidator/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 22 19:22:08 2009
@@ -0,0 +1 @@
+test-output

Added: tapestry/tapestry5/trunk/tapestry-beanvalidator/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/pom.xml?rev=828823&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-beanvalidator/pom.xml (added)
+++ tapestry/tapestry5/trunk/tapestry-beanvalidator/pom.xml Thu Oct 22 19:22:08 
2009
@@ -0,0 +1,162 @@
+<project
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns="http://maven.apache.org/POM/4.0.0";>
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.apache.tapestry</groupId>
+       <artifactId>tapestry-beanvalidator</artifactId>
+       <version>5.2.0-SNAPSHOT</version>
+    <name>Tapestry/JSR-303 Integration Library</name>
+    <description>
+        Provides support for bean validation
+    </description>
+
+       <parent>
+               <groupId>org.apache.tapestry</groupId>
+               <artifactId>tapestry-project</artifactId>
+               <version>5.2.0-SNAPSHOT</version>
+       </parent>
+
+       <url></url>
+       <dependencies>
+
+               <dependency>
+                       <groupId>org.apache.tapestry</groupId>
+                       <artifactId>tapestry-core</artifactId>
+                       <type>jar</type>
+                       <optional>false</optional>
+               </dependency>
+               <dependency>
+                       <groupId>javax.servlet</groupId>
+                       <artifactId>servlet-api</artifactId>
+                       <type>jar</type>
+                       <scope>provided</scope>
+                       <optional>false</optional>
+               </dependency>
+               <dependency>
+                       <groupId>javax.validation</groupId>
+                       <artifactId>validation-api</artifactId>
+                       <version>1.0.0.GA</version>
+                       <type>jar</type>
+                       <optional>false</optional>
+               </dependency>
+               <dependency>
+                       <groupId>org.hibernate</groupId>
+                       <artifactId>hibernate-validator</artifactId>
+                       <version>4.0.0.GA</version>
+                       <type>jar</type>
+                       <scope>test</scope>
+                       <optional>false</optional>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.tapestry</groupId>
+                       <artifactId>tapestry-test</artifactId>
+                       <type>jar</type>
+                       <optional>false</optional>
+               </dependency>
+               <dependency>
+                       <groupId>org.easymock</groupId>
+                       <artifactId>easymock</artifactId>
+                       <type>jar</type>
+                       <optional>false</optional>
+               </dependency>
+               <dependency>
+                       <groupId>org.easymock</groupId>
+                       <artifactId>easymockclassextension</artifactId>
+                       <version>2.2.2</version>
+                       <type>jar</type>
+                       <scope>test</scope>
+                       <optional>false</optional>
+               </dependency>
+               <dependency>
+                       <groupId>log4j</groupId>
+                       <artifactId>log4j</artifactId>
+                       <version>1.2.14</version>
+                       <type>jar</type>
+                       <scope>test</scope>
+                       <optional>false</optional>
+               </dependency>
+       </dependencies>
+       
+       <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+            </plugin>
+            <!-- This gets the plugin to clean up the cobertura.ser file left
+        in the root directory. -->
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>cobertura-maven-plugin</artifactId>
+                <version>${cobertura-plugin-version}</version>
+                <executions>
+                    <execution>
+                        <id>clean</id>
+                        <goals>
+                            <goal>clean</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifestEntries>
+                            <Tapestry-Module-Classes>
+                                
org.apache.tapestry5.beanvalidator.BeanValidatorModule
+                            </Tapestry-Module-Classes>
+                        </manifestEntries>
+                    </archive>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+       
+       <repositories>
+               <repository>
+                       <id>jboss</id>
+                       <url>http://repository.jboss.com/maven2</url>
+                       <releases>
+                               <enabled>true</enabled>
+                       </releases>
+                       <snapshots>
+                               <enabled>false</enabled>
+                       </snapshots>
+               </repository>
+       </repositories>
+       
+       <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>cobertura-maven-plugin</artifactId>
+                <version>${cobertura-plugin-version}</version>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+                <reportSets>
+                    <reportSet>
+                        <reports>
+                            <report>summary</report>
+                            <report>dependencies</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+</project>

Propchange: tapestry/tapestry5/trunk/tapestry-beanvalidator/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tapestry/tapestry5/trunk/tapestry-beanvalidator/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorConfigurer.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorConfigurer.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorConfigurer.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorConfigurer.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,30 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry5.beanvalidator;
+
+import javax.validation.Configuration;
+
+/**
+ * Defines the interface for a chain-of-command that updates JSR-303 
configuration in some way before the {...@link
+ * javax.validation.ValidatorFactory} is created.
+ * 
+ * @since 5.2.0.0
+ */
+public interface BeanValidatorConfigurer 
+{
+       /**
+        * Passed the configuration so as to make changes.
+        */
+       void configure(Configuration<?> configuration);
+}
\ No newline at end of file

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorConfigurer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorConfigurer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorGroupSource.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorGroupSource.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorGroupSource.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorGroupSource.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,30 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry5.beanvalidator;
+
+import org.apache.tapestry5.ioc.annotations.UsesConfiguration;
+
+/**
+ * Provides list of groups targeted for validation.
+ *
+ * @since 5.2.0.0
+ */
+...@usesconfiguration(Class.class)
+public interface BeanValidatorGroupSource {
+       
+       /**
+        * Returns groups targeted for validation.
+        */
+       Class<?>[] get();
+}

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorGroupSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorGroupSource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,69 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry5.beanvalidator;
+
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.groups.Default;
+
+import 
org.apache.tapestry5.internal.beanvalidator.BeanFieldValidatorDefaultSource;
+import 
org.apache.tapestry5.internal.beanvalidator.BeanValidationGroupSourceImpl;
+import org.apache.tapestry5.internal.beanvalidator.BeanValidatorSourceImpl;
+import org.apache.tapestry5.ioc.Configuration;
+import org.apache.tapestry5.ioc.MappedConfiguration;
+import org.apache.tapestry5.ioc.ServiceBinder;
+import org.apache.tapestry5.ioc.annotations.Local;
+import org.apache.tapestry5.ioc.services.PropertyShadowBuilder;
+import org.apache.tapestry5.services.FieldValidatorDefaultSource;
+
+/**
+ * Module for JSR-303 services.
+ * 
+ * @since 5.2.0.0
+ */
+public class BeanValidatorModule 
+{
+       public static void bind(final ServiceBinder binder) 
+       {
+               binder.bind(FieldValidatorDefaultSource.class, 
BeanFieldValidatorDefaultSource.class)
+                                       
.withId("BeanFieldValidatorDefaultSource");
+               binder.bind(BeanValidatorGroupSource.class, 
BeanValidationGroupSourceImpl.class);
+               binder.bind(BeanValidatorSource.class, 
BeanValidatorSourceImpl.class);
+       }
+
+       public static void contributeServiceOverride(
+                       MappedConfiguration<Class, Object> configuration,
+                       @Local FieldValidatorDefaultSource source) 
+       {
+               configuration.add(FieldValidatorDefaultSource.class, source);
+       }
+       
+       public static Validator buildBeanValidator(ValidatorFactory 
validatorFactory, PropertyShadowBuilder propertyShadowBuilder) 
+       {
+               return propertyShadowBuilder.build(validatorFactory, 
"validator", Validator.class);
+       }
+       
+       
+       public static ValidatorFactory buildValidatorFactory( 
BeanValidatorSource beanValidatorSource, PropertyShadowBuilder 
propertyShadowBuilder) 
+       {
+               return propertyShadowBuilder.build(beanValidatorSource, 
"validatorFactory", ValidatorFactory.class);
+       }
+
+       public static void contributeBeanValidatorGroupSource(
+                       final Configuration<Class> configuration) 
+       {
+               configuration.add(Default.class);
+       }
+
+}

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorSource.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorSource.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorSource.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorSource.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,39 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry5.beanvalidator;
+
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.apache.tapestry5.ioc.annotations.UsesOrderedConfiguration;
+
+/**
+ * Creates {...@link javax.validation.ValidatorFactory}.
+ * 
+ * @since 5.2.0.0
+ */
+...@usesorderedconfiguration(BeanValidatorConfigurer.class)
+public interface BeanValidatorSource 
+{
+
+       /**
+        * Creates a new Validator.
+        */
+       Validator create();
+
+       /**
+        * Returns the ValidatorFactory from which Validators are created.
+        */
+       ValidatorFactory getValidatorFactory();
+}
\ No newline at end of file

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/beanvalidator/BeanValidatorSource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanFieldValidatorDefaultSource.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanFieldValidatorDefaultSource.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanFieldValidatorDefaultSource.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanFieldValidatorDefaultSource.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,138 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry5.internal.beanvalidator;
+
+import static java.lang.String.format;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.Field;
+import org.apache.tapestry5.FieldValidator;
+import org.apache.tapestry5.MarkupWriter;
+import org.apache.tapestry5.ValidationException;
+import org.apache.tapestry5.beanvalidator.BeanValidatorGroupSource;
+import org.apache.tapestry5.beanvalidator.BeanValidatorSource;
+import org.apache.tapestry5.internal.services.CompositeFieldValidator;
+import org.apache.tapestry5.ioc.AnnotationProvider;
+import org.apache.tapestry5.ioc.Messages;
+import org.apache.tapestry5.services.BeanValidationContext;
+import org.apache.tapestry5.services.Core;
+import org.apache.tapestry5.services.Environment;
+import org.apache.tapestry5.services.FieldValidatorDefaultSource;
+
+public class BeanFieldValidatorDefaultSource implements 
FieldValidatorDefaultSource 
+{
+       private final FieldValidatorDefaultSource fieldValidatorDefaultSource;
+       private final BeanValidatorSource beanValidatorSource;
+       private final BeanValidatorGroupSource beanValidationGroupSource;
+       private final Environment environment;
+
+       public BeanFieldValidatorDefaultSource(
+                       @Core FieldValidatorDefaultSource 
fieldValidatorDefaultSource,
+                       final BeanValidatorSource beanValidatorSource,
+                       final BeanValidatorGroupSource 
beanValidationGroupSource,
+                       final Environment environment) 
+       {
+               this.fieldValidatorDefaultSource = fieldValidatorDefaultSource;
+               this.beanValidatorSource = beanValidatorSource;
+               this.beanValidationGroupSource = beanValidationGroupSource;
+               this.environment = environment;
+       }
+
+       public FieldValidator createDefaultValidator(final Field field,
+                       final String overrideId, final Messages 
overrideMessages,
+                       final Locale locale, final Class propertyType,
+                       final AnnotationProvider propertyAnnotations) 
+       {
+               
+               FieldValidator validator = 
fieldValidatorDefaultSource.createDefaultValidator(
+                               field, overrideId, overrideMessages, locale, 
propertyType, propertyAnnotations);
+
+               FieldValidator beanValidator = new FieldValidator() {
+                       
+                       public boolean isRequired() 
+                       {
+                               return false;
+                       }
+
+                       public void render(final MarkupWriter writer) 
+                       {
+                       }
+
+                       public void validate(final Object value) throws 
ValidationException 
+                       {
+
+                               final BeanValidationContext 
beanValidationContext = BeanFieldValidatorDefaultSource.this.environment
+                                               
.peek(BeanValidationContext.class);
+
+                               if (beanValidationContext == null) 
+                               {
+                                       return;
+                               }
+                               
+                               final Validator validator = 
BeanFieldValidatorDefaultSource.this.beanValidatorSource.create();
+                               
+                               final Set<ConstraintViolation<Object>> 
violations = validator.validateValue(
+                                                               (Class<Object>) 
beanValidationContext.getObject().getClass(), overrideId, 
+                                                               value, 
beanValidationGroupSource.get());
+                               
+                               if (violations.isEmpty()) 
+                               {
+                                       return;
+                               }
+                               
+                               final StringBuilder builder = new 
StringBuilder();
+                               
+                               for (Iterator iterator = violations.iterator(); 
iterator.hasNext();) 
+                               {
+                                       ConstraintViolation<?> violation = 
(ConstraintViolation<Object>) iterator.next();
+                                       
+                                       builder.append(format("%s %s", 
field.getLabel(), violation.getMessage()));
+                                       
+                                       if(iterator.hasNext())
+                                               builder.append(", ");
+                       
+                               }
+                               
+                               throw new 
ValidationException(builder.toString());
+
+                       }
+
+               };
+               
+               return new CompositeFieldValidator(Arrays.asList(validator, 
beanValidator));
+       }
+
+       public FieldValidator createDefaultValidator(
+                       final ComponentResources resources, final String 
parameterName) 
+       {
+               final Class propertyType = 
resources.getBoundType(parameterName);
+               
+               if (propertyType == null)
+                       return null;
+
+               final Field field = (Field) resources.getComponent();
+
+               return createDefaultValidator(field, resources.getId(), 
resources
+                               .getContainerMessages(), resources.getLocale(), 
propertyType,
+                               resources.getAnnotationProvider(parameterName));
+       }
+}
\ No newline at end of file

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanFieldValidatorDefaultSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanFieldValidatorDefaultSource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidationGroupSourceImpl.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidationGroupSourceImpl.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidationGroupSourceImpl.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidationGroupSourceImpl.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,35 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry5.internal.beanvalidator;
+
+import java.util.Collection;
+
+import org.apache.tapestry5.beanvalidator.BeanValidatorGroupSource;
+
+
+public class BeanValidationGroupSourceImpl implements BeanValidatorGroupSource 
{
+       
+       private final Class<?>[] groups;
+
+       public BeanValidationGroupSourceImpl(Collection<Class> groups) 
+       {       
+               this.groups = groups.toArray(new Class<?>[]{});
+       }
+
+       public Class<?>[] get() 
+       {
+               return groups;
+       }
+
+}

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidationGroupSourceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidationGroupSourceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidatorSourceImpl.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidatorSourceImpl.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidatorSourceImpl.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidatorSourceImpl.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,52 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry5.internal.beanvalidator;
+
+import java.util.List;
+
+import javax.validation.Configuration;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.apache.tapestry5.beanvalidator.BeanValidatorConfigurer;
+import org.apache.tapestry5.beanvalidator.BeanValidatorSource;
+
+public class BeanValidatorSourceImpl implements BeanValidatorSource 
+{
+       private final ValidatorFactory validatorFactory;
+
+       public BeanValidatorSourceImpl(final List<BeanValidatorConfigurer> 
contribution) 
+       {
+               final Configuration<?> configuration = 
Validation.byDefaultProvider().configure();
+
+               for (final BeanValidatorConfigurer configurer : contribution) 
+               {
+                       configurer.configure(configuration);
+               }
+
+               this.validatorFactory = configuration.buildValidatorFactory();
+       }
+
+       public Validator create() 
+       {
+               return this.validatorFactory.getValidator();
+       }
+
+       public ValidatorFactory getValidatorFactory() 
+       {
+               return this.validatorFactory;
+       }
+
+}
\ No newline at end of file

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidatorSourceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/main/java/org/apache/tapestry5/internal/beanvalidator/BeanValidatorSourceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,74 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry5.beanvalidator.integration;
+
+import java.util.Locale;
+
+import org.apache.tapestry5.test.AbstractIntegrationTestSuite;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+...@test(sequential = true, groups = "integration")
+public class TapestryBeanValidationIntegrationTests extends 
AbstractIntegrationTestSuite
+{
+    public TapestryBeanValidationIntegrationTests()
+    {
+        super("src/test/webapp");
+    }
+    
+    @BeforeClass
+    public void setDefaultLocale()
+    {
+       //Hibernate validator uses Locale.getDefault()
+       Locale.setDefault(Locale.ENGLISH);
+    }
+
+    public void form_validation() throws Exception
+    {
+       start("Form Validation Demo");
+       
+       //Test JSR-303 validator
+       
+       clickAndWait(SUBMIT);
+
+        assertTextPresent("User Name may not be null");
+        
+        //Test Tapestry validator
+        
+        type("userName", "igor");
+       
+       clickAndWait(SUBMIT);
+       
+       assertTextPresent("You must provide at least 5 characters for User 
Name.");
+        
+        type("userName", "igor123");
+       
+       clickAndWait(SUBMIT);
+    }
+
+    public void beaneditform_validation() throws Exception
+    {
+       start("BeanEditForm Validation Demo");
+       
+       clickAndWait(SUBMIT);
+       
+        assertTextPresent("User Name may not be null", "Password may not be 
null");
+        
+        type("userName", "igor");
+       
+       clickAndWait(SUBMIT);
+       
+        assertTextPresent("User Name size must be between 7 and 10", "User 
Name must match \"[0-9]+\"");
+    }
+}
\ No newline at end of file

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/User.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/User.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/User.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/User.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,49 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.example.testapp.entities;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+public class User
+{
+       @NotNull
+       @Size(min=7, max=10)
+       @Pattern(regexp = "[0-9]+")
+       private String userName;
+       
+       @NotNull
+       private String password;
+       
+       public String getUserName() 
+       {
+               return userName;
+       }
+       
+       public void setUserName(String userName) 
+       {
+               this.userName = userName;
+       }
+       
+       public String getPassword() 
+       {
+               return password;
+       }
+       
+       public void setPassword(String password)
+       {
+               this.password = password;
+       }
+}

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/User.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/User.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/BeanEditFormValidationDemo.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/BeanEditFormValidationDemo.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/BeanEditFormValidationDemo.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/BeanEditFormValidationDemo.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,25 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.example.testapp.pages;
+
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.example.testapp.entities.User;
+
+public class BeanEditFormValidationDemo 
+{
+       @Property
+       @Persist
+       private User user;
+}

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/BeanEditFormValidationDemo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/BeanEditFormValidationDemo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/FormValidationDemo.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/FormValidationDemo.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/FormValidationDemo.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/FormValidationDemo.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,31 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.example.testapp.pages;
+
+import javax.validation.constraints.NotNull;
+
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.beaneditor.Validate;
+import org.example.testapp.services.Foo;
+
+public class FormValidationDemo 
+{
+       @NotNull(groups=Foo.class)
+       @Validate("minlength=5")
+       @Property
+       @Persist
+       private String userName;
+       
+}

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/FormValidationDemo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/FormValidationDemo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/Index.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/Index.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/Index.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/Index.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,23 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.example.testapp.pages;
+
+/**
+ * Start page of the test app.
+ *
+ */
+public class Index 
+{
+
+}

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/Index.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/Index.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,53 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.example.testapp.services;
+
+import org.apache.tapestry5.SymbolConstants;
+import org.apache.tapestry5.beanvalidator.BeanValidatorConfigurer;
+import org.apache.tapestry5.beanvalidator.BeanValidatorModule;
+import org.apache.tapestry5.ioc.Configuration;
+import org.apache.tapestry5.ioc.MappedConfiguration;
+import org.apache.tapestry5.ioc.OrderedConfiguration;
+import org.apache.tapestry5.ioc.annotations.SubModule;
+
+...@submodule(BeanValidatorModule.class)
+public class AppModule
+{
+
+    public static void 
contributeApplicationDefaults(MappedConfiguration<String, String> configuration)
+    {
+        configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
+    }
+    
+       public static void contributeBeanValidatorSource(
+                       final OrderedConfiguration<BeanValidatorConfigurer> 
configuration) 
+       {
+               configuration.add("Test", new BeanValidatorConfigurer() 
+               {
+                       
+                       public void configure(javax.validation.Configuration<?> 
configuration) 
+                       {
+                               configuration.ignoreXmlConfiguration();
+                       }
+               });
+       }
+
+
+       public static void contributeBeanValidatorGroupSource(
+                       final Configuration<Class> configuration) 
+       {
+               configuration.add(Foo.class);
+       }
+
+}

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/Foo.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/Foo.java?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/Foo.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/Foo.java
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,18 @@
+// Copyright 2009 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.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.example.testapp.services;
+
+public interface Foo 
+{
+}
\ No newline at end of file

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/Foo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/java/org/example/testapp/services/Foo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/BeanEditFormValidationDemo.tml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/BeanEditFormValidationDemo.tml?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/BeanEditFormValidationDemo.tml
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/BeanEditFormValidationDemo.tml
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,5 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
+    <body>
+        <t:beaneditform object="user" clientValidation="false"/>
+    </body>
+</html>
\ No newline at end of file

Added: 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/FormValidationDemo.tml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/FormValidationDemo.tml?rev=828823&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/FormValidationDemo.tml
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/FormValidationDemo.tml
 Thu Oct 22 19:22:08 2009
@@ -0,0 +1,16 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
+    <body>
+        <t:form clientValidation="false">
+               <t:errors/>
+               
+               <br/>
+               
+               <t:textfield t:id="userName" value="userName"/>
+               
+               <br/>
+               
+               <input type="submit" value="Login"/>
+               
+        </t:form>
+    </body>
+</html>
\ No newline at end of file

Added: tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/Index.tml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/Index.tml?rev=828823&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/Index.tml 
(added)
+++ tapestry/tapestry5/trunk/tapestry-beanvalidator/src/test/webapp/Index.tml 
Thu Oct 22 19:22:08 2009
@@ -0,0 +1,17 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
+    <head>
+        <title>Start Page</title>
+    </head>
+    <body>
+        <h2>Test application for tapestry-jsr 303 integration tests</h2>
+
+        <ul>
+            <li>
+                <t:pagelink page="FormValidationDemo">Form Validation 
Demo</t:pagelink>
+            </li>
+            <li>
+                <t:pagelink page="BeanEditFormValidationDemo">BeanEditForm 
Validation Demo</t:pagelink>
+            </li>
+        </ul>
+    </body>
+</html>


Reply via email to