cleanup
git-svn-id: https://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/prepare@835598 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/1_2_2_prepare_rc_base/assembly/pom.xml b/1_2_2_prepare_rc_base/assembly/pom.xml
new file mode 100644
index 0000000..7a647e7
--- /dev/null
+++ b/1_2_2_prepare_rc_base/assembly/pom.xml
@@ -0,0 +1,181 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>myfaces-extval-assembly12</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache MyFaces Extensions Validator Assembly</name>
+ <description>MyFaces Extensions Validator Assembly is used to generate
+ .zip and .tar.gz distributions </description>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-parent</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/assembly</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/assembly</developerConnection>
+ <url>http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/1_2_2_rc/assembly</url>
+ </scm>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-javadoc</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>${core.version}</version>
+ <classifier>javadoc</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>myfaces-extval-generic-support</artifactId>
+ <version>${generic-support.version}</version>
+ <classifier>javadoc</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>myfaces-extval-trinidad-support</artifactId>
+ <version>${trinidad-support.version}</version>
+ <classifier>javadoc</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>myfaces-extval-property-validation</artifactId>
+ <version>${property-validation.version}</version>
+ <classifier>javadoc</classifier>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/javadoc</outputDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-source</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>${core.version}</version>
+ <classifier>sources</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>myfaces-extval-generic-support</artifactId>
+ <version>${generic-support.version}</version>
+ <classifier>sources</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>myfaces-extval-trinidad-support</artifactId>
+ <version>${trinidad-support.version}</version>
+ <classifier>sources</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>myfaces-extval-property-validation</artifactId>
+ <version>${property-validation.version}</version>
+ <classifier>sources</classifier>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/src</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <!-- EXECUTE mvn package to generate assembly files -->
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>make_assembly_src</id>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/coresrc.xml</descriptor>
+ </descriptors>
+ <finalName>myfaces-extval12-${version}-src</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ <outputDirectory>target/assembly/out</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>make_assembly_bin</id>
+ <configuration>
+ <descriptors>
+ <descriptor>${basedir}/src/main/assembly/corebin.xml</descriptor>
+ </descriptors>
+ <finalName>myfaces-extval12-${version}-bin</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ <outputDirectory>target/assembly/out</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>${core.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>myfaces-extval-property-validation</artifactId>
+ <version>${property-validation.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>myfaces-extval-trinidad-support</artifactId>
+ <version>${trinidad-support.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>myfaces-extval-generic-support</artifactId>
+ <version>${generic-support.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- Since extval could be async released, an generated assembly could contain different
+ artifact versions -->
+ <properties>
+ <core.version>1.2.2-SNAPSHOT</core.version>
+ <trinidad-support.version>1.2.2-SNAPSHOT</trinidad-support.version>
+ <generic-support.version>1.2.2-SNAPSHOT</generic-support.version>
+ <property-validation.version>1.2.2-SNAPSHOT</property-validation.version>
+ </properties>
+</project>
diff --git a/1_2_2_prepare_rc_base/assembly/src/main/assembly/corebin.xml b/1_2_2_prepare_rc_base/assembly/src/main/assembly/corebin.xml
new file mode 100644
index 0000000..cb6795b
--- /dev/null
+++ b/1_2_2_prepare_rc_base/assembly/src/main/assembly/corebin.xml
@@ -0,0 +1,32 @@
+<assembly>
+ <id>corebin</id>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>README*</include>
+ <include>LICENSE*</include>
+ <include>NOTICE*</include>
+ <include>RELEASE*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/javadoc</directory>
+ <outputDirectory>javadoc</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/1_2_2_prepare_rc_base/assembly/src/main/assembly/coresrc.xml b/1_2_2_prepare_rc_base/assembly/src/main/assembly/coresrc.xml
new file mode 100644
index 0000000..ee186c6
--- /dev/null
+++ b/1_2_2_prepare_rc_base/assembly/src/main/assembly/coresrc.xml
@@ -0,0 +1,27 @@
+<assembly>
+ <id>coresrc</id>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>README*</include>
+ <include>LICENSE*</include>
+ <include>NOTICE*</include>
+ <include>RELEASE*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/src</directory>
+ <outputDirectory>src</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
+
diff --git a/1_2_2_prepare_rc_base/assembly/src/main/resources/LICENSE.txt b/1_2_2_prepare_rc_base/assembly/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..dd5b3a5
--- /dev/null
+++ b/1_2_2_prepare_rc_base/assembly/src/main/resources/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/assembly/src/main/resources/NOTICE.txt b/1_2_2_prepare_rc_base/assembly/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..409bdb1
--- /dev/null
+++ b/1_2_2_prepare_rc_base/assembly/src/main/resources/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/generic-support/pom.xml b/1_2_2_prepare_rc_base/component-support/generic-support/pom.xml
new file mode 100644
index 0000000..10af60f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/generic-support/pom.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>myfaces-extval-generic-support</artifactId>
+
+ <name>MyFaces Extensions-Validator Generic Support Module</name>
+ <version>1.2.2-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>component-support-modules-project</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ <version>2.1_3</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/config</directory>
+ <includes>
+ <include>**/*xml</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*properties</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/1_2_2_prepare_rc_base/component-support/generic-support/src/main/config/faces-config.xml b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/config/faces-config.xml
new file mode 100644
index 0000000..38463e6
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/config/faces-config.xml
@@ -0,0 +1,28 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+ <lifecycle>
+ <phase-listener>
+ org.apache.myfaces.extensions.validator.generic.startup.GenericModuleStartupListener
+ </phase-listener>
+ </lifecycle>
+</faces-config>
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/META-INF/LICENSE.txt b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/META-INF/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/META-INF/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/META-INF/NOTICE.txt b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/META-INF/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/META-INF/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRenderKit.java b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRenderKit.java
new file mode 100644
index 0000000..7fb558a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRenderKit.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.generic.renderkit;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRenderKit;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.render.RenderKit;
+import javax.faces.render.Renderer;
+import java.lang.reflect.Method;
+
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodProxy;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValGenericRenderKit extends ExtValRenderKit implements MethodInterceptor
+{
+ public static RenderKit newInstance(RenderKit renderKit)
+ {
+ Class currentClass = renderKit.getClass();
+
+ //it's not possible to wrap the converter again - occurs e.g. under solaris + bea weblogic
+ if (currentClass.getName().contains("$$EnhancerByCGLIB$$")
+ || currentClass.getName().contains("$$FastClassByCGLIB$$"))
+ {
+ return renderKit;
+ }
+
+ Enhancer enhancer = new Enhancer();
+ enhancer.setSuperclass(renderKit.getClass());
+ enhancer.setCallback(new ExtValGenericRenderKit(renderKit));
+
+ return (RenderKit) enhancer.create();
+ }
+
+ public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable
+ {
+ if(method.getName().equals("getRenderer"))
+ {
+ return getRenderer((String)args[0], (String)args[1]);
+ }
+ else if(method.getName().equals("addRenderer"))
+ {
+ addRenderer((String)args[0], (String)args[1], (Renderer)args[2]);
+ }
+ else
+ {
+ return proxy.invokeSuper(obj, args);
+ }
+
+ return null;
+ }
+
+ public ExtValGenericRenderKit(RenderKit wrapped)
+ {
+ super(wrapped);
+ }
+
+ @Override
+ protected Renderer createWrapper(Renderer renderer)
+ {
+ return ExtValGenericRendererWrapper.newInstance(renderer);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRendererWrapper.java b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRendererWrapper.java
new file mode 100644
index 0000000..e50d622
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRendererWrapper.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.generic.renderkit;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererWrapper;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+import java.lang.reflect.Method;
+
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodProxy;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public final class ExtValGenericRendererWrapper extends ExtValRendererWrapper implements MethodInterceptor
+{
+ public static Renderer newInstance(Renderer renderer)
+ {
+ Class currentClass = renderer.getClass();
+
+ //to avoid re-wrapping - occurs e.g. under solaris + bea weblogic
+ if (currentClass.getName().contains("$$EnhancerByCGLIB$$") ||
+ currentClass.getName().contains("$$FastClassByCGLIB$$"))
+ {
+ return renderer;
+ }
+
+ Enhancer enhancer = new Enhancer();
+ enhancer.setSuperclass(renderer.getClass());
+ enhancer.setCallback(new ExtValGenericRendererWrapper(renderer));
+
+ return (Renderer) enhancer.create();
+ }
+
+ public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable
+ {
+ if (method.getName().equals("getConvertedValue") && args[1] instanceof UIComponent)
+ {
+ return getConvertedValue((FacesContext)args[0], (UIComponent)args[1], args[2]);
+ }
+ else if (method.getName().equals("decode") && args[1] instanceof UIComponent)
+ {
+ decode((FacesContext)args[0], (UIComponent)args[1]);
+ }
+ else if (method.getName().equals("encodeBegin") && args[1] instanceof UIComponent)
+ {
+ encodeBegin((FacesContext)args[0], (UIComponent)args[1]);
+ }
+ else if (method.getName().equals("encodeChildren") && args[1] instanceof UIComponent)
+ {
+ encodeChildren((FacesContext)args[0], (UIComponent)args[1]);
+ }
+ else if (method.getName().equals("encodeEnd") && args[1] instanceof UIComponent)
+ {
+ encodeEnd((FacesContext)args[0], (UIComponent)args[1]);
+ }
+ else if (method.getName().equals("convertClientId") && args[1] instanceof String)
+ {
+ return convertClientId((FacesContext)args[0], (String)args[1]);
+ }
+ else if (method.getName().equals("getRendersChildren"))
+ {
+ return getRendersChildren();
+ }
+ else
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("method " + method.getName() + " called without rendering-interceptors");
+ }
+
+ return proxy.invokeSuper(obj, args);
+ }
+ return null;
+ }
+
+ public ExtValGenericRendererWrapper(Renderer wrapped)
+ {
+ super(wrapped);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java
new file mode 100644
index 0000000..6d917e6
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.generic.renderkit;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.AbstractRenderKitWrapperFactory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.render.RenderKit;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class GenericRenderKitWrapperFactory extends AbstractRenderKitWrapperFactory
+{
+ protected RenderKit createWrapper(RenderKit renderKit)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("extval renderkit wrapper created for " + renderKit.getClass().getName() + " via cglib");
+ }
+
+ return ExtValGenericRenderKit.newInstance(renderKit);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/startup/GenericModuleStartupListener.java b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/startup/GenericModuleStartupListener.java
new file mode 100644
index 0000000..88c7b41
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/startup/GenericModuleStartupListener.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.generic.startup;
+
+import org.apache.myfaces.extensions.validator.core.startup.AbstractStartupListener;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.renderkit.AbstractRenderKitWrapperFactory;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.generic.renderkit.GenericRenderKitWrapperFactory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class GenericModuleStartupListener extends AbstractStartupListener
+{
+ protected void init()
+ {
+ ExtValContext.getContext().getFactoryFinder().getFactory(FactoryNames.RENDERKIT_WRAPPER_FACTORY,
+ AbstractRenderKitWrapperFactory.class).addRenderKitWrapperFactory(new GenericRenderKitWrapperFactory());
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/generic-support/src/main/resources/LICENSE.txt b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/resources/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/component-support/generic-support/src/main/resources/NOTICE.txt b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/generic-support/src/main/resources/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/generic-support/src/site/apt/index.apt b/1_2_2_prepare_rc_base/component-support/generic-support/src/site/apt/index.apt
new file mode 100644
index 0000000..659a8e8
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/generic-support/src/site/apt/index.apt
@@ -0,0 +1,9 @@
+ ------
+Apache MyFaces Extensions Validator Generic Support Module
+ ------
+
+Apache MyFaces Extensions Validator Generic Support Module Overview
+
+ MyFaces Extensions Validator Generic Support Module provides generic Support for JSF component frameworks which have special requirements (e.g. RichFaces, MyFaces Tobago, ...).
+
+ MyFaces Extensions Validator is compatible with JSF 1.1.x and JSF 1.2.x. Both versions require Java 1.5+
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/pom.xml b/1_2_2_prepare_rc_base/component-support/pom.xml
new file mode 100644
index 0000000..2377b25
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/pom.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <packaging>pom</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>component-support-modules-project</artifactId>
+
+ <name>MyFaces Extensions-Validator Component-Support Modules</name>
+ <version>1.2.2-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-parent</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/component-support</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/component-support</developerConnection>
+ <url>http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/1_2_2_rc/component-support</url>
+ </scm>
+
+ <modules>
+ <module>trinidad-support</module>
+ <module>generic-support</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <trinidad.version>1.2.9</trinidad.version>
+ </properties>
+</project>
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/pom.xml b/1_2_2_prepare_rc_base/component-support/trinidad-support/pom.xml
new file mode 100644
index 0000000..c23f5db
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/pom.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>myfaces-extval-trinidad-support</artifactId>
+
+ <name>MyFaces Extensions-Validator Trinidad Support Module</name>
+ <version>1.2.2-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>component-support-modules-project</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.trinidad</groupId>
+ <artifactId>trinidad-api</artifactId>
+ <version>${trinidad.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.trinidad</groupId>
+ <artifactId>trinidad-impl</artifactId>
+ <version>${trinidad.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/config</directory>
+ <includes>
+ <include>**/*xml</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*properties</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/config/faces-config.xml b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/config/faces-config.xml
new file mode 100644
index 0000000..098b2bb
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/config/faces-config.xml
@@ -0,0 +1,34 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+ <lifecycle>
+ <phase-listener>
+ org.apache.myfaces.extensions.validator.trinidad.startup.TrinidadModuleStartupListener
+ </phase-listener>
+ </lifecycle>
+
+ <lifecycle>
+ <phase-listener>
+ org.apache.myfaces.extensions.validator.trinidad.ExtValTrinidadValidationPhaseListener
+ </phase-listener>
+ </lifecycle>
+</faces-config>
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/META-INF/LICENSE.txt b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/META-INF/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/META-INF/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/META-INF/NOTICE.txt b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/META-INF/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/META-INF/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/ExtValTrinidadClientValidatorWrapper.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/ExtValTrinidadClientValidatorWrapper.java
new file mode 100644
index 0000000..150eb68
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/ExtValTrinidadClientValidatorWrapper.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad;
+
+import org.apache.myfaces.trinidad.validator.ClientValidator;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import java.io.Serializable;
+import java.util.Collection;
+
+/**
+ * in case of client-side validation a trinidad client validator is added to the component based on the meta-data.
+ * at the postback: the extval validation strategy gets called and after that the added validator.
+ * this wrapper prevents such a server-side double validation.
+ * it just delegates the client-side functionality.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.REUSE)
+public class ExtValTrinidadClientValidatorWrapper implements Validator, ClientValidator, Serializable
+{
+ private transient ClientValidator wrapped;
+ private static final long serialVersionUID = 1414547841700621410L;
+
+ public ExtValTrinidadClientValidatorWrapper(ClientValidator clientValidator)
+ {
+ this.wrapped = clientValidator;
+ }
+
+ public void validate(FacesContext facesContext, UIComponent uiComponent, Object o) throws ValidatorException
+ {
+ //don't validate - the extval validation strategy will do that
+ }
+
+ public String getClientLibrarySource(FacesContext facesContext)
+ {
+ return wrapped.getClientLibrarySource(facesContext);
+ }
+
+ public Collection<String> getClientImportNames()
+ {
+ return wrapped.getClientImportNames();
+ }
+
+ public String getClientScript(FacesContext facesContext, UIComponent uiComponent)
+ {
+ return wrapped.getClientScript(facesContext, uiComponent);
+ }
+
+ public String getClientValidation(FacesContext facesContext, UIComponent uiComponent)
+ {
+ return wrapped.getClientValidation(facesContext, uiComponent);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/ExtValTrinidadValidationPhaseListener.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/ExtValTrinidadValidationPhaseListener.java
new file mode 100644
index 0000000..9dbc194
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/ExtValTrinidadValidationPhaseListener.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad;
+
+import org.apache.myfaces.extensions.validator.trinidad.renderkit.ExtValTrinidadRenderKit;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.FactoryFinder;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import javax.faces.render.RenderKit;
+import javax.faces.render.RenderKitFactory;
+
+/**
+ * use this phase-listener instead of a ExtValTrinidadRenderKitWrapperFactory due to a trinidad issue
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValTrinidadValidationPhaseListener implements PhaseListener
+{
+ public void afterPhase(PhaseEvent event)
+ {
+ }
+
+ public void beforePhase(PhaseEvent event)
+ {
+ if(event.getPhaseId() != PhaseId.APPLY_REQUEST_VALUES && event.getPhaseId() != PhaseId.RENDER_RESPONSE)
+ {
+ return;
+ }
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ RenderKitFactory renderKitFactory = (RenderKitFactory)
+ FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+
+ String renderKitId = facesContext.getViewRoot().getRenderKitId();
+
+ if(ExtValTrinidadRenderKit.ID.equals(renderKitId))
+ {
+ return;
+ }
+
+ RenderKit renderKit = renderKitFactory.getRenderKit(FacesContext.getCurrentInstance(), renderKitId);
+ renderKitFactory.addRenderKit(ExtValTrinidadRenderKit.ID, new ExtValTrinidadRenderKit(renderKit));
+ facesContext.getViewRoot().setRenderKitId(ExtValTrinidadRenderKit.ID);
+ }
+
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.RENDER_RESPONSE;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/WebXmlParameter.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/WebXmlParameter.java
new file mode 100644
index 0000000..4e0cb74
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/WebXmlParameter.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.WebXmlUtils;
+
+/**
+ * centralized in order that these information aren't spread over the complete code base
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface WebXmlParameter
+{
+ /*
+ * deactivate
+ */
+ static final String DEACTIVATE_CLIENT_SIDE_TRINIDAD_VALIDATION = WebXmlUtils
+ .getInitParameter("DEACTIVATE_CLIENT_SIDE_TRINIDAD_VALIDATION");
+
+ static final String DEACTIVATE_TRINIDAD_CORE_OUTPUT_LABEL_INITIALIZATION = WebXmlUtils
+ .getInitParameter("DEACTIVATE_TRINIDAD_CORE_OUTPUT_LABEL_INITIALIZATION");
+
+ static final String DEACTIVATE_TRINIDAD_VALIDATION_EXCEPTION_INTERCEPTOR = WebXmlUtils
+ .getInitParameter("DEACTIVATE_TRINIDAD_VALIDATION_EXCEPTION_INTERCEPTOR");
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/DoubleRangeInitializer.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/DoubleRangeInitializer.java
new file mode 100644
index 0000000..eb329f6
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/DoubleRangeInitializer.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.initializer.component;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.trinidad.ExtValTrinidadClientValidatorWrapper;
+import org.apache.myfaces.trinidad.validator.DoubleRangeValidator;
+import org.apache.myfaces.trinidad.validator.ClientValidator;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@ToDo(value = Priority.MEDIUM, description = "skipValidationSupport for client-side validation")
+@UsageInformation(UsageCategory.INTERNAL)
+class DoubleRangeInitializer extends TrinidadComponentInitializer
+{
+ @Override
+ public boolean configureTrinidadComponent(FacesContext facesContext, UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ boolean informationAdded = false;
+ DoubleRangeValidator doubleRangeValidator = (DoubleRangeValidator)facesContext.getApplication()
+ .createValidator("org.apache.myfaces.trinidad.DoubleRange");
+
+ if(metaData.containsKey(CommonMetaDataKeys.RANGE_MIN))
+ {
+ Object min = metaData.get(CommonMetaDataKeys.RANGE_MIN);
+
+ if(min instanceof Double)
+ {
+ doubleRangeValidator.setMinimum((Double)min);
+ informationAdded = true;
+ }
+ }
+
+ if(metaData.containsKey(CommonMetaDataKeys.RANGE_MAX))
+ {
+ Object maxLength = metaData.get(CommonMetaDataKeys.RANGE_MAX);
+
+ if(maxLength instanceof Double)
+ {
+ doubleRangeValidator.setMaximum((Double)maxLength);
+ informationAdded = true;
+ }
+ }
+
+ if(informationAdded &&
+ doubleRangeValidator instanceof ClientValidator && uiComponent instanceof EditableValueHolder)
+ {
+ ((EditableValueHolder)uiComponent).addValidator(
+ new ExtValTrinidadClientValidatorWrapper((ClientValidator)doubleRangeValidator));
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LengthInitializer.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LengthInitializer.java
new file mode 100644
index 0000000..6741225
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LengthInitializer.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.initializer.component;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.trinidad.ExtValTrinidadClientValidatorWrapper;
+import org.apache.myfaces.trinidad.validator.ClientValidator;
+import org.apache.myfaces.trinidad.component.core.output.CoreOutputLabel;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.LengthValidator;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@ToDo(value = Priority.MEDIUM, description = "skipValidationSupport for client-side validation")
+@UsageInformation(UsageCategory.INTERNAL)
+class LengthInitializer extends TrinidadComponentInitializer
+{
+ @Override
+ public boolean configureTrinidadComponent(FacesContext facesContext, UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ boolean informationAdded = false;
+ //TODO
+ LengthValidator lengthValidator = (LengthValidator)facesContext.getApplication()
+ .createValidator("org.apache.myfaces.trinidad.Length");
+
+ if(metaData.containsKey(CommonMetaDataKeys.MIN_LENGTH))
+ {
+ Object min = metaData.get(CommonMetaDataKeys.MIN_LENGTH);
+
+ if(min instanceof Integer)
+ {
+ lengthValidator.setMinimum((Integer)min);
+ informationAdded = true;
+ }
+ }
+
+ if(metaData.containsKey(CommonMetaDataKeys.MAX_LENGTH))
+ {
+ Object maxLength = metaData.get(CommonMetaDataKeys.MAX_LENGTH);
+
+ if(maxLength instanceof Integer)
+ {
+ if(processComponent(uiComponent))
+ {
+ ReflectionUtils.tryToInvokeMethod(
+ uiComponent,
+ ReflectionUtils.tryToGetMethod(
+ uiComponent.getClass(),
+ "setMaximumLength",
+ int.class),
+ maxLength);
+ }
+ lengthValidator.setMaximum((Integer)maxLength);
+ informationAdded = true;
+ }
+ }
+
+ //reInitValidators((EditableValueHolder)uiComponent, metaData); //search wrappers and call .deactivate
+
+ if(informationAdded && lengthValidator instanceof ClientValidator)
+ {
+ if(uiComponent instanceof EditableValueHolder)
+ {
+ ((EditableValueHolder)uiComponent).addValidator(
+ new ExtValTrinidadClientValidatorWrapper((ClientValidator)lengthValidator));
+ }
+ else if (uiComponent instanceof CoreOutputLabel)
+ {
+ if(lengthValidator.getMinimum() > 0)
+ {
+ ((CoreOutputLabel)uiComponent).setShowRequired(true);
+ }
+
+ if(Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.SKIP_VALIDATION)))
+ {
+ ((CoreOutputLabel)uiComponent).setShowRequired(false);
+ }
+ }
+
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LongRangeInitializer.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LongRangeInitializer.java
new file mode 100644
index 0000000..0ec34de
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LongRangeInitializer.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.initializer.component;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.trinidad.ExtValTrinidadClientValidatorWrapper;
+import org.apache.myfaces.trinidad.validator.LongRangeValidator;
+import org.apache.myfaces.trinidad.validator.ClientValidator;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@ToDo(value = Priority.MEDIUM, description = "skipValidationSupport for client-side validation")
+@UsageInformation(UsageCategory.INTERNAL)
+class LongRangeInitializer extends TrinidadComponentInitializer
+{
+ @Override
+ public boolean configureTrinidadComponent(FacesContext facesContext, UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ boolean informationAdded = false;
+ LongRangeValidator longRangeValidator = (LongRangeValidator)facesContext.getApplication()
+ .createValidator("org.apache.myfaces.trinidad.LongRange");
+
+ if(metaData.containsKey(CommonMetaDataKeys.RANGE_MIN))
+ {
+ Object min = metaData.get(CommonMetaDataKeys.RANGE_MIN);
+
+ if(min instanceof Long)
+ {
+ longRangeValidator.setMinimum((Long)min);
+ informationAdded = true;
+ }
+ }
+
+ if(metaData.containsKey(CommonMetaDataKeys.RANGE_MAX))
+ {
+ Object maxLength = metaData.get(CommonMetaDataKeys.RANGE_MAX);
+
+ if(maxLength instanceof Long)
+ {
+ longRangeValidator.setMaximum((Long)maxLength);
+ informationAdded = true;
+ }
+ }
+
+ if(informationAdded &&
+ longRangeValidator instanceof ClientValidator && uiComponent instanceof EditableValueHolder)
+ {
+ ((EditableValueHolder)uiComponent).addValidator(
+ new ExtValTrinidadClientValidatorWrapper((ClientValidator)longRangeValidator));
+
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/PatternInitializer.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/PatternInitializer.java
new file mode 100644
index 0000000..7ff088d
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/PatternInitializer.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.initializer.component;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.trinidad.ExtValTrinidadClientValidatorWrapper;
+import org.apache.myfaces.trinidad.validator.RegExpValidator;
+import org.apache.myfaces.trinidad.validator.ClientValidator;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@ToDo(value = Priority.MEDIUM, description = "skipValidationSupport for client-side validation")
+@UsageInformation(UsageCategory.INTERNAL)
+class PatternInitializer extends TrinidadComponentInitializer
+{
+ @Override
+ public boolean configureTrinidadComponent(FacesContext facesContext, UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ if(!metaData.containsKey(CommonMetaDataKeys.PATTERN))
+ {
+ return false;
+ }
+
+ String[] patterns = (String[])metaData.get(CommonMetaDataKeys.PATTERN);
+
+ RegExpValidator regExpValidator;
+
+ for(String pattern : patterns)
+ {
+ regExpValidator = (RegExpValidator)facesContext.getApplication()
+ .createValidator("org.apache.myfaces.trinidad.RegExp");
+
+ regExpValidator.setPattern(pattern);
+ regExpValidator.setMessageDetailNoMatch((String)metaData.get(
+ CommonMetaDataKeys.PATTERN_VALIDATION_ERROR_MESSAGE));
+
+ if(regExpValidator instanceof ClientValidator && uiComponent instanceof EditableValueHolder)
+ {
+ ((EditableValueHolder)uiComponent).addValidator(
+ new ExtValTrinidadClientValidatorWrapper((ClientValidator)regExpValidator));
+ }
+ }
+ return true;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/RequiredInitializer.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/RequiredInitializer.java
new file mode 100644
index 0000000..5f3d136
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/RequiredInitializer.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.initializer.component;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.trinidad.util.TrinidadUtils;
+import org.apache.myfaces.trinidad.component.core.output.CoreOutputLabel;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class RequiredInitializer extends TrinidadComponentInitializer
+{
+ @Override
+ public boolean configureTrinidadComponent(FacesContext facesContext, UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ if(metaData.containsKey(CommonMetaDataKeys.REQUIRED) ||
+ metaData.containsKey(CommonMetaDataKeys.WEAK_REQUIRED)||
+ metaData.containsKey(CommonMetaDataKeys.SKIP_VALIDATION))
+ {
+ if((
+ (!Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.SKIP_VALIDATION)) &&
+ Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.WEAK_REQUIRED))) ||
+ Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.REQUIRED)))
+ &&
+ Boolean.TRUE.equals(isComponentRequired(uiComponent)))
+ {
+ if(uiComponent instanceof EditableValueHolder)
+ {
+ ((EditableValueHolder)uiComponent).setRequired(true);
+ }
+ else if (uiComponent instanceof CoreOutputLabel)
+ {
+ ((CoreOutputLabel)uiComponent).setShowRequired(true);
+ }
+
+ return true;
+ }
+ else if(Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.SKIP_VALIDATION)) &&
+ !Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.REQUIRED)))
+ {
+ if(uiComponent instanceof EditableValueHolder)
+ {
+ ((EditableValueHolder)uiComponent).setRequired(false);
+ }
+ else if (uiComponent instanceof CoreOutputLabel)
+ {
+ ((CoreOutputLabel)uiComponent).setShowRequired(false);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected Boolean isComponentRequired(UIComponent uiComponent)
+ {
+ if(uiComponent instanceof CoreOutputLabel)
+ {
+ uiComponent = TrinidadUtils.findLabeledEditableComponent((CoreOutputLabel) uiComponent);
+
+ if(uiComponent == null)
+ {
+ return false;
+ }
+ }
+
+ //compare with false so true = true or null
+ boolean isReadOnly = !Boolean.FALSE.equals(ReflectionUtils.tryToInvokeMethod(
+ uiComponent, ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "isReadOnly")));
+ boolean isDisabled = !Boolean.FALSE.equals(ReflectionUtils.tryToInvokeMethod(
+ uiComponent, ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "isDisabled")));
+
+ return !(isReadOnly || isDisabled);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/TrinidadComponentInitializer.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/TrinidadComponentInitializer.java
new file mode 100644
index 0000000..193108c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/TrinidadComponentInitializer.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.initializer.component;
+
+import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.trinidad.context.RequestContext;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class TrinidadComponentInitializer implements ComponentInitializer
+{
+ private static final String TRINIDAD_CORE_INPUT_TEXT
+ = "org.apache.myfaces.trinidad.component.core.input.CoreInputText";
+ private static final String TRINIDAD_CORE_INPUT_DATE
+ = "org.apache.myfaces.trinidad.component.core.input.CoreInputDate";
+
+ private static List<TrinidadComponentInitializer> componentInitializers =
+ new ArrayList<TrinidadComponentInitializer>();
+
+ static
+ {
+ componentInitializers.add(new RequiredInitializer());
+ componentInitializers.add(new LengthInitializer());
+ componentInitializers.add(new LongRangeInitializer());
+ componentInitializers.add(new DoubleRangeInitializer());
+ componentInitializers.add(new PatternInitializer());
+ //componentInitializers.add(new ValidatorInitializer());
+ }
+
+ @ToDo(value = Priority.LOW, description = "check ppr issue")
+ public final void configureComponent(FacesContext facesContext, UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ for(TrinidadComponentInitializer componentInitializer : componentInitializers)
+ {
+ if(componentInitializer.configureTrinidadComponent(facesContext, uiComponent, metaData))
+ {
+ updateComponent(facesContext, uiComponent);
+ }
+ }
+ }
+
+ protected boolean configureTrinidadComponent(FacesContext facesContext, UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ return false;
+ }
+
+ protected boolean processComponent(UIComponent uiComponent)
+ {
+ return TRINIDAD_CORE_INPUT_TEXT.equals(uiComponent.getClass().getName()) ||
+ TRINIDAD_CORE_INPUT_DATE.equals(uiComponent.getClass().getName());
+ }
+
+ private void updateComponent(FacesContext facesContext, UIComponent uiComponent)
+ {
+ if(RequestContext.getCurrentInstance().isPartialRequest(facesContext))
+ {
+ RequestContext.getCurrentInstance().addPartialTarget(uiComponent.getParent());
+ }
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/ValidatorInitializer.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/ValidatorInitializer.java
new file mode 100644
index 0000000..de8878c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/ValidatorInitializer.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.initializer.component;
+
+import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(value = UsageCategory.INTERNAL)
+@ToDo(value = Priority.LOW, description = "impl. trinidad e-mail validator")
+class ValidatorInitializer implements ComponentInitializer
+{
+ public void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData)
+ {
+ if(!metaData.containsKey(CommonMetaDataKeys.CUSTOM))
+ {
+ return;
+ }
+
+ Object value = metaData.get(CommonMetaDataKeys.CUSTOM);
+
+ if(!(value instanceof List))
+ {
+ return;
+ }
+
+ for(Object currentValue : (List)value)
+ {
+ if(!(currentValue instanceof String))
+ {
+ continue;
+ }
+
+ if(CommonMetaDataKeys.EMAIL.equals(currentValue))
+ {
+ //TODO
+ }
+ }
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadRendererInterceptor.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadRendererInterceptor.java
new file mode 100644
index 0000000..2e67cf9
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadRendererInterceptor.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.interceptor;
+
+import org.apache.myfaces.extensions.validator.core.interceptor.AbstractRendererInterceptor;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.ComponentMetaDataExtractorFactory;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.myfaces.extensions.validator.trinidad.util.TrinidadUtils;
+import org.apache.myfaces.trinidad.component.core.output.CoreOutputLabel;
+
+import javax.faces.render.Renderer;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+public class TrinidadRendererInterceptor extends AbstractRendererInterceptor
+{
+ public void beforeEncodeBegin(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
+ throws IOException
+ {
+ if(filterCoreOutputLabel(uiComponent))
+ {
+ initCoreOutputLabel(facesContext, (CoreOutputLabel)uiComponent);
+ }
+ }
+
+ private boolean filterCoreOutputLabel(UIComponent uiComponent)
+ {
+ return (uiComponent instanceof CoreOutputLabel);
+ }
+
+ protected void initCoreOutputLabel(FacesContext facesContext, CoreOutputLabel coreOutputLabel)
+ {
+ ValidationStrategy validationStrategy;
+ MetaDataTransformer metaDataTransformer;
+
+ MetaDataExtractor annotationExtractor = ExtValContext.getContext().getFactoryFinder().getFactory(
+ FactoryNames.COMPONENT_META_DATA_EXTRACTOR_FACTORY, ComponentMetaDataExtractorFactory.class).create();
+
+ UIComponent targetComponent = TrinidadUtils.findLabeledEditableComponent(coreOutputLabel);
+
+ if(targetComponent == null || !isComponentEditable(targetComponent))
+ {
+ return;
+ }
+
+ Boolean skipInitialization = false;
+
+ Map<String, Object> metaData;
+ for (MetaDataEntry entry : annotationExtractor.extract(facesContext, targetComponent).getMetaDataEntries())
+ {
+ validationStrategy = ExtValUtils.getValidationStrategyForMetaData(entry.getKey());
+
+ if (validationStrategy != null)
+ {
+ metaDataTransformer = ExtValUtils.getMetaDataTransformerForValidationStrategy(validationStrategy);
+
+ if(metaDataTransformer != null)
+ {
+ metaData = metaDataTransformer.convertMetaData(entry);
+ }
+ else
+ {
+ metaData = null;
+ }
+
+ if(metaData == null)
+ {
+ metaData = new HashMap<String, Object>();
+ }
+ else if(metaData.containsKey(CommonMetaDataKeys.SKIP_VALIDATION))
+ {
+ //execute skip validation strategy -> skip validation y/n in entry
+ validationStrategy.validate(facesContext, targetComponent, entry, null);
+ skipInitialization = entry.getProperty(CommonMetaDataKeys.SKIP_VALIDATION, Boolean.class);
+ continue;
+ }
+
+ if(Boolean.TRUE.equals(skipInitialization) && !metaData.isEmpty() &&
+ ExtValUtils.isSkipableValidationStrategy(validationStrategy.getClass()))
+ {
+ metaData.put(CommonMetaDataKeys.SKIP_VALIDATION, true);
+ }
+
+ if(!metaData.isEmpty())
+ {
+ ExtValUtils.configureComponentWithMetaData(facesContext, coreOutputLabel, metaData);
+ }
+ }
+ }
+ }
+
+ private boolean isComponentEditable(UIComponent uiComponent)
+ {
+ //compare with false so true = true or null
+ boolean isReadOnly = !Boolean.FALSE.equals(ReflectionUtils.tryToInvokeMethod(
+ uiComponent, ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "isReadOnly")));
+ boolean isDisabled = !Boolean.FALSE.equals(ReflectionUtils.tryToInvokeMethod(
+ uiComponent, ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "isDisabled")));
+
+ return !(isReadOnly || isDisabled);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java
new file mode 100644
index 0000000..65c2695
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.interceptor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.message.LabeledMessage;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.trinidad.context.RequestContext;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.validator.ValidatorException;
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class TrinidadValidationExceptionInterceptor implements ValidationExceptionInterceptor
+{
+ private static final String TRINIDAD_CORE_INPUT_TEXT
+ = "org.apache.myfaces.trinidad.component.core.input.CoreInputText";
+ private static final String TRINIDAD_CORE_INPUT_DATE
+ = "org.apache.myfaces.trinidad.component.core.input.CoreInputDate";
+
+ public boolean afterThrowing(UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject,
+ ValidatorException validatorException,
+ ValidationStrategy validatorExceptionSource)
+ {
+ refreshComponent(uiComponent);
+
+ if(processComponent(uiComponent))
+ {
+ FacesMessage facesMessage = validatorException.getFacesMessage();
+
+ String label = getLabel(uiComponent);
+
+ if(label == null)
+ {
+ label = uiComponent.getClientId(FacesContext.getCurrentInstance());
+ }
+
+ //override the label if the annotation provides a label
+ if(metaDataEntry != null && metaDataEntry.getProperty(PropertyInformationKeys.LABEL) != null)
+ {
+ label = metaDataEntry.getProperty(PropertyInformationKeys.LABEL, String.class);
+ }
+
+ if(facesMessage instanceof LabeledMessage)
+ {
+ ((LabeledMessage)facesMessage).setLabelText(label);
+ }
+ //if someone uses a normal faces message
+ else
+ {
+ for(int i = 0; i < 3; i++)
+ {
+ ExtValUtils.tryToPlaceLabel(facesMessage, label, i);
+ }
+ }
+ }
+ return true;
+ }
+
+ private void refreshComponent(UIComponent uiComponent)
+ {
+ if(RequestContext.getCurrentInstance().isPartialRequest(FacesContext.getCurrentInstance()))
+ {
+ RequestContext.getCurrentInstance().addPartialTarget(uiComponent);
+ }
+ }
+
+ protected boolean processComponent(UIComponent uiComponent)
+ {
+ return TRINIDAD_CORE_INPUT_TEXT.equals(uiComponent.getClass().getName()) ||
+ TRINIDAD_CORE_INPUT_DATE.equals(uiComponent.getClass().getName());
+ }
+
+ private String getLabel(UIComponent uiComponent)
+ {
+ return (String)ReflectionUtils.tryToInvokeMethod(uiComponent,
+ ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "getLabel"));
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRenderKit.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRenderKit.java
new file mode 100644
index 0000000..cdb45e9
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRenderKit.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.renderkit;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRenderKit;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.trinidadinternal.renderkit.RenderKitDecorator;
+import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
+
+import javax.faces.render.RenderKit;
+import javax.faces.render.Renderer;
+import javax.faces.render.ResponseStateManager;
+import javax.faces.context.ResponseWriter;
+import javax.faces.context.ResponseStream;
+import java.io.Writer;
+import java.io.OutputStream;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValTrinidadRenderKit extends RenderKitDecorator
+{
+ protected ExtValRenderKit extValRenderKit;
+
+ public static final String ID = "EXTVAL_TRINIDAD_RENDERKIT";
+
+ public ExtValTrinidadRenderKit(RenderKit wrapped)
+ {
+ this.extValRenderKit = new ExtValRenderKit(wrapped);
+ }
+
+ @Override
+ public void addRenderer(String family, String rendererType, Renderer renderer)
+ {
+ this.extValRenderKit.addRenderer(family, rendererType, renderer);
+ }
+
+ @Override
+ public Renderer getRenderer(String family, String rendererType)
+ {
+ return this.extValRenderKit.getRenderer(family, rendererType);
+ }
+
+ @Override
+ public ResponseStateManager getResponseStateManager()
+ {
+ return this.extValRenderKit.getResponseStateManager();
+ }
+
+ @Override
+ public ResponseWriter createResponseWriter(Writer writer, String s, String s1)
+ {
+ return this.extValRenderKit.createResponseWriter(writer, s, s1);
+ }
+
+ @Override
+ public ResponseStream createResponseStream(OutputStream outputStream)
+ {
+ return this.extValRenderKit.createResponseStream(outputStream);
+ }
+
+ protected String getDecoratedRenderKitId()
+ {
+ return CoreRenderKit.BASE_RENDER_KIT_ID;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRendererProxy.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRendererProxy.java
new file mode 100644
index 0000000..ff2701f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRendererProxy.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.renderkit;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererProxy;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableRenderingContext;
+
+import javax.faces.component.UIComponent;
+import javax.faces.render.Renderer;
+import javax.faces.context.FacesContext;
+
+/**
+ * solution for trinidad table renderer issue (in connection with double call prevention proxies)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class ExtValTrinidadRendererProxy extends ExtValRendererProxy
+{
+ public ExtValTrinidadRendererProxy(Renderer renderer)
+ {
+ super(renderer);
+ }
+
+ @Override
+ protected String getOptionalKey(FacesContext facesContext, UIComponent uiComponent)
+ {
+ if(TableRenderingContext.getCurrentInstance() != null)
+ {
+ return "|" + TableRenderingContext.getCurrentInstance().getRenderStage().getStage();
+ }
+
+ return "";
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java
new file mode 100644
index 0000000..dbdecb4
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.startup;
+
+import org.apache.myfaces.extensions.validator.core.startup.AbstractStartupListener;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.renderkit.AbstractRenderKitWrapperFactory;
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererProxy;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.trinidad.initializer.component.TrinidadComponentInitializer;
+import org.apache.myfaces.extensions.validator.trinidad.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.trinidad.validation.message.TrinidadFacesMessageFactory;
+import org.apache.myfaces.extensions.validator.trinidad.renderkit.ExtValTrinidadRendererProxy;
+import org.apache.myfaces.extensions.validator.trinidad.interceptor.TrinidadValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.trinidad.interceptor.TrinidadRendererInterceptor;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * alternative approach for ExtValRenderKitFactory
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class TrinidadModuleStartupListener extends AbstractStartupListener
+{
+ protected void init()
+ {
+ initTrinidadSupport();
+ }
+
+ private void initTrinidadSupport()
+ {
+ //deactivate default approach
+ ExtValContext.getContext().getFactoryFinder()
+ .getFactory(FactoryNames.RENDERKIT_WRAPPER_FACTORY, AbstractRenderKitWrapperFactory.class).deactivate();
+
+ String deactivateClientSideValidation = WebXmlParameter.DEACTIVATE_CLIENT_SIDE_TRINIDAD_VALIDATION;
+
+ if(deactivateClientSideValidation == null || !deactivateClientSideValidation.equalsIgnoreCase("true"))
+ {
+ ExtValContext.getContext().addComponentInitializer(new TrinidadComponentInitializer());
+ }
+
+ String deactivateInitCoreOutputLabel = WebXmlParameter.DEACTIVATE_TRINIDAD_CORE_OUTPUT_LABEL_INITIALIZATION;
+
+ if(deactivateInitCoreOutputLabel == null || !deactivateInitCoreOutputLabel.equalsIgnoreCase("true"))
+ {
+ ExtValContext.getContext().registerRendererInterceptor(new TrinidadRendererInterceptor());
+ }
+
+ String deactivateTrinidadValidationExceptionInterceptor =
+ WebXmlParameter.DEACTIVATE_TRINIDAD_VALIDATION_EXCEPTION_INTERCEPTOR;
+
+ if(deactivateTrinidadValidationExceptionInterceptor == null ||
+ !deactivateTrinidadValidationExceptionInterceptor.equalsIgnoreCase("true"))
+ {
+ ExtValContext.getContext().addValidationExceptionInterceptor(new TrinidadValidationExceptionInterceptor());
+ }
+
+ //deactivate extval renderer proxy - due to an incompatibility with the table renderer
+ ExtValContext.getContext()
+ .addGlobalProperty(ExtValRendererProxy.KEY, ExtValTrinidadRendererProxy.class.getName());
+
+ ExtValContext.getContext()
+ .addGlobalProperty(
+ FactoryNames.FACES_MESSAGE_FACTORY.name(),
+ TrinidadFacesMessageFactory.class.getName());
+ /*
+ * if there are further incompatible renderers use the following quick-fix:
+ * ExtValContext.getContext()
+ .addGlobalProperty(ExtValRendererProxy.KEY, null);
+ attention: it causes direct delegation without a check of double invocations
+ */
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/util/TrinidadUtils.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/util/TrinidadUtils.java
new file mode 100644
index 0000000..f57aee9
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/util/TrinidadUtils.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.util;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.trinidad.component.core.output.CoreOutputLabel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+@ToDo(value = Priority.MEDIUM, description = "check subform")
+public class TrinidadUtils
+{
+ protected static final Log LOG = LogFactory.getLog(TrinidadUtils.class);
+
+ public static UIComponent findLabeledEditableComponent(CoreOutputLabel coreOutputLabel)
+ {
+ //TODO
+ if(coreOutputLabel.getFor() == null)
+ {
+ return null;
+ }
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIComponent result = facesContext.getViewRoot().findComponent(coreOutputLabel.getFor());
+
+ if(result instanceof EditableValueHolder)
+ {
+ return result;
+ }
+
+ if(LOG.isTraceEnabled())
+ {
+ LOG.trace(coreOutputLabel.getClientId(facesContext) + " doesn't reference an editable component");
+ }
+
+ return null;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadFacesMessageFactory.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadFacesMessageFactory.java
new file mode 100644
index 0000000..acc21cc
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadFacesMessageFactory.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.validation.message;
+
+import org.apache.myfaces.extensions.validator.core.validation.message.DefaultFacesMessageFactory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class TrinidadFacesMessageFactory extends DefaultFacesMessageFactory
+{
+ @Override
+ protected boolean isLabeledFacesMessage(FacesMessage facesMessage)
+ {
+ return facesMessage instanceof TrinidadViolationMessage;
+ }
+
+ @Override
+ public FacesMessage create(FacesMessage.Severity severity, String summary, String detail)
+ {
+ return new TrinidadViolationMessage(severity, summary, detail);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadViolationMessage.java b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadViolationMessage.java
new file mode 100644
index 0000000..701aa1c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/validation/message/TrinidadViolationMessage.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.trinidad.validation.message;
+
+import org.apache.myfaces.trinidad.util.LabeledFacesMessage;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.message.LabeledMessage;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class TrinidadViolationMessage extends LabeledFacesMessage implements LabeledMessage
+{
+ private static final long serialVersionUID = 6356800689961505154L;
+
+ public TrinidadViolationMessage(Severity severity, String summary, String detail)
+ {
+ super(severity, summary, detail);
+ }
+
+ public String getLabelText()
+ {
+ return super.getLabelAsString(FacesContext.getCurrentInstance());
+ }
+
+ public void setLabelText(String label)
+ {
+ super.setLabel(label);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/resources/LICENSE.txt b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/resources/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/resources/NOTICE.txt b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/main/resources/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/component-support/trinidad-support/src/site/apt/index.apt b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/site/apt/index.apt
new file mode 100644
index 0000000..234ba8a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/component-support/trinidad-support/src/site/apt/index.apt
@@ -0,0 +1,10 @@
+ ------
+Apache MyFaces Extensions Validator Trinidad Support Module
+ ------
+
+Apache MyFaces Extensions Validator Trinidad Support Module Overview
+
+ MyFaces Extensions Validator Trinidad Support Module provides special Trinidad Support for MyFaces Extensions Validator.
+ Furthermore, it allows to join the client-side validation mechanism of Trinidad. Sample use-case: annotate your model with JPA 1.0 annotations, bind properties to JSF Input components and get automatic client-side validation just by adding 3 JAR files (MyFaces Extensions Validator Core, Property Validation and Trinidad Support).
+
+ MyFaces Extensions Validator is compatible with JSF 1.1.x and JSF 1.2.x. Both versions require Java 1.5+
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/pom.xml b/1_2_2_prepare_rc_base/core/pom.xml
new file mode 100644
index 0000000..445f340
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/pom.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-parent</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <name>MyFaces Extensions-Validator Core</name>
+ <version>1.2.2-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/core</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/core</developerConnection>
+ <url>http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/1_2_2_rc/core</url>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/config</directory>
+ <includes>
+ <include>**/*xml</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*properties</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/1_2_2_prepare_rc_base/core/src/main/config/faces-config.xml b/1_2_2_prepare_rc_base/core/src/main/config/faces-config.xml
new file mode 100644
index 0000000..abd4dc4
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/config/faces-config.xml
@@ -0,0 +1,31 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+ <factory>
+ <render-kit-factory>org.apache.myfaces.extensions.validator.core.renderkit.ExtValRenderKitFactory</render-kit-factory>
+ </factory>
+
+ <lifecycle>
+ <phase-listener>org.apache.myfaces.extensions.validator.core.startup.ExtValStartupListener</phase-listener>
+ </lifecycle>
+</faces-config>
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/META-INF/LICENSE.txt b/1_2_2_prepare_rc_base/core/src/main/java/META-INF/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/META-INF/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/META-INF/NOTICE.txt b/1_2_2_prepare_rc_base/core/src/main/java/META-INF/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/META-INF/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/ExtValInformation.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/ExtValInformation.java
new file mode 100644
index 0000000..77d5d1c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/ExtValInformation.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+
+/**
+ * dont't move to an other package!!!
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface ExtValInformation
+{
+ static final String EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME = ExtValInformation.class.getPackage().getName();
+ static final String WEBXML_PARAM_PREFIX = ExtValInformation.class.getPackage().getName();
+ static final String VERSION = ClassUtils.getJarVersion(ExtValInformation.class);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInformation.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInformation.java
new file mode 100644
index 0000000..3190ce5
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInformation.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.API})
+public enum CustomInformation
+{
+ BASE_PACKAGE,
+ COMPONENT_META_DATA_EXTRACTOR,
+
+ VALIDATION_STRATEGY_POSTFIX,
+ VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX,
+ META_DATA_TRANSFORMER_POSTFIX,
+
+ VALIDATION_STRATEGY_TO_MSG_RESOLVER_NAME_MAPPER,
+ META_DATA_TO_VALIDATION_STRATEGY_NAME_MAPPER,
+ VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER,
+
+ STARTUP_LISTENER,
+ COMPONENT_INITIALIZER,
+ VALIDATION_EXCEPTION_INTERCEPTOR,
+ META_DATA_EXTRACTION_INTERCEPTOR,
+
+ MESSAGE_RESOLVER_FACTORY,
+ VALIDATION_STRATEGY_FACTORY,
+ COMPONENT_META_DATA_EXTRACTOR_FACTORY,
+ META_DATA_TRANSFORMER_FACTORY,
+ FACES_MESSAGE_FACTORY,
+
+ MESSAGE_BUNDLE_NAME,
+ STATIC_STRATEGY_MAPPING_SOURCE
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java
new file mode 100644
index 0000000..ae10f07
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java
@@ -0,0 +1,386 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core;
+
+import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfiguration;
+import org.apache.myfaces.extensions.validator.core.interceptor.RendererInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.MetaDataExtractionInterceptor;
+import org.apache.myfaces.extensions.validator.core.recorder.ProcessedInformationRecorder;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryFinder;
+import org.apache.myfaces.extensions.validator.core.factory.DefaultFactoryFinder;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.context.FacesContext;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public class ExtValContext
+{
+ private final Log logger = LogFactory.getLog(getClass());
+
+ private static ExtValContext extValContext = new ExtValContext();
+
+ private FactoryFinder factoryFinder = DefaultFactoryFinder.getInstance();
+ private Map<String, RendererInterceptor> rendererInterceptors = new HashMap<String, RendererInterceptor>();
+ private List<String> deniedInterceptors = new ArrayList<String>();
+ private List<ProcessedInformationRecorder> processedInformationRecorders =
+ new ArrayList<ProcessedInformationRecorder>();
+
+ private List<ComponentInitializer> componentInitializers;
+ private List<ValidationExceptionInterceptor> validationExceptionInterceptors;
+ private List<MetaDataExtractionInterceptor> metaDataExtractionInterceptors;
+
+ private Map<String, Object> globalProperties = new HashMap<String, Object>();
+
+ private Map<StaticConfigurationNames, List<StaticConfiguration<String, String>>> staticConfigMap
+ = new HashMap<StaticConfigurationNames, List<StaticConfiguration<String, String>>>();
+
+
+ private void lazyInitComponentInitializers()
+ {
+ if(this.componentInitializers != null)
+ {
+ return;
+ }
+
+ this.componentInitializers = new ArrayList<ComponentInitializer>();
+ List<String> componentInitializerClassNames = new ArrayList<String>();
+ componentInitializerClassNames
+ .add(WebXmlParameter.CUSTOM_COMPONENT_INITIALIZER);
+ componentInitializerClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean().get(CustomInformation.COMPONENT_INITIALIZER));
+
+ ComponentInitializer componentInitializer;
+ for (String componentInitializerName : componentInitializerClassNames)
+ {
+ componentInitializer =
+ (ComponentInitializer) ClassUtils.tryToInstantiateClassForName(componentInitializerName);
+
+ if (componentInitializer != null)
+ {
+ componentInitializers.add(componentInitializer);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(componentInitializer.getClass().getName() + " added");
+ }
+ }
+ }
+ }
+
+ private void lazyInitValidationExceptionInterceptors()
+ {
+ if(this.validationExceptionInterceptors != null)
+ {
+ return;
+ }
+
+ this.validationExceptionInterceptors = new ArrayList<ValidationExceptionInterceptor>();
+ List<String> validationExceptionInterceptorClassNames = new ArrayList<String>();
+
+ validationExceptionInterceptorClassNames
+ .add(WebXmlParameter.CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR);
+ validationExceptionInterceptorClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean().get(
+ CustomInformation.VALIDATION_EXCEPTION_INTERCEPTOR));
+
+ ValidationExceptionInterceptor validationExceptionInterceptor;
+ for (String validationExceptionInterceptorName : validationExceptionInterceptorClassNames)
+ {
+ validationExceptionInterceptor =
+ (ValidationExceptionInterceptor)
+ ClassUtils.tryToInstantiateClassForName(validationExceptionInterceptorName);
+
+ if (validationExceptionInterceptor != null)
+ {
+ validationExceptionInterceptors.add(validationExceptionInterceptor);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(validationExceptionInterceptor.getClass().getName() + " added");
+ }
+ }
+ }
+ }
+
+ private void lazyInitMetaDataExtractionInterceptors()
+ {
+ if(this.metaDataExtractionInterceptors != null)
+ {
+ return;
+ }
+
+ this.metaDataExtractionInterceptors = new ArrayList<MetaDataExtractionInterceptor>();
+
+ List<String> metaDataExtractionInterceptorClassNames = new ArrayList<String>();
+
+ metaDataExtractionInterceptorClassNames
+ .add(WebXmlParameter.CUSTOM_META_DATA_EXTRACTION_INTERCEPTOR);
+ metaDataExtractionInterceptorClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean().get(
+ CustomInformation.META_DATA_EXTRACTION_INTERCEPTOR));
+
+ MetaDataExtractionInterceptor metaDataExtractionInterceptor;
+ for (String validationExceptionInterceptorName : metaDataExtractionInterceptorClassNames)
+ {
+ metaDataExtractionInterceptor =
+ (MetaDataExtractionInterceptor)
+ ClassUtils.tryToInstantiateClassForName(validationExceptionInterceptorName);
+
+ if (metaDataExtractionInterceptor != null)
+ {
+ this.metaDataExtractionInterceptors.add(metaDataExtractionInterceptor);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(metaDataExtractionInterceptor.getClass().getName() + " added");
+ }
+ }
+ }
+ }
+
+ public static ExtValContext getContext()
+ {
+ return extValContext;
+ }
+
+ public FactoryFinder getFactoryFinder()
+ {
+ return factoryFinder;
+ }
+
+ public void setFactoryFinder(FactoryFinder factoryFinder)
+ {
+ if(factoryFinder != null)
+ {
+ this.factoryFinder = factoryFinder;
+ }
+ }
+
+ public List<RendererInterceptor> getRendererInterceptors()
+ {
+ return new ArrayList<RendererInterceptor>(rendererInterceptors.values());
+ }
+
+ public boolean registerRendererInterceptor(RendererInterceptor rendererInterceptor)
+ {
+ synchronized (ExtValContext.class)
+ {
+ if (deniedInterceptors.contains(rendererInterceptor.getInterceptorId()))
+ {
+ return false;
+ }
+
+ rendererInterceptors.put(rendererInterceptor.getInterceptorId(), rendererInterceptor);
+ }
+ return true;
+ }
+
+ public void deregisterRendererInterceptor(Class rendererInterceptorClass)
+ {
+ RendererInterceptor rendererInterceptor =
+ (RendererInterceptor) ClassUtils.tryToInstantiateClass(rendererInterceptorClass);
+
+ synchronized (ExtValContext.class)
+ {
+ rendererInterceptors.remove(rendererInterceptor.getInterceptorId());
+ }
+ }
+
+ //if an interceptor hasn't been registered so far, it should be denied at future registrations
+ public void denyRendererInterceptor(Class rendererInterceptorClass)
+ {
+ RendererInterceptor rendererInterceptor =
+ (RendererInterceptor) ClassUtils.tryToInstantiateClass(rendererInterceptorClass);
+
+ synchronized (ExtValContext.class)
+ {
+ deniedInterceptors.add(rendererInterceptor.getInterceptorId());
+ }
+ deregisterRendererInterceptor(rendererInterceptorClass);
+ }
+
+ public void addComponentInitializer(ComponentInitializer componentInitializer)
+ {
+ lazyInitComponentInitializers();
+ this.componentInitializers.add(componentInitializer);
+ }
+
+ public List<ComponentInitializer> getComponentInitializers()
+ {
+ lazyInitComponentInitializers();
+ return componentInitializers;
+ }
+
+ public void addValidationExceptionInterceptor(ValidationExceptionInterceptor validationExceptionInterceptor)
+ {
+ lazyInitValidationExceptionInterceptors();
+ this.validationExceptionInterceptors.add(validationExceptionInterceptor);
+ }
+
+ public List<ValidationExceptionInterceptor> getValidationExceptionInterceptors()
+ {
+ lazyInitValidationExceptionInterceptors();
+ return validationExceptionInterceptors;
+ }
+
+ public void addMetaDataExtractionInterceptor(MetaDataExtractionInterceptor metaDataExtractionInterceptor)
+ {
+ lazyInitMetaDataExtractionInterceptors();
+ metaDataExtractionInterceptors.add(metaDataExtractionInterceptor);
+ }
+
+ public List<MetaDataExtractionInterceptor> getMetaDataExtractionInterceptors()
+ {
+ lazyInitMetaDataExtractionInterceptors();
+ return metaDataExtractionInterceptors;
+ }
+
+ public List<ProcessedInformationRecorder> getProcessedInformationRecorders()
+ {
+ return processedInformationRecorders;
+ }
+
+ public void addProcessedInformationRecorder(ProcessedInformationRecorder processedInformationRecorder)
+ {
+ this.processedInformationRecorders.add(processedInformationRecorder);
+ }
+
+ public InformationProviderBean getInformationProviderBean()
+ {
+ Map applicationMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();
+ InformationProviderBean bean = (InformationProviderBean) applicationMap.get(InformationProviderBean.BEAN_NAME);
+
+ if (bean == null)
+ {
+ return initInformationProviderBean(applicationMap);
+ }
+ return bean;
+ }
+
+ private InformationProviderBean initInformationProviderBean(Map applicationMap)
+ {
+ List<String> informationProviderBeanClassNames = new ArrayList<String>();
+
+ informationProviderBeanClassNames.add(WebXmlParameter.CUSTOM_INFORMATION_PROVIDER_BEAN);
+ informationProviderBeanClassNames.add(InformationProviderBean.CUSTOM_BEAN);
+
+ InformationProviderBean informationProviderBean;
+ for (String className : informationProviderBeanClassNames)
+ {
+ informationProviderBean = (InformationProviderBean) ClassUtils.tryToInstantiateClassForName(className);
+
+ if (informationProviderBean != null)
+ {
+ applicationMap.put(InformationProviderBean.BEAN_NAME, informationProviderBean);
+ return informationProviderBean;
+ }
+ }
+
+ tryToInitCustomConfiguredInformationProviderBeanClassName(applicationMap);
+
+ if(applicationMap.containsKey(InformationProviderBean.BEAN_NAME))
+ {
+ return (InformationProviderBean)applicationMap.get(InformationProviderBean.BEAN_NAME);
+ }
+ return new InformationProviderBean();
+ }
+
+ private void tryToInitCustomConfiguredInformationProviderBeanClassName(Map applicationMap)
+ {
+ InformationProviderBean bean = (InformationProviderBean) ExtValUtils.getELHelper()
+ .getBean(InformationProviderBean.CUSTOM_BEAN.replace(".", "_"));
+
+ if(bean != null)
+ {
+ applicationMap.put(InformationProviderBean.BEAN_NAME, bean);
+ }
+ }
+
+ public List<StaticConfiguration<String, String>> getStaticConfiguration(StaticConfigurationNames name)
+ {
+ if(!this.staticConfigMap.containsKey(name))
+ {
+ List<StaticConfiguration<String, String>> staticConfigList =
+ new ArrayList<StaticConfiguration<String, String>>();
+ this.staticConfigMap.put(name, staticConfigList);
+ }
+ return this.staticConfigMap.get(name);
+ }
+
+ public void addStaticConfiguration(StaticConfigurationNames name, StaticConfiguration<String, String> staticConfig)
+ {
+ synchronized (this)
+ {
+ List<StaticConfiguration<String, String>> staticConfigList;
+ if(!this.staticConfigMap.containsKey(name))
+ {
+ staticConfigList = new ArrayList<StaticConfiguration<String, String>>();
+ this.staticConfigMap.put(name, staticConfigList);
+ }
+ this.staticConfigMap.get(name).add(staticConfig);
+ }
+ }
+
+ public boolean addGlobalProperty(String name, Object value)
+ {
+ return addGlobalProperty(name , value, true);
+ }
+
+ public boolean addGlobalProperty(String name, Object value, boolean forceOverride)
+ {
+ if(this.globalProperties.containsKey(name))
+ {
+ if(!forceOverride)
+ {
+ return false;
+ }
+ else
+ {
+ if(this.logger.isInfoEnabled())
+ {
+ logger.info("override global property '" + name + "'");
+ }
+ }
+ }
+
+ this.globalProperties.put(name, value);
+ return true;
+ }
+
+ public Object getGlobalProperty(String name)
+ {
+ return this.globalProperties.get(name);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java
new file mode 100644
index 0000000..6defa6a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * centralized in order that these information aren't spread over the complete code base
+ * + some of them can be customized within a custom impl. of the bean
+ * (extend this class and provide it via convention or web.xml)
+ * <p/>
+ * the static api should only be used
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.API, UsageCategory.CUSTOMIZABLE})
+public class InformationProviderBean
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public static final String BEAN_NAME = ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME
+ + "." + InformationProviderBean.class.getSimpleName();
+ //custom class which is an optional replacement for this class (has to extend this class)
+ public static final String CUSTOM_BEAN = (ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME
+ + ".custom." + InformationProviderBean.class.getSimpleName());
+
+ public InformationProviderBean()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+
+ setupCustomizableInformation();
+ applyCustomValues(this.customizableInfos);
+ }
+
+ private Map<CustomInformation, String> customizableInfos = new HashMap<CustomInformation, String>();
+
+ private void setupCustomizableInformation()
+ {
+ String basePackage = WebXmlParameter.CUSTOM_BASE_PACKAGE;
+
+ if (basePackage == null)
+ {
+ basePackage = ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME + ".custom.";
+ }
+ if (!basePackage.endsWith("."))
+ {
+ basePackage = basePackage + ".";
+ }
+
+ customizableInfos.put(CustomInformation.BASE_PACKAGE, basePackage);
+
+ customizableInfos.put(CustomInformation.COMPONENT_META_DATA_EXTRACTOR,
+ "ComponentMetaDataExtractor");
+
+ customizableInfos.put(CustomInformation.VALIDATION_STRATEGY_POSTFIX,
+ "ValidationStrategy");
+ customizableInfos.put(CustomInformation.META_DATA_TRANSFORMER_POSTFIX,
+ "MetaDataTransformer");
+ customizableInfos.put(CustomInformation.VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX,
+ "ValidationErrorMessageResolver");
+
+ customizableInfos.put(CustomInformation.COMPONENT_INITIALIZER,
+ "ComponentInitializer");
+ customizableInfos.put(CustomInformation.VALIDATION_EXCEPTION_INTERCEPTOR,
+ "ValidationExceptionInterceptor");
+ customizableInfos.put(CustomInformation.META_DATA_EXTRACTION_INTERCEPTOR,
+ "MetaDataExtractionInterceptor");
+
+ customizableInfos.put(CustomInformation.VALIDATION_STRATEGY_TO_MSG_RESOLVER_NAME_MAPPER,
+ "ValidationStrategyToMsgResolverNameMapper");
+ customizableInfos.put(CustomInformation.META_DATA_TO_VALIDATION_STRATEGY_NAME_MAPPER,
+ "MetaDataToValidationStrategyNameMapper");
+ customizableInfos.put(CustomInformation.VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER,
+ "ValidationStrategyToMetaDataTransformerNameMapper");
+
+ customizableInfos.put(CustomInformation.STARTUP_LISTENER,
+ "StartupListener");
+
+ customizableInfos.put(CustomInformation.MESSAGE_RESOLVER_FACTORY,
+ "MessageResolverFactory");
+ customizableInfos.put(CustomInformation.VALIDATION_STRATEGY_FACTORY,
+ "ValidationStrategyFactory");
+ customizableInfos.put(CustomInformation.COMPONENT_META_DATA_EXTRACTOR_FACTORY,
+ "ComponentMetaDataExtractorFactory");
+ customizableInfos.put(CustomInformation.META_DATA_TRANSFORMER_FACTORY,
+ "MetaDataTransformerFactory");
+ customizableInfos.put(CustomInformation.FACES_MESSAGE_FACTORY,
+ "FacesMessageFactory");
+
+ //conventions (the rest of the conventions are built with the help of name mappers,...
+ customizableInfos.put(CustomInformation.MESSAGE_BUNDLE_NAME,
+ "validation_messages");
+ //static strategy mappings (name of property files)
+ customizableInfos.put(CustomInformation.STATIC_STRATEGY_MAPPING_SOURCE,
+ "strategy_mappings");
+ }
+
+ protected void applyCustomValues(Map<CustomInformation, String> map)
+ {
+ //override to customize information
+ }
+
+ public final String get(CustomInformation customInformation)
+ {
+ String value = customizableInfos.get(customInformation);
+
+ switch (customInformation)
+ {
+ case BASE_PACKAGE:
+ return value;
+
+ /*
+ * postfix used by the SimpleAnnotationToValidationStrategyNameMapper
+ * the SimpleAnnotationToValidationStrategyNameMapper is for custom strategies only
+ * (not for public validation modules)
+ * so it's fine to customize it
+ */
+ case VALIDATION_STRATEGY_POSTFIX:
+ return value;
+
+ case VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX:
+ return value;
+
+ case META_DATA_TRANSFORMER_POSTFIX:
+ return value;
+
+ default:
+ return customizableInfos.get(CustomInformation.BASE_PACKAGE) + value;
+ }
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/InternalConventionProvider.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/InternalConventionProvider.java
new file mode 100644
index 0000000..8d9f869
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/InternalConventionProvider.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class InternalConventionProvider
+{
+ public static String getModuleMessageBundleName(String packageName)
+ {
+ String newPackageName;
+ if (packageName.endsWith(".resolver"))
+ {
+ newPackageName = packageName.replace(".resolver", ".bundle");
+ }
+ else
+ {
+ newPackageName = packageName.replace(".resolver.", ".bundle.");
+ }
+
+ return newPackageName + ".validation_messages";
+ }
+
+ /**
+ * use a custom name mapper to implement custom conventions
+ */
+ @ToDo(value = Priority.MEDIUM, description = "logging")
+ public static String getMessageResolverClassName(
+ Class<? extends ValidationStrategy> validationStrategyClass, String targetClassName)
+ {
+ return getValidationStrategyBasedName(validationStrategyClass, ".message.resolver.", targetClassName);
+ }
+
+ public static String getMetaDataTransformerClassName(
+ Class<? extends ValidationStrategy> validationStrategyClass, String targetClassName)
+ {
+ return getValidationStrategyBasedName(validationStrategyClass, ".metadata.transformer.", targetClassName);
+ }
+
+ private static String getValidationStrategyBasedName(Class<? extends ValidationStrategy> validationStrategyClass,
+ String targetPackageName, String targetClassName)
+ {
+ String validationStrategyClassName = validationStrategyClass.getName();
+
+ validationStrategyClassName = validationStrategyClassName.replace(".strategy.", targetPackageName);
+
+ if (targetClassName == null || validationStrategyClassName.lastIndexOf(".") == -1)
+ {
+ return null;
+ }
+ return validationStrategyClassName
+ .substring(0, validationStrategyClassName.lastIndexOf(".")) + "." + targetClassName;
+ }
+
+ /**
+ * use a custom name mapper to implement custom conventions
+ */
+ public static String getMessageResolverClassName(String validationStrategyName)
+ {
+ return getValidationStrategyBasedName(validationStrategyName, "ValidationErrorMessageResolver");
+ }
+
+ /**
+ * use a custom name mapper to implement custom conventions
+ */
+ public static String getValidationStrategyClassName(String metaDataKey)
+ {
+ return metaDataKey.replace(".annotation.", ".strategy.") + "Strategy";
+ }
+
+ public static String getMetaDataTransformerClassName(String validationStrategyName)
+ {
+ return getValidationStrategyBasedName(validationStrategyName, "MetaDataTransformer");
+ }
+
+ public static String getValidationStrategyBasedName(String validationStrategyName, String targetPostfix)
+ {
+ if (validationStrategyName.endsWith("ValidationStrategy"))
+ {
+ return validationStrategyName.substring(0, validationStrategyName.length() - 18) + targetPostfix;
+ }
+ else if (validationStrategyName.endsWith("Strategy"))
+ {
+ return validationStrategyName.substring(0, validationStrategyName.length() - 8) + targetPostfix;
+ }
+ return validationStrategyName + targetPostfix;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java
new file mode 100644
index 0000000..74faabe
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.WebXmlUtils;
+
+/**
+ * centralized in order that these information aren't spread over the complete code base
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface WebXmlParameter
+{
+ /*
+ * misc
+ */
+ static final String CUSTOM_MESSAGE_BUNDLE = WebXmlUtils
+ .getInitParameter("CUSTOM_MESSAGE_BUNDLE");
+
+ static final String CUSTOM_BASE_PACKAGE = WebXmlUtils
+ .getInitParameter("CUSTOM_BASE_PACKAGE");
+
+ static final String CUSTOM_INFORMATION_PROVIDER_BEAN = WebXmlUtils
+ .getInitParameter("CUSTOM_INFORMATION_PROVIDER_BEAN");
+
+ static final String CUSTOM_COMPONENT_META_DATA_EXTRACTOR = WebXmlUtils
+ .getInitParameter("CUSTOM_COMPONENT_META_DATA_EXTRACTOR");
+
+ static final String CUSTOM_STATIC_VALIDATION_STRATEGY_MAPPING = WebXmlUtils
+ .getInitParameter("CUSTOM_STATIC_VALIDATION_STRATEGY_MAPPING");
+
+ static final String CUSTOM_COMPONENT_INITIALIZER = WebXmlUtils
+ .getInitParameter("CUSTOM_COMPONENT_INITIALIZER");
+
+ static final String CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR = WebXmlUtils
+ .getInitParameter("CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR");
+
+ static final String CUSTOM_META_DATA_EXTRACTION_INTERCEPTOR = WebXmlUtils
+ .getInitParameter("CUSTOM_META_DATA_EXTRACTION_INTERCEPTOR");
+
+ /*
+ * name mapper
+ */
+ static final String CUSTOM_VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_NAME_MAPPER = WebXmlUtils
+ .getInitParameter("CUSTOM_VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_NAME_MAPPER");
+
+ static final String CUSTOM_META_DATA_TO_VALIDATION_STRATEGY_NAME_MAPPER = WebXmlUtils
+ .getInitParameter("CUSTOM_META_DATA_TO_VALIDATION_STRATEGY_NAME_MAPPER");
+
+ static final String CUSTOM_VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER = WebXmlUtils
+ .getInitParameter("CUSTOM_VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER");
+
+ /*
+ * factories
+ */
+ static final String CUSTOM_VALIDATION_STRATEGY_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_VALIDATION_STRATEGY_FACTORY");
+
+ static final String CUSTOM_MESSAGE_RESOLVER_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_MESSAGE_RESOLVER_FACTORY");
+
+ static final String CUSTOM_COMPONENT_META_DATA_EXTRACTOR_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_COMPONENT_META_DATA_EXTRACTOR_FACTORY");
+
+ static final String CUSTOM_META_DATA_TRANSFORMER_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_META_DATA_TRANSFORMER_FACTORY");
+
+ static final String CUSTOM_FACES_MESSAGE_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_FACES_MESSAGE_FACTORY");
+
+ /*
+ * deactivate
+ */
+ @Deprecated
+ static final String DEACTIVATE_RENDERKIT = WebXmlUtils
+ .getInitParameter("DEACTIVATE_RENDERKIT");
+
+ //currently just used by AbstractValidationErrorMessageResolver
+ static final String DEACTIVATE_DEFAULT_CONVENTION = WebXmlUtils
+ .getInitParameter("DEACTIVATE_DEFAULT_CONVENTION");
+
+ static final String DEACTIVATE_DEFAULT_NAME_MAPPERS = WebXmlUtils
+ .getInitParameter("DEACTIVATE_DEFAULT_NAME_MAPPERS");
+
+ static final String DEACTIVATE_EL_RESOLVER = WebXmlUtils
+ .getInitParameter("DEACTIVATE_EL_RESOLVER");
+
+ //there is nothing like DEACTIVATE_DEFAULT_VALIDATION_INTERCEPTOR
+ //use ExtValContext.getContext().denyRendererInterceptor(...) within an extval-StartupListener
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/AbstractELHelperFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/AbstractELHelperFactory.java
new file mode 100644
index 0000000..4a43f25
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/AbstractELHelperFactory.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.el;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * details
+ * @see DefaultELHelper
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public abstract class AbstractELHelperFactory
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+ protected AbstractELHelperFactory customELHelperFactory;
+
+ protected AbstractELHelperFactory()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public void setCustomELHelperFactory(AbstractELHelperFactory elHelperFactory)
+ {
+ this.customELHelperFactory = elHelperFactory;
+ }
+
+ public final ELHelper create()
+ {
+ ELHelper result = null;
+
+ if(this.customELHelperFactory != null)
+ {
+ result = this.customELHelperFactory.createELHelper();
+ }
+
+ if(result == null)
+ {
+ return createELHelper();
+ }
+
+ return result;
+ }
+
+ protected abstract ELHelper createELHelper();
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelper.java
new file mode 100644
index 0000000..914ee1c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelper.java
@@ -0,0 +1,308 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.el;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.el.ValueExpression;
+import javax.el.ELContext;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import java.io.Externalizable;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+/**
+ * in order to centralize the jsf version dependency within the core
+ *
+ * this el-helper supports jsp and facelets (tested with 1.1.14)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+/*
+ * there is a special facelets workaround for el-expressions of custom components
+ * it's pluggable in order to support special mechanisms of different technologies (than jsp and facelets)
+ * so you can plug in your own impl. which implements a custom workaround (like the facelets workaround of this impl.)
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultELHelper implements ELHelper
+{
+ private static final String DEACTIVATE_EL_RESOLVER = WebXmlParameter.DEACTIVATE_EL_RESOLVER;
+
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public DefaultELHelper()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public Class getTypeOfExpression(FacesContext facesContext, ValueBindingExpression valueBindingExpression)
+ {
+ //due to a restriction with the ri
+ Object bean = getValueOfExpression(facesContext, valueBindingExpression);
+ return (bean != null) ? bean.getClass() : null;
+ }
+
+ public Object getBean(String beanName)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ return facesContext.getApplication().getELResolver().getValue(facesContext.getELContext(), null, beanName);
+ }
+
+ public Object getValueOfExpression(FacesContext facesContext,
+ ValueBindingExpression valueBindingExpression)
+ {
+ return (valueBindingExpression != null) ? facesContext.getApplication().evaluateExpressionGet(
+ facesContext, valueBindingExpression.getExpressionString(), Object.class) : null;
+ }
+
+ public boolean isELTermValid(FacesContext facesContext, String valueBindingExpression)
+ {
+ try
+ {
+ facesContext.getApplication().evaluateExpressionGet(facesContext, valueBindingExpression, Object.class);
+ }
+ catch (Throwable t)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private ValueBindingExpression getValueBindingExpression(UIComponent uiComponent, boolean allowBlankCharacters)
+ {
+ String valueBindingExpression = getOriginalValueBindingExpression(uiComponent);
+
+ //for input components without value-binding
+ //(e.g. for special component libs -> issue with ExtValRendererWrapper#encodeBegin)
+ if(valueBindingExpression == null)
+ {
+ if(this.logger.isTraceEnabled())
+ {
+ this.logger.trace(
+ uiComponent.getClass() + " has no value binding - component id: " + uiComponent.getId());
+ }
+ return null;
+ }
+
+ if(!allowBlankCharacters)
+ {
+ valueBindingExpression = valueBindingExpression.replace(" ", "");
+ }
+
+ if (getTypeOfExpression(FacesContext.getCurrentInstance(),
+ new ValueBindingExpression(valueBindingExpression).getBaseExpression()) == null)
+ {
+ ValueBindingExpression result = FaceletsTaglibExpressionHelper.
+ tryToCreateValueBindingForFaceletsBinding(uiComponent);
+
+ if(result == null)
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("couldn't resolve expression: " + valueBindingExpression);
+ }
+ return null;
+ }
+
+ Class entityClass = ExtValUtils.getELHelper()
+ .getTypeOfExpression(FacesContext.getCurrentInstance(), result.getBaseExpression());
+
+ if(entityClass == null)
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("couldn't resolve expression: " + result.getExpressionString());
+ }
+
+ return null;
+ }
+ return result;
+ }
+ return new ValueBindingExpression(valueBindingExpression);
+ }
+
+ public PropertyDetails getPropertyDetailsOfValueBinding(UIComponent uiComponent)
+ {
+ if("true".equalsIgnoreCase(DEACTIVATE_EL_RESOLVER))
+ {
+ return getPropertyDetailsViaReflectionFallback(uiComponent);
+ }
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ ExtValELResolver elResolver = new ExtValELResolver(facesContext.getApplication().getELResolver());
+ ELContext elContext = ExtValELResolver.createContextWrapper(facesContext.getELContext(), elResolver);
+
+ ValueExpression valueExpression = uiComponent.getValueExpression("value");
+
+ if(valueExpression == null)
+ {
+ return null;
+ }
+
+ try
+ {
+ valueExpression.setValue(elContext, null);
+ }
+ catch (Throwable t)
+ {
+ throw new IllegalStateException(
+ "error at binding: " + valueExpression.getExpressionString() +
+ " -- an el-resolver error occurred! maybe you used an invalid binding. otherwise: " +
+ "please report the issue, deactivate the el-resovler of extval via web.xml context-param: " +
+ ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_EL_RESOLVER" +
+ " and test again.", t);
+ }
+
+ if(elResolver.getPath() == null || elResolver.getBaseObject() == null || elResolver.getProperty() == null)
+ {
+ return null;
+ }
+
+ return new PropertyDetails(elResolver.getPath(), elResolver.getBaseObject(), elResolver.getProperty());
+ }
+
+ //keep in sync with DefaultELHelper#getPropertyDetailsOfValueBinding of branch!!!
+ private PropertyDetails getPropertyDetailsViaReflectionFallback(UIComponent uiComponent)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ValueBindingExpression valueBindingExpression = getValueBindingExpression(uiComponent, false);
+ ValueBindingExpression currentValueBindingExpression =
+ new ValueBindingExpression(valueBindingExpression.getExpressionString());
+
+ String path = null;
+
+ while(currentValueBindingExpression.getBaseExpression() != null)
+ {
+ if(path == null)
+ {
+ path = getPropertyName(currentValueBindingExpression);
+ }
+ else
+ {
+ path = getPropertyName(currentValueBindingExpression) + "." + path;
+ }
+
+ currentValueBindingExpression = currentValueBindingExpression.getBaseExpression();
+ }
+
+ path = currentValueBindingExpression.getProperty() + "." + path;
+
+ Object baseObject = getValueOfExpression(facesContext, valueBindingExpression.getBaseExpression());
+
+ //in case of e.g.: #{bean[bean.passwordRepeatedPropertyName]}
+ //-> bean.passwordRepeatedPropertyName is not the final property name
+ return new PropertyDetails(path, baseObject, getPropertyName(valueBindingExpression));
+ }
+
+ private String getPropertyName(ValueBindingExpression valueBindingExpression)
+ {
+ String propertyName = valueBindingExpression.getProperty();
+
+ if(propertyName.contains("."))
+ {
+ propertyName = extractPropertyNameOfPropertyPath(propertyName);
+ }
+
+ return propertyName;
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "support for more dynamic bindings - details see inline")
+ private String extractPropertyNameOfPropertyPath(String propertyChain)
+ {
+ String[] properties = propertyChain.split("\\.");
+
+ Object currentPropertyValue = ExtValUtils.getELHelper().getBean(properties[0]);
+
+ Method currentMethod;
+ String currentPropertyName;
+ for(int i = 1; i < properties.length; i++)
+ {
+ currentPropertyName = properties[i];
+ currentMethod = ReflectionUtils.tryToGetMethod(currentPropertyValue.getClass(),
+ "get" + currentPropertyName.substring(0, 1).toUpperCase() + currentPropertyName.substring(1));
+
+ if(currentMethod == null && currentPropertyValue instanceof Map)
+ {
+ //it's ok for the simple map case - but not for e.g.:
+ //#{bean1[bean2.propertyNameProvider[ bean3.index]]}
+ //or every other complex replacement for bean3.index
+ //it might also require an adjustment at FaceletsTaglibExpressionHelper#tryToTransformToRealBinding
+ ((Map)currentPropertyValue).get(currentPropertyName);
+ }
+ else
+ {
+ currentPropertyValue = ReflectionUtils.tryToInvokeMethod(currentPropertyValue, currentMethod);
+ }
+ }
+
+ if(currentPropertyValue instanceof String)
+ {
+ return (String)currentPropertyValue;
+ }
+ else
+ {
+ if(this.logger.isErrorEnabled())
+ {
+ this.logger.error("unexpected value within map syntax: " + propertyChain +
+ " last property name: " + currentPropertyValue);
+ }
+ return null;
+ }
+ }
+
+ static String getOriginalValueBindingExpression(UIComponent uiComponent)
+ {
+ ValueExpression valueExpression = uiComponent.getValueExpression("value");
+
+ return (valueExpression != null) ? valueExpression.getExpressionString() : null;
+ }
+
+ public boolean isELTermWellFormed(Object o)
+ {
+ if (o instanceof ValueBinding || o instanceof Externalizable)
+ {
+ return false;
+ }
+
+ String s = o.toString();
+ return ((s.contains("#") || s.contains("$")) && s.contains("{") && s.contains("}"));
+ }
+
+ public Object getBindingOfComponent(UIComponent uiComponent, String name)
+ {
+ return uiComponent.getValueExpression(name);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelperFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelperFactory.java
new file mode 100644
index 0000000..2cfe56c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelperFactory.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.el;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultELHelperFactory extends AbstractELHelperFactory
+{
+ private ELHelper elHelper = new DefaultELHelper();
+
+ protected ELHelper createELHelper()
+ {
+ return this.elHelper;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.java
new file mode 100644
index 0000000..deb2553
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.el;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * in order to centralize the jsf version dependency within the core
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface ELHelper
+{
+ Object getBean(String beanName);
+
+ Object getValueOfExpression(FacesContext facesContext, ValueBindingExpression valueBindingExpression);
+
+ Class getTypeOfExpression(FacesContext facesContext, ValueBindingExpression valueBindingExpression);
+
+ PropertyDetails getPropertyDetailsOfValueBinding(UIComponent uiComponent);
+
+ boolean isELTermValid(FacesContext facesContext, String valueBindingExpression);
+
+ boolean isELTermWellFormed(Object o);
+
+ Object getBindingOfComponent(UIComponent uiComponent, String name);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ExtValELResolver.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ExtValELResolver.java
new file mode 100644
index 0000000..ef58963
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ExtValELResolver.java
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.el;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.el.ELResolver;
+import javax.el.ELContext;
+import javax.el.VariableMapper;
+import javax.el.FunctionMapper;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.beans.FeatureDescriptor;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class ExtValELResolver extends ELResolver
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private ELResolver wrapped;
+ private Object baseObject;
+ private String property;
+ //forms the id for cross-validation within complex components
+ private String expression;
+ private boolean isPathRecordingStopped = false;
+
+ public ExtValELResolver(ELResolver elResolver)
+ {
+ this.wrapped = elResolver;
+ }
+
+ public Object getBaseObject()
+ {
+ return baseObject;
+ }
+
+ public String getProperty()
+ {
+ return property;
+ }
+
+ public String getPath()
+ {
+ if(this.logger.isTraceEnabled())
+ {
+ this.logger.trace("extracted path: " + this.expression);
+ }
+ return this.expression;
+ }
+
+ public void reset()
+ {
+ this.baseObject = null;
+ this.property = null;
+ this.expression = null;
+ }
+
+ /**
+ * path recording is performed to get a key for cross-validation<br/>
+ * every base after the first call which is null stops recording<br/>
+ * with a dynamic map syntax the last property in the middle of an expression has to be a string.
+ * such a string result continues the path recording at the next call for the current expression.
+ * <p/>
+ * example: #{bean[bean.propertyNameProvider['nameOfProperty1']]['dynBean'].property}
+ * <p/>
+ * limitation for cross-validation: nameOfProperty1 has to be of type string.
+ * other key types aren't supported yet
+ *
+ * @param elContext wrapped el-context
+ * @param base current base
+ * @param property property to resolve
+ * @return result of the delegated method call
+ */
+ public Object getValue(ELContext elContext, Object base, Object property)
+ {
+ Object result = this.wrapped.getValue(elContext, base, property);
+
+ //very first call for an expression
+ if(this.expression == null)
+ {
+ this.expression = (String)property;
+ }
+ //#{bean[dynBase.propertyName]} -> base of dynBase is null -> stop path recording
+ else if(base == null)
+ {
+ this.isPathRecordingStopped = true;
+ }
+ else
+ {
+ boolean propertyExists = false;
+ String propertyName = (String)property;
+ propertyName = propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
+
+ try
+ {
+ if(base instanceof Map)
+ {
+ if(((Map)base).containsKey(property))
+ {
+ propertyExists = true;
+ }
+ }
+ else if(base.getClass().getMethod("get" + propertyName) != null)
+ {
+ propertyExists = true;
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ try
+ {
+ if(base.getClass().getMethod("is" + propertyName) != null)
+ {
+ propertyExists = true;
+ }
+ }
+ catch (NoSuchMethodException e1)
+ {
+ if(this.logger.isTraceEnabled())
+ {
+ this.logger.trace("property: " + property +
+ " isn't used for path - it isn't a property of " + base.getClass());
+ }
+ }
+ }
+
+ //e.g.: #{bean.subBase.property} -> here we are at subBase
+ if(propertyExists && !this.isPathRecordingStopped)
+ {
+ this.expression += "." + property;
+ }
+ else if(propertyExists && result instanceof String)
+ {
+ this.isPathRecordingStopped = false;
+ }
+ }
+
+ /*
+ if(this.isPathRecordingStopped && result instanceof String)
+ {
+ this.expression += "." + property;
+ }
+ */
+
+ return result;
+ }
+
+ public Class<?> getType(ELContext elContext, Object o, Object o1)
+ {
+ return wrapped.getType(elContext, o, o1);
+ }
+
+ public void setValue(ELContext elContext, Object o, Object o1, Object o2)
+ {
+ expression += "." + o1;
+ property = (String)o1;
+ baseObject = o;
+ elContext.setPropertyResolved(true);
+ }
+
+ public boolean isReadOnly(ELContext elContext, Object o, Object o1)
+ {
+ return wrapped.isReadOnly(elContext, o, o1);
+ }
+
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext elContext, Object o)
+ {
+ return wrapped.getFeatureDescriptors(elContext, o);
+ }
+
+ public Class<?> getCommonPropertyType(ELContext elContext, Object o)
+ {
+ return wrapped.getCommonPropertyType(elContext, o);
+ }
+
+ public static ELContext createContextWrapper(final ELContext context, final ELResolver resolver)
+ {
+ return new ELContext()
+ {
+ @Override
+ public Locale getLocale()
+ {
+ return context.getLocale();
+ }
+
+ @Override
+ public void setPropertyResolved(boolean value)
+ {
+ super.setPropertyResolved(value);
+ context.setPropertyResolved(value);
+ }
+
+ @Override
+ public void putContext(Class clazz, Object object)
+ {
+ super.putContext(clazz, object);
+ context.putContext(clazz, object);
+ }
+
+ @Override
+ public Object getContext(Class clazz)
+ {
+ return context.getContext(clazz);
+ }
+
+ @Override
+ public void setLocale(Locale locale)
+ {
+ super.setLocale(locale);
+ context.setLocale(locale);
+ }
+
+ @Override
+ public ELResolver getELResolver()
+ {
+ return resolver;
+ }
+
+ @Override
+ public FunctionMapper getFunctionMapper()
+ {
+ return context.getFunctionMapper();
+ }
+
+ @Override
+ public VariableMapper getVariableMapper()
+ {
+ return context.getVariableMapper();
+ }
+
+ };
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/FaceletsTaglibExpressionHelper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/FaceletsTaglibExpressionHelper.java
new file mode 100644
index 0000000..5f2b89f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/FaceletsTaglibExpressionHelper.java
@@ -0,0 +1,546 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.el;
+
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Iterator;
+
+/**
+ * Helper class to get the real/full value binding - tested with facelets 1.1.14
+ * The target is to get rid of this impl. - currently it's a workaround to support custom facelets components.
+ * An alternative would be an EL-Resolver - there are still some open issues with such an approach
+ * + It isn't available with JSF 1.1.x
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class FaceletsTaglibExpressionHelper
+{
+ public static ValueBindingExpression tryToCreateValueBindingForFaceletsBinding(UIComponent uiComponent)
+ {
+ String faceletsValueBindingExpression = DefaultELHelper.getOriginalValueBindingExpression(uiComponent);
+
+ try
+ {
+ List<String> foundBindings = extractELTerms(
+ ExtValUtils.getELHelper().getBindingOfComponent(uiComponent, "value"));
+
+ Map<String, String> mappedFaceletsVars = new HashMap<String, String>();
+ ValueBindingExpression vbe= new ValueBindingExpression(faceletsValueBindingExpression
+ .substring(0, 1) + "{" + createBinding(foundBindings, mappedFaceletsVars) + "}");
+
+ Class entityClass = ExtValUtils.getELHelper()
+ .getTypeOfExpression(FacesContext.getCurrentInstance(), vbe.getBaseExpression());
+
+ if(entityClass == null)
+ {
+ return tryToReplaceVars(vbe, mappedFaceletsVars);
+ }
+ return vbe;
+ }
+ catch (Throwable t)
+ {
+ return new ValueBindingExpression(faceletsValueBindingExpression);
+ }
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "logging")
+ private static String createBinding(List<String> expressions, Map<String, String> virtualVars)
+ {
+ String currentBinding;
+
+ int indexOfBindingDetails;
+ String[] foundBindingDetails;
+ String[] bindingDetails;
+
+ Map<String, String> addedVirtualNames = new HashMap<String, String>();
+
+ for (String entry : expressions)
+ {
+ if (entry.startsWith("ValueExpression["))
+ {
+ continue;
+ }
+
+ foundBindingDetails = entry.split(" ");
+ indexOfBindingDetails = findIndexOfBindingDetails(foundBindingDetails);
+
+ if (indexOfBindingDetails == -1)
+ {
+ return null;
+ }
+
+ bindingDetails = foundBindingDetails[indexOfBindingDetails].split("=");
+
+ if (bindingDetails.length < 2)
+ {
+ return null;
+ }
+
+ currentBinding = bindingDetails[1];
+
+ //to support blanks within a binding with map syntax
+ if(currentBinding.contains("{") && !currentBinding.contains("}"))
+ {
+ currentBinding = addFurtherBindingParts(currentBinding, foundBindingDetails, indexOfBindingDetails);
+ }
+
+ if (currentBinding.contains("}"))
+ {
+ //entry for "virtual" facelets beans
+ if(!addedVirtualNames.containsKey(bindingDetails[0]))
+ {
+ addedVirtualNames.put(bindingDetails[0], currentBinding);
+ }
+ }
+ //entry for "virtual" facelets var
+ if(!(currentBinding.contains("{") || currentBinding.contains("}")))
+ {
+ virtualVars.put(bindingDetails[0], bindingDetails[1].substring(1, bindingDetails[1].length()-2));
+ }
+ }
+
+ String originalBinding = addedVirtualNames.get("value");
+ originalBinding = originalBinding.substring(originalBinding.indexOf("{") + 1, originalBinding.indexOf("}"));
+ addedVirtualNames.remove("value");
+ return tryToTransformToRealBinding(originalBinding, addedVirtualNames, virtualVars);
+ }
+
+ private static String tryToTransformToRealBinding(
+ String originalBinding, Map<String, String> addedVirtualNames, Map<String, String> virtualVars)
+ {
+ originalBinding = "#{" + originalBinding + "}";
+ Iterator nameIterator = addedVirtualNames.keySet().iterator();
+
+ String currentKey;
+ String currentValue;
+ while(nameIterator.hasNext())
+ {
+ currentKey = (String) nameIterator.next();
+
+ currentValue = addedVirtualNames.get(currentKey);
+ currentValue = currentValue.substring(currentValue.indexOf("{") + 1, currentValue.indexOf("}"));
+
+ originalBinding = originalBinding.replace("{" + currentKey + ".", "{" + currentValue + ".");
+ //dynamic base and property
+ originalBinding = originalBinding.replace("{" + currentKey + "[", "{" + currentValue + "[");
+
+ originalBinding = originalBinding.replace("." + currentKey + ".", "." + currentValue + ".");
+ //dynamic base and property
+ originalBinding = originalBinding.replace("." + currentKey + "[", "." + currentValue + "[");
+
+ originalBinding = originalBinding.replace("[" + currentKey + "]", "['" + currentValue + "']");
+ //dynamic base and property
+ originalBinding = originalBinding.replace("[" + currentKey + "[", "[" + currentValue + "[");
+ originalBinding = originalBinding.replace("[" + currentKey + ".", "[" + currentValue + ".");
+ }
+
+ nameIterator = virtualVars.keySet().iterator();
+
+ while(nameIterator.hasNext())
+ {
+ currentKey = (String) nameIterator.next();
+
+ currentValue = virtualVars.get(currentKey);
+
+ originalBinding = originalBinding.replace("{" + currentKey + ".", "{" + currentValue + ".");
+ //dynamic base and property
+ originalBinding = originalBinding.replace("{" + currentKey + "[", "{" + currentValue + "[");
+
+ originalBinding = originalBinding.replace("." + currentKey + ".", "." + currentValue + ".");
+ //dynamic base and property
+ originalBinding = originalBinding.replace("." + currentKey + "[", "." + currentValue + "[");
+
+ originalBinding = originalBinding.replace("[" + currentKey + "]", "['" + currentValue + "']");
+ //dynamic base and property
+ originalBinding = originalBinding.replace("[" + currentKey + "[", "[" + currentValue + "[");
+ originalBinding = originalBinding.replace("[" + currentKey + ".", "[" + currentValue + ".");
+ }
+
+ return originalBinding.substring(2, originalBinding.length() - 1);
+ }
+
+ //to support blanks - e.g. with map syntax
+ private static String addFurtherBindingParts(String currentBinding, String[] foundBindingDetails,
+ int indexOfBindingDetails)
+ {
+ for(int i = indexOfBindingDetails + 1; i < foundBindingDetails.length; i++)
+ {
+ currentBinding += foundBindingDetails[i];
+ if(foundBindingDetails[i].contains("}"))
+ {
+ return currentBinding;
+ }
+ }
+ return currentBinding;
+ }
+
+ private static int findIndexOfBindingDetails(String[] bindingDetails)
+ {
+ int count = 0;
+ for (String entry : bindingDetails)
+ {
+ if (entry.contains("="))
+ {
+ return count;
+ }
+ count++;
+ }
+ return -1;
+ }
+
+ private static List<String> extractELTerms(Object o)
+ {
+ List<String> foundELTerms = new ArrayList<String>();
+ try
+ {
+ if (resolveELTerms(o, new HashMap<Object, Object>(), foundELTerms, 0) > 0)
+ {
+ return foundELTerms;
+ }
+ }
+ catch (Exception ex)
+ {
+ return null;
+ }
+ return null;
+ }
+
+ private static int resolveELTerms(Object o, Map<Object, Object> visited,
+ List<String> foundELTerms, int count) throws Exception
+ {
+ if (o == null || visited.containsKey(o) || count > 50)
+ {
+ return 0;
+ }
+
+ visited.put(o, null);
+
+ int elCount = 0;
+ Class c = o.getClass();
+
+ //inspect maps
+ if (o instanceof Map)
+ {
+
+ for (Object entry : ((Map) o).values())
+ {
+ //found entry for "virtual" facelets var
+ if(entry.toString().contains("ValueExpression["))
+ {
+ foundELTerms.add(entry.toString());
+ }
+ elCount += resolveELTerms(entry, visited, foundELTerms, count + 1);
+ }
+ return elCount;
+ }
+
+ if (ExtValUtils.getELHelper().isELTermWellFormed(o))
+ {
+ if (foundELTerms != null)
+ {
+ foundELTerms.add(o.toString());
+ }
+ return ++elCount;
+ }
+
+ //analyze arrays
+ if (c.isArray())
+ {
+ int length = Array.getLength(o);
+ //check array [L -> no array of primitive types
+ if (o.toString().startsWith("[L"))
+ {
+ for (int i = 0; i < length; i++)
+ {
+ if (o.toString().startsWith("[Ljava.lang.String"))
+ {
+ if (ExtValUtils.getELHelper().isELTermWellFormed(Array.get(o, i)))
+ {
+ if (foundELTerms != null)
+ {
+ foundELTerms.add(o.toString());
+ }
+ elCount++;
+ }
+ }
+ else
+ {
+ elCount += resolveELTerms(Array.get(o, i), visited, foundELTerms, count + 1);
+ }
+ }
+ }
+ return elCount;
+ }
+
+ List<Field> attributes = findAllAttributes(c, new ArrayList<Field>());
+ Field[] fields = attributes.toArray(new Field[attributes.size()]);
+
+ AccessibleObject.setAccessible(fields, true);
+ for (Field currentField : fields)
+ {
+ if (currentField.get(o) == null)
+ {
+ continue;
+ }
+
+ if (currentField.getType().equals(String.class))
+ {
+ if (currentField.get(o) != null && ExtValUtils.getELHelper().isELTermWellFormed(currentField.get(o)))
+ {
+ if (foundELTerms != null)
+ {
+ foundELTerms.add(o.toString());
+ }
+ elCount++;
+ }
+ }
+ else if (!currentField.getType().isPrimitive())
+ {
+ elCount += resolveELTerms(currentField.get(o), visited, foundELTerms, count + 1);
+ }
+ }
+ return elCount;
+ }
+
+ private static List<Field> findAllAttributes(Class c, List<Field> attributes)
+ {
+ if (c == null)
+ {
+ return attributes;
+ }
+ findAllAttributes(c.getSuperclass(), attributes);
+
+ Field[] fields = c.getDeclaredFields();
+ for (Field currentField : fields)
+ {
+ if (!Modifier.isStatic(currentField.getModifiers()))
+ {
+ attributes.add(currentField);
+ }
+ }
+
+ return attributes;
+ }
+
+ private static ValueBindingExpression tryToReplaceVars(ValueBindingExpression valueBindingExpression,
+ Map<String, String> mappedFaceletsVars)
+ {
+ String property;
+ String result = "";
+ boolean last = false;
+
+ while(true)
+ {
+ if(valueBindingExpression.getBaseExpression() == null)
+ {
+ last = true;
+ }
+
+
+ property = valueBindingExpression.getProperty();
+
+ valueBindingExpression = ValueBindingExpression
+ .replaceProperty(valueBindingExpression, getNewProperty(property, mappedFaceletsVars));
+
+ if(result.length() == 0)
+ {
+ result = valueBindingExpression.getProperty();
+ }
+ else
+ {
+ result = valueBindingExpression.getProperty() + "." + result;
+ }
+
+ valueBindingExpression = valueBindingExpression.getBaseExpression();
+
+ if(last)
+ {
+ break;
+ }
+ }
+ return new ValueBindingExpression(valueBindingExpression.getPrefix() + "{" + result + "}");
+ }
+
+ private static String getNewProperty(String oldProperty, Map<String, String> mappedFaceletsVars)
+ {
+ List<String> virtualVars = getPotentialVirtualVars(oldProperty);
+
+ for(String virtualVar : virtualVars)
+ {
+ if(mappedFaceletsVars.containsKey(virtualVar))
+ {
+ oldProperty = replacePropertyValue(oldProperty, virtualVar, mappedFaceletsVars.get(virtualVar));
+ }
+ }
+ return oldProperty;
+ }
+
+ private static List<String> getPotentialVirtualVars(String oldProperty)
+ {
+ int start = -1;
+ int end = -1;
+
+ List<String> virtualVarList = new ArrayList<String>();
+
+ for(int i = 0; i < oldProperty.length(); i++)
+ {
+ if(start == - 1 && oldProperty.charAt(i) == '[')
+ {
+ start = i + 1;
+ }
+ else if((start != - 1 && oldProperty.charAt(i) == '[') || oldProperty.charAt(i) == ']')
+ {
+ end = i;
+ }
+
+ if(start != -1 && end != -1)
+ {
+ virtualVarList.add(oldProperty.substring(start, end));
+ if(oldProperty.charAt(i) == '[')
+ {
+ start = i + 1;
+ }
+ else
+ {
+ start = -1;
+ }
+ end = -1;
+ }
+ }
+
+ return virtualVarList;
+ }
+
+ private static String replacePropertyValue(String oldProperty, String targetVar, String newValue)
+ {
+ int index = oldProperty.indexOf(targetVar);
+
+ if(index == -1)
+ {
+ return oldProperty;
+ }
+
+ String result = oldProperty.substring(0, index);
+ result += newValue;
+ return result + oldProperty.substring(index + targetVar.length(), oldProperty.length());
+ }
+
+ /*
+ * replace virtual facelets vars (map syntax)
+ * tested styles (simple and nested): test[ix[ix2[ix3]]]
+ */
+ /*
+ private static String _createBinding(List<String> expressions, Map<String, String> virtualVars)
+ {
+ String result = "";
+
+ String prevFaceletsAttributeName = null;
+ String currentBinding;
+ String partOfBinding;
+
+ int indexOfBindingDetails;
+ String[] foundBindingDetails;
+ String[] bindingDetails;
+
+ List<String> addedVirtualNames = new ArrayList<String>();
+
+ for (String entry : expressions)
+ {
+ if (entry.startsWith("ValueExpression["))
+ {
+ continue;
+ }
+
+ foundBindingDetails = entry.split(" ");
+ indexOfBindingDetails = findIndexOfBindingDetails(foundBindingDetails);
+
+ if (indexOfBindingDetails == -1)
+ {
+ return null;
+ }
+
+ bindingDetails = foundBindingDetails[indexOfBindingDetails].split("=");
+
+ if (bindingDetails.length < 2)
+ {
+ return null;
+ }
+
+ currentBinding = bindingDetails[1];
+
+ //to support blanks within a binding with map syntax
+ if(currentBinding.contains("{") && !currentBinding.contains("}"))
+ {
+ currentBinding = addFurtherBindingParts(currentBinding, foundBindingDetails, indexOfBindingDetails);
+ }
+
+ if (prevFaceletsAttributeName != null && currentBinding.contains("}"))
+ {
+ //entry for "virtual" facelets beans
+ if(!addedVirtualNames.contains(bindingDetails[0]))
+ {
+ partOfBinding = currentBinding.substring(currentBinding.indexOf(prevFaceletsAttributeName)
+ + prevFaceletsAttributeName.length(), currentBinding.indexOf("}"));
+
+ addedVirtualNames.add(bindingDetails[0]);
+ result = result + partOfBinding;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ //entry for "virtual" facelets var
+ else if(!(currentBinding.contains("{") || currentBinding.contains("}")))
+ {
+ virtualVars.put(bindingDetails[0], bindingDetails[1].substring(1, bindingDetails[1].length()-2));
+ continue;
+ }
+ else
+ {
+ if(!addedVirtualNames.contains(bindingDetails[0]))
+ {
+ addedVirtualNames.add(bindingDetails[0]);
+ result = currentBinding.substring(currentBinding.indexOf("{") + 1, currentBinding.indexOf("}"));
+ }
+ }
+
+ prevFaceletsAttributeName = bindingDetails[0];
+ }
+ return result;
+ }
+ */
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ValueBindingExpression.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ValueBindingExpression.java
new file mode 100644
index 0000000..d78eb66
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ValueBindingExpression.java
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.el;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@ToDo(value = Priority.MEDIUM, description = "difference between [ and [' - test with more constellations")
+@UsageInformation({UsageCategory.API})
+public class ValueBindingExpression
+{
+ private ValueBindingExpression base;
+ private String value;
+ private String prefix;
+ private String token;
+
+ public static ValueBindingExpression replaceOrAddProperty(ValueBindingExpression valueBindingExpression,
+ String newProperty)
+ {
+ if(valueBindingExpression.getBaseExpression() != null)
+ {
+ return replaceProperty(valueBindingExpression, newProperty);
+ }
+ else
+ {
+ return addProperty(valueBindingExpression, newProperty);
+ }
+ }
+
+ public static ValueBindingExpression replaceProperty(ValueBindingExpression valueBindingExpression,
+ String newProperty)
+ {
+ //TODO adjustments for isDynamicBaseAndProperty
+ if(valueBindingExpression.getProperty().endsWith("']"))
+ {
+ valueBindingExpression = valueBindingExpression.getBaseExpression();
+ }
+
+ if(valueBindingExpression.getBaseExpression() != null)
+ {
+ return addProperty(valueBindingExpression.getBaseExpression(), newProperty);
+ }
+ else
+ {
+ return addProperty(valueBindingExpression, newProperty);
+ }
+ }
+
+ public static ValueBindingExpression addProperty(ValueBindingExpression valueBindingExpression, String newProperty)
+ {
+ String sourceExpression = valueBindingExpression.getExpressionString();
+ String result = sourceExpression.substring(0, sourceExpression.length() - 1);
+
+ //TODO adjustments for isDynamicBaseAndProperty
+ if(newProperty.startsWith("['"))
+ {
+ return new ValueBindingExpression(result + newProperty + "}");
+ }
+ else
+ {
+ return new ValueBindingExpression(result + "." + newProperty + "}");
+ }
+ }
+
+ public ValueBindingExpression(String expression)
+ {
+ if(!ExtValUtils.getELHelper().isELTermWellFormed(expression))
+ {
+ throw new IllegalStateException(expression + " is no valid el-expression");
+ }
+
+ boolean isDynamicBaseAndProperty = expression.lastIndexOf("']") == -1;
+ int index1 = isDynamicBaseAndProperty ? expression.lastIndexOf("]") : expression.lastIndexOf("']");
+ int index2 = expression.lastIndexOf(".");
+
+ if(index1 > index2)
+ {
+ expression = expression.substring(0, index1);
+
+ int index3 = findIndexOfStartingBracket(expression);
+ if(isDynamicBaseAndProperty)
+ {
+ this.value = expression.substring(index3 + 1, index1);
+
+ }
+ else
+ {
+ this.value = expression.substring(index3 + 2, index1);
+ }
+
+ this.base = new ValueBindingExpression(expression.substring(0, index3) + "}");
+ this.token = isDynamicBaseAndProperty ? "[" : "['";
+ }
+ else if( index2 > index1)
+ {
+ this.value = expression.substring(index2 + 1, expression.length() - 1 );
+ this.base = new ValueBindingExpression(expression.substring(0, index2) + "}");
+ this.token = ".";
+ }
+ else
+ {
+ this.value = expression.substring(2, expression.length() - 1);
+ this.prefix = expression.substring(0, 1);
+ }
+ }
+
+ public String getProperty()
+ {
+ this.value = this.value.trim();
+
+ if("[".equals(this.token))
+ {
+ if(this.value.startsWith("'"))
+ {
+ return this.value.substring(1, this.value.length() - 1);
+ }
+ //return this.base.value + this.token + this.value.substring(0, this.value.length()) + "']";
+ }
+ return value;
+ }
+
+ public ValueBindingExpression getBaseExpression()
+ {
+ return base;
+ }
+
+ public String getExpressionString()
+ {
+ if(this.base != null)
+ {
+ String baseExpression = this.base.getExpressionString();
+
+ if("['".equals(this.token))
+ {
+ return baseExpression.substring(0, baseExpression.length() - 1) + this.token + this.value + "']}";
+ }
+ else if("[".equals(this.token))
+ {
+ return baseExpression.substring(0, baseExpression.length() - 1) + this.token + this.value + "]}";
+ }
+ return baseExpression.substring(0, baseExpression.length() - 1) + this.token + this.value + "}";
+ }
+ else
+ {
+ return this.prefix + "{" + this.value + "}";
+ }
+ }
+
+ public String getPrefix()
+ {
+ if(this.base != null)
+ {
+ return this.base.getPrefix();
+ }
+ else
+ {
+ return prefix;
+ }
+ }
+
+ public void setPrefix(String prefix)
+ {
+ if(this.base != null)
+ {
+ this.base.setPrefix(prefix);
+ }
+ else
+ {
+ this.prefix = prefix;
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return getExpressionString();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getExpressionString().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object target)
+ {
+ return target instanceof ValueBindingExpression && getExpressionString()
+ .equals(((ValueBindingExpression) target).getExpressionString());
+ }
+
+ private int findIndexOfStartingBracket(String expression)
+ {
+ int closeCount = 0;
+ for(int i = expression.length() - 1; i > 0; i--)
+ {
+ if(expression.charAt(i) == '[')
+ {
+ closeCount--;
+ if(closeCount < 0)
+ {
+ return i;
+ }
+ }
+ else if(expression.charAt(i) == ']')
+ {
+ closeCount++;
+ }
+ }
+ return 0;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.java
new file mode 100644
index 0000000..682e514
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/AbstractNameMapperAwareFactory.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.factory;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.API)
+public abstract class AbstractNameMapperAwareFactory<T> implements NameMapperAwareFactory<NameMapper<T>>
+{
+ private List<Class> deniedNameMapperList = new ArrayList<Class>();
+
+ public synchronized void register(NameMapper<T> nameMapper)
+ {
+ if(!deniedNameMapperList.contains(nameMapper.getClass()))
+ {
+ getNameMapperList().add(nameMapper);
+ }
+ }
+
+ public synchronized void deregister(Class<? extends NameMapper> classToDeregister)
+ {
+ Iterator<NameMapper<T>> nameMapperIterator = getNameMapperList().iterator();
+ while(nameMapperIterator.hasNext())
+ {
+ if(nameMapperIterator.next().getClass().getName().equals(classToDeregister.getName()))
+ {
+ nameMapperIterator.remove();
+ //don't break - e.g. to deregister all wrappers...
+ //break;
+ }
+ }
+ }
+
+ public void deny(Class<? extends NameMapper> classToDeny)
+ {
+ deregister(classToDeny);
+
+ synchronized (getClass())
+ {
+ deniedNameMapperList.add(classToDeny);
+ }
+ }
+
+ protected abstract List<NameMapper<T>> getNameMapperList();
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/ClassMappingFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/ClassMappingFactory.java
new file mode 100644
index 0000000..d366070
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/ClassMappingFactory.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.factory;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface ClassMappingFactory<P, R>
+{
+ R create(P source);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java
new file mode 100644
index 0000000..2832dba
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java
@@ -0,0 +1,267 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.factory;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.DefaultComponentMetaDataExtractorFactory;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.core.el.DefaultELHelperFactory;
+import org.apache.myfaces.extensions.validator.core.renderkit.DefaultRenderKitWrapperFactory;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.DefaultMetaDataTransformerFactory;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.DefaultValidationStrategyFactory;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.DefaultMessageResolverFactory;
+import org.apache.myfaces.extensions.validator.core.validation.message.DefaultFacesMessageFactory;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+//dynamic approach to create the factories during the first request, when a faces-context is available
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultFactoryFinder implements FactoryFinder
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+ protected Map<FactoryNames, Object> factoryMap = new HashMap<FactoryNames, Object>();
+
+ private static FactoryFinder factoryFinder = new DefaultFactoryFinder();
+
+ private DefaultFactoryFinder()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public static FactoryFinder getInstance()
+ {
+ return factoryFinder;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public final <T> T getFactory(FactoryNames factoryName, Class<T> targetClass)
+ {
+ if(!(factoryMap.containsKey(factoryName)))
+ {
+ initFactory(factoryName);
+ }
+
+ return (T)factoryMap.get(factoryName);
+ }
+
+ private void initFactory(FactoryNames factoryName)
+ {
+ Object factory = null;
+ switch (factoryName)
+ {
+ case COMPONENT_META_DATA_EXTRACTOR_FACTORY:
+ factory = createComponentMetaDataExtractorFactory();
+ break;
+
+ case VALIDATION_STRATEGY_FACTORY:
+ factory = createValidationStrategyFactory();
+ break;
+
+ case MESSAGE_RESOLVER_FACTORY:
+ factory = createMessageResolverFactory();
+ break;
+
+ case META_DATA_TRANSFORMER_FACTORY:
+ factory = createMetaDataTransformerFactory();
+ break;
+
+ case RENDERKIT_WRAPPER_FACTORY:
+ factory = createRenderKitWrapperFactory();
+ break;
+
+ case EL_HELPER_FACTORY:
+ factory = createELHelperFactory();
+ break;
+
+ case FACES_MESSAGE_FACTORY:
+ factory = createFacesMessageFactory();
+ break;
+
+ default: //required by checkstyle
+ }
+
+ if(factory == null)
+ {
+ throw new IllegalStateException("not possible to create factory " + factoryName);
+ }
+
+ factoryMap.put(factoryName, factory);
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "add global property extension point")
+ protected Object createComponentMetaDataExtractorFactory()
+ {
+ Object factory = null;
+
+ List<String> metaDataExtractorFactoryClassNames = new ArrayList<String>();
+
+ metaDataExtractorFactoryClassNames.add(WebXmlParameter.CUSTOM_COMPONENT_META_DATA_EXTRACTOR_FACTORY);
+ metaDataExtractorFactoryClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.COMPONENT_META_DATA_EXTRACTOR_FACTORY));
+ metaDataExtractorFactoryClassNames.add(DefaultComponentMetaDataExtractorFactory.class.getName());
+
+ for (String className : metaDataExtractorFactoryClassNames)
+ {
+ factory = ClassUtils.tryToInstantiateClassForName(className);
+
+ if (factory != null)
+ {
+ break;
+ }
+ }
+ return factory;
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "add global property extension point")
+ protected Object createValidationStrategyFactory()
+ {
+ Object factory = null;
+
+ List<String> validationStrategyFactoryClassNames = new ArrayList<String>();
+
+ validationStrategyFactoryClassNames.add(WebXmlParameter.CUSTOM_VALIDATION_STRATEGY_FACTORY);
+ validationStrategyFactoryClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.VALIDATION_STRATEGY_FACTORY));
+ validationStrategyFactoryClassNames.add(DefaultValidationStrategyFactory.class.getName());
+
+ for (String className : validationStrategyFactoryClassNames)
+ {
+ factory = ClassUtils.tryToInstantiateClassForName(className);
+
+ if (factory != null)
+ {
+ break;
+ }
+ }
+
+ return factory;
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "add global property extension point")
+ protected Object createMessageResolverFactory()
+ {
+ Object factory = null;
+ List<String> messageResolverFactoryClassNames = new ArrayList<String>();
+
+ messageResolverFactoryClassNames.add(WebXmlParameter.CUSTOM_MESSAGE_RESOLVER_FACTORY);
+ messageResolverFactoryClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.MESSAGE_RESOLVER_FACTORY));
+ messageResolverFactoryClassNames
+ .add(DefaultMessageResolverFactory.class.getName());
+
+ for (String className : messageResolverFactoryClassNames)
+ {
+ factory = ClassUtils.tryToInstantiateClassForName(className);
+
+ if (factory != null)
+ {
+ break;
+ }
+ }
+
+ return factory;
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "add global property extension point")
+ protected Object createMetaDataTransformerFactory()
+ {
+ Object factory = null;
+ List<String> metaDataTransformerFactoryClassNames = new ArrayList<String>();
+
+ metaDataTransformerFactoryClassNames.add(WebXmlParameter.CUSTOM_META_DATA_TRANSFORMER_FACTORY );
+ metaDataTransformerFactoryClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.META_DATA_TRANSFORMER_FACTORY));
+ metaDataTransformerFactoryClassNames.add(DefaultMetaDataTransformerFactory.class.getName());
+
+ for (String className : metaDataTransformerFactoryClassNames)
+ {
+ factory = ClassUtils.tryToInstantiateClassForName(className);
+
+ if (factory != null)
+ {
+ break;
+ }
+ }
+
+ return factory;
+ }
+
+ protected Object createRenderKitWrapperFactory()
+ {
+ return new DefaultRenderKitWrapperFactory();
+ }
+
+ private Object createFacesMessageFactory()
+ {
+ Object factory = null;
+
+ List<String> facesMessageFactoryClassNames = new ArrayList<String>();
+
+ facesMessageFactoryClassNames.add(WebXmlParameter.CUSTOM_FACES_MESSAGE_FACTORY);
+ facesMessageFactoryClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.FACES_MESSAGE_FACTORY));
+
+ Object target = ExtValContext.getContext().getGlobalProperty(CustomInformation.FACES_MESSAGE_FACTORY.name());
+ if(target != null && target instanceof String)
+ {
+ facesMessageFactoryClassNames.add((String)target);
+ }
+ facesMessageFactoryClassNames.add(DefaultFacesMessageFactory.class.getName());
+
+ for (String className : facesMessageFactoryClassNames)
+ {
+ factory = ClassUtils.tryToInstantiateClassForName(className);
+
+ if (factory != null)
+ {
+ break;
+ }
+ }
+
+ return factory;
+ }
+
+ private Object createELHelperFactory()
+ {
+ return new DefaultELHelperFactory();
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FacesMessageFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FacesMessageFactory.java
new file mode 100644
index 0000000..97bd8a3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FacesMessageFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.factory;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.API)
+public interface FacesMessageFactory
+{
+ FacesMessage convert(FacesMessage facesMessage);
+
+ FacesMessage create(FacesMessage.Severity severity, String summary, String detail);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryFinder.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryFinder.java
new file mode 100644
index 0000000..a4f2625
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryFinder.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.factory;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface FactoryFinder
+{
+ <T> T getFactory(FactoryNames factoryName, Class<T> targetClass);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java
new file mode 100644
index 0000000..51f3139
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.factory;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.API})
+public enum FactoryNames
+{
+ COMPONENT_META_DATA_EXTRACTOR_FACTORY,
+ VALIDATION_STRATEGY_FACTORY,
+ MESSAGE_RESOLVER_FACTORY,
+ META_DATA_TRANSFORMER_FACTORY,
+
+ FACES_MESSAGE_FACTORY,
+
+ RENDERKIT_WRAPPER_FACTORY,
+ EL_HELPER_FACTORY
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/NameMapperAwareFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/NameMapperAwareFactory.java
new file mode 100644
index 0000000..bd2d1f0
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/NameMapperAwareFactory.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.factory;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.API)
+public interface NameMapperAwareFactory<T extends NameMapper>
+{
+ void register(T classToAdd);
+ void deregister(Class<? extends NameMapper> classToDeregister);
+ void deny(Class<? extends NameMapper> classToDeny);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/ComponentInitializer.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/ComponentInitializer.java
new file mode 100644
index 0000000..b9bd97a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/ComponentInitializer.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.initializer.component;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * Allows to initialize components beforeEncodeBegin.<br/>
+ * e.g.: you can add information for client-side validation mechanisms,...
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface ComponentInitializer
+{
+ void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData);
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfiguration.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfiguration.java
new file mode 100644
index 0000000..359c041
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfiguration.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.initializer.configuration;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface StaticConfiguration<T, R>
+{
+ void setSourceOfMapping(String path);
+ List<StaticConfigurationEntry<T, R>> getMapping();
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationEntry.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationEntry.java
new file mode 100644
index 0000000..2b84af5
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationEntry.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.initializer.configuration;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public class StaticConfigurationEntry<T, R>
+{
+ private T source;
+ private R target;
+
+ public T getSource()
+ {
+ return source;
+ }
+
+ public void setSource(T source)
+ {
+ this.source = source;
+ }
+
+ public R getTarget()
+ {
+ return target;
+ }
+
+ public void setTarget(R target)
+ {
+ this.target = target;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.java
new file mode 100644
index 0000000..a2bcdc4
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.initializer.configuration;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.API})
+public enum StaticConfigurationNames
+{
+ META_DATA_TO_VALIDATION_STRATEGY_CONFIG,
+ VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_CONFIG,
+ VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_CONFIG,
+
+ SKIP_VALIDATION_SUPPORT_CONFIG
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticInMemoryConfiguration.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticInMemoryConfiguration.java
new file mode 100644
index 0000000..60cb6f4
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticInMemoryConfiguration.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.initializer.configuration;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.REUSE})
+public class StaticInMemoryConfiguration implements StaticConfiguration<String, String>
+{
+ private List<StaticConfigurationEntry<String, String>> mappings
+ = new ArrayList<StaticConfigurationEntry<String, String>>();
+
+ public void setSourceOfMapping(String path)
+ {
+ }
+
+ public List<StaticConfigurationEntry<String, String>> getMapping()
+ {
+ return mappings;
+ }
+
+ public void addMapping(String source, String target)
+ {
+ StaticConfigurationEntry<String, String> entry = new StaticConfigurationEntry<String, String>();
+ entry.setSource(source);
+ entry.setTarget(target);
+ this.mappings.add(entry);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticResourceBundleConfiguration.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticResourceBundleConfiguration.java
new file mode 100644
index 0000000..81a63c4
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticResourceBundleConfiguration.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.initializer.configuration;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.Enumeration;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.REUSE})
+public class StaticResourceBundleConfiguration implements StaticConfiguration<String, String>
+{
+ private String path;
+ private List<StaticConfigurationEntry<String, String>> mappings;
+
+ public void setSourceOfMapping(String path)
+ {
+ this.path = path;
+ //force reload
+ mappings = null;
+ }
+
+ public List<StaticConfigurationEntry<String, String>> getMapping()
+ {
+ if(mappings != null)
+ {
+ return mappings;
+ }
+
+ mappings = new ArrayList<StaticConfigurationEntry<String, String>>();
+
+ ResourceBundle mapping = ResourceBundle.getBundle(path);
+
+ if (mapping == null)
+ {
+ //logging
+ return new ArrayList<StaticConfigurationEntry<String, String>>();
+ }
+
+ Enumeration keys = mapping.getKeys();
+
+ String metaDataKey;
+ String validationStrategyClassName;
+
+ while (keys.hasMoreElements())
+ {
+ metaDataKey = (String) keys.nextElement();
+ validationStrategyClassName = mapping.getString(metaDataKey);
+
+ addMapping(metaDataKey, validationStrategyClassName);
+ }
+ return mappings;
+ }
+
+ private void addMapping(String metaDataKey, String validationStrategyClassName)
+ {
+ StaticConfigurationEntry<String, String> entry = new StaticConfigurationEntry<String, String>();
+ entry.setSource(metaDataKey);
+ entry.setTarget(validationStrategyClassName);
+ this.mappings.add(entry);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractRendererInterceptor.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractRendererInterceptor.java
new file mode 100644
index 0000000..6993968
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractRendererInterceptor.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.interceptor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipRendererDelegationException;
+import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipBeforeInterceptorsException;
+import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipAfterInterceptorsException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.convert.ConverterException;
+import javax.faces.render.Renderer;
+import java.io.IOException;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public abstract class AbstractRendererInterceptor implements RendererInterceptor
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ protected AbstractRendererInterceptor()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public final String getInterceptorId()
+ {
+ return getClass().getName();
+ }
+
+ public Object getReturnValueOnSkipRendererDelegationException(
+ SkipRendererDelegationException skipRendererDelegationException, Object currentReturnValue)
+ {
+ return currentReturnValue;
+ }
+
+ /*
+ * before
+ */
+ public void beforeDecode(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
+ throws SkipBeforeInterceptorsException, SkipRendererDelegationException
+ {
+ }
+
+ public void beforeEncodeBegin(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
+ throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException
+ {
+ }
+
+ public void beforeEncodeChildren(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
+ throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException
+ {
+ }
+
+ public void beforeEncodeEnd(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
+ throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException
+ {
+ }
+
+ public void beforeGetConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o, Renderer wrapped)
+ throws ConverterException, SkipBeforeInterceptorsException, SkipRendererDelegationException
+ {
+ }
+
+ /*
+ * after
+ */
+ public void afterDecode(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
+ throws SkipAfterInterceptorsException
+ {
+ }
+
+ public void afterEncodeBegin(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
+ throws IOException, SkipAfterInterceptorsException
+ {
+ }
+
+ public void afterEncodeChildren(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
+ throws IOException, SkipAfterInterceptorsException
+ {
+ }
+
+ public void afterEncodeEnd(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
+ throws IOException, SkipAfterInterceptorsException
+ {
+ }
+
+ public void afterGetConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o, Renderer wrapped)
+ throws ConverterException, SkipAfterInterceptorsException
+ {
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/MetaDataExtractionInterceptor.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/MetaDataExtractionInterceptor.java
new file mode 100644
index 0000000..8a3b1b6
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/MetaDataExtractionInterceptor.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.interceptor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.API)
+public interface MetaDataExtractionInterceptor
+{
+ /**
+ *
+ * @param propertyInformation the information entry which contains information about the property
+ */
+ void afterExtracting(PropertyInformation propertyInformation);
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/RendererInterceptor.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/RendererInterceptor.java
new file mode 100644
index 0000000..431f054
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/RendererInterceptor.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.interceptor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipBeforeInterceptorsException;
+import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipRendererDelegationException;
+import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipAfterInterceptorsException;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.convert.ConverterException;
+import javax.faces.render.Renderer;
+import java.io.IOException;
+
+/**
+ * Allows to intercept renderer methods.<br/>
+ * Base mechanism of extval. It allows to add custom infrastructures.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface RendererInterceptor
+{
+ String getInterceptorId();
+
+ Object getReturnValueOnSkipRendererDelegationException(
+ SkipRendererDelegationException skipRendererDelegationException, Object currentReturnValue);
+
+ /*
+ * before
+ */
+ void beforeDecode(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
+ throws SkipBeforeInterceptorsException, SkipRendererDelegationException;
+
+ void beforeEncodeBegin(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
+ throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException;
+
+ void beforeEncodeChildren(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
+ throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException;
+
+ void beforeEncodeEnd(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
+ throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException;
+
+ void beforeGetConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o, Renderer renderer)
+ throws ConverterException, SkipBeforeInterceptorsException, SkipRendererDelegationException;
+
+ /*
+ * after
+ */
+ void afterDecode(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
+ throws SkipAfterInterceptorsException;
+
+ void afterEncodeBegin(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
+ throws IOException, SkipAfterInterceptorsException;
+
+ void afterEncodeChildren(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
+ throws IOException, SkipAfterInterceptorsException;
+
+ void afterEncodeEnd(FacesContext facesContext, UIComponent uiComponent, Renderer renderer)
+ throws IOException, SkipAfterInterceptorsException;
+
+ void afterGetConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o, Renderer renderer)
+ throws ConverterException, SkipAfterInterceptorsException;
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.java
new file mode 100644
index 0000000..97c09ab
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.interceptor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+
+import javax.faces.component.UIComponent;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * Allows to intercept validatior exceptions.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface ValidationExceptionInterceptor
+{
+ /**
+ *
+ * @param uiComponent the current component
+ * @param metaDataEntry the meta data entry which contains the meta data of the property
+ * @param convertedObject the converted user input
+ * @param validatorException the current exception
+ * @param validatorExceptionSource validation strategy which threw the exception
+ * @return false to stop throwing the exception
+ */
+ boolean afterThrowing(UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject,
+ ValidatorException validatorException,
+ ValidationStrategy validatorExceptionSource);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java
new file mode 100644
index 0000000..5956949
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.interceptor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipBeforeInterceptorsException;
+import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipRendererDelegationException;
+import org.apache.myfaces.extensions.validator.core.recorder.ProcessedInformationRecorder;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.convert.ConverterException;
+import javax.faces.render.Renderer;
+import javax.faces.validator.ValidatorException;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ValidationInterceptor extends AbstractRendererInterceptor
+{
+ @Override
+ public void beforeEncodeBegin(FacesContext facesContext, UIComponent uiComponent, Renderer wrapped)
+ throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException
+ {
+ initComponent(facesContext, uiComponent);
+ }
+
+ protected void initComponent(FacesContext facesContext, UIComponent uiComponent)
+ {
+ if(!(uiComponent instanceof EditableValueHolder))
+ {
+ return;
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start to init component " + uiComponent.getClass().getName());
+ }
+
+ ValidationStrategy validationStrategy;
+ MetaDataTransformer metaDataTransformer;
+
+ MetaDataExtractor metaDataExtractor = ExtValUtils.getComponentMetaDataExtractor();
+
+ Map<String, Object> metaData = new HashMap<String, Object>();
+ for (MetaDataEntry entry : metaDataExtractor.extract(facesContext, uiComponent).getMetaDataEntries())
+ {
+ validationStrategy = ExtValUtils.getValidationStrategyForMetaData(entry.getKey());
+
+ if (validationStrategy != null)
+ {
+ if(!skipValidation(facesContext, uiComponent, validationStrategy, entry))
+ {
+ metaDataTransformer = ExtValUtils.getMetaDataTransformerForValidationStrategy(validationStrategy);
+
+ if(metaDataTransformer != null)
+ {
+ if(this.logger.isDebugEnabled())
+ {
+ this.logger.debug(metaDataTransformer.getClass().getName() + " instantiated");
+ }
+
+ metaData = metaDataTransformer.convertMetaData(entry);
+ }
+ else
+ {
+ metaData = null;
+ }
+
+ if(metaData == null)
+ {
+ metaData = new HashMap<String, Object>();
+ }
+ }
+
+ if(!metaData.isEmpty() &&
+ Boolean.TRUE.equals(entry.getProperty(PropertyInformationKeys.SKIP_VALIDATION, Boolean.class)))
+ {
+ metaData.put(CommonMetaDataKeys.SKIP_VALIDATION, true);
+ }
+
+ //get component initializer for the current component and configure it
+ //also in case of skipped validation to reset e.g. the required attribute
+ if(!metaData.isEmpty())
+ {
+ ExtValUtils.configureComponentWithMetaData(facesContext, uiComponent, metaData);
+ }
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("init component of " + uiComponent.getClass().getName() + " finished");
+ }
+ }
+
+ @Override
+ public void beforeGetConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o, Renderer wrapped)
+ throws ConverterException, SkipBeforeInterceptorsException, SkipRendererDelegationException
+ {
+ Object convertedObject = wrapped.getConvertedValue(facesContext, uiComponent, o);
+
+ //recorde user input e.g. for cross-component validation
+ for(ProcessedInformationRecorder recorder : ExtValContext.getContext().getProcessedInformationRecorders())
+ {
+ recorder.recordUserInput(uiComponent, convertedObject);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(recorder.getClass().getName() + " called");
+ }
+ }
+
+ try
+ {
+ processValidation(facesContext, uiComponent, convertedObject);
+ }
+ catch (ValidatorException e)
+ {
+ throw new ConverterException(e.getFacesMessage(), e);
+ }
+ }
+
+ protected void processValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject)
+ {
+ if (!(uiComponent instanceof EditableValueHolder))
+ {
+ return;
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start validation");
+ }
+
+ ValidationStrategy validationStrategy;
+
+ MetaDataExtractor metaDataExtractor = ExtValUtils.getComponentMetaDataExtractor();
+
+ for (MetaDataEntry entry : metaDataExtractor.extract(facesContext, uiComponent).getMetaDataEntries())
+ {
+ validationStrategy = ExtValUtils.getValidationStrategyForMetaData(entry.getKey());
+
+ if (validationStrategy != null)
+ {
+ if(skipValidation(facesContext, uiComponent, validationStrategy, entry))
+ {
+ //required is a special case - reset it
+ ((EditableValueHolder)uiComponent).setRequired(false);
+
+ continue;
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("validate " + entry.getValue() + " with " +
+ validationStrategy.getClass().getName());
+ }
+
+ validationStrategy.validate(facesContext, uiComponent, entry, convertedObject);
+ }
+ else
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("no validation strategy found for "
+ + entry.getValue());
+ }
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("validation finished");
+ }
+ }
+
+ protected boolean skipValidation(FacesContext facesContext,
+ UIComponent uiComponent,
+ ValidationStrategy validationStrategy,
+ MetaDataEntry entry)
+ {
+ //override for custom skip validation support (if needed)
+ return false;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/AbstractCustomNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/AbstractCustomNameMapper.java
new file mode 100644
index 0000000..47d3865
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/AbstractCustomNameMapper.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.mapper;
+
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A generic implementation. Subclasses just have to now the fully qualified name of the name mapper.
+ *
+ * NameMappers are stateless.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.REUSE)
+public abstract class AbstractCustomNameMapper<T> implements NameMapper<T>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+ private NameMapper<T> customNameMapper;
+
+ protected AbstractCustomNameMapper()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public String createName(T source)
+ {
+ if (customNameMapper == null)
+ {
+ String className = getCustomNameMapperClassName();
+
+ if (className != null)
+ {
+ customNameMapper = (NameMapper<T>) ClassUtils.tryToInstantiateClassForName(className);
+ }
+ }
+
+ return (customNameMapper != null) ? customNameMapper.createName(source) : null;
+ }
+
+ protected abstract String getCustomNameMapperClassName();
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/NameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/NameMapper.java
new file mode 100644
index 0000000..106078d
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/NameMapper.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.mapper;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * Interface for name mappers.
+ * A name mapper calculates a name for a given source object.
+ * e.g. Meta-Data Key (e.g.: annotation class name) -> ValidationStrategy
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface NameMapper<T>
+{
+ String createName(T source);
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/CommonMetaDataKeys.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/CommonMetaDataKeys.java
new file mode 100644
index 0000000..87cc431
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/CommonMetaDataKeys.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * helper for frequent meta-data keys
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+/*
+ * placed in core to avoid duplicated information in multiple modules (validation module and component-support module)
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface CommonMetaDataKeys
+{
+ static final String REQUIRED = "required";
+ static final String WEAK_REQUIRED = "weak_required";
+
+ static final String MIN_LENGTH = "min_length";
+ static final String MAX_LENGTH = "max_length";
+
+ static final String RANGE_MIN = "range_min";
+ static final String RANGE_MAX = "range_max";
+
+ static final String PATTERN = "pattern";
+ static final String PATTERN_VALIDATION_ERROR_MESSAGE = "pattern_validation_error_message";
+ static final String EMAIL = "email";
+
+ static final String CUSTOM = "custom";
+ static final String SKIP_VALIDATION = "skip_validation";
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/MetaDataEntry.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/MetaDataEntry.java
new file mode 100644
index 0000000..1e54582
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/MetaDataEntry.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Data holder which stores the meta-data and some information where the meta-data was around.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public class MetaDataEntry
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private String key;
+ private Object value;
+ private Map<String, Object> properties = new HashMap<String, Object>();
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey(String key)
+ {
+ if(this.logger.isTraceEnabled())
+ {
+ this.logger.trace("setting meta-data key: " + key);
+ }
+
+ this.key = key;
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+
+ public <T> T getValue(Class<T> targetClass)
+ {
+ return (T)getValue();
+ }
+
+ public void setValue(Object value)
+ {
+ if(this.logger.isTraceEnabled())
+ {
+ this.logger.trace("setting meta-data value: " + value);
+ }
+
+ this.value = value;
+ }
+
+ public void setProperties(Map<String, Object> properties)
+ {
+ this.properties = properties;
+ }
+
+ public Object getProperty(String key)
+ {
+ return this.properties.get(key);
+ }
+
+ public <T> T getProperty(String key, Class<T> targetClass)
+ {
+ return (T)getProperty(key);
+ }
+
+ public void setProperty(String key, Object value)
+ {
+ if(this.logger.isTraceEnabled())
+ {
+ this.logger.trace("new property added key: " + key + " value: " + value + " for metadata-key: " + this.key);
+ }
+
+ this.properties.put(key, value);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/ComponentMetaDataExtractorFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/ComponentMetaDataExtractorFactory.java
new file mode 100644
index 0000000..232f4a7
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/ComponentMetaDataExtractorFactory.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.extractor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * The interface for all factories which create meta-data extractors
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface ComponentMetaDataExtractorFactory
+{
+ MetaDataExtractor create();
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractor.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractor.java
new file mode 100644
index 0000000..d589c90
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractor.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.extractor;
+
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.core.property.DefaultPropertyInformation;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Default implementation which extracts meta-data (e.g. the annotations) of the value binding of a component.
+ * It extracts the meta-data of the field and the property.
+ * (Also the annotations of super classes and interfaces.)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultComponentMetaDataExtractor implements MetaDataExtractor
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public DefaultComponentMetaDataExtractor()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ @ToDo(Priority.MEDIUM)
+ public PropertyInformation extract(FacesContext facesContext, Object object)
+ {
+ PropertyInformation propertyInformation = new DefaultPropertyInformation();
+
+ //should never occur
+ if (!(object instanceof UIComponent))
+ {
+ if(this.logger.isWarnEnabled() && object != null)
+ {
+ this.logger.warn(object.getClass() + " is no valid component");
+ }
+ return propertyInformation;
+ }
+
+ UIComponent uiComponent = (UIComponent) object;
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start extracting meta-data of " + uiComponent.getClass().getName());
+ }
+
+ PropertyDetails propertyDetails = ExtValUtils.getELHelper().getPropertyDetailsOfValueBinding(uiComponent);
+
+ if (propertyDetails == null)
+ {
+ return propertyInformation;
+ }
+
+ /*
+ * get bean class and property name
+ */
+ Class entityClass = propertyDetails.getBaseObject().getClass();
+
+ //create
+ propertyInformation.setInformation(PropertyInformationKeys.PROPERTY_DETAILS, propertyDetails);
+
+ /*
+ * find and add annotations
+ */
+ Class currentClass = entityClass;
+
+ while (!Object.class.getName().equals(currentClass.getName()))
+ {
+ addPropertyAccessAnnotations(currentClass, propertyDetails.getProperty(), propertyInformation);
+ addFieldAccessAnnotations(currentClass, propertyDetails.getProperty(), propertyInformation);
+
+ processInterfaces(currentClass, propertyDetails, propertyInformation);
+
+ currentClass = currentClass.getSuperclass();
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("extract finished");
+ }
+
+ return propertyInformation;
+ }
+
+ private void processInterfaces(
+ Class currentClass, PropertyDetails propertyDetails, PropertyInformation propertyInformation)
+ {
+ for (Class currentInterface : currentClass.getInterfaces())
+ {
+ addPropertyAccessAnnotations(currentInterface, propertyDetails.getProperty(), propertyInformation);
+
+ processInterfaces(currentInterface, propertyDetails, propertyInformation);
+ }
+ }
+
+ protected void addPropertyAccessAnnotations(Class entity, String property,
+ PropertyInformation propertyInformation)
+ {
+ property = property.substring(0, 1).toUpperCase() + property.substring(1);
+
+ Method method;
+
+ try
+ {
+ method = entity.getDeclaredMethod("get" + property);
+ }
+ catch (NoSuchMethodException e)
+ {
+ try
+ {
+ method = entity.getDeclaredMethod("is" + property);
+ }
+ catch (NoSuchMethodException e1)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("method not found - class: " + entity.getName()
+ + " - methods: " + "get" + property + " " + "is" + property);
+ }
+
+ return;
+ }
+ }
+
+ addAnnotationToAnnotationEntries(Arrays.asList(method.getAnnotations()), propertyInformation);
+ }
+
+ protected void addFieldAccessAnnotations(Class entity, String property,
+ PropertyInformation propertyInformation)
+ {
+ Field field;
+
+ try
+ {
+ field = entity.getDeclaredField(property);
+ }
+ catch (Exception e)
+ {
+ try
+ {
+ field = entity.getDeclaredField("_" + property);
+ }
+ catch (NoSuchFieldException e1)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("field " + property + " or _" + property + " not found", e1);
+ }
+
+ return;
+ }
+ }
+
+ addAnnotationToAnnotationEntries(Arrays.asList(field.getAnnotations()), propertyInformation);
+ }
+
+ protected void addAnnotationToAnnotationEntries(
+ List<Annotation> annotations, PropertyInformation propertyInformation)
+ {
+ for (Annotation annotation : annotations)
+ {
+ propertyInformation.addMetaDataEntry(createMetaDataEntryForAnnotation(annotation));
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(annotation.getClass().getName() + " found");
+ }
+ }
+ }
+
+ protected MetaDataEntry createMetaDataEntryForAnnotation(Annotation foundAnnotation)
+ {
+ MetaDataEntry entry = new MetaDataEntry();
+
+ entry.setKey(foundAnnotation.annotationType().getName());
+ entry.setValue(foundAnnotation);
+
+ return entry;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractorFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractorFactory.java
new file mode 100644
index 0000000..4bd70ad
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractorFactory.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.extractor;
+
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This factory creates a meta-data extractor which extracts the meta-data
+ * of the value binding of a component.
+ * <p/>
+ * order:<br/>
+ * <ol>
+ * <li>configured meta-data extractor (web.xml)</li>
+ * <li>configured meta-data extractor (information provider bean)</li>
+ * <li>default implementation</li>
+ * </ol>
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultComponentMetaDataExtractorFactory implements ComponentMetaDataExtractorFactory
+{
+ private final Log logger = LogFactory.getLog(getClass());
+
+ private static MetaDataExtractor metaDataExtractor = null;
+
+ public DefaultComponentMetaDataExtractorFactory()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "logging")
+ public MetaDataExtractor create()
+ {
+ if (metaDataExtractor == null)
+ {
+ List<String> metaDataExtractorClassNames = new ArrayList<String>();
+
+ metaDataExtractorClassNames.add(WebXmlParameter.CUSTOM_COMPONENT_META_DATA_EXTRACTOR);
+ metaDataExtractorClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.COMPONENT_META_DATA_EXTRACTOR));
+ metaDataExtractorClassNames.add(DefaultComponentMetaDataExtractor.class.getName());
+
+ for (String className : metaDataExtractorClassNames)
+ {
+ metaDataExtractor = (MetaDataExtractor) ClassUtils.tryToInstantiateClassForName(className);
+
+ if (metaDataExtractor != null)
+ {
+ break;
+ }
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(metaDataExtractor.getClass().getName() + " created");
+ }
+
+ return ExtValUtils.createInterceptedMetaDataExtractor(metaDataExtractor);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/MetaDataExtractor.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/MetaDataExtractor.java
new file mode 100644
index 0000000..fd4051d
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/MetaDataExtractor.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.extractor;
+
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * An meta-data extractor is responsible to analyze an object
+ * and returns all available meta-data information
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface MetaDataExtractor
+{
+ PropertyInformation extract(FacesContext facesContext, Object object);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapter.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapter.java
new file mode 100644
index 0000000..569912a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapter.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * it's just a helper for proxies - you just need it, if you define the equivalent validation strategy as bean and
+ * e.g. spring creates a proxy for it.
+ *
+ * if there is also a proxy for the extractor you can use the className property to manually repeat the
+ * full qualified class name.
+ *
+ * @see org.apache.myfaces.extensions.validator.core.validation.strategy.BeanValidationStrategyAdapter
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.REUSE})
+public interface BeanMetaDataTransformerAdapter extends MetaDataTransformer
+{
+ String getMetaDataTransformerClassName();
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapterImpl.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapterImpl.java
new file mode 100644
index 0000000..10ea819
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapterImpl.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Map;
+
+/**
+ * it's just a helper for proxies - you just need it, if you define the equivalent validation strategy as bean and
+ * e.g. spring creates a proxy for it.
+ *
+ * if there is also a proxy for the transformer you can use the className property to manually repeat the
+ * full qualified class name.
+ *
+ * @see org.apache.myfaces.extensions.validator.core.validation.strategy.BeanValidationStrategyAdapter
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.REUSE})
+public class BeanMetaDataTransformerAdapterImpl implements MetaDataTransformer, BeanMetaDataTransformerAdapter
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private MetaDataTransformer metaDataTransformer;
+ private String metaDataTransformerClassName;
+
+ public Map<String, Object> convertMetaData(MetaDataEntry metaDataEntry)
+ {
+ return this.metaDataTransformer.convertMetaData(metaDataEntry);
+ }
+
+ public String getMetaDataTransformerClassName()
+ {
+ if(metaDataTransformerClassName != null)
+ {
+ return metaDataTransformerClassName;
+ }
+ if(metaDataTransformer.getClass().getPackage() != null)
+ {
+ metaDataTransformer.getClass();
+ }
+
+ return null;
+ }
+
+ /*
+ * generated
+ */
+ public void setMetaDataTransformerClassName(String metaDataTransformerClassName)
+ {
+ this.metaDataTransformerClassName = metaDataTransformerClassName;
+ }
+
+ public MetaDataTransformer getMetaDataTransformer()
+ {
+ return metaDataTransformer;
+ }
+
+ public void setMetaDataTransformer(MetaDataTransformer metaDataTransformer)
+ {
+ this.metaDataTransformer = metaDataTransformer;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/DefaultMetaDataTransformerFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/DefaultMetaDataTransformerFactory.java
new file mode 100644
index 0000000..625162b
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/DefaultMetaDataTransformerFactory.java
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.core.factory.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.factory.AbstractNameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.BeanValidationStrategyAdapter;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationEntry;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * Factory which creates the MetaDataTransformer for a given ValidationStrategy
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+/*
+ * ValidationStrategy -> MetaDataTransformer instead of Meta-Data -> MetaDataTransformer
+ * to avoid a second static mapping e.g. for jpa annotations
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultMetaDataTransformerFactory extends AbstractNameMapperAwareFactory<ValidationStrategy>
+ implements ClassMappingFactory<ValidationStrategy, MetaDataTransformer>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private Map<String, String> validationStrategyToMetaDataTransformerMapping;
+ private List<NameMapper<ValidationStrategy>> nameMapperList = new ArrayList<NameMapper<ValidationStrategy>>();
+
+ public DefaultMetaDataTransformerFactory()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public MetaDataTransformer create(ValidationStrategy validationStrategy)
+ {
+ String validationStrategyName = null;
+
+ //proxy check
+ if(validationStrategy.getClass().getPackage() != null)
+ {
+ validationStrategyName = validationStrategy.getClass().getName();
+ }
+ //in case of a proxy and the usage of a BeanValidationStrategyAdapter
+ else if (validationStrategy instanceof BeanValidationStrategyAdapter)
+ {
+ validationStrategyName = ((BeanValidationStrategyAdapter)validationStrategy)
+ .getValidationStrategyClassName();
+ }
+
+ if (validationStrategyToMetaDataTransformerMapping == null)
+ {
+ initStaticMappings();
+ }
+
+ if (validationStrategyToMetaDataTransformerMapping.containsKey(validationStrategyName))
+ {
+ return (MetaDataTransformer)ClassUtils.tryToInstantiateClassForName(
+ validationStrategyToMetaDataTransformerMapping.get(validationStrategyName));
+ }
+
+ MetaDataTransformer metaDataTransformer;
+ String transformerName;
+ //null -> use name mappers
+ for (NameMapper<ValidationStrategy> nameMapper : nameMapperList)
+ {
+ transformerName = nameMapper.createName(validationStrategy);
+
+ if (transformerName == null)
+ {
+ continue;
+ }
+
+ metaDataTransformer = (MetaDataTransformer)ClassUtils.tryToInstantiateClassForName(transformerName);
+
+ if (metaDataTransformer != null)
+ {
+ if(validationStrategyName != null)
+ {
+ addMapping(validationStrategyName, transformerName);
+ }
+ return metaDataTransformer;
+ }
+ }
+
+ return null;
+ }
+
+ private synchronized void initStaticMappings()
+ {
+ validationStrategyToMetaDataTransformerMapping = new HashMap<String, String>();
+
+ //setup internal static mappings
+ for (StaticConfiguration<String, String> staticConfig :
+ ExtValContext.getContext().getStaticConfiguration(
+ StaticConfigurationNames.VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_CONFIG))
+ {
+ setupStrategyMappings(staticConfig.getMapping());
+ }
+ }
+
+ private void setupStrategyMappings(List<StaticConfigurationEntry<String, String>> mappings)
+ {
+ for(StaticConfigurationEntry<String, String> mapping : mappings)
+ {
+ addMapping(mapping.getSource(), mapping.getTarget());
+ }
+ }
+
+ private synchronized void addMapping(String validationStrategyName, String transformerName)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("adding validation strategy to meta-data transformer mapping: "
+ + validationStrategyName + " -> " + transformerName);
+ }
+
+ validationStrategyToMetaDataTransformerMapping.put(validationStrategyName, transformerName);
+ }
+
+ protected List<NameMapper<ValidationStrategy>> getNameMapperList()
+ {
+ return nameMapperList;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/MetaDataTransformer.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/MetaDataTransformer.java
new file mode 100644
index 0000000..9e504b2
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/MetaDataTransformer.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+
+import java.util.Map;
+
+/**
+ * Allows to transform concrete meta-data to a more abstract form.<br/>
+ * e.g.: @Required, @Column(nullable = false,...), @Length(minimum = 1), ... -> required = true
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+//*Transformer instead of *Converter to avoid naming confusion
+public interface MetaDataTransformer
+{
+ Map<String, Object> convertMetaData(MetaDataEntry metaData);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/AbstractValidationStrategyToMetaDataTransformerNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/AbstractValidationStrategyToMetaDataTransformerNameMapper.java
new file mode 100644
index 0000000..2dadc16
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/AbstractValidationStrategyToMetaDataTransformerNameMapper.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.transformer.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL})
+public abstract class AbstractValidationStrategyToMetaDataTransformerNameMapper
+ implements NameMapper<ValidationStrategy>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public AbstractValidationStrategyToMetaDataTransformerNameMapper()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/BeanValidationStrategyToMetaDataTransformerNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/BeanValidationStrategyToMetaDataTransformerNameMapper.java
new file mode 100644
index 0000000..74722a8
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/BeanValidationStrategyToMetaDataTransformerNameMapper.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.transformer.mapper;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.BeanValidationStrategyAdapter;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * It's an alternative Mapper - if there is a proxy around the validation strategy.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL})
+public class BeanValidationStrategyToMetaDataTransformerNameMapper extends
+ AbstractValidationStrategyToMetaDataTransformerNameMapper
+{
+ public String createName(ValidationStrategy validationStrategy)
+ {
+ if(validationStrategy instanceof BeanValidationStrategyAdapter)
+ {
+ return ((BeanValidationStrategyAdapter)validationStrategy).getMetaDataTransformerClassName();
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/CustomConfiguredValidationStrategyToMetaDataTransformerNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/CustomConfiguredValidationStrategyToMetaDataTransformerNameMapper.java
new file mode 100644
index 0000000..357b2d9
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/CustomConfiguredValidationStrategyToMetaDataTransformerNameMapper.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.transformer.mapper;
+
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.mapper.AbstractCustomNameMapper;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * To provide a custom NameMapper to map ValidationStrategies to MetaDataTransformers.
+ * (configured via web.xml)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class CustomConfiguredValidationStrategyToMetaDataTransformerNameMapper extends
+ AbstractCustomNameMapper<ValidationStrategy>
+{
+ protected String getCustomNameMapperClassName()
+ {
+ return WebXmlParameter.CUSTOM_VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/CustomConventionValidationStrategyToMetaDataTransformerNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/CustomConventionValidationStrategyToMetaDataTransformerNameMapper.java
new file mode 100644
index 0000000..acacd11
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/CustomConventionValidationStrategyToMetaDataTransformerNameMapper.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.transformer.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.AbstractCustomNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * To provide a custom NameMapper to map ValidationStrategies to MetaDataTransformers.
+ * (configured via information provider bean)
+ * The bean provides the default name (convention).
+ * It's possible to provide a custom full qualified name. (= customizable convention)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class CustomConventionValidationStrategyToMetaDataTransformerNameMapper extends
+ AbstractCustomNameMapper<ValidationStrategy>
+{
+ protected String getCustomNameMapperClassName()
+ {
+ return ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/DefaultValidationStrategyToMetaDataTransformerNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/DefaultValidationStrategyToMetaDataTransformerNameMapper.java
new file mode 100644
index 0000000..802868f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/DefaultValidationStrategyToMetaDataTransformerNameMapper.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.transformer.mapper;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.InternalConventionProvider;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * Default implementation which maps ExtVal ValidationStrategies to MetaDataTransformers.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultValidationStrategyToMetaDataTransformerNameMapper extends
+ AbstractValidationStrategyToMetaDataTransformerNameMapper
+{
+ public String createName(ValidationStrategy validationStrategy)
+ {
+ return InternalConventionProvider.getMetaDataTransformerClassName(
+ validationStrategy.getClass(), getClassName(validationStrategy.getClass().getSimpleName()));
+ }
+
+ protected String getClassName(String validationStrategyClassName)
+ {
+ return InternalConventionProvider.getMetaDataTransformerClassName(validationStrategyClassName);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/SimpleValidationStrategyToMetaDataTransformerNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/SimpleValidationStrategyToMetaDataTransformerNameMapper.java
new file mode 100644
index 0000000..b85b53f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/SimpleValidationStrategyToMetaDataTransformerNameMapper.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.metadata.transformer.mapper;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * It's an alternative Mapper to place ValidationStrategies and MetaDataTransformers in the same package.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL})
+public class SimpleValidationStrategyToMetaDataTransformerNameMapper extends
+ AbstractValidationStrategyToMetaDataTransformerNameMapper
+{
+ public String createName(ValidationStrategy validationStrategy)
+ {
+ if(validationStrategy.getClass().getPackage() == null)
+ {
+ return null;
+ }
+ return getSimpleMetaDataTransformerName(validationStrategy.getClass().getPackage().getName() + ".",
+ validationStrategy.getClass().getSimpleName());
+ }
+
+ public String getSimpleMetaDataTransformerName(String validationStrategyPackageName,
+ String validationStrategyClassName)
+ {
+ String postfix = ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.META_DATA_TRANSFORMER_POSTFIX);
+
+ if(validationStrategyClassName.endsWith("ValidationStrategy") ||
+ validationStrategyClassName.endsWith("Strategy"))
+ {
+ return validationStrategyPackageName + validationStrategyClassName
+ .replace(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.VALIDATION_STRATEGY_POSTFIX) ,postfix)
+ .replace("ValidationStrategy", postfix)
+ .replace("Strategy", postfix);
+ }
+
+ //in case of a static validation strategy mapping
+ return validationStrategyPackageName + validationStrategyClassName + postfix;
+ }
+
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/DefaultPropertyInformation.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/DefaultPropertyInformation.java
new file mode 100644
index 0000000..e45f528
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/DefaultPropertyInformation.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.property;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultPropertyInformation implements PropertyInformation
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private Map<String, Object> informationMap = new HashMap<String, Object>();
+ private List<MetaDataEntry> metaDataList = new ArrayList<MetaDataEntry>();
+
+ public boolean containsInformation(String key)
+ {
+ return informationMap.containsKey(key);
+ }
+
+ public Object getInformation(String key)
+ {
+ return informationMap.get(key);
+ }
+
+ public <T> T getInformation(String key, Class<T> targetClass)
+ {
+ return (T) getInformation(key);
+ }
+
+ public void setInformation(String key, Object value)
+ {
+ if(this.logger.isTraceEnabled())
+ {
+ this.logger.trace("new information added key: " + key + " value: " + value);
+ }
+
+ informationMap.put(key, value);
+ }
+
+ public MetaDataEntry[] getMetaDataEntries()
+ {
+ return metaDataList.toArray(new MetaDataEntry[metaDataList.size()]);
+ }
+
+ public void addMetaDataEntry(MetaDataEntry metaDataEntry)
+ {
+ metaDataEntry.setProperties(this.informationMap);
+ this.metaDataList.add(metaDataEntry);
+ }
+
+ public void resetMetaDataEntries()
+ {
+ if(this.logger.isTraceEnabled())
+ {
+ this.logger.trace("resetting meta-data entries");
+ }
+
+ this.metaDataList.clear();
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java
new file mode 100644
index 0000000..79037cf
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyDetails.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.property;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class PropertyDetails
+{
+ //forms the id for cross-validation within complex components
+ private String key;
+ private Object baseObject;
+ private String property;
+
+ public PropertyDetails(String key, Object baseObject, String property)
+ {
+ this.key = key;
+ this.baseObject = baseObject;
+ this.property = property;
+ }
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey(String key)
+ {
+ this.key = key;
+ }
+
+ public Object getBaseObject()
+ {
+ return baseObject;
+ }
+
+ public void setBaseObject(Object baseObject)
+ {
+ this.baseObject = baseObject;
+ }
+
+ public String getProperty()
+ {
+ return property;
+ }
+
+ public void setProperty(String property)
+ {
+ this.property = property;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformation.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformation.java
new file mode 100644
index 0000000..ad9284f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformation.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.property;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface PropertyInformation
+{
+ boolean containsInformation(String key);
+ Object getInformation(String key);
+ <T> T getInformation(String key, Class<T> targetClass);
+ void setInformation(String key, Object value);
+
+ MetaDataEntry[] getMetaDataEntries();
+ void addMetaDataEntry(MetaDataEntry metaDataEntry);
+ void resetMetaDataEntries();
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java
new file mode 100644
index 0000000..24e925c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.property;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface PropertyInformationKeys
+{
+ static final String PROPERTY_DETAILS = "property_details";
+ static final String SKIP_VALIDATION = "skip_validation";
+ static final String LABEL = "label";
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/recorder/ProcessedInformationRecorder.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/recorder/ProcessedInformationRecorder.java
new file mode 100644
index 0000000..270f23f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/recorder/ProcessedInformationRecorder.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.recorder;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * Allows to capture converted values.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface ProcessedInformationRecorder
+{
+ void recordUserInput(UIComponent uiComponent, Object value);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/AbstractRenderKitWrapperFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/AbstractRenderKitWrapperFactory.java
new file mode 100644
index 0000000..39de5c4
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/AbstractRenderKitWrapperFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.renderkit;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.factory.ClassMappingFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.render.RenderKit;
+
+/**
+ * Base for all RenderKitWrapperFactories to force a specific behaviour
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public abstract class AbstractRenderKitWrapperFactory implements ClassMappingFactory<RenderKit, RenderKit>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ protected AbstractRenderKitWrapperFactory wrapped;
+ private boolean deactivated = false;
+
+ protected AbstractRenderKitWrapperFactory()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public void addRenderKitWrapperFactory(AbstractRenderKitWrapperFactory renderKitWrapperFactory)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(renderKitWrapperFactory.getClass().getName() + " added");
+ }
+
+ if(this.wrapped != null)
+ {
+ this.wrapped.addRenderKitWrapperFactory(renderKitWrapperFactory);
+ return;
+ }
+
+ this.wrapped = renderKitWrapperFactory;
+ }
+
+ public void deactivate()
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(getClass().getName() + " deactivated");
+ }
+
+ this.deactivated = true;
+ }
+
+ public boolean isDeactivated()
+ {
+ return deactivated;
+ }
+
+ public final RenderKit create(RenderKit renderKit)
+ {
+ if(isDeactivated())
+ {
+ return null;
+ }
+
+ RenderKit result = null;
+
+ if(this.wrapped != null)
+ {
+ result = this.wrapped.create(renderKit);
+ }
+
+ if(result == null)
+ {
+ return createWrapper(renderKit);
+ }
+
+ return result;
+ }
+
+ protected abstract RenderKit createWrapper(RenderKit renderKit);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/DefaultRenderKitWrapperFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/DefaultRenderKitWrapperFactory.java
new file mode 100644
index 0000000..147e050
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/DefaultRenderKitWrapperFactory.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.renderkit;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import javax.faces.render.RenderKit;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultRenderKitWrapperFactory extends AbstractRenderKitWrapperFactory
+{
+ private RenderKit renderKit;
+
+ protected RenderKit createWrapper(RenderKit renderKit)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("extval renderkit wrapper created for " + renderKit.getClass().getName());
+ }
+
+ if(this.renderKit == null)
+ {
+ this.renderKit = new ExtValRenderKit(renderKit);
+ }
+ return this.renderKit;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValLazyRendererProxy.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValLazyRendererProxy.java
new file mode 100644
index 0000000..cb36287
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValLazyRendererProxy.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.renderkit;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+import javax.faces.component.UIComponent;
+import javax.faces.convert.ConverterException;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+
+/**
+ * to support a custom proxy
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class ExtValLazyRendererProxy extends Renderer
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private Renderer wrapped;
+
+ public ExtValLazyRendererProxy(Renderer renderer)
+ {
+ this.wrapped = renderer;
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("simple proxy created for " + renderer.getClass().getName());
+ }
+ }
+
+ @Override
+ public void decode(FacesContext facesContext, UIComponent uiComponent)
+ {
+ getLazyRenderer().decode(facesContext, uiComponent);
+ }
+
+ @Override
+ public void encodeBegin(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ getLazyRenderer().encodeBegin(facesContext, uiComponent);
+ }
+
+ @Override
+ public void encodeChildren(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ getLazyRenderer().encodeChildren(facesContext, uiComponent);
+ }
+
+ @Override
+ public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ getLazyRenderer().encodeEnd(facesContext, uiComponent);
+ }
+
+ @Override
+ public String convertClientId(FacesContext facesContext, String s)
+ {
+ return getLazyRenderer().convertClientId(facesContext, s);
+ }
+
+ @Override
+ public boolean getRendersChildren()
+ {
+ return getLazyRenderer().getRendersChildren();
+ }
+
+ @Override
+ public Object getConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o)
+ throws ConverterException
+ {
+ return getLazyRenderer().getConvertedValue(facesContext, uiComponent, o);
+ }
+
+ private Renderer getLazyRenderer()
+ {
+ String proxyClassName = (String) ExtValContext.getContext().getGlobalProperty(ExtValRendererProxy.KEY);
+
+ if(proxyClassName != null && !proxyClassName.endsWith(getClass().getName()))
+ {
+ Class targetClass = ClassUtils.tryToLoadClassForName(proxyClassName);
+
+ if(targetClass == null)
+ {
+ throw new IllegalStateException("a custom invalid renderer proxy is configured: " + proxyClassName);
+ }
+
+ Class[] argClasses = new Class[1];
+ argClasses[0] = Renderer.class;
+
+ try
+ {
+ Constructor constructor = targetClass.getConstructor(argClasses);
+ return (Renderer)constructor.newInstance(this.wrapped);
+ }
+ catch (Throwable t)
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("couldn't create: " + targetClass.getName());
+ }
+
+ return this.wrapped;
+ }
+ }
+ else
+ {
+ return this.wrapped;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKit.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKit.java
new file mode 100644
index 0000000..9b354e5
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKit.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.renderkit;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.context.ResponseStream;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.RenderKit;
+import javax.faces.render.Renderer;
+import javax.faces.render.ResponseStateManager;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValRenderKit extends RenderKit
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+ protected RenderKit wrapped;
+
+ public ExtValRenderKit(RenderKit wrapped)
+ {
+ this.wrapped = wrapped;
+
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public void addRenderer(String family, String rendererType, Renderer renderer)
+ {
+ if (renderer instanceof ExtValRendererWrapper)
+ {
+ wrapped.addRenderer(family, rendererType, renderer);
+ }
+ else
+ {
+ wrapped.addRenderer(family, rendererType, createWrapper(renderer));
+ }
+ }
+
+ public Renderer getRenderer(String family, String rendererType)
+ {
+ Renderer renderer = wrapped.getRenderer(family, rendererType);
+
+ if(renderer != null)
+ {
+ return renderer instanceof ExtValRendererWrapper ? renderer : createWrapper(renderer);
+ }
+
+ if(this.logger.isWarnEnabled())
+ {
+ this.logger.warn("no renderer found for family " + family + " and type " + rendererType);
+ }
+
+ return renderer;
+ }
+
+ public ResponseStateManager getResponseStateManager()
+ {
+ return wrapped.getResponseStateManager();
+ }
+
+ public ResponseWriter createResponseWriter(Writer writer, String s, String s1)
+ {
+ return wrapped.createResponseWriter(writer, s, s1);
+ }
+
+ public ResponseStream createResponseStream(OutputStream outputStream)
+ {
+ return wrapped.createResponseStream(outputStream);
+ }
+
+ @UsageInformation(UsageCategory.REUSE)
+ protected Renderer createWrapper(Renderer renderer)
+ {
+ return new ExtValRendererWrapper(renderer);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKitFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKitFactory.java
new file mode 100644
index 0000000..7282bbc
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKitFactory.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.renderkit;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.render.RenderKitFactory;
+import javax.faces.render.RenderKit;
+import javax.faces.context.FacesContext;
+import java.util.Iterator;
+
+/**
+ * central mechanism which is responsible to create a wrapper for a renderer - starting point of extval.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValRenderKitFactory extends RenderKitFactory
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+ private RenderKitFactory wrapped;
+
+ public ExtValRenderKitFactory(RenderKitFactory renderKitFactory)
+ {
+ this.wrapped = renderKitFactory;
+
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public void addRenderKit(String s, RenderKit renderKit)
+ {
+ wrapped.addRenderKit(s, renderKit);
+ }
+
+ public RenderKit getRenderKit(FacesContext facesContext, String s)
+ {
+ RenderKit renderKit = this.wrapped.getRenderKit(facesContext, s);
+
+ //jsf ri + trinidad
+ if(renderKit == null)
+ {
+ return null;
+ }
+
+ AbstractRenderKitWrapperFactory wrapperFactory = ExtValContext.getContext().getFactoryFinder()
+ .getFactory(FactoryNames.RENDERKIT_WRAPPER_FACTORY, AbstractRenderKitWrapperFactory.class);
+
+ //some component libs e.g. myfaces-trinidad aren't compatible with this clean approach
+ //example see TrinidadModuleStartupListener
+ if(wrapperFactory.isDeactivated())
+ {
+ return renderKit;
+ }
+
+ return wrapperFactory.create(renderKit);
+ }
+
+ public Iterator<String> getRenderKitIds()
+ {
+ return wrapped.getRenderKitIds();
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererProxy.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererProxy.java
new file mode 100644
index 0000000..1934fe2
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererProxy.java
@@ -0,0 +1,290 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.renderkit;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+import javax.faces.component.UIComponent;
+import javax.faces.convert.ConverterException;
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * to avoid multiple calls of renderer methods within renderer interceptors (e.g. for encode, decode,...)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValRendererProxy extends Renderer
+{
+ public static final String KEY = ExtValRendererProxy.class.getName() + ":KEY";
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ protected Renderer wrapped;
+
+ public ExtValRendererProxy(Renderer renderer)
+ {
+ this.wrapped = renderer;
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("proxy created for " + renderer.getClass().getName());
+ }
+ }
+
+ @Override
+ public void decode(FacesContext facesContext, UIComponent uiComponent)
+ {
+ RendererProxyEntry entry = getOrInitEntry(facesContext, uiComponent);
+
+ if (!entry.isDecodeCalled())
+ {
+ entry.setDecodeCalled(true);
+
+ try
+ {
+ this.wrapped.decode(facesContext, uiComponent);
+ }
+ catch (RuntimeException r)
+ {
+ resetComponentProxyMapping();
+ throw r;
+ }
+ }
+ else
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("double call of method 'decode' filtered");
+ }
+ }
+ }
+
+ @Override
+ public void encodeBegin(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ RendererProxyEntry entry = getOrInitEntry(facesContext, uiComponent);
+
+ if (!entry.isEncodeBeginCalled())
+ {
+ entry.setEncodeBeginCalled(true);
+ try
+ {
+ this.wrapped.encodeBegin(facesContext, uiComponent);
+ }
+ catch (IOException e)
+ {
+ resetComponentProxyMapping();
+ throw e;
+ }
+ catch (RuntimeException r)
+ {
+ resetComponentProxyMapping();
+ throw r;
+ }
+ }
+ else
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("double call of method 'encodeBegin' filtered");
+ }
+ }
+ }
+
+ @Override
+ public void encodeChildren(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ RendererProxyEntry entry = getOrInitEntry(facesContext, uiComponent);
+
+ if (!entry.isEncodeChildrenCalled())
+ {
+ entry.setEncodeChildrenCalled(true);
+
+ try
+ {
+ this.wrapped.encodeChildren(facesContext, uiComponent);
+ }
+ catch (IOException e)
+ {
+ resetComponentProxyMapping();
+ throw e;
+ }
+ catch (RuntimeException r)
+ {
+ resetComponentProxyMapping();
+ throw r;
+ }
+ }
+ else
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("double call of method 'encodeChildren' filtered");
+ }
+ }
+ }
+
+ @Override
+ public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ RendererProxyEntry entry = getOrInitEntry(facesContext, uiComponent);
+
+ if (!entry.isEncodeEndCalled())
+ {
+ entry.setEncodeEndCalled(true);
+
+ try
+ {
+ this.wrapped.encodeEnd(facesContext, uiComponent);
+ }
+ catch (IOException e)
+ {
+ resetComponentProxyMapping();
+ throw e;
+ }
+ catch (RuntimeException r)
+ {
+ resetComponentProxyMapping();
+ throw r;
+ }
+ }
+ else
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("double call of method 'encodeEnd' filtered");
+ }
+ }
+ }
+
+ @Override
+ public String convertClientId(FacesContext facesContext, String s)
+ {
+ try
+ {
+ return wrapped.convertClientId(facesContext, s);
+ }
+ catch (RuntimeException r)
+ {
+ resetComponentProxyMapping();
+ throw r;
+ }
+ }
+
+ @Override
+ public boolean getRendersChildren()
+ {
+ try
+ {
+ return wrapped.getRendersChildren();
+ }
+ catch (RuntimeException t)
+ {
+ resetComponentProxyMapping();
+ throw t;
+ }
+ }
+
+ @Override
+ public Object getConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o)
+ throws ConverterException
+ {
+ RendererProxyEntry entry = getOrInitEntry(facesContext, uiComponent);
+
+ if (entry.getConvertedValue() == null)
+ {
+ try
+ {
+ entry.setConvertedValue(wrapped.getConvertedValue(facesContext, uiComponent, o));
+ }
+ catch (RuntimeException r)
+ {
+ resetComponentProxyMapping();
+ throw r;
+ }
+ }
+ else
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("double call of method 'getConvertedValue' filtered");
+ }
+ }
+ return entry.getConvertedValue();
+ }
+
+ private RendererProxyEntry getOrInitEntry(FacesContext facesContext, UIComponent uiComponent)
+ {
+ String key = uiComponent.getClientId(facesContext);
+
+ key += getOptionalKey(facesContext, uiComponent);
+
+ if (!getOrInitComponentProxyMapping().containsKey(key))
+ {
+ getOrInitComponentProxyMapping().put(key, new RendererProxyEntry());
+ }
+ return getOrInitComponentProxyMapping().get(key);
+ }
+
+ protected String getOptionalKey(FacesContext facesContext, UIComponent uiComponent)
+ {
+ return "";
+ }
+
+ private static final String PROXY_STORAGE_NAME = ExtValRendererProxy.class.getName() + ":STORAGE";
+
+ private Map<String, RendererProxyEntry> getOrInitComponentProxyMapping()
+ {
+ Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+
+ if(!requestMap.containsKey(PROXY_STORAGE_NAME))
+ {
+ requestMap.put(PROXY_STORAGE_NAME, new HashMap<String, Map<String, RendererProxyEntry>>());
+ }
+
+ Map<String, Map<String, RendererProxyEntry>> proxyStorage =
+ ((Map<String, Map<String, RendererProxyEntry>>)requestMap.get(PROXY_STORAGE_NAME));
+
+ String key = this.wrapped.getClass().getName();
+
+ if(!proxyStorage.containsKey(key))
+ {
+ proxyStorage.put(key, new HashMap<String, RendererProxyEntry>());
+ }
+
+ return proxyStorage.get(key);
+ }
+
+ private void resetComponentProxyMapping()
+ {
+ //reset component proxy mapping
+ FacesContext.getCurrentInstance().getExternalContext().getRequestMap().remove(PROXY_STORAGE_NAME);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererWrapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererWrapper.java
new file mode 100644
index 0000000..b7c305e
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererWrapper.java
@@ -0,0 +1,537 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.renderkit;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.interceptor.RendererInterceptor;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipBeforeInterceptorsException;
+import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipAfterInterceptorsException;
+import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipRendererDelegationException;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.ConverterException;
+import javax.faces.render.Renderer;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+
+/**
+ * Default approach to avoid proxies for converters and the adapter fallback.
+ * It requires that components delegate getConvertedValue to a renderer.<br/>
+ * If it isn't the case for your component lib use:
+ * org.apache.myfaces.extensions.validator.core.proxy.ExtValApplicationFactory<br/>
+ * and<br/>
+ * org.apache.myfaces.extensions.validator.core.proxy.ProxyMappingPhaseListener
+ * <p/>
+ * This wrapper will also implement client-side validation behaviour
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValRendererWrapper extends Renderer
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ protected Renderer wrapped;
+ protected ExtValContext extValContext = ExtValContext.getContext();
+
+ public ExtValRendererWrapper(Renderer renderer)
+ {
+ String proxyClassName = (String)ExtValContext.getContext().getGlobalProperty(ExtValRendererProxy.KEY);
+
+ if(proxyClassName == null)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("no extval renderer proxy configured");
+ }
+
+ this.wrapped = new ExtValLazyRendererProxy(renderer);
+ return;
+ }
+
+ Class targetClass = ClassUtils.tryToLoadClassForName(proxyClassName);
+
+ if(targetClass == null)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("no extval renderer proxy configured");
+ }
+
+ this.wrapped = new ExtValLazyRendererProxy(renderer);
+ return;
+ }
+
+ Class[] argClasses = new Class[1];
+ argClasses[0] = Renderer.class;
+
+ try
+ {
+ Constructor constructor = targetClass.getConstructor(argClasses);
+ this.wrapped = (Renderer)constructor.newInstance(renderer);
+ }
+ catch (Throwable e)
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("no extval renderer proxy created for " + renderer.getClass().getName());
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("extval renderer wrapper created for " + renderer.getClass().getName());
+ }
+ }
+
+ @Override
+ public final void decode(FacesContext facesContext, UIComponent uiComponent)
+ {
+ boolean delegateToWrappedRenderer = true;
+
+ try
+ {
+ for(RendererInterceptor rendererInterceptor : extValContext.getRendererInterceptors())
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start beforeDecode of " + rendererInterceptor.getClass().getName());
+ }
+
+ try
+ {
+ rendererInterceptor.beforeDecode(facesContext, uiComponent, this.wrapped);
+ }
+ catch (SkipRendererDelegationException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("decode delegation canceled", e);
+ }
+
+ delegateToWrappedRenderer = false;
+
+ if(e.isSkipOtherInterceptors())
+ {
+ break;
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("beforeDecode of " + rendererInterceptor.getClass().getName() + " finished");
+ }
+ }
+ }
+ catch(SkipBeforeInterceptorsException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("beforeDecode interceptors canceled", e);
+ }
+ }
+
+ /*
+ * delegate
+ */
+ if(delegateToWrappedRenderer)
+ {
+ wrapped.decode(facesContext, uiComponent);
+ }
+
+ try
+ {
+ for(RendererInterceptor rendererInterceptor : extValContext.getRendererInterceptors())
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start afterDecode of " + rendererInterceptor.getClass().getName());
+ }
+
+ rendererInterceptor.afterDecode(facesContext, uiComponent, this.wrapped);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("afterDecode of " + rendererInterceptor.getClass().getName() + " finished");
+ }
+ }
+ }
+ catch (SkipAfterInterceptorsException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("afterDecode interceptors canceled", e);
+ }
+ }
+ }
+
+ @Override
+ public final void encodeBegin(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ boolean delegateToWrappedRenderer = true;
+
+ try
+ {
+ for(RendererInterceptor rendererInterceptor : extValContext.getRendererInterceptors())
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start beforeEncodeBegin of " + rendererInterceptor.getClass().getName());
+ }
+
+ try
+ {
+ rendererInterceptor.beforeEncodeBegin(facesContext, uiComponent, this.wrapped);
+ }
+ catch (SkipRendererDelegationException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("encodeBegin delegation canceled", e);
+ }
+
+ delegateToWrappedRenderer = false;
+
+ if(e.isSkipOtherInterceptors())
+ {
+ break;
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("beforeEncodeBegin of " + rendererInterceptor.getClass().getName() + " finished");
+ }
+ }
+ }
+ catch (SkipBeforeInterceptorsException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("beforeEncodeBegin interceptors canceled", e);
+ }
+ }
+
+ /*
+ * delegate
+ */
+ if(delegateToWrappedRenderer)
+ {
+ wrapped.encodeBegin(facesContext, uiComponent);
+ }
+
+ try
+ {
+ for(RendererInterceptor rendererInterceptor : extValContext.getRendererInterceptors())
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start afterEncodeBegin of " + rendererInterceptor.getClass().getName());
+ }
+
+ rendererInterceptor.afterEncodeBegin(facesContext, uiComponent, this.wrapped);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("afterEncodeBegin of " + rendererInterceptor.getClass().getName() + " finished");
+ }
+ }
+ }
+ catch (SkipAfterInterceptorsException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("afterEncodeBegin interceptors canceled", e);
+ }
+ }
+ }
+
+ @Override
+ public final void encodeChildren(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ boolean delegateToWrappedRenderer = true;
+
+ try
+ {
+ for(RendererInterceptor rendererInterceptor : extValContext.getRendererInterceptors())
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start beforeEncodeChildren of " + rendererInterceptor.getClass().getName());
+ }
+
+ try
+ {
+ rendererInterceptor.beforeEncodeChildren(facesContext, uiComponent, this.wrapped);
+ }
+ catch (SkipRendererDelegationException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("encodeChildren delegation canceled", e);
+ }
+
+ delegateToWrappedRenderer = false;
+
+ if(e.isSkipOtherInterceptors())
+ {
+ break;
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("beforeEncodeChildren of " +
+ rendererInterceptor.getClass().getName() + " finished");
+ }
+ }
+ }
+ catch (SkipBeforeInterceptorsException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("beforeEncodeChildren interceptors canceled", e);
+ }
+ }
+
+ /*
+ * delegate
+ */
+ if(delegateToWrappedRenderer)
+ {
+ wrapped.encodeChildren(facesContext, uiComponent);
+ }
+
+ try
+ {
+ for(RendererInterceptor rendererInterceptor : extValContext.getRendererInterceptors())
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start afterEncodeChildren of " + rendererInterceptor.getClass().getName());
+ }
+
+ rendererInterceptor.afterEncodeChildren(facesContext, uiComponent, this.wrapped);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("afterEncodeChildren of " + rendererInterceptor.getClass().getName() + " finished");
+ }
+ }
+ }
+ catch (SkipAfterInterceptorsException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("afterEncodeChildren interceptors canceled", e);
+ }
+ }
+ }
+
+ @Override
+ public final void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ boolean delegateToWrappedRenderer = true;
+
+ try
+ {
+ for(RendererInterceptor rendererInterceptor : extValContext.getRendererInterceptors())
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start beforeEncodeEnd of " + rendererInterceptor.getClass().getName());
+ }
+
+ try
+ {
+ rendererInterceptor.beforeEncodeEnd(facesContext, uiComponent, this.wrapped);
+ }
+ catch (SkipRendererDelegationException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("encodeEnd delegation canceled", e);
+ }
+
+ delegateToWrappedRenderer = false;
+
+ if(e.isSkipOtherInterceptors())
+ {
+ break;
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("beforeEncodeEnd of " + rendererInterceptor.getClass().getName() + " finished");
+ }
+ }
+ }
+ catch (SkipBeforeInterceptorsException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("beforeEncodeEnd interceptors canceled", e);
+ }
+ }
+
+ /*
+ * delegate
+ */
+ if(delegateToWrappedRenderer)
+ {
+ wrapped.encodeEnd(facesContext, uiComponent);
+ }
+
+ try
+ {
+ for(RendererInterceptor rendererInterceptor : extValContext.getRendererInterceptors())
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start afterEncodeEnd of " + rendererInterceptor.getClass().getName());
+ }
+
+ rendererInterceptor.afterEncodeEnd(facesContext, uiComponent, this.wrapped);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("afterEncodeEnd of " + rendererInterceptor.getClass().getName() + " finished");
+ }
+ }
+ }
+ catch (SkipAfterInterceptorsException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("afterEncodeEnd interceptors canceled", e);
+ }
+ }
+ }
+
+ @Override
+ public final String convertClientId(FacesContext facesContext, String s)
+ {
+ return wrapped.convertClientId(facesContext, s);
+ }
+
+ @Override
+ public final boolean getRendersChildren()
+ {
+ return wrapped.getRendersChildren();
+ }
+
+ @Override
+ public final Object getConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o)
+ throws ConverterException
+ {
+ boolean delegateToWrappedRenderer = true;
+ Object convertedObject = null;
+
+ try
+ {
+ for(RendererInterceptor rendererInterceptor : extValContext.getRendererInterceptors())
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start beforeGetConvertedValue of " + rendererInterceptor.getClass().getName());
+ }
+
+ try
+ {
+ rendererInterceptor.beforeGetConvertedValue(facesContext, uiComponent, o, this.wrapped);
+ }
+ catch (SkipRendererDelegationException e)
+ {
+ convertedObject = e.getReturnValueOnException(convertedObject);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("getConvertedValue delegation canceled", e);
+ }
+
+ delegateToWrappedRenderer = false;
+
+ if(e.isSkipOtherInterceptors())
+ {
+ break;
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("beforeGetConvertedValue of " +
+ rendererInterceptor.getClass().getName() + " finished");
+ }
+ }
+ }
+ catch (SkipBeforeInterceptorsException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("beforeGetConvertedValue interceptors canceled", e);
+ }
+ }
+
+ /*
+ * delegate
+ */
+ if(delegateToWrappedRenderer)
+ {
+ convertedObject = wrapped.getConvertedValue(facesContext, uiComponent, o);
+ }
+
+ try
+ {
+ for(RendererInterceptor rendererInterceptor : extValContext.getRendererInterceptors())
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start afterGetConvertedValue of " + rendererInterceptor.getClass().getName());
+ }
+
+ rendererInterceptor.afterGetConvertedValue(facesContext, uiComponent, o, this.wrapped);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("afterGetConvertedValue of " + rendererInterceptor.getClass().getName() + " finished");
+ }
+ }
+ }
+ catch (SkipAfterInterceptorsException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("afterGetConvertedValue interceptors canceled", e);
+ }
+ }
+
+ return convertedObject;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/RendererProxyEntry.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/RendererProxyEntry.java
new file mode 100644
index 0000000..d9e57f9
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/RendererProxyEntry.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.renderkit;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class RendererProxyEntry
+{
+ private boolean decodeCalled = false;
+ private boolean encodeBeginCalled = false;
+ private boolean encodeChildrenCalled = false;
+ private boolean encodeEndCalled = false;
+
+ private Object convertedValue = null;
+
+ public boolean isDecodeCalled()
+ {
+ return decodeCalled;
+ }
+
+ public void setDecodeCalled(boolean decodeCalled)
+ {
+ this.decodeCalled = decodeCalled;
+ }
+
+ public boolean isEncodeBeginCalled()
+ {
+ return encodeBeginCalled;
+ }
+
+ public void setEncodeBeginCalled(boolean encodeBeginCalled)
+ {
+ this.encodeBeginCalled = encodeBeginCalled;
+ }
+
+ public boolean isEncodeChildrenCalled()
+ {
+ return encodeChildrenCalled;
+ }
+
+ public void setEncodeChildrenCalled(boolean encodeChildrenCalled)
+ {
+ this.encodeChildrenCalled = encodeChildrenCalled;
+ }
+
+ public boolean isEncodeEndCalled()
+ {
+ return encodeEndCalled;
+ }
+
+ public void setEncodeEndCalled(boolean encodeEndCalled)
+ {
+ this.encodeEndCalled = encodeEndCalled;
+ }
+
+ public Object getConvertedValue()
+ {
+ return convertedValue;
+ }
+
+ public void setConvertedValue(Object convertedValue)
+ {
+ this.convertedValue = convertedValue;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipAfterInterceptorsException.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipAfterInterceptorsException.java
new file mode 100644
index 0000000..a32eef9
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipAfterInterceptorsException.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.renderkit.exception;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public class SkipAfterInterceptorsException extends Exception
+{
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipBeforeInterceptorsException.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipBeforeInterceptorsException.java
new file mode 100644
index 0000000..49e96cf
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipBeforeInterceptorsException.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.renderkit.exception;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public class SkipBeforeInterceptorsException extends Exception
+{
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipRendererDelegationException.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipRendererDelegationException.java
new file mode 100644
index 0000000..637c64a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipRendererDelegationException.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.renderkit.exception;
+
+import org.apache.myfaces.extensions.validator.core.interceptor.RendererInterceptor;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public class SkipRendererDelegationException extends Exception
+{
+ protected RendererInterceptor exceptionSource;
+ protected Object information;
+ boolean skipOtherInterceptors = false;
+
+ public SkipRendererDelegationException()
+ {
+ }
+
+ public SkipRendererDelegationException(boolean skipOtherInterceptors)
+ {
+ this.skipOtherInterceptors = skipOtherInterceptors;
+ }
+
+ public SkipRendererDelegationException(boolean skipOtherInterceptors, RendererInterceptor rendererInterceptor)
+ {
+ this(skipOtherInterceptors);
+ this.exceptionSource = rendererInterceptor;
+ }
+
+ public void setInformation(Object information)
+ {
+ this.information = information;
+ }
+
+ public Object getInformation()
+ {
+ return information;
+ }
+
+ public boolean isSkipOtherInterceptors()
+ {
+ return skipOtherInterceptors;
+ }
+
+ public Object getReturnValueOnException(Object currentReturnValue)
+ {
+ if(this.exceptionSource != null)
+ {
+ return this.exceptionSource.getReturnValueOnSkipRendererDelegationException(this, currentReturnValue);
+ }
+ return currentReturnValue;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/AbstractStartupListener.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/AbstractStartupListener.java
new file mode 100644
index 0000000..f2098bc
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/AbstractStartupListener.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.startup;
+
+import org.apache.myfaces.extensions.validator.util.JsfUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * In order to execute logic just once.
+ * e.g. register artifacts via api
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.REUSE)
+public abstract class AbstractStartupListener implements PhaseListener
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ //don't remove - it's a fallback if there is a problem with deregistration
+ //target: don't process init logic more than once
+ private static List<Class> initializedListeners = new ArrayList<Class>();
+
+ protected AbstractStartupListener()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public void afterPhase(PhaseEvent event)
+ {
+ }
+
+ public void beforePhase(PhaseEvent event)
+ {
+ synchronized (AbstractStartupListener.class)
+ {
+ if (!initializedListeners.contains(getClass()))
+ {
+ try
+ {
+ if(logger.isInfoEnabled())
+ {
+ logger.info("start init of " + getClass().getName());
+ }
+
+ try
+ {
+ init();
+
+ if(logger.isInfoEnabled())
+ {
+ logger.info("init of " + getClass().getName() + " finished");
+ }
+ }
+ finally
+ {
+ JsfUtils.deregisterPhaseListener(this);
+ }
+ }
+ catch (Throwable t)
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("an exception occurred while deregistering the phase-listener"
+ + getClass().getName()
+ + " -> there is just a little overhead,"
+ + " but everything else works correctly."
+ + " however, please inform the community about your configuration", t);
+ }
+ }
+ finally
+ {
+ initializedListeners.add(getClass());
+ }
+ }
+ }
+ }
+
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.RESTORE_VIEW;
+ }
+
+ protected abstract void init();
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java
new file mode 100644
index 0000000..27c360a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.startup;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationInterceptor;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.mapper
+ .BeanValidationStrategyToMetaDataTransformerNameMapper;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.mapper
+ .SimpleValidationStrategyToMetaDataTransformerNameMapper;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.mapper
+ .DefaultValidationStrategyToMetaDataTransformerNameMapper;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.mapper
+ .CustomConventionValidationStrategyToMetaDataTransformerNameMapper;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.mapper
+ .CustomConfiguredValidationStrategyToMetaDataTransformerNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper
+ .CustomConventionAnnotationToValidationStrategyNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper
+ .DefaultAnnotationToValidationStrategyNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper
+ .CustomConfiguredAnnotationToValidationStrategyNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper
+ .SimpleAnnotationToValidationStrategyNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper
+ .AnnotationToValidationStrategyBeanNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.mapper
+ .CustomConfiguredValidationStrategyToMsgResolverNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.mapper
+ .CustomConventionValidationStrategyToMsgResolverNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.mapper
+ .DefaultValidationStrategyToMsgResolverNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.mapper
+ .DefaultModuleValidationStrategyToMsgResolverNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.mapper
+ .SimpleValidationStrategyToMsgResolverNameMapper;
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererProxy;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValStartupListener extends AbstractStartupListener
+{
+ protected void init()
+ {
+ if(logger.isInfoEnabled())
+ {
+ if(ExtValInformation.VERSION != null)
+ {
+ logger.info("starting up MyFaces Extensions Validator v" + ExtValInformation.VERSION);
+ }
+ else
+ {
+ logger.info("starting up MyFaces Extensions Validator");
+ }
+ }
+
+ ExtValContext.getContext().registerRendererInterceptor(new ValidationInterceptor());
+
+ ExtValContext.getContext()
+ .addGlobalProperty(ExtValRendererProxy.KEY, ExtValRendererProxy.class.getName(), false);
+
+ initNameMappers();
+ executeCustomStartupListener();
+ }
+
+ private void initNameMappers()
+ {
+ String deactivateDefaultNameMappers = WebXmlParameter.DEACTIVATE_DEFAULT_NAME_MAPPERS;
+ if ((deactivateDefaultNameMappers != null && deactivateDefaultNameMappers.equalsIgnoreCase("true")))
+ {
+ return;
+ }
+
+ //register metadata to validation strategy name mapper
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new CustomConfiguredAnnotationToValidationStrategyNameMapper());
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new CustomConventionAnnotationToValidationStrategyNameMapper());
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new DefaultAnnotationToValidationStrategyNameMapper());
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new SimpleAnnotationToValidationStrategyNameMapper());
+
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new AnnotationToValidationStrategyBeanNameMapper(
+ new CustomConfiguredAnnotationToValidationStrategyNameMapper()));
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new AnnotationToValidationStrategyBeanNameMapper(
+ new CustomConventionAnnotationToValidationStrategyNameMapper()));
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new AnnotationToValidationStrategyBeanNameMapper(
+ new DefaultAnnotationToValidationStrategyNameMapper()));
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new AnnotationToValidationStrategyBeanNameMapper(
+ new SimpleAnnotationToValidationStrategyNameMapper()));
+
+ //register validation strategy to message resolver name mapper
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new CustomConfiguredValidationStrategyToMsgResolverNameMapper());
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new CustomConventionValidationStrategyToMsgResolverNameMapper());
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new DefaultValidationStrategyToMsgResolverNameMapper());
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new DefaultModuleValidationStrategyToMsgResolverNameMapper());
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new SimpleValidationStrategyToMsgResolverNameMapper());
+
+ //register validation strategy to metadata transformer name mapper
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new CustomConfiguredValidationStrategyToMetaDataTransformerNameMapper());
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new CustomConventionValidationStrategyToMetaDataTransformerNameMapper());
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new DefaultValidationStrategyToMetaDataTransformerNameMapper());
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new SimpleValidationStrategyToMetaDataTransformerNameMapper());
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new BeanValidationStrategyToMetaDataTransformerNameMapper());
+ }
+
+ private void executeCustomStartupListener()
+ {
+ String customStartupListenerName = ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.STARTUP_LISTENER);
+ AbstractStartupListener customStartupListener =
+ (AbstractStartupListener)ClassUtils.tryToInstantiateClassForName(customStartupListenerName);
+
+ if(customStartupListener != null)
+ {
+ if(logger.isInfoEnabled())
+ {
+ logger.info("start init of " + customStartupListener.getClass().getName());
+ }
+
+ customStartupListener.init();
+
+ if(logger.isInfoEnabled())
+ {
+ logger.info("init of " + customStartupListener.getClass().getName() + " finished");
+ }
+ }
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/DefaultFacesMessageFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/DefaultFacesMessageFactory.java
new file mode 100644
index 0000000..a62510c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/DefaultFacesMessageFactory.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.factory.FacesMessageFactory;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultFacesMessageFactory implements FacesMessageFactory
+{
+ public FacesMessage convert(FacesMessage facesMessage)
+ {
+ if(isLabeledFacesMessage(facesMessage))
+ {
+ return facesMessage;
+ }
+ return create(facesMessage.getSeverity(), facesMessage.getSummary(), facesMessage.getDetail());
+ }
+
+ public FacesMessage create(FacesMessage.Severity severity, String summary, String detail)
+ {
+ return new ViolationMessage(severity, summary, detail);
+ }
+
+ protected boolean isLabeledFacesMessage(FacesMessage facesMessage)
+ {
+ //don't use the interface here
+ return facesMessage instanceof ViolationMessage;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/LabeledMessage.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/LabeledMessage.java
new file mode 100644
index 0000000..3df7ae7
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/LabeledMessage.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * don't remove *Text - it would lead to an overlap with trinidad
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.API)
+public interface LabeledMessage
+{
+ String getLabelText();
+ void setLabelText(String label);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/ViolationMessage.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/ViolationMessage.java
new file mode 100644
index 0000000..7081435
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/ViolationMessage.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class ViolationMessage extends FacesMessage implements LabeledMessage
+{
+ private static final long serialVersionUID = 6903958942987711231L;
+ private String label;
+ private boolean summaryLabelReplaced = false;
+ private boolean detailLabelReplaced = false;
+
+ public ViolationMessage(String summary, String detail)
+ {
+ this(SEVERITY_ERROR, summary, detail);
+ }
+
+ public ViolationMessage(Severity severity, String summary, String detail)
+ {
+ setSeverity(severity);
+ setSummary(summary);
+ setDetail(detail);
+ }
+
+ public String getLabelText()
+ {
+ return label;
+ }
+
+ public void setLabelText(String label)
+ {
+ this.label = label;
+ }
+
+ @Override
+ public String getSummary()
+ {
+ if(label != null && !this.summaryLabelReplaced)
+ {
+ setSummary(getLabeledMesssage(super.getSummary(), getLabelText()));
+ this.summaryLabelReplaced = true;
+ }
+ return super.getSummary();
+ }
+
+ @Override
+ public String getDetail()
+ {
+ if(label != null && !this.detailLabelReplaced)
+ {
+ setDetail(getLabeledMesssage(super.getDetail(), getLabelText()));
+ this.detailLabelReplaced = true;
+ }
+ return super.getDetail();
+ }
+
+ private String getLabeledMesssage(String message, String label)
+ {
+ for(int i = 0; i < 3; i++)
+ {
+ if(message != null && message.contains("{" + i + "}"))
+ {
+ message = message.replace("{" + i + "}", label);
+ }
+ }
+
+ return message;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java
new file mode 100644
index 0000000..87c805b
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java
@@ -0,0 +1,222 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message.resolver;
+
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * MessageResolver which uses property files.
+ * Subclasses just have to provide the package to look at.
+ * An implementation can also provide a custom name which is e.g. configured via web.xml.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public abstract class AbstractValidationErrorMessageResolver implements MessageResolver
+{
+ public static final String MISSING_RESOURCE_MARKER = "???";
+
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private static String deactivateDefaultConvention = WebXmlParameter.DEACTIVATE_DEFAULT_CONVENTION;
+ private static ResourceBundle defaultBundle = null;
+ private String messageBundleBaseName;
+ //with jsf 1.1 only available if there is a custom bean
+ private String messageBundleVarName;
+
+ protected AbstractValidationErrorMessageResolver()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public String getMessage(String key, Locale locale)
+ {
+ if (key == null || key.equals(""))
+ {
+ return null;
+ }
+
+ ResourceBundle resourceBundle = null;
+ String customMessage = null;
+
+ //only in case of a ValidationErrorMessageResolver which is configured as bean
+ if (this.messageBundleBaseName != null)
+ {
+ resourceBundle = ResourceBundle.getBundle(this.messageBundleBaseName, locale);
+ if (resourceBundle != null)
+ {
+ customMessage = resourceBundle.getString(key);
+ }
+ else
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("message bundle " + this.messageBundleBaseName + " not found");
+ }
+ }
+ }
+
+ //only in case of a ValidationErrorMessageResolver which is configured as bean
+ if (this.messageBundleVarName != null && customMessage == null)
+ {
+ resourceBundle = (ResourceBundle) ExtValUtils.getELHelper().getBean(messageBundleVarName);
+
+ if (resourceBundle != null)
+ {
+ customMessage = resourceBundle.getString(key);
+ }
+ else
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("message bundle var name " + this.messageBundleVarName + " not found");
+ }
+ }
+ }
+
+ if (customMessage != null)
+ {
+ return customMessage;
+ }
+
+ /*
+ * try to use the convention for the message bundle
+ */
+ customMessage = tryToUseMessageBundleConvention(key, locale);
+
+ if (customMessage != null)
+ {
+ return customMessage;
+ }
+
+ /*
+ * no message bundle or message found (with the convention)?
+ */
+
+ //try to load custom messages
+ try
+ {
+ resourceBundle = ResourceBundle.getBundle(getCustomBaseName(), locale);
+ }
+ catch (Throwable t)
+ {
+ //do nothing - it was just a try
+ }
+
+ if (resourceBundle != null)
+ {
+ try
+ {
+ customMessage = resourceBundle.getString(key);
+ }
+ catch (MissingResourceException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("no custom message for " + key + " within " + getCustomBaseName(), e);
+ }
+ }
+ }
+
+ //use custom name (if possible) otherwise: fallback to default message (if possible)
+ try
+ {
+ return (customMessage != null) ? customMessage
+ : (getBaseName() != null) ? ResourceBundle.getBundle(getBaseName(), locale).getString(key) : null;
+ }
+ catch (MissingResourceException e)
+ {
+ return MISSING_RESOURCE_MARKER + key + MISSING_RESOURCE_MARKER;
+ }
+ }
+
+ private String tryToUseMessageBundleConvention(String key, Locale locale)
+ {
+ String customMessage = null;
+
+ if ((deactivateDefaultConvention == null || !deactivateDefaultConvention.equalsIgnoreCase("true"))
+ && isDefaultMessageBundleConventionActive())
+ {
+ if (defaultBundle == null)
+ {
+ try
+ {
+ defaultBundle = ResourceBundle.getBundle(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.MESSAGE_BUNDLE_NAME), locale);
+ }
+ catch (Throwable t)
+ {
+ //do nothing
+ deactivateDefaultConvention = "true";
+ }
+ }
+
+ if (defaultBundle != null)
+ {
+ try
+ {
+ customMessage = defaultBundle.getString(key);
+ }
+ catch (MissingResourceException e)
+ {
+ //do nothing
+ }
+ }
+ }
+
+ return customMessage;
+ }
+
+ protected boolean isDefaultMessageBundleConventionActive()
+ {
+ return true;
+ }
+
+ protected abstract String getBaseName();
+
+ protected String getCustomBaseName()
+ {
+ return null;
+ }
+
+ public void setMessageBundleBaseName(String messageBundleBaseName)
+ {
+ this.messageBundleBaseName = messageBundleBaseName;
+ }
+
+ public void setMessageBundleVarName(String messageBundleVarName)
+ {
+ this.messageBundleVarName = messageBundleVarName;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java
new file mode 100644
index 0000000..940e68f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message.resolver;
+
+import org.apache.myfaces.extensions.validator.core.factory.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.factory.AbstractNameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationEntry;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Factory which creates a MessageResolver for a given ValidationStrategy
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@ToDo(value = Priority.MEDIUM, description = "add generic java api (de-/register mapping)")
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultMessageResolverFactory extends AbstractNameMapperAwareFactory<ValidationStrategy>
+ implements ClassMappingFactory<ValidationStrategy, MessageResolver>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private Map<String, String> strategyMessageResolverMapping;
+ private List<NameMapper<ValidationStrategy>> nameMapperList = new ArrayList<NameMapper<ValidationStrategy>>();
+
+ public DefaultMessageResolverFactory()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public MessageResolver create(ValidationStrategy validationStrategy)
+ {
+ String strategyName = validationStrategy.getClass().getName();
+
+ if (strategyMessageResolverMapping == null)
+ {
+ initStaticMappings();
+ }
+
+ if (strategyMessageResolverMapping.containsKey(strategyName))
+ {
+ return (MessageResolver) ClassUtils
+ .tryToInstantiateClassForName(strategyMessageResolverMapping.get(strategyName));
+ }
+
+ MessageResolver messageResolver;
+ String resolverName;
+ for (NameMapper<ValidationStrategy> nameMapper : nameMapperList)
+ {
+ //build convention (ValidationErrorMessageResolver)
+ resolverName = nameMapper.createName(validationStrategy);
+
+ //name wasn't mapped
+ if (resolverName == null || validationStrategy.getClass().getName().equals(resolverName))
+ {
+ continue;
+ }
+
+ messageResolver = (MessageResolver) ClassUtils.tryToInstantiateClassForName(resolverName);
+
+ if (messageResolver != null)
+ {
+ addMapping(strategyName, resolverName);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(resolverName + " used for " + strategyName);
+ }
+
+ return messageResolver;
+ }
+ }
+
+ addMapping(strategyName, DefaultValidationErrorMessageResolver.class.getName());
+ return new DefaultValidationErrorMessageResolver();
+ }
+
+ private synchronized void initStaticMappings()
+ {
+ strategyMessageResolverMapping = new HashMap<String, String>();
+
+ //setup internal static mappings
+ for (StaticConfiguration<String, String> staticConfig :
+ ExtValContext.getContext().getStaticConfiguration(
+ StaticConfigurationNames.VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_CONFIG))
+ {
+ setupStrategyMappings(staticConfig.getMapping());
+ }
+ }
+
+ private void setupStrategyMappings(List<StaticConfigurationEntry<String,String>> mappings)
+ {
+ for(StaticConfigurationEntry<String, String> mapping : mappings)
+ {
+ addMapping(mapping.getSource(), mapping.getTarget());
+ }
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "logging")
+ private synchronized void addMapping(String validationStrategyName, String messageResolverName)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("adding static validation strategy to message resolver mapping: "
+ + validationStrategyName + " -> " + messageResolverName);
+ }
+
+ strategyMessageResolverMapping.put(validationStrategyName, messageResolverName);
+ }
+
+ protected List<NameMapper<ValidationStrategy>> getNameMapperList()
+ {
+ return nameMapperList;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultValidationErrorMessageResolver.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultValidationErrorMessageResolver.java
new file mode 100644
index 0000000..079edc6
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultValidationErrorMessageResolver.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message.resolver;
+
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.InternalConventionProvider;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * Default MessageResolver which uses the default convention for the message bundle.
+ * It's possible to provide a custom message bundle via web.xml
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultValidationErrorMessageResolver extends AbstractValidationErrorMessageResolver
+{
+ private static final String CUSTOM_BUNDLE = WebXmlParameter.CUSTOM_MESSAGE_BUNDLE;
+
+ //not used at the moment - just for a convention
+ protected String getBaseName()
+ {
+ return InternalConventionProvider.getModuleMessageBundleName(getClass().getPackage().getName());
+ }
+
+ protected String getCustomBaseName()
+ {
+ return CUSTOM_BUNDLE;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java
new file mode 100644
index 0000000..dcca1c1
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message.resolver;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.Locale;
+
+/**
+ * Interface for MessageResolvers independent of the message source.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface MessageResolver
+{
+ String getMessage(String key, Locale locale);
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/AbstractValidationStrategyToMsgResolverNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/AbstractValidationStrategyToMsgResolverNameMapper.java
new file mode 100644
index 0000000..10d40b6
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/AbstractValidationStrategyToMsgResolverNameMapper.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message.resolver.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public abstract class AbstractValidationStrategyToMsgResolverNameMapper implements NameMapper<ValidationStrategy>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public AbstractValidationStrategyToMsgResolverNameMapper()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/CustomConfiguredValidationStrategyToMsgResolverNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/CustomConfiguredValidationStrategyToMsgResolverNameMapper.java
new file mode 100644
index 0000000..747401a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/CustomConfiguredValidationStrategyToMsgResolverNameMapper.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message.resolver.mapper;
+
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.mapper.AbstractCustomNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * To provide a custom NameMapper to map ValidationStrategies to MessageResolvers.
+ * (configured via web.xml)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class CustomConfiguredValidationStrategyToMsgResolverNameMapper extends
+ AbstractCustomNameMapper<ValidationStrategy>
+{
+
+ protected String getCustomNameMapperClassName()
+ {
+ return WebXmlParameter.CUSTOM_VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_NAME_MAPPER;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/CustomConventionValidationStrategyToMsgResolverNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/CustomConventionValidationStrategyToMsgResolverNameMapper.java
new file mode 100644
index 0000000..4c72035
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/CustomConventionValidationStrategyToMsgResolverNameMapper.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message.resolver.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.AbstractCustomNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * To provide a custom NameMapper to map ValidationStrategy to MessageResolver.
+ * (configured via information provider bean)
+ * The bean provides the default name (convention).
+ * It's possible to provide a custom full qualified name. (= customizable convention)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class CustomConventionValidationStrategyToMsgResolverNameMapper extends
+ AbstractCustomNameMapper<ValidationStrategy>
+{
+
+ protected String getCustomNameMapperClassName()
+ {
+ return ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.VALIDATION_STRATEGY_TO_MSG_RESOLVER_NAME_MAPPER);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultModuleValidationStrategyToMsgResolverNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultModuleValidationStrategyToMsgResolverNameMapper.java
new file mode 100644
index 0000000..c1b59b5
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultModuleValidationStrategyToMsgResolverNameMapper.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message.resolver.mapper;
+
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.DefaultValidationErrorMessageResolver;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * In order to provide a NameMapper per validation module.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultModuleValidationStrategyToMsgResolverNameMapper extends
+ DefaultValidationStrategyToMsgResolverNameMapper
+{
+ @Override
+ protected String getClassName(String strategyClassName)
+ {
+ return DefaultValidationErrorMessageResolver.class.getSimpleName();
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java
new file mode 100644
index 0000000..454838b
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message.resolver.mapper;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.InternalConventionProvider;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * Default implementation which maps ExtVal ValidationStrategies to ExtVal MessageResolvers.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultValidationStrategyToMsgResolverNameMapper extends
+ AbstractValidationStrategyToMsgResolverNameMapper
+{
+ public String createName(ValidationStrategy validationStrategy)
+ {
+ return InternalConventionProvider.getMessageResolverClassName(validationStrategy.getClass(),
+ getClassName(validationStrategy.getClass().getSimpleName()));
+ }
+
+ protected String getClassName(String strategyClassName)
+ {
+ return InternalConventionProvider.getMessageResolverClassName(strategyClassName);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java
new file mode 100644
index 0000000..12606f5
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.message.resolver.mapper;
+
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.core.InternalConventionProvider;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * It's an alternative Mapper to place ValidationStrategies and MessageResolvers in the same package.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL})
+public class SimpleValidationStrategyToMsgResolverNameMapper extends
+ DefaultValidationStrategyToMsgResolverNameMapper
+{
+ protected String getClassName(String strategyClassName)
+ {
+ String customPostfix = ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX);
+ return InternalConventionProvider.getValidationStrategyBasedName(strategyClassName, customPostfix);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java
new file mode 100644
index 0000000..07d379e
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy;
+
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.MessageResolver;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.validator.ValidatorException;
+import java.lang.annotation.Annotation;
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+/**
+ * Provides the ability of message resolving to ValidationStrategies
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.REUSE})
+public abstract class AbstractAnnotationValidationStrategy extends AbstractValidationStrategy
+{
+ protected static final String DETAIL_MESSAGE_KEY_POSTFIX = "_detail";
+ //e.g. for injecting a message resolver via spring
+ private MessageResolver messageResolver;
+
+ protected String resolveMessage(String key)
+ {
+ Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
+
+ return this.messageResolver != null ? this.messageResolver.getMessage(key, locale) :
+ ExtValUtils.getMessageResolverForValidationStrategy(this).getMessage(key, locale);
+ }
+
+ protected String getErrorMessageSummary(Annotation annotation)
+ {
+ return resolveMessage(getValidationErrorMsgKey(annotation));
+ }
+
+ protected String getErrorMessageDetail(Annotation annotation)
+ {
+ try
+ {
+ String key = getValidationErrorMsgKey(annotation);
+ return (key != null) ? resolveMessage(key + DETAIL_MESSAGE_KEY_POSTFIX) : null;
+ }
+ catch (MissingResourceException e)
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("couldn't find key " + getValidationErrorMsgKey(annotation) + DETAIL_MESSAGE_KEY_POSTFIX,
+ e);
+ }
+ }
+ return null;
+ }
+
+ protected FacesMessage getValidationErrorFacesMassage(Annotation annotation)
+ {
+ return ExtValUtils.createFacesMessage(getErrorMessageSummary(annotation), getErrorMessageDetail(annotation));
+ }
+
+ protected abstract String getValidationErrorMsgKey(Annotation annotation);
+
+ public void setMessageResolver(MessageResolver messageResolver)
+ {
+ this.messageResolver = messageResolver;
+ }
+
+ @Override
+ protected boolean processAfterValidatorException(FacesContext facesContext,
+ UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject,
+ ValidatorException validatorException)
+ {
+ metaDataEntry.setProperty(PropertyInformationKeys.LABEL, getLabel(facesContext, uiComponent, metaDataEntry));
+
+ return super.processAfterValidatorException(
+ facesContext, uiComponent, metaDataEntry, convertedObject, validatorException);
+ }
+
+ //for custom annotations - override if needed
+ protected String getLabel(FacesContext facesContext, UIComponent uiComponent, MetaDataEntry metaDataEntry)
+ {
+ return null;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java
new file mode 100644
index 0000000..4b694b3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * Provides the ability to use ValidatorException (as expected by the user) instead of ConverterException.
+ * Furthermore it provides:<br/>
+ * initValidation<br/>
+ * processAfterValidatorException
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.REUSE})
+public abstract class AbstractValidationStrategy implements ValidationStrategy
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ protected AbstractValidationStrategy()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public void validate(FacesContext facesContext, UIComponent uiComponent,
+ MetaDataEntry metaDataEntry, Object convertedObject)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start initValidation of " + getClass().getName());
+ }
+
+ initValidation(facesContext, uiComponent, metaDataEntry, convertedObject);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("initValidation of " + getClass().getName() + " finished");
+ }
+
+ try
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start processValidation of " + getClass().getName());
+ }
+
+ processValidation(facesContext, uiComponent, metaDataEntry, convertedObject);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("processValidation of " + getClass().getName() + " finished");
+ }
+ }
+ catch (ValidatorException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start processAfterValidatorException of " + getClass().getName());
+ }
+
+ ValidatorException validatorException = new ValidatorException(
+ ExtValUtils.convertFacesMessage(e.getFacesMessage()), e.getCause());
+ if (processAfterValidatorException(
+ facesContext, uiComponent, metaDataEntry, convertedObject, validatorException))
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(getClass().getName() +
+ ": throw original exception after processAfterValidatorException");
+ }
+
+ throw validatorException;
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(getClass().getName() +
+ ": original exception after processAfterValidatorException not thrown");
+ }
+ }
+ }
+
+ protected void initValidation(FacesContext facesContext,
+ UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject)
+ {
+ //override if needed
+ }
+
+ //override if needed
+ protected boolean processAfterValidatorException(FacesContext facesContext,
+ UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject,
+ ValidatorException validatorException)
+ {
+ return ExtValUtils.executeAfterThrowingInterceptors(
+ uiComponent, metaDataEntry, convertedObject, validatorException, this);
+ }
+
+ protected abstract void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, MetaDataEntry metaDataEntry,
+ Object convertedObject) throws ValidatorException;
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapter.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapter.java
new file mode 100644
index 0000000..ab5dc4e
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapter.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * it's just a helper for proxies - you just need it, if you define the validation strategy as bean and
+ * e.g. spring creates a proxy for it.
+
+ * adapter to connect validation strategies with meta-data transformers,
+ * if the validation strategy is defined as bean and e.g. spring creates a proxy
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.REUSE})
+public interface BeanValidationStrategyAdapter extends ValidationStrategy
+{
+ //to get back the internal cashing
+ String getValidationStrategyClassName();
+
+ String getMetaDataTransformerClassName();
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapterImpl.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapterImpl.java
new file mode 100644
index 0000000..e75cb63
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapterImpl.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.BeanMetaDataTransformerAdapter;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * it's just a helper for proxies - you just need it, if you define the validation strategy as bean and
+ * e.g. spring creates a proxy for it.
+
+ * adapter to connect validation strategies with meta-data transformers,
+ * if the validation strategy is defined as bean and e.g. spring creates a proxy
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.REUSE})
+public class BeanValidationStrategyAdapterImpl implements BeanValidationStrategyAdapter
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private MetaDataTransformer metaDataTransformer;
+ private ValidationStrategy validationStrategy;
+ //optional fallback for internal cashing
+ private String validationStrategyClassName;
+
+ public BeanValidationStrategyAdapterImpl()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public void validate(FacesContext facesContext,
+ UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject)
+ {
+ this.validationStrategy.validate(facesContext, uiComponent, metaDataEntry, convertedObject);
+ }
+
+ public String getValidationStrategyClassName()
+ {
+ if(validationStrategy.getClass().getPackage() != null)
+ {
+ return validationStrategy.getClass().getName();
+ }
+ return validationStrategyClassName;
+ }
+
+ public String getMetaDataTransformerClassName()
+ {
+ if(metaDataTransformer != null)
+ {
+ if(metaDataTransformer.getClass().getPackage() != null)
+ {
+ return metaDataTransformer.getClass().getName();
+ }
+ else
+ {
+ if(metaDataTransformer instanceof BeanMetaDataTransformerAdapter)
+ {
+ return ((BeanMetaDataTransformerAdapter) metaDataTransformer ).getMetaDataTransformerClassName();
+ }
+ }
+ }
+ return null;
+ }
+
+ /*
+ * generated
+ */
+ public MetaDataTransformer getMetaDataTransformer()
+ {
+ return metaDataTransformer;
+ }
+
+ public void setMetaDataTransformer(MetaDataTransformer metaDataTransformer)
+ {
+ this.metaDataTransformer = metaDataTransformer;
+ }
+
+ public ValidationStrategy getValidationStrategy()
+ {
+ return validationStrategy;
+ }
+
+ public void setValidationStrategy(ValidationStrategy validationStrategy)
+ {
+ this.validationStrategy = validationStrategy;
+ }
+
+ public void setValidationStrategyClassName(String validationStrategyClassName)
+ {
+ this.validationStrategyClassName = validationStrategyClassName;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java
new file mode 100644
index 0000000..dbad4f9
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy;
+
+import org.apache.myfaces.extensions.validator.core.factory.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.factory.AbstractNameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationEntry;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticResourceBundleConfiguration;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper
+ .AnnotationToValidationStrategyBeanNameMapper;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+
+
+/**
+ * Factory which creates the ValidationStrategy for a given Meta-Data Key
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultValidationStrategyFactory extends AbstractNameMapperAwareFactory
+ implements ClassMappingFactory<String, ValidationStrategy>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private Map<String, String> metaDataKeyToValidationStrategyMapping = null;
+ private List<NameMapper<String>> nameMapperList = new ArrayList<NameMapper<String>>();
+
+ public DefaultValidationStrategyFactory()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public ValidationStrategy create(String metaDataKey)
+ {
+ if (metaDataKeyToValidationStrategyMapping == null)
+ {
+ initStaticMappings();
+ }
+
+ if (metaDataKeyToValidationStrategyMapping.containsKey(metaDataKey))
+ {
+ return getValidationStrategyInstance(metaDataKeyToValidationStrategyMapping.get(metaDataKey));
+ }
+
+ ValidationStrategy validationStrategy;
+ String strategyName;
+ //null -> use name mappers
+ for (NameMapper<String> nameMapper : nameMapperList)
+ {
+ strategyName = nameMapper.createName(metaDataKey);
+
+ if (strategyName == null)
+ {
+ continue;
+ }
+
+ validationStrategy = getValidationStrategyInstance(strategyName);
+
+ if (validationStrategy != null)
+ {
+ addMapping(metaDataKey, strategyName);
+ return validationStrategy;
+ }
+ }
+ return null;
+ }
+
+ private ValidationStrategy getValidationStrategyInstance(String validationStrategyName)
+ {
+ if (validationStrategyName
+ .startsWith(AnnotationToValidationStrategyBeanNameMapper.PREFIX_FOR_BEAN_MAPPING))
+ {
+ return (ValidationStrategy) ExtValUtils.getELHelper().getBean(validationStrategyName
+ .substring(AnnotationToValidationStrategyBeanNameMapper.PREFIX_FOR_BEAN_MAPPING.length()));
+ }
+ else
+ {
+ return (ValidationStrategy) ClassUtils.tryToInstantiateClassForName(validationStrategyName);
+ }
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "logging")
+ private synchronized void addMapping(String metaDataKey, String validationStrategyName)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("adding meta-data key to validation strategy mapping: "
+ + metaDataKey + " -> " + validationStrategyName);
+ }
+
+ metaDataKeyToValidationStrategyMapping.put(metaDataKey, validationStrategyName);
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "logging")
+ private synchronized void initStaticMappings()
+ {
+ metaDataKeyToValidationStrategyMapping = new HashMap<String, String>();
+
+ //setup internal static mappings
+ for (StaticConfiguration<String, String> staticConfig :
+ ExtValContext.getContext().getStaticConfiguration(
+ StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG))
+ {
+ setupStrategyMappings(staticConfig.getMapping());
+ }
+
+ StaticConfiguration<String, String> staticConfig = new StaticResourceBundleConfiguration();
+ //try to setup mapping with base name by convention - overrides default mapping
+ try
+ {
+ //build convention (strategy mapping)
+ staticConfig.setSourceOfMapping(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.STATIC_STRATEGY_MAPPING_SOURCE));
+
+ setupStrategyMappings(staticConfig.getMapping());
+ }
+ catch (Throwable t)
+ {
+ //do nothing - it was just a try
+ }
+
+ //setup custom mapping - overrides all other mappings
+ String customMappingBaseName = WebXmlParameter.CUSTOM_STATIC_VALIDATION_STRATEGY_MAPPING;
+ if (customMappingBaseName != null)
+ {
+ try
+ {
+ staticConfig = new StaticResourceBundleConfiguration();
+ staticConfig.setSourceOfMapping(customMappingBaseName);
+ setupStrategyMappings(staticConfig.getMapping());
+ }
+ catch (MissingResourceException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void setupStrategyMappings(List<StaticConfigurationEntry<String,String>> mappings)
+ {
+ for(StaticConfigurationEntry<String, String> mapping : mappings)
+ {
+ addMapping(mapping.getSource(), mapping.getTarget());
+ }
+ }
+
+ protected List<NameMapper<String>> getNameMapperList()
+ {
+ return this.nameMapperList;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.java
new file mode 100644
index 0000000..b55523d
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * Base interface for ValidationStrategies
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+//*ValidationStrategy instead of *Validator to avoid naming confusion
+public interface ValidationStrategy
+{
+ void validate(FacesContext facesContext, UIComponent uiComponent,
+ MetaDataEntry metaDataEntry, Object convertedObject);
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AbstractMetaDataToValidationStrategyNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AbstractMetaDataToValidationStrategyNameMapper.java
new file mode 100644
index 0000000..b9b3f0d
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AbstractMetaDataToValidationStrategyNameMapper.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public abstract class AbstractMetaDataToValidationStrategyNameMapper implements NameMapper<String>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public AbstractMetaDataToValidationStrategyNameMapper()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AnnotationToValidationStrategyBeanNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AnnotationToValidationStrategyBeanNameMapper.java
new file mode 100644
index 0000000..bd5d361
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AnnotationToValidationStrategyBeanNameMapper.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * Name Mapper which delegates the name mapping, extract the name and convert it to a bean name + prefix
+ * target: configure a validation strategy via a managed bean facility -> allows to inject other beans
+ * instead of api calls + hardcoded bean names
+ * <p/>
+ * allowed bean scopes:
+ * the validation strategy is stateless: application/singleton
+ * the validation strategy is stateful: none/prototype
+ * don't use the session or a conversation scope
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class AnnotationToValidationStrategyBeanNameMapper extends AbstractMetaDataToValidationStrategyNameMapper
+{
+ public static final String PREFIX_FOR_BEAN_MAPPING = "bean:";
+ private NameMapper<String> wrapped;
+
+ public AnnotationToValidationStrategyBeanNameMapper(NameMapper<String> nameMapper)
+ {
+ this.wrapped = nameMapper;
+ }
+
+ public String createName(String source)
+ {
+ String name = wrapped.createName(source);
+
+ if (name == null)
+ {
+ return null;
+ }
+
+ name = name.substring(name.lastIndexOf(".") + 1);
+ return PREFIX_FOR_BEAN_MAPPING + name.substring(0, 1).toLowerCase() + name.substring(1);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConfiguredAnnotationToValidationStrategyNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConfiguredAnnotationToValidationStrategyNameMapper.java
new file mode 100644
index 0000000..e6e1f6e
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConfiguredAnnotationToValidationStrategyNameMapper.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.mapper.AbstractCustomNameMapper;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * To provide a custom NameMapper to map Annotations to ValidationStrategies.
+ * (configured via web.xml)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class CustomConfiguredAnnotationToValidationStrategyNameMapper extends
+ AbstractCustomNameMapper<String>
+{
+ protected String getCustomNameMapperClassName()
+ {
+ return WebXmlParameter.CUSTOM_META_DATA_TO_VALIDATION_STRATEGY_NAME_MAPPER;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java
new file mode 100644
index 0000000..cf8ddfa
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.AbstractCustomNameMapper;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * To provide a custom NameMapper to map Annotations to ValidationStrategies.
+ * (configured via information provider bean)
+ * The bean provides the default name (convention).
+ * It's possible to provide a custom full qualified name. (= customizable convention)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class CustomConventionAnnotationToValidationStrategyNameMapper extends
+ AbstractCustomNameMapper<String>
+{
+ protected String getCustomNameMapperClassName()
+ {
+ return ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.META_DATA_TO_VALIDATION_STRATEGY_NAME_MAPPER);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.java
new file mode 100644
index 0000000..270e420
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.InternalConventionProvider;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * Default implementation which maps ExtVal Annotations to ExtVal ValidationStrategies.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultAnnotationToValidationStrategyNameMapper extends AbstractMetaDataToValidationStrategyNameMapper
+{
+ public String createName(String metaDataKey)
+ {
+ return InternalConventionProvider.getValidationStrategyClassName(metaDataKey);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.java
new file mode 100644
index 0000000..490a612
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * It's an alternative Mapper to place Annotations and ValidationStrategies in the same package.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL})
+public class SimpleAnnotationToValidationStrategyNameMapper extends AbstractMetaDataToValidationStrategyNameMapper
+{
+ public String createName(String metaDataKey)
+ {
+ return metaDataKey +
+ ExtValContext.getContext().getInformationProviderBean().get(CustomInformation.VALIDATION_STRATEGY_POSTFIX);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/Priority.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/Priority.java
new file mode 100644
index 0000000..111aa33
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/Priority.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.internal;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public enum Priority
+{
+ BLOCKING,
+ HIGH,
+ MEDIUM,
+ LOW
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/ToDo.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/ToDo.java
new file mode 100644
index 0000000..697fd57
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/ToDo.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.internal;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({TYPE, METHOD, FIELD})
+public @interface ToDo
+{
+ Priority value();
+ String description() default "";
+
+ @Target({TYPE, METHOD, FIELD})
+ @interface List
+ {
+ ToDo[] value();
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageCategory.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageCategory.java
new file mode 100644
index 0000000..547b385
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageCategory.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.internal;
+
+/**
+ * API:<br/>
+ * parts you might need for custom implementations and which are quite stable in view of changes
+ * <p/>
+ * INTERNAL:<br/>
+ * if you think about referencing an artifact which is marked as internal, ask for support.
+ * there should be a better solution
+ * <p/>
+ * CUSTOMIZABLE:<br/>
+ * a planned extension point which contains logic to customize the framework.
+ * if it isn't also marked as API it might change in future releases.
+ * however, we try to keep it as stable as possible and reasonable.
+ * <p/>
+ * REUSE:<br/>
+ * an artifact which you can reuse for a custom implementation.
+ * if it isn't marked as API it might change in future releases.
+ * however, we try to keep it as stable as possible and reasonable.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public enum UsageCategory
+{
+ API,
+ INTERNAL,
+ CUSTOMIZABLE,
+ REUSE
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageInformation.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageInformation.java
new file mode 100644
index 0000000..f937ebc
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageInformation.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.internal;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Target;
+
+/**
+ * it's an internal annotation to provide some information concerning usage-categories
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ * @see org.apache.myfaces.extensions.validator.internal.UsageCategory
+ */
+@Target({TYPE, METHOD, FIELD})
+public @interface UsageInformation
+{
+ UsageCategory[] value();
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java
new file mode 100644
index 0000000..cea65b1
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.util;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.jar.Manifest;
+import java.util.jar.Attributes;
+import java.net.URL;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ClassUtils
+{
+ private static final Log LOG = LogFactory.getLog(ClassUtils.class);
+
+ public static Class tryToLoadClassForName(String name)
+ {
+ try
+ {
+ return loadClassForName(name);
+ }
+ catch (ClassNotFoundException e)
+ {
+ //do nothing - it's just a try
+ return null;
+ }
+ }
+
+ public static Class loadClassForName(String name) throws ClassNotFoundException
+ {
+ try
+ {
+ // Try WebApp ClassLoader first
+ return Class.forName(name, false, // do not initialize for faster startup
+ Thread.currentThread().getContextClassLoader());
+ }
+ catch (ClassNotFoundException ignore)
+ {
+ // fallback: Try ClassLoader for ClassUtils (i.e. the myfaces.jar lib)
+ return Class.forName(name, false, // do not initialize for faster startup
+ ClassUtils.class.getClassLoader());
+ }
+ }
+
+ public static Object tryToInstantiateClass(Class targetClass)
+ {
+ try
+ {
+ return targetClass.newInstance();
+ }
+ catch (Throwable t)
+ {
+ //do nothing - it was just a try
+ }
+ return null;
+ }
+
+ public static Object tryToInstantiateClassForName(String className)
+ {
+ try
+ {
+ return instantiateClassForName(className);
+ }
+ catch (Throwable t)
+ {
+ //do nothing - it was just a try
+ }
+ return null;
+ }
+
+ public static Object instantiateClassForName(String className)
+ throws ClassNotFoundException, IllegalAccessException, InstantiationException
+ {
+ return loadClassForName(className).newInstance();
+ }
+
+ public static String getJarVersion(Class targetClass)
+ {
+ String classFilePath = targetClass.getCanonicalName().replace('.', '/') + ".class";
+ String manifestFilePath = "/META-INF/MANIFEST.MF";
+
+ String classLocation = targetClass.getResource(targetClass.getSimpleName() + ".class").toString();
+ String manifestFileLocation = classLocation
+ .substring(0, classLocation.indexOf(classFilePath) - 1) + manifestFilePath;
+
+ try
+ {
+ return new Manifest(new URL(manifestFileLocation).openStream())
+ .getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION);
+ }
+ catch (Throwable t)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("couldn't load version of jar file which contains " + targetClass.getName(), t);
+ }
+ return null;
+ }
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
new file mode 100644
index 0000000..ede7392
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
@@ -0,0 +1,415 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.util;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.MessageResolver;
+import org.apache.myfaces.extensions.validator.core.factory.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.MetaDataExtractionInterceptor;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.core.el.ELHelper;
+import org.apache.myfaces.extensions.validator.core.el.AbstractELHelperFactory;
+import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.ComponentMetaDataExtractorFactory;
+import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.factory.NameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.factory.FacesMessageFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import javax.faces.application.FacesMessage;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValUtils
+{
+ private static final Log LOGGER = LogFactory.getLog(ExtValUtils.class);
+
+ private static final String JAVAX_FACES_REQUIRED = "javax.faces.component.UIInput.REQUIRED";
+ private static final String JAVAX_FACES_REQUIRED_DETAIL = "javax.faces.component.UIInput.REQUIRED_detail";
+
+ private static final String JAVAX_FACES_MAXIMUM = "javax.faces.validator.LengthValidator.MAXIMUM";
+ private static final String JAVAX_FACES_MAXIMUM_DETAIL = "javax.faces.validator.LengthValidator.MAXIMUM_detail";
+
+ public static ValidationStrategy getValidationStrategyForMetaData(String metaDataKey)
+ {
+ return ((ClassMappingFactory<String, ValidationStrategy>) ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.VALIDATION_STRATEGY_FACTORY, ClassMappingFactory.class))
+ .create(metaDataKey);
+ }
+
+ public static void registerMetaDataToValidationStrategyNameMapper(
+ NameMapper<String> metaDataToValidationStrategyNameMapper)
+ {
+ (ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.VALIDATION_STRATEGY_FACTORY, NameMapperAwareFactory.class))
+ .register(metaDataToValidationStrategyNameMapper);
+ }
+
+ public static void deregisterMetaDataToValidationStrategyNameMapper(
+ Class<? extends NameMapper> metaDataToValidationStrategyNameMapperClass)
+ {
+ (ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.VALIDATION_STRATEGY_FACTORY, NameMapperAwareFactory.class))
+ .deregister(metaDataToValidationStrategyNameMapperClass);
+ }
+
+ public static void denyMetaDataToValidationStrategyNameMapper(
+ Class<? extends NameMapper> metaDataToValidationStrategyNameMapperClass)
+ {
+ (ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.VALIDATION_STRATEGY_FACTORY, NameMapperAwareFactory.class))
+ .deny(metaDataToValidationStrategyNameMapperClass);
+ }
+
+ public static MetaDataTransformer getMetaDataTransformerForValidationStrategy(ValidationStrategy validationStrategy)
+ {
+ return ((ClassMappingFactory<ValidationStrategy, MetaDataTransformer>) ExtValContext
+ .getContext().getFactoryFinder()
+ .getFactory(FactoryNames.META_DATA_TRANSFORMER_FACTORY, ClassMappingFactory.class))
+ .create(validationStrategy);
+ }
+
+ public static void registerValidationStrategyToMetaDataTransformerNameMapper(
+ NameMapper<ValidationStrategy> validationStrategyToMetaDataTransformerNameMapper)
+ {
+ (ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.META_DATA_TRANSFORMER_FACTORY, NameMapperAwareFactory.class))
+ .register(validationStrategyToMetaDataTransformerNameMapper);
+ }
+
+ public static void deregisterValidationStrategyToMetaDataTransformerNameMapper(
+ Class<? extends NameMapper> validationStrategyToMetaDataTransformerNameMapperClass)
+ {
+ (ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.META_DATA_TRANSFORMER_FACTORY, NameMapperAwareFactory.class))
+ .deregister(validationStrategyToMetaDataTransformerNameMapperClass);
+ }
+
+ public static void denyValidationStrategyToMetaDataTransformerNameMapper(
+ Class<? extends NameMapper> validationStrategyToMetaDataTransformerNameMapperClass)
+ {
+ (ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.META_DATA_TRANSFORMER_FACTORY, NameMapperAwareFactory.class))
+ .deny(validationStrategyToMetaDataTransformerNameMapperClass);
+ }
+
+ public static MetaDataExtractor getComponentMetaDataExtractor()
+ {
+ return ExtValContext.getContext().getFactoryFinder()
+ .getFactory(FactoryNames.COMPONENT_META_DATA_EXTRACTOR_FACTORY, ComponentMetaDataExtractorFactory.class)
+ .create();
+ }
+
+ public static void configureComponentWithMetaData(FacesContext facesContext,
+ UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ for(ComponentInitializer componentInitializer : ExtValContext.getContext().getComponentInitializers())
+ {
+ componentInitializer.configureComponent(facesContext, uiComponent, metaData);
+ }
+ }
+
+ public static boolean executeAfterThrowingInterceptors(UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject,
+ ValidatorException validatorException,
+ ValidationStrategy validatorExceptionSource)
+ {
+ boolean result = true;
+
+ for(ValidationExceptionInterceptor validationExceptionInterceptor : ExtValContext.getContext()
+ .getValidationExceptionInterceptors())
+ {
+ if(!validationExceptionInterceptor.afterThrowing(
+ uiComponent, metaDataEntry, convertedObject, validatorException, validatorExceptionSource))
+ {
+ result = false;
+ }
+ }
+
+ return result;
+ }
+
+ public static MetaDataExtractor createInterceptedMetaDataExtractor(final MetaDataExtractor metaDataExtractor)
+ {
+ return new MetaDataExtractor()
+ {
+ public PropertyInformation extract(FacesContext facesContext, Object object)
+ {
+ PropertyInformation result = metaDataExtractor.extract(facesContext, object);
+ for(MetaDataExtractionInterceptor metaDataExtractionInterceptor :
+ ExtValContext.getContext().getMetaDataExtractionInterceptors())
+ {
+ metaDataExtractionInterceptor.afterExtracting(result);
+ }
+ return result;
+ }
+ };
+ }
+
+ public static MessageResolver getMessageResolverForValidationStrategy(ValidationStrategy validationStrategy)
+ {
+ return ((ClassMappingFactory<ValidationStrategy, MessageResolver>)ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.MESSAGE_RESOLVER_FACTORY, ClassMappingFactory.class))
+ .create(validationStrategy);
+ }
+
+ public static void registerValidationStrategyToMessageResolverNameMapper(
+ NameMapper<ValidationStrategy> validationStrategyToMsgResolverNameMapper)
+ {
+ (ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.MESSAGE_RESOLVER_FACTORY, NameMapperAwareFactory.class))
+ .register(validationStrategyToMsgResolverNameMapper);
+ }
+
+ public static void deregisterValidationStrategyToMessageResolverNameMapper(
+ Class<? extends NameMapper> validationStrategyToMessageResolverNameMapperClass)
+ {
+ (ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.MESSAGE_RESOLVER_FACTORY, NameMapperAwareFactory.class))
+ .deregister(validationStrategyToMessageResolverNameMapperClass);
+ }
+
+ public static void denyValidationStrategyToMessageResolverNameMapper(
+ Class<? extends NameMapper> validationStrategyToMessageResolverNameMapperClass)
+ {
+ (ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.MESSAGE_RESOLVER_FACTORY, NameMapperAwareFactory.class))
+ .deny(validationStrategyToMessageResolverNameMapperClass);
+ }
+
+ public static ELHelper getELHelper()
+ {
+ return ExtValContext.getContext().getFactoryFinder()
+ .getFactory(FactoryNames.EL_HELPER_FACTORY, AbstractELHelperFactory.class).create();
+ }
+
+ public static FacesMessage createFacesMessage(String summary, String detail)
+ {
+ return createFacesMessage(FacesMessage.SEVERITY_ERROR, summary, detail);
+ }
+
+ public static FacesMessage createFacesMessage(FacesMessage.Severity severity, String summary, String detail)
+ {
+ return ExtValContext.getContext().getFactoryFinder()
+ .getFactory(FactoryNames.FACES_MESSAGE_FACTORY, FacesMessageFactory.class)
+ .create(severity, summary, detail);
+ }
+
+ public static FacesMessage convertFacesMessage(FacesMessage facesMessage)
+ {
+ return ExtValContext.getContext().getFactoryFinder()
+ .getFactory(FactoryNames.FACES_MESSAGE_FACTORY, FacesMessageFactory.class)
+ .convert(facesMessage);
+ }
+
+ public static PropertyDetails createPropertyDetailsForNewTarget(MetaDataEntry metaDataEntry,
+ String targetExpression)
+ {
+ Object baseObject;
+ if(ExtValUtils.getELHelper().isELTermWellFormed(targetExpression))
+ {
+ ValueBindingExpression vbe = new ValueBindingExpression(targetExpression);
+
+ String expression = vbe.getExpressionString();
+ baseObject = ExtValUtils.getELHelper()
+ .getValueOfExpression(FacesContext.getCurrentInstance(), vbe.getBaseExpression());
+ return new PropertyDetails(
+ expression.substring(2, expression.length() - 1), baseObject, vbe.getProperty());
+ }
+
+ PropertyDetails original = metaDataEntry.getProperty(
+ PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);
+
+ String newBaseKey = original.getKey().substring(0, original.getKey().lastIndexOf(".") + 1);
+ String newKey = newBaseKey + targetExpression;
+
+ baseObject = ReflectionUtils.getBaseOfPropertyChain(original.getBaseObject(), targetExpression);
+ return new PropertyDetails(
+ newKey, baseObject, targetExpression.substring(targetExpression.lastIndexOf(".") + 1,
+ targetExpression.length()));
+ }
+
+ @UsageInformation(UsageCategory.INTERNAL)
+ public static void tryToPlaceLabel(FacesMessage facesMessage, String label, int index)
+ {
+ if(facesMessage.getSummary() != null && facesMessage.getSummary().contains("{" + index + "}"))
+ {
+ facesMessage.setSummary(facesMessage.getSummary().replace("{" + index + "}", label));
+ }
+
+ if(facesMessage.getDetail() != null && facesMessage.getDetail().contains("{" + index + "}"))
+ {
+ facesMessage.setDetail(facesMessage.getDetail().replace("{" + index + "}", label));
+ }
+ }
+
+ @UsageInformation(UsageCategory.INTERNAL)
+ public static void replaceWithDefaultMaximumMessage(FacesMessage facesMessage, int maxLength)
+ {
+ String facesRequiredMessage = JsfUtils.getDefaultFacesMessageBundle().getString(JAVAX_FACES_MAXIMUM);
+ String facesRequiredMessageDetail = facesRequiredMessage;
+
+ //use try/catch for easier sync between trunk/branch
+ try
+ {
+ if(JsfUtils.getDefaultFacesMessageBundle().getString(JAVAX_FACES_MAXIMUM_DETAIL) != null)
+ {
+ facesRequiredMessageDetail = JsfUtils
+ .getDefaultFacesMessageBundle().getString(JAVAX_FACES_MAXIMUM_DETAIL);
+ }
+ }
+ catch (MissingResourceException missingResourceException)
+ {
+ //jsf 1.2 doesn't have a detail message
+ }
+
+ facesRequiredMessage = facesRequiredMessage.replace("{0}", "" + maxLength);
+ facesRequiredMessageDetail = facesRequiredMessageDetail.replace("{0}", "" + maxLength);
+
+ facesMessage.setSummary(facesRequiredMessage);
+ facesMessage.setDetail(facesRequiredMessageDetail);
+ }
+
+ @UsageInformation(UsageCategory.INTERNAL)
+ public static void replaceWithDefaultRequiredMessage(FacesMessage facesMessage)
+ {
+ String facesRequiredMessage = JsfUtils.getDefaultFacesMessageBundle().getString(JAVAX_FACES_REQUIRED);
+ String facesRequiredMessageDetail = facesRequiredMessage;
+
+ //use try/catch for easier sync between trunk/branch
+ try
+ {
+ if(JsfUtils.getDefaultFacesMessageBundle().getString(JAVAX_FACES_REQUIRED_DETAIL) != null)
+ {
+ facesRequiredMessageDetail = JsfUtils
+ .getDefaultFacesMessageBundle().getString(JAVAX_FACES_REQUIRED_DETAIL);
+ }
+ }
+ catch (MissingResourceException missingResourceException)
+ {
+ //jsf 1.2 doesn't have a detail message
+ }
+
+ facesMessage.setSummary(facesRequiredMessage);
+ facesMessage.setDetail(facesRequiredMessageDetail);
+ }
+
+ public static boolean isSkipableValidationStrategy(Class<? extends ValidationStrategy> targetClass)
+ {
+ for(Class currentClass : ExtValUtils.getSkipValidationSupportClassList())
+ {
+ if(ExtValUtils.isSkipValidationSupported(currentClass, targetClass))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public static List<Class> getSkipValidationSupportClassList()
+ {
+ List<StaticConfiguration<String, String>> staticConfigurationList = ExtValContext.getContext()
+ .getStaticConfiguration(StaticConfigurationNames.SKIP_VALIDATION_SUPPORT_CONFIG);
+
+ List<Class> markerList = new ArrayList<Class>();
+
+ Class currentClass;
+ for(StaticConfiguration<String, String> currentEntry : staticConfigurationList)
+ {
+ for(StaticConfigurationEntry<String, String> currentConfigurationEntry : currentEntry.getMapping())
+ {
+ currentClass = ClassUtils.tryToLoadClassForName(currentConfigurationEntry.getTarget());
+
+ if(currentClass != null)
+ {
+ markerList.add(currentClass);
+ }
+ else
+ {
+ if(LOGGER.isWarnEnabled())
+ {
+ LOGGER.warn("configuration entry provides an invalid entry: "
+ + currentConfigurationEntry.getTarget());
+ }
+ }
+ }
+ }
+
+ return markerList;
+ }
+
+ public static boolean isSkipValidationSupported(Class currentClass, Class targetClass)
+ {
+ if(currentClass.isAnnotation())
+ {
+ if(targetClass.isAnnotationPresent(currentClass))
+ {
+ return true;
+ }
+ }
+ else
+ {
+ if(currentClass.isAssignableFrom(targetClass))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/JsfUtils.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/JsfUtils.java
new file mode 100644
index 0000000..9f50d89
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/JsfUtils.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.util;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.FactoryFinder;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseListener;
+import javax.faces.lifecycle.Lifecycle;
+import javax.faces.lifecycle.LifecycleFactory;
+import java.util.Iterator;
+import java.util.ResourceBundle;
+
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class JsfUtils
+{
+ public static void deregisterPhaseListener(PhaseListener phaseListener)
+ {
+ LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+
+ String currentId;
+ Lifecycle currentLifecycle;
+ Iterator lifecycleIds = lifecycleFactory.getLifecycleIds();
+ while (lifecycleIds.hasNext())
+ {
+ currentId = (String) lifecycleIds.next();
+ currentLifecycle = lifecycleFactory.getLifecycle(currentId);
+ currentLifecycle.removePhaseListener(phaseListener);
+ }
+ }
+
+ public static ResourceBundle getDefaultFacesMessageBundle()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ String bundleName = facesContext.getApplication().getMessageBundle();
+
+ if(bundleName == null)
+ {
+ bundleName = FacesMessage.FACES_MESSAGES;
+ }
+
+ return ResourceBundle.getBundle(bundleName, facesContext.getViewRoot().getLocale());
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/ReflectionUtils.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/ReflectionUtils.java
new file mode 100644
index 0000000..c187f7d
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/ReflectionUtils.java
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.util;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.StringTokenizer;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ReflectionUtils
+{
+ public static Method tryToGetMethod(Class targetClass, String targetMethodName)
+ {
+ return tryToGetMethod(targetClass, targetMethodName, null);
+ }
+
+ public static Method tryToGetMethod(Class targetClass, String targetMethodName, Class... parameterTypes)
+ {
+ try
+ {
+ return getMethod(targetClass, targetMethodName, parameterTypes);
+ }
+ catch (Throwable t)
+ {
+ //do nothing - it's just a try
+ return null;
+ }
+ }
+
+ public static Method getMethod(Class targetClass, String targetMethodName)
+ throws NoSuchMethodException
+ {
+ return getMethod(targetClass, targetMethodName, null);
+ }
+
+ public static Method getMethod(Class targetClass, String targetMethodName, Class... parameterTypes)
+ throws NoSuchMethodException
+ {
+ Class currentClass = targetClass;
+ Method targetMethod = null;
+
+ while (!Object.class.getName().equals(currentClass.getName()))
+ {
+ try
+ {
+ targetMethod = currentClass.getDeclaredMethod(targetMethodName, parameterTypes);
+ break;
+ }
+ catch (NoSuchMethodException e)
+ {
+ currentClass = currentClass.getSuperclass();
+ }
+ }
+
+ if(targetMethod == null)
+ {
+ for (Class currentInterface : targetClass.getInterfaces())
+ {
+ currentClass = currentInterface;
+
+ while (currentClass != null)
+ {
+ try
+ {
+ targetMethod = currentClass.getDeclaredMethod(targetMethodName, parameterTypes);
+ break;
+ }
+ catch (NoSuchMethodException e)
+ {
+ currentClass = currentClass.getSuperclass();
+ }
+ }
+ }
+ }
+
+ if(targetMethod != null)
+ {
+ return targetMethod;
+ }
+
+ throw new NoSuchMethodException("there is no method with the name '" + targetMethodName + "'" +
+ " class: " + targetClass.getName());
+ }
+
+ public static Object tryToInvokeMethod(Object target, Method method)
+ {
+ return tryToInvokeMethod(target, method, null);
+ }
+
+ public static Object tryToInvokeMethodOfClass(Class target, Method method)
+ {
+ return tryToInvokeMethodOfClass(target, method, null);
+ }
+
+ public static Object tryToInvokeMethodOfClass(Class target, Method method, Object[] args)
+ {
+ try
+ {
+ return invokeMethodOfClass(target, method, args);
+ }
+ catch (Throwable e)
+ {
+ //do nothing - it's just a try
+ return null;
+ }
+ }
+
+ public static Object invokeMethodOfClass(Class target, Method method)
+ throws IllegalAccessException, InstantiationException, InvocationTargetException
+ {
+ return invokeMethod(target.newInstance(), method, null);
+ }
+
+ public static Object invokeMethodOfClass(Class target, Method method, Object... args)
+ throws IllegalAccessException, InstantiationException, InvocationTargetException
+ {
+ return invokeMethod(target.newInstance(), method, args);
+ }
+
+ public static Object tryToInvokeMethod(Object target, Method method, Object... args)
+ {
+ try
+ {
+ return invokeMethod(target, method, args);
+ }
+ catch (Throwable t)
+ {
+ //do nothing - it's just a try
+ return null;
+ }
+ }
+
+ public static Object invokeMethod(Object target, Method method)
+ throws InvocationTargetException, IllegalAccessException
+ {
+ return invokeMethod(target, method, null);
+ }
+
+ public static Object invokeMethod(Object target, Method method, Object... args)
+ throws InvocationTargetException, IllegalAccessException
+ {
+ method.setAccessible(true);
+ return method.invoke(target, args);
+ }
+
+ public static Object getBaseOfPropertyChain(Object baseObject, String propertyChain)
+ {
+ StringTokenizer tokenizer = new StringTokenizer(propertyChain, ".");
+
+ Object currentBase = baseObject;
+ String currentProperty;
+ Method currentMethod;
+
+ while(tokenizer.hasMoreTokens())
+ {
+ currentProperty = tokenizer.nextToken();
+
+ //ignore the last property
+ if(!tokenizer.hasMoreTokens())
+ {
+ break;
+ }
+
+ //no is - it's only possible at properties not at bean level
+ currentMethod = tryToGetMethod(currentBase.getClass(),
+ "get" + currentProperty.substring(0, 1).toUpperCase() +
+ currentProperty.substring(1, currentProperty.length()));
+ currentBase = tryToInvokeMethod(currentBase, currentMethod);
+ }
+
+ return currentBase;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/WebXmlUtils.java b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/WebXmlUtils.java
new file mode 100644
index 0000000..1ab217b
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/java/org/apache/myfaces/extensions/validator/util/WebXmlUtils.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.util;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class WebXmlUtils
+{
+ public static String getInitParameter(String key)
+ {
+ String value = FacesContext.getCurrentInstance().getExternalContext()
+ .getInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + "." + key);
+ return (value != null) ? value.replace(" ", "").trim() : null;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/core/src/main/resources/LICENSE.txt b/1_2_2_prepare_rc_base/core/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/resources/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/core/src/main/resources/NOTICE.txt b/1_2_2_prepare_rc_base/core/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/main/resources/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/core/src/site/apt/index.apt b/1_2_2_prepare_rc_base/core/src/site/apt/index.apt
new file mode 100644
index 0000000..4a201d2
--- /dev/null
+++ b/1_2_2_prepare_rc_base/core/src/site/apt/index.apt
@@ -0,0 +1,10 @@
+ ------
+Apache MyFaces Extensions Validator Core Module
+ ------
+
+Apache MyFaces Extensions Validator Core Module Overview
+
+ MyFaces Extensions Validator Core Module provides an extensible validation platform to implement validation based on meta-data.
+ Based on this module it is possible to implement validation modules.
+
+ MyFaces Extensions Validator is compatible with JSF 1.1.x and JSF 1.2.x. Both versions require Java 1.5+
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/assembly/pom.xml b/1_2_2_prepare_rc_base/examples/assembly/pom.xml
new file mode 100644
index 0000000..555c700
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/assembly/pom.xml
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <name>Apache MyFaces Extensions Validator Examples Assembly</name>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>myfaces-extval-examples-assembly12</artifactId>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-project</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-war</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-hello_world</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-feature-set_01</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/war</outputDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-src</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-hello_world</artifactId>
+ <version>${project.version}</version>
+ <type>java-source</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-feature-set_01</artifactId>
+ <version>${project.version}</version>
+ <type>java-source</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/src</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <!-- EXECUTE mvn package to generate assembly files -->
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.1</version>
+ <executions>
+ <execution>
+ <id>make_assembly_src</id>
+ <phase>package</phase>
+ <goals>
+ <goal>assembly</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/depsrc.xml</descriptor>
+ </descriptors>
+ <finalName>myfaces-extval-examples-${project.version}-src</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ <outputDirectory>${project.build.directory}/out</outputDirectory>
+ <workDirectory>${project.build.directory}/work</workDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>make_assembly_bin</id>
+ <phase>package</phase>
+ <goals>
+ <goal>assembly</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/dep.xml</descriptor>
+ </descriptors>
+ <finalName>myfaces-extval-examples-${project.version}</finalName>
+ <outputDirectory>${project.build.directory}/out</outputDirectory>
+ <workDirectory>${project.build.directory}/work</workDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.myfaces.maven</groupId>
+ <artifactId>wagon-maven-plugin</artifactId>
+ <version>1.0.1</version>
+ <configuration>
+ <id>myfaces-nightly-builds</id>
+ <url>scpexe://minotaur.apache.org/www/people.apache.org/builds/myfaces/nightly</url>
+ <inputDirectory>${project.build.directory}/out</inputDirectory>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+</project>
diff --git a/1_2_2_prepare_rc_base/examples/assembly/src/main/assembly/dep.xml b/1_2_2_prepare_rc_base/examples/assembly/src/main/assembly/dep.xml
new file mode 100644
index 0000000..a0f7b81
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/assembly/src/main/assembly/dep.xml
@@ -0,0 +1,17 @@
+<assembly>
+ <id>bin</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>target/war</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>*.war</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/1_2_2_prepare_rc_base/examples/assembly/src/main/assembly/depsrc.xml b/1_2_2_prepare_rc_base/examples/assembly/src/main/assembly/depsrc.xml
new file mode 100644
index 0000000..d570ccc
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/assembly/src/main/assembly/depsrc.xml
@@ -0,0 +1,24 @@
+<assembly>
+ <id>src</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>target/src</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>*.txt</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/1_2_2_prepare_rc_base/examples/assembly/src/main/resources/LICENSE.txt b/1_2_2_prepare_rc_base/examples/assembly/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..dd5b3a5
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/assembly/src/main/resources/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/examples/assembly/src/main/resources/NOTICE.txt b/1_2_2_prepare_rc_base/examples/assembly/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..409bdb1
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/assembly/src/main/resources/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/pom.xml b/1_2_2_prepare_rc_base/examples/feature-set_01/pom.xml
new file mode 100644
index 0000000..95b42a8
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/pom.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>war</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-feature-set_01</artifactId>
+
+ <name>MyFaces Extensions-Validator examples feature-set 01</name>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-project</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>myfaces-extval-property-validation</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>myfaces-extval-trinidad-support</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.14</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${jsf.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.trinidad</groupId>
+ <artifactId>trinidad-api</artifactId>
+ <version>${trinidad.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.trinidad</groupId>
+ <artifactId>trinidad-impl</artifactId>
+ <version>${trinidad.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!--
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ <scope>runtime</scope>
+ </dependency>
+ -->
+
+ <dependency>
+ <groupId>org.apache.myfaces.tomahawk</groupId>
+ <artifactId>tomahawk</artifactId>
+ <version>1.1.6</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/META-INF/LICENSE.txt b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/META-INF/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/META-INF/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/META-INF/NOTICE.txt b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/META-INF/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/META-INF/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties
new file mode 100644
index 0000000..f401df7
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+# this message bundle is picked up via convention
+repeated_password_required=please retype the password
+repeated_password_required_detail=please retype the password
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java
new file mode 100644
index 0000000..a6ae41e
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.demo.domain;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIs;
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIsType;
+import org.apache.myfaces.extensions.validator.crossval.annotation.NotEquals;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Length;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Pattern;
+
+import javax.persistence.Column;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Date;
+
+public class Person
+{
+ @Length(minimum = 2)
+ @Column(nullable = false, length = 20)
+ @NotEquals("lastName")
+ @Pattern("[A-Z][a-z]+")
+ private String firstName;
+
+ @Length(minimum = 2)
+ @Column(nullable = false, length = 20)
+ private String lastName;
+
+ @Column(nullable = false, length = 10)
+ private String password;
+
+ @Column(nullable = false, length = 10)
+ private String role = "user";
+
+ @DateIs(type = DateIsType.before, valueOf = "finalExam")
+ @Column(nullable = false)
+ @Temporal(TemporalType.DATE)
+ private Date birthday;
+
+ @Column(nullable = false)
+ @Temporal(TemporalType.DATE)
+ private Date finalExam;
+
+ @Length(minimum = 2)
+ @Column(nullable = false, length = 10)
+ private String nickName;
+
+ @Length(minimum = 6)
+ @Column(nullable = false, length = 60)
+ private String email;
+
+ @Column(nullable = false)
+ private int numberOfSiblings;
+
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+
+ public String getLastName()
+ {
+ return lastName;
+ }
+
+ public void setLastName(String lastName)
+ {
+ this.lastName = lastName;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ public String getRole()
+ {
+ return role;
+ }
+
+ public void setRole(String role)
+ {
+ this.role = role;
+ }
+
+ public Date getBirthday()
+ {
+ return birthday;
+ }
+
+ public void setBirthday(Date birthday)
+ {
+ this.birthday = birthday;
+ }
+
+ public Date getFinalExam()
+ {
+ return finalExam;
+ }
+
+ public void setFinalExam(Date finalExam)
+ {
+ this.finalExam = finalExam;
+ }
+
+ public String getNickName()
+ {
+ return nickName;
+ }
+
+ public void setNickName(String nickName)
+ {
+ this.nickName = nickName;
+ }
+
+ public String getEmail()
+ {
+ return email;
+ }
+
+ public void setEmail(String email)
+ {
+ this.email = email;
+ }
+
+ public int getNumberOfSiblings()
+ {
+ return numberOfSiblings;
+ }
+
+ public void setNumberOfSiblings(int numberOfSiblings)
+ {
+ this.numberOfSiblings = numberOfSiblings;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/gui/beans/RegistrationPage.java b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/gui/beans/RegistrationPage.java
new file mode 100644
index 0000000..72e14fb
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/gui/beans/RegistrationPage.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.demo.gui.beans;
+
+import org.apache.myfaces.extensions.validator.demo.domain.Person;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+import org.apache.myfaces.extensions.validator.crossval.annotation.NotEquals;
+import org.apache.myfaces.extensions.validator.baseval.annotation.JoinValidation;
+import org.apache.myfaces.extensions.validator.baseval.annotation.LongRange;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Validator;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidation;
+import org.apache.myfaces.custom.emailvalidator.EmailValidator;
+
+public class RegistrationPage
+{
+
+ //the old password of the person isn't used within the page
+ //-> validate with value of the model
+ @SkipValidation("#{person.role eq 'admin'}")
+ @Required
+ @Equals("person.password")
+ @NotEquals("password")
+ private String oldPassword;
+
+ @Equals("passwordRepeated")
+ //combine gui related annotations with the annoations of the domain model
+ @JoinValidation(value = "#{registrationPage.person.password}")
+ private String password;
+
+ @Required(validationErrorMsgKey = "repeated_password_required")
+ private String passwordRepeated;
+
+ //use #{registrationPage.person.nickName}, #{person.nickName}
+ //use registrationPage to display the second error message at old nickname
+ //or local property chaining (to avoid the usage of the bean name) - like:
+ @SkipValidation("#{person.role eq 'admin'}")
+ @NotEquals("person.nickName")
+ @JoinValidation("person.nickName")
+ private String newNickName;
+
+ private Person person;
+
+ public String finish()
+ {
+ this.person.setPassword(this.password);
+ return "home";
+ }
+
+ public String updateNickName()
+ {
+ this.person.setNickName(this.newNickName);
+ return "home";
+ }
+
+ //just a quick illustration of skipValidation
+ public String switchMode()
+ {
+ String currentRole = this.person.getRole();
+
+ if(currentRole.equals("admin"))
+ {
+ this.person.setRole("user");
+ }
+ else
+ {
+ this.person.setRole("admin");
+ }
+ return "";
+ }
+
+ @JoinValidation("person.email")
+ @Validator(EmailValidator.class)
+ public String getEmail()
+ {
+ return this.person.getEmail();
+ }
+
+ public void setEmail(String email)
+ {
+ this.person.setEmail(email);
+ }
+
+ @JoinValidation("#{person.numberOfSiblings}")
+ @LongRange(maximum = 20)
+ public int getNumberOfSiblings()
+ {
+ return this.person.getNumberOfSiblings();
+ }
+
+ public void setNumberOfSiblings(int numberOfSiblings)
+ {
+ this.person.setNumberOfSiblings(numberOfSiblings);
+ }
+
+ /*
+ * generated
+ */
+ public String getOldPassword()
+ {
+ return oldPassword;
+ }
+
+ public void setOldPassword(String oldPassword)
+ {
+ this.oldPassword = oldPassword;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ public String getPasswordRepeated()
+ {
+ return passwordRepeated;
+ }
+
+ public void setPasswordRepeated(String passwordRepeated)
+ {
+ this.passwordRepeated = passwordRepeated;
+ }
+
+ public Person getPerson()
+ {
+ return person;
+ }
+
+ public void setPerson(Person person)
+ {
+ this.person = person;
+ }
+
+ public String getNewNickName()
+ {
+ return newNickName;
+ }
+
+ public void setNewNickName(String newNickName)
+ {
+ this.newNickName = newNickName;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/LICENSE.txt b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/NOTICE.txt b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/faces-config.xml b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..0418d66
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,70 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+ <application>
+ <!-- trinidad -->
+ <default-render-kit-id>
+ org.apache.myfaces.trinidad.core
+ </default-render-kit-id>
+
+ </application>
+
+ <managed-bean>
+ <managed-bean-name>registrationPage</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.extensions.validator.demo.gui.beans.RegistrationPage</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+
+ <managed-property>
+ <property-name>person</property-name>
+ <value>#{person}</value>
+ </managed-property>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>person</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.extensions.validator.demo.domain.Person</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
+ <navigation-rule>
+ <from-view-id>/pages/home.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>addUser</from-outcome>
+ <to-view-id>/pages/registration.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>changeNickName</from-outcome>
+ <to-view-id>/pages/change_nickName.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>changePassword</from-outcome>
+ <to-view-id>/pages/change_password.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>home</from-outcome>
+ <to-view-id>/pages/home.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+</faces-config>
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/main.taglib.xml b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/main.taglib.xml
new file mode 100644
index 0000000..2339366
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/main.taglib.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!DOCTYPE facelet-taglib PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
+ "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+
+<facelet-taglib>
+ <namespace>http://myfaces.apache.org/extval/demo/components</namespace>
+
+ <tag>
+ <tag-name>userForm</tag-name>
+ <source>
+ ../components/user_form.xhtml
+ </source>
+ </tag>
+
+</facelet-taglib>
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/web.xml b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..25c01aa
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,191 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <description>MyProject web.xml</description>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>facelets.LIBRARIES</param-name>
+ <param-value>/WEB-INF/main.taglib.xml</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.apache.myfaces.trinidad.ENABLE_LIGHTWEIGHT_DIALOGS</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
+ <param-value>com.sun.facelets.FaceletViewHandler</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.apache.myfaces.trinidad.CHANGE_PERSISTENCE</param-name>
+ <param-value>session</param-value>
+ </context-param>
+
+ <context-param>
+ <description>State saving method: "client" or "server" (= default)
+ See JSF Specification 2.5.3
+ </description>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>client</param-value>
+ </context-param>
+ <context-param>
+ <description>Only applicable if state saving method is "server" (= default).
+ Defines the amount (default = 20) of the latest views are stored in session.
+ </description>
+ <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
+ <param-value>20</param-value>
+ </context-param>
+ <context-param>
+ <description>Only applicable if state saving method is "server" (= default).
+ If true (default) the state will be serialized to a byte stream before it
+ is written to the session.
+ If false the state will not be serialized to a byte stream.
+ </description>
+ <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <description>Only applicable if state saving method is "server" (= default) and if
+ org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (= default)
+ If true (default) the serialized state will be compressed before it
+ is written to the session. If false the state will not be compressed.
+ </description>
+ <param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <description>This parameter tells MyFaces if javascript code should be allowed in the
+ rendered HTML output.
+ If javascript is allowed, command_link anchors will have javascript code
+ that submits the corresponding form.
+ If javascript is not allowed, the state saving info and nested parameters
+ will be added as url parameters.
+ Default: "true"
+ </description>
+ <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <context-param>
+ <description>If true, rendered HTML code will be formatted, so that it is "human readable".
+ i.e. additional line separators and whitespace will be written, that do not
+ influence the HTML code.
+ Default: "true"
+ </description>
+ <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <description>If true, a javascript function will be rendered that is able to restore the
+ former vertical scroll on every request. Convenient feature if you have pages
+ with long lists and you do not want the browser page to always jump to the top
+ if you trigger a link or button action that stays on the same page.
+ Default: "false"
+ </description>
+ <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <description>Used for encrypting view state. Only relevant for client side
+ state saving. See MyFaces wiki/web site documentation for instructions
+ on how to configure an application for diffenent encryption strengths.
+ </description>
+ <param-name>org.apache.myfaces.SECRET</param-name>
+ <param-value>NzY1NDMyMTA=</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Validate managed beans, navigation rules and ensure that forms are not nested.
+ </description>
+ <param-name>org.apache.myfaces.VALIDATE</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <!-- Listener, to allow Jetty serving MyFaces apps -->
+ <listener>
+ <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+ </listener>
+
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>resources</servlet-name>
+ <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
+ </servlet>
+
+ <filter>
+ <filter-name>trinidad</filter-name>
+ <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>trinidad</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ </filter-mapping>
+
+ <!-- Faces Servlet Mappings -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>resources</servlet-name>
+ <url-pattern>/adf/*</url-pattern>
+ </servlet-mapping>
+
+ <!-- Welcome files -->
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/components/user_form.xhtml b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/components/user_form.xhtml
new file mode 100644
index 0000000..c84d648
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/components/user_form.xhtml
@@ -0,0 +1,52 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:tr="http://myfaces.apache.org/trinidad"
+ xmlns:trh="http://myfaces.apache.org/trinidad/html">
+
+<ui:composition>
+ <tr:panelFormLayout>
+
+ <tr:inputText label="nick name" value="#{bean.person[ 'nickName' ]}"/>
+ <tr:inputText label="e-mail" value="#{bean.email}"/>
+
+ <tr:inputText label="first name" value="#{bean.person.firstName}"/>
+ <tr:inputText label="last name" value="#{bean.person.lastName}"/>
+ <tr:inputDate label="birthday" value="#{bean.person.birthday}">
+ <tr:convertDateTime type="date" pattern="dd.MM.yyyy"/>
+ </tr:inputDate>
+ <tr:inputDate label="final exam" value="#{bean.person.finalExam}">
+ <tr:convertDateTime type="date" pattern="dd.MM.yyyy"/>
+ </tr:inputDate>
+
+ <tr:inputText label="number of siblings" value="#{bean.numberOfSiblings}"/>
+
+ <tr:inputText label="password" value="#{bean.password}" secret="true"/>
+ <tr:inputText label="re-enter password" value="#{bean.passwordRepeated}" secret="true"/>
+
+ </tr:panelFormLayout>
+</ui:composition>
+</html>
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/index.html b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/index.html
new file mode 100644
index 0000000..25cd148
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/index.html
@@ -0,0 +1,25 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+
+<html>
+
+<head>
+ <meta http-equiv="refresh" content="0; URL=faces/pages/home.xhtml">
+</head>
+</html>
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/layout/template.xhtml b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/layout/template.xhtml
new file mode 100644
index 0000000..b0c1ea8
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/layout/template.xhtml
@@ -0,0 +1,54 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+
+<tr:document
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:tr="http://myfaces.apache.org/trinidad"
+ xmlns:trh="http://myfaces.apache.org/trinidad/html"
+ xmlns:c="http://java.sun.com/jstl/core">
+ <f:facet name="metaContainer">
+ <title>sev-en feature-set demo 01</title>
+ </f:facet>
+
+ <trh:body>
+
+ <!-- original -->
+ <div id="wrap">
+
+ <tr:form id="form" defaultCommand="defaultButton">
+ <div id="main">
+ <ui:insert name="content">
+ <div class="under_construction">
+ <h2>!site under construction!</h2>
+
+ <p>The content of this site is not available at the moment.</p>
+ </div>
+ </ui:insert>
+ </div>
+
+ </tr:form>
+ <tr:messages globalOnly="true"/>
+
+ </div>
+ </trh:body>
+
+
+</tr:document>
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/change_nickName.xhtml b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/change_nickName.xhtml
new file mode 100644
index 0000000..9893fae
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/change_nickName.xhtml
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<body>
+
+<ui:composition template="../layout/template.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:tr="http://myfaces.apache.org/trinidad"
+ xmlns:trh="http://myfaces.apache.org/trinidad/html">
+
+ <ui:define name="content">
+
+ <tr:panelFormLayout>
+
+ <ui:remove>
+ just for the demo we are using two input components
+ </ui:remove>
+ <tr:inputText label="old nick name" readOnly="true" value="#{registrationPage.person.nickName}"/>
+
+ <tr:inputText label="nick name" value="#{registrationPage.newNickName}"/>
+
+ </tr:panelFormLayout>
+ <tr:commandButton text="save" action="#{registrationPage.updateNickName}"/>
+
+ </ui:define>
+</ui:composition>
+
+</body>
+</html>
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/change_password.xhtml b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/change_password.xhtml
new file mode 100644
index 0000000..310975a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/change_password.xhtml
@@ -0,0 +1,64 @@
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<body>
+
+<ui:composition template="../layout/template.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:tr="http://myfaces.apache.org/trinidad"
+ xmlns:trh="http://myfaces.apache.org/trinidad/html">
+
+ <ui:define name="content">
+
+ <table>
+ <tr>
+ <td><tr:outputLabel value="old password" for="old_password"/></td>
+ <td><tr:inputText id="old_password" simple="true" value="#{registrationPage.oldPassword}" secret="true"/></td>
+ <td><tr:message for="old_password"/></td>
+ </tr>
+
+ <tr>
+ <td><tr:outputLabel value="new password" for="new_password"/></td>
+ <td><tr:inputText id="new_password" simple="true" value="#{registrationPage.password}" secret="true"/></td>
+ <td><tr:message for="new_password"/></td>
+ </tr>
+
+ <tr>
+ <td><tr:outputLabel value="re-enter password" for="reentered"/></td>
+ <td><tr:inputText id="reentered" simple="true" value="#{registrationPage.passwordRepeated}" secret="true"/></td>
+ <td><tr:message for="reentered"/></td>
+ </tr>
+
+ </table>
+ <tr:commandButton text="save" action="#{registrationPage.finish}"/>
+ </ui:define>
+</ui:composition>
+
+</body>
+</html>
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/home.xhtml b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/home.xhtml
new file mode 100644
index 0000000..017ebd9
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/home.xhtml
@@ -0,0 +1,47 @@
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<body>
+
+<ui:composition template="../layout/template.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:tr="http://myfaces.apache.org/trinidad"
+ xmlns:trh="http://myfaces.apache.org/trinidad/html">
+
+ <ui:define name="content">
+ <tr:commandButton text="add user" action="addUser"/><br/>
+ <tr:commandButton text="change nick name" action="changeNickName"/><br/>
+ <tr:commandButton text="change password" action="changePassword"/><br/>
+ <tr:commandLink text="mode: #{registrationPage.person.role}"
+ action="#{registrationPage.switchMode}" immediate="true"/>
+ </ui:define>
+</ui:composition>
+
+</body>
+</html>
diff --git a/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/registration.xhtml b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/registration.xhtml
new file mode 100644
index 0000000..c0f6b06
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/feature-set_01/src/main/webapp/pages/registration.xhtml
@@ -0,0 +1,48 @@
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<body>
+
+<ui:composition template="../layout/template.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:tr="http://myfaces.apache.org/trinidad"
+ xmlns:trh="http://myfaces.apache.org/trinidad/html"
+ xmlns:c="http://myfaces.apache.org/extval/demo/components"
+ >
+
+ <ui:define name="content">
+
+ <c:userForm bean="#{registrationPage}"/>
+ <tr:commandButton text="save" action="#{registrationPage.finish}"/>
+
+ </ui:define>
+</ui:composition>
+
+</body>
+</html>
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/pom.xml b/1_2_2_prepare_rc_base/examples/hello_world/pom.xml
new file mode 100644
index 0000000..a505924
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/pom.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>war</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-hello_world</artifactId>
+
+ <name>MyFaces Extensions-Validator examples hello world</name>
+ <version>1.2.2-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-project</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>myfaces-extval-property-validation</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${jsf.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>jstl</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/META-INF/LICENSE.txt b/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/META-INF/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/META-INF/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/META-INF/NOTICE.txt b/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/META-INF/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/META-INF/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java b/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
new file mode 100644
index 0000000..7bafb39
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.blank;
+
+import org.apache.myfaces.blank.domain.Person;
+
+/**
+ * A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
+ *
+ */
+public class HelloWorldController
+{
+ private Person person = new Person();
+
+ /**
+ * default empty constructor
+ */
+ public HelloWorldController()
+ {
+ }
+
+ /**
+ * Method that is backed to a submit button of a form.
+ */
+ public String send()
+ {
+ //do real logic, return a string which will be used for the navigation system of JSF
+ return "success";
+ }
+
+ public Person getPerson()
+ {
+ return person;
+ }
+
+ public void setPerson(Person person)
+ {
+ this.person = person;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java b/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java
new file mode 100644
index 0000000..66d4a9e
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/src/main/java/org/apache/myfaces/blank/domain/Person.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.blank.domain;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+import javax.persistence.Column;
+
+public class Person
+{
+ //hello world demo
+ @Required
+ private String firstName;
+
+ //demo for jpa based validation support
+ @Column(nullable = false, length = 10 /*...*/)
+ private String lastName;
+
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+
+ public String getLastName()
+ {
+ return lastName;
+ }
+
+ public void setLastName(String lastName)
+ {
+ this.lastName = lastName;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/LICENSE.txt b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/NOTICE.txt b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/faces-config.xml b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..62beae7
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,50 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+
+<faces-config version="1.2"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
+ <!-- managed beans of the simple hello world app -->
+ <managed-bean>
+ <managed-bean-name>helloWorld</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.blank.HelloWorldController</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
+ <!-- navigation rules for helloWorld.jsp -->
+ <navigation-rule>
+ <from-view-id>/helloWorld.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/page2.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
+ <!-- navigation rules for page2.jsp -->
+ <navigation-rule>
+ <from-view-id>/page2.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>back</from-outcome>
+ <to-view-id>/helloWorld.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+</faces-config>
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/web.xml b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..9a4a183
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,182 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <description>MyProject web.xml</description>
+
+ <!--optional: context-param>
+ <description>Comma separated list of URIs of (additional) faces config files.
+ (e.g. /WEB-INF/my-config.xml)
+ See JSF 1.0 PRD2, 10.3.2
+ Attention: You do not need to put /WEB-INF/faces-config.xml in here.
+ </description>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/examples-config.xml</param-value>
+ </context-param-->
+ <context-param>
+ <description>State saving method: "client" or "server" (= default)
+ See JSF Specification 2.5.3</description>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>client</param-value>
+ </context-param>
+ <context-param>
+ <description>Only applicable if state saving method is "server" (= default).
+ Defines the amount (default = 20) of the latest views are stored in session.</description>
+ <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
+ <param-value>20</param-value>
+ </context-param>
+ <context-param>
+ <description>Only applicable if state saving method is "server" (= default).
+ If true (default) the state will be serialized to a byte stream before it
+ is written to the session.
+ If false the state will not be serialized to a byte stream.</description>
+ <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <description>Only applicable if state saving method is "server" (= default) and if
+ org.apache.myfaces.SERIALIZE_STATE_IN_SESSION is true (= default)
+ If true (default) the serialized state will be compressed before it
+ is written to the session. If false the state will not be compressed.</description>
+ <param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <description>This parameter tells MyFaces if javascript code should be allowed in the
+ rendered HTML output.
+ If javascript is allowed, command_link anchors will have javascript code
+ that submits the corresponding form.
+ If javascript is not allowed, the state saving info and nested parameters
+ will be added as url parameters.
+ Default: "true"</description>
+ <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <context-param>
+ <description>If true, rendered HTML code will be formatted, so that it is "human readable".
+ i.e. additional line separators and whitespace will be written, that do not
+ influence the HTML code.
+ Default: "true"</description>
+ <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <description>If true, a javascript function will be rendered that is able to restore the
+ former vertical scroll on every request. Convenient feature if you have pages
+ with long lists and you do not want the browser page to always jump to the top
+ if you trigger a link or button action that stays on the same page.
+ Default: "false"</description>
+ <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <description>Used for encrypting view state. Only relevant for client side
+ state saving. See MyFaces wiki/web site documentation for instructions
+ on how to configure an application for diffenent encryption strengths.
+ </description>
+ <param-name>org.apache.myfaces.SECRET</param-name>
+ <param-value>NzY1NDMyMTA=</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Validate managed beans, navigation rules and ensure that forms are not nested.
+ </description>
+ <param-name>org.apache.myfaces.VALIDATE</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Treat readonly same as if disabled attribute was set for select elements.
+ </description>
+ <param-name>org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Use the defined class as the class which will be called when a resource is added to the
+ ExtensionFilter handling. Using StreamingAddResource here helps with performance. If you want to add
+ custom components and want to use the ExtensionFilter, you need to provide your custom implementation here.
+ </description>
+ <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>
+ <param-value>org.apache.myfaces.renderkit.html.util.DefaultAddResource</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Virtual path in the URL which triggers loading of resources for the MyFaces extended components
+ in the ExtensionFilter.
+ </description>
+ <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
+ <param-value>/faces/myFacesExtensionResource</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Check if the extensions-filter has been properly configured.
+ </description>
+ <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <description>
+ Define partial state saving as true/false.
+ </description>
+ <param-name>javax.faces.PARTIAL_STATE_SAVING_METHOD</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <!-- Listener, to allow Jetty serving MyFaces apps -->
+ <listener>
+ <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+ </listener>
+
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!-- Faces Servlet Mapping -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+ <!-- Welcome files -->
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/helloWorld.jsp b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/helloWorld.jsp
new file mode 100644
index 0000000..23e10b3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/helloWorld.jsp
@@ -0,0 +1,43 @@
+<%--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+--%>
+
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+ <head>
+ <title>Hello World</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form id="mainForm">
+ <h:panelGrid columns="3">
+ <h:outputLabel for="first_name" value="First name:"/>
+ <h:inputText id="first_name" label="First name" value="#{helloWorld.person.firstName}"/>
+ <h:message for="first_name" showSummary="true" showDetail="false"/>
+
+ <h:outputLabel for="last_name" value="Last name:"/>
+ <h:inputText id="last_name" label="Last name" value="#{helloWorld.person.lastName}"/>
+ <h:message for="last_name" showSummary="true" showDetail="false"/>
+
+ <h:commandButton value="Press me" action="#{helloWorld.send}"/>
+ <h:panelGroup/>
+ <h:panelGroup/>
+ </h:panelGrid>
+ </h:form>
+ </f:view>
+ </body>
+</html>
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/index.jsp b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/index.jsp
new file mode 100644
index 0000000..2482d53
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/index.jsp
@@ -0,0 +1,21 @@
+<%--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+--%>
+
+<%@ page session="false"%>
+<%
+response.sendRedirect("helloWorld.jsf");
+%>
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/page2.jsp b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/page2.jsp
new file mode 100644
index 0000000..1ac8523
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/hello_world/src/main/webapp/page2.jsp
@@ -0,0 +1,34 @@
+<%--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+--%>
+
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+ <head>
+ <title>Hello World</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form id="mainForm">
+ <h2><h:outputText value="Hello #{helloWorld.person.firstName} #{helloWorld.person.lastName}. We hope you enjoy Apache MyFaces Extensions Validator!"/></h2>
+ <h:commandLink action="back">
+ <h:outputText value="Home"/>
+ </h:commandLink>
+ </h:form>
+ </f:view>
+ </body>
+</html>
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/examples/pom.xml b/1_2_2_prepare_rc_base/examples/pom.xml
new file mode 100644
index 0000000..163c0f0
--- /dev/null
+++ b/1_2_2_prepare_rc_base/examples/pom.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <packaging>pom</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-project</artifactId>
+
+ <name>MyFaces Extensions-Validator examples project</name>
+ <version>1.2.2-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-parent</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/examples</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/examples</developerConnection>
+ <url>http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/1_2_2_rc/examples</url>
+ </scm>
+
+ <build>
+ <plugins>
+ <plugin>
+ <!--This plugin allows to run the example using mvn jetty:run -->
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.8</version>
+ <configuration>
+ <scanIntervalSeconds>10</scanIntervalSeconds>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <modules>
+ <module>hello_world</module>
+ <module>feature-set_01</module>
+ </modules>
+
+ <profiles>
+ <!-- This profile is invoked by -DprepareRelease=true. This allows mvn release:prepare to
+ run successfully on the assembly projects. -->
+ <profile>
+ <id>prepare-release</id>
+ <activation>
+ <property>
+ <name>prepareRelease</name>
+ </property>
+ </activation>
+ <modules>
+ <module>assembly</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <arguments>-DprepareRelease</arguments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <properties>
+ <trinidad.version>1.2.9</trinidad.version>
+ </properties>
+
+</project>
diff --git a/1_2_2_prepare_rc_base/logo/LICENSE.txt b/1_2_2_prepare_rc_base/logo/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/logo/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/logo/NOTICE.txt b/1_2_2_prepare_rc_base/logo/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/logo/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/logo/extval-logo.svg b/1_2_2_prepare_rc_base/logo/extval-logo.svg
new file mode 100644
index 0000000..472b539
--- /dev/null
+++ b/1_2_2_prepare_rc_base/logo/extval-logo.svg
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+
+<!--
+ Copyright 2009 Enrico Berti (enrico.berti@gmail.com)
+
+ 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.
+-->
+
+
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.0"
+ width="744.09448"
+ height="1052.3622"
+ id="svg2">
+ <defs
+ id="defs4" />
+ <g
+ id="layer2">
+ <rect
+ width="353.41953"
+ height="113.1084"
+ ry="11"
+ x="182.23015"
+ y="381.33292"
+ id="rect2484"
+ style="fill:#ffffff;fill-opacity:1;stroke:#66666f;stroke-width:0.80188262;stroke-opacity:0.94117647" />
+ </g>
+ <g
+ id="layer1">
+ <path
+ d="M 107.1875,393.56638 L 122.30469,393.56638 L 177.5,467.39451 L 162.38281,467.39451 L 107.1875,393.56638 M 122.30469,467.39451 L 107.1875,467.39451 L 162.38281,393.56638 L 177.5,393.56638 L 122.30469,467.39451 M 185.9375,381.61326 L 194.09375,381.61326 L 196.90625,393.56638 L 214.0625,393.56638 L 214.0625,404.11326 L 198.94531,404.11326 L 198.94531,446.51169 C 198.9453,453.40233 201.92186,456.84764 207.875,456.84763 L 214.0625,456.84763 L 214.0625,467.39451 L 204.5,467.39451 C 192.12499,467.39451 185.9375,460.7617 185.9375,447.49607 L 185.9375,381.61326"
+ transform="translate(147.52173,19.291922)"
+ id="flowRoot2461"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#666666;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sansation;-inkscape-font-specification:Sansation" />
+ <path
+ d="M 484.15625,337.9375 C 479.95007,341.18105 476.90861,345.60121 473.71875,349.78125 C 466.07192,360.15902 458.35347,370.48461 450.83739,380.95796 C 440.98123,394.44873 431.29593,408.06449 421.83298,421.83413 C 413.65007,433.72799 405.45568,445.61412 397.35857,457.56666 C 396.7446,458.33309 396.35119,459.30427 395.59375,459.9375 C 394.78303,460.50627 393.39697,460.07425 393.30995,459.00785 C 390.05782,441.64514 386.77256,424.28865 383.39742,406.94938 C 382.026,399.77422 380.62643,392.60344 379.06866,385.46625 C 378.33302,382.12924 377.55764,378.78854 376.4556,375.55233 C 376.08189,374.69373 375.92846,373.48739 374.86152,373.21336 C 373.90945,372.77359 372.87113,373.35054 372.36123,374.17909 C 371.41481,375.55691 370.61571,377.05798 370.16263,378.67398 C 369.15946,381.70019 368.85097,384.90492 368.73445,388.07481 C 368.66876,392.77417 369.40888,397.43369 370.12162,402.06479 C 371.94518,413.33393 374.32417,424.50373 376.17486,435.76813 C 376.86055,439.57107 377.50297,443.3833 377.91973,447.22669 C 378.45818,452.18708 378.57847,457.18279 378.625,462.16873 C 378.64893,470.73709 378.05038,479.30085 378.26439,487.86974 C 378.50699,491.06515 378.94369,494.39429 380.63676,497.18155 C 381.71818,498.9161 383.5747,500.25786 385.67117,500.29965 C 387.79584,500.34803 389.89704,499.55975 391.63354,498.37083 C 392.98011,497.34428 394.10044,496.02367 394.99889,494.59172 C 396.49831,492.05246 398.06307,489.53913 399.23028,486.82797 C 400.61353,483.72883 401.96472,480.614 403.17026,477.43989 C 404.79338,473.21645 406.42567,468.99012 408.44074,464.9342 C 411.77791,457.85251 415.34266,450.88011 419.0082,443.96362 C 421.05061,440.13042 423.20921,436.35631 425.55865,432.70293 C 428.40254,428.51347 431.41661,424.44318 434.42912,420.37465 C 440.2865,412.57456 446.33367,404.91964 452.23691,397.15447 C 456.97879,390.98615 461.75235,384.84071 466.39317,378.59587 C 469.35373,374.59166 472.22163,370.51632 474.94293,366.34568 C 477.84406,361.76847 480.52757,357.03505 482.67429,352.05405 C 484.07993,348.67379 485.27036,345.139 485.44273,341.45279 C 485.45991,340.53419 485.55823,339.58269 485.3125,338.6875 C 485.11783,338.23359 484.70246,337.78109 484.15625,337.9375 z"
+ id="text2475"
+ style="font-size:49.32169342px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#99cc00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sansation;-inkscape-font-specification:Sansation" />
+ <path
+ d="M 142.55469,393.56638 C 165.14838,393.56646 174.26556,407.11332 169.90625,434.20701 L 120.19531,434.20701 C 120.1953,449.30077 129.71091,456.84764 148.74219,456.84763 C 155.25776,456.84764 161.77338,456.14452 168.28906,454.73826 L 168.28906,465.28513 C 161.77338,466.69138 153.85152,467.39451 144.52344,467.39451 C 119.6328,467.39451 107.1875,454.80858 107.1875,429.63669 C 107.1875,405.58988 118.97655,393.56646 142.55469,393.56638 M 120.19531,423.37888 L 158.02344,423.37888 C 158.67964,410.44144 152.82027,403.97269 140.44531,403.97263 C 127.78904,403.97269 121.03905,410.44144 120.19531,423.37888"
+ transform="translate(81.0425,19.291676)"
+ id="flowRoot4783"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#666666;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sansation;-inkscape-font-specification:Sansation" />
+ <path
+ d="M 107.1875,444.40232 C 107.1875,429.26173 117.17187,421.69143 137.14062,421.69138 C 144.49996,421.69143 150.92183,422.16018 156.40625,423.09763 L 156.40625,416.13669 C 156.4062,408.12113 149.77339,404.11332 136.50781,404.11326 C 128.91404,404.11332 121.1328,405.28519 113.16406,407.62888 L 113.16406,397.08201 C 121.1328,394.73833 128.91404,393.56646 136.50781,393.56638 C 158.44526,393.56646 169.414,401.44145 169.41406,417.19138 L 169.41406,467.39451 L 162.80469,467.39451 L 157.60156,462.19138 C 151.17964,465.66013 143.63278,467.39451 134.96094,467.39451 C 116.4453,467.39451 107.1875,459.73045 107.1875,444.40232 M 156.40625,433.64451 C 151.24996,432.70704 144.82809,432.23829 137.14062,432.23826 C 125.84373,432.23829 120.1953,436.22266 120.19531,444.19138 C 120.1953,452.6289 125.11717,456.84764 134.96094,456.84763 C 143.9609,456.84764 151.10933,454.92577 156.40625,451.08201 L 156.40625,433.64451"
+ transform="matrix(1.000002,0,0,1,329.73829,19.291676)"
+ id="flowRoot4807"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#666666;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sansation;-inkscape-font-specification:Sansation" />
+ <path
+ d="M 107.1875,366.84763 L 107.1875,467.39451 L 120.19531,467.39451 L 120.19531,366.84763 L 107.1875,366.84763"
+ transform="matrix(1.000002,0,0,1,403.79929,19.291676)"
+ id="flowRoot4819"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#666666;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sansation;-inkscape-font-specification:Sansation" />
+ </g>
+ <g
+ id="layer3">
+ <rect
+ width="11.891597"
+ height="12.806335"
+ x="333.57455"
+ y="400.87384"
+ id="rect4695"
+ style="fill:#666666;fill-opacity:1;stroke:none;stroke-opacity:1" />
+ <rect
+ width="15.071473"
+ height="20.124157"
+ ry="0.31444132"
+ x="281.89182"
+ y="439.79248"
+ id="rect4697"
+ style="fill:#666666;fill-opacity:1;stroke:none;stroke-opacity:1" />
+ <rect
+ width="11.891597"
+ height="10.530645"
+ x="327.69699"
+ y="412.87155"
+ id="rect4891"
+ style="fill:#666666;fill-opacity:1;stroke:none;stroke-opacity:1" />
+ </g>
+</svg>
diff --git a/1_2_2_prepare_rc_base/parent/LICENSE.txt b/1_2_2_prepare_rc_base/parent/LICENSE.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/1_2_2_prepare_rc_base/parent/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/1_2_2_prepare_rc_base/parent/NOTICE.txt b/1_2_2_prepare_rc_base/parent/NOTICE.txt
new file mode 100644
index 0000000..409bdb1
--- /dev/null
+++ b/1_2_2_prepare_rc_base/parent/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/parent/pom.xml b/1_2_2_prepare_rc_base/parent/pom.xml
new file mode 100644
index 0000000..b979bdb
--- /dev/null
+++ b/1_2_2_prepare_rc_base/parent/pom.xml
@@ -0,0 +1,280 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<!--
+ - Parent pom of all the myfaces extensions validator subprojects
+ that help to build other myfaces projects.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.myfaces</groupId>
+ <artifactId>myfaces</artifactId>
+ <version>6</version>
+ </parent>
+
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-parent</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache MyFaces Extensions-Validator Project Parent</name>
+ <url>http://myfaces.apache.org/extensions/validator12</url>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>http://issues.apache.org/jira/browse/EXTVAL</url>
+ </issueManagement>
+
+ <ciManagement>
+ <system>continuum</system>
+ <url>http://myfaces.zones.apache.org:8080/continuum</url>
+ <notifiers>
+ <notifier>
+ <type>mail</type>
+ <sendOnSuccess>true</sendOnSuccess>
+ <configuration>
+ <address>commits@myfaces.apache.org</address>
+ </configuration>
+ </notifier>
+ </notifiers>
+ </ciManagement>
+
+ <inceptionYear>2008</inceptionYear>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>NOTICE.txt</include>
+ <include>LICENSE.txt</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>${basedir}/src/main/resources</directory>
+ </resource>
+ </resources>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <!--
+ - Copy LICENSE.txt and NOTICE.txt so that they are included
+ - in the -javadoc jar file for the component.
+ -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>javadoc.resources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <copy todir="${project.build.directory}/apidocs/META-INF">
+ <fileset dir="${basedir}">
+ <include name="LICENSE.txt" />
+ <include name="NOTICE.txt" />
+ </fileset>
+ </copy>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>javadoc.site.copy</id>
+ <phase>site</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <!-- Copy javadoc to another directory, to keep javadoc of previous versions on site -->
+ <copy todir="${project.build.directory}/site/apidocs-${project.version}" failonerror="false">
+ <fileset dir="${project.build.directory}/site/apidocs"/>
+ </copy>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!--
+ - Make a checkstyle violation a compile error. Note that if a compile error occurs,
+ - further information can be found in target/site/checkstyle.html (present even when
+ - just the compile goal and not the site goal has been run). Note also that child
+ - projects may redeclare this plugin and provide different configuration settings
+ - to use different checks (more or less strict than the default).
+ -->
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <id>verify-style</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <configLocation>default/myfaces-checks-standard.xml</configLocation>
+ <headerLocation>default/myfaces-header.txt</headerLocation>
+ </configuration>
+ </plugin>
+
+
+ <plugin>
+ <!-- Set compile source at 1.5, since the target JSF impl is 1.2 -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <optimize>false</optimize>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>maven2-repository.dev.java.net</id>
+ <name>Java.net Repository for Maven</name>
+ <url>http://download.java.net/maven/1/</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.3</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jxr-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.4.3</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>2.0.1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <rulesets>
+ <ruleset>/rulesets/basic.xml</ruleset>
+ <ruleset>/rulesets/unusedcode.xml</ruleset>
+ </rulesets>
+ <linkXref>true</linkXref>
+ <minimumTokens>100</minimumTokens>
+ <targetJdk>1.5</targetJdk>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <configLocation>default/myfaces-checks-standard.xml</configLocation>
+ <headerLocation>default/myfaces-header.txt</headerLocation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/parent</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/parent</developerConnection>
+ <url>http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/1_2_2_rc/parent</url>
+ </scm>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <uniqueVersion>false</uniqueVersion>
+ <id>apache.snapshots</id>
+ <name>Apache Maven Snapshot Repository</name>
+ <url>scpexe://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository</url>
+ </snapshotRepository>
+ <site>
+ <id>apache-site</id>
+ <url>scpexe://people.apache.org/www/myfaces.apache.org/extensions/validator12</url>
+ </site>
+ </distributionManagement>
+
+ <profiles>
+ <profile>
+ <id>generate-assembly</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.3</version>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <properties>
+ <jsf.version>1.2.4</jsf.version>
+ </properties>
+</project>
diff --git a/1_2_2_prepare_rc_base/parent/src/site/apt/index.apt b/1_2_2_prepare_rc_base/parent/src/site/apt/index.apt
new file mode 100644
index 0000000..6287930
--- /dev/null
+++ b/1_2_2_prepare_rc_base/parent/src/site/apt/index.apt
@@ -0,0 +1,7 @@
+ ------
+Overview
+ ------
+
+Apache MyFaces Extensions Validator for JSF 1.2
+
+ Apache MyFaces Extensions Validator provides versions for JSF 1.1 and 1.2
diff --git a/1_2_2_prepare_rc_base/parent/src/site/apt/javadoc.apt b/1_2_2_prepare_rc_base/parent/src/site/apt/javadoc.apt
new file mode 100644
index 0000000..5226631
--- /dev/null
+++ b/1_2_2_prepare_rc_base/parent/src/site/apt/javadoc.apt
@@ -0,0 +1,11 @@
+ ------
+Javadoc
+ ------
+
+Javadoc
+
+ Here you can find the javadoc of previous extval versions.
+
+ * {{{http://myfaces.apache.org/extensions/validator12/myfaces-extval-core/apidocs-1.2.1/index.html}Myfaces ExtVal Core Version 1.2.1}}
+
+ * {{{http://myfaces.apache.org/extensions/validator12/validation-modules-project/myfaces-extval-property-validation/apidocs-1.2.1/index.html}Myfaces ExtVal Property Validation Version 1.2.1}}
diff --git a/1_2_2_prepare_rc_base/parent/src/site/site.xml b/1_2_2_prepare_rc_base/parent/src/site/site.xml
new file mode 100644
index 0000000..778649f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/parent/src/site/site.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+-->
+
+<project name="Apache MyFaces Extensions Validator">
+ <bannerLeft>
+ <name>Apache MyFaces ExtVal</name>
+ <src>images/extval_logo.png</src>
+ <href>http://myfaces.apache.org/extensions/validator/index.html</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache MyFaces</name>
+ <src>img/banners/MyFaces_logo.jpg</src>
+ <href>http://myfaces.apache.org/index.html</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy"/>
+
+ <skin>
+ <groupId>org.apache.myfaces.maven</groupId>
+ <artifactId>myfaces-site-skin</artifactId>
+ <version>1-SNAPSHOT</version>
+ </skin>
+
+ <body>
+ <links>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="MyFaces" href="http://myfaces.apache.org/index.html"/>
+ <item name="Download Myfaces ExtVal" href="http://myfaces.apache.org/extensions/validator/download.html"/>
+ </links>
+
+ <menu name="Apache MyFaces" inherit="top">
+ <item name="Overview" href="http://myfaces.apache.org/index.html"/>
+ <item name="Download" href="http://myfaces.apache.org/download.html"/>
+ </menu>
+
+ <menu name="Contents" inherit="top">
+ <item name="Main Site" href="http://myfaces.apache.org/extensions/validator/index.html"/>
+ <item name="ExtVal for JSF 1.1" href="http://myfaces.apache.org/extensions/validator11/index.html" collapse="true">
+ <item name="dummy" href="dummy"/>
+ </item>
+ <item name="ExtVal for JSF 1.2" href="http://myfaces.apache.org/extensions/validator12/index.html">
+ <item name="Core Module" href="http://myfaces.apache.org/extensions/validator12/myfaces-extval-core/index.html"/>
+ <item name="Property Validation" href="http://myfaces.apache.org/extensions/validator12/validation-modules-project/myfaces-extval-property-validation/index.html"/>
+ <item name="Trinidad Support" href="http://myfaces.apache.org/extensions/validator12/component-support-modules-project/myfaces-extval-trinidad-support/index.html"/>
+ <item name="Generic Support" href="http://myfaces.apache.org/extensions/validator12/component-support-modules-project/myfaces-extval-generic-support/index.html"/>
+ </item>
+ </menu>
+
+ <menu name="Documentation">
+ <item name="Wiki" href="http://wiki.apache.org/myfaces/Extensions/Validator/"/>
+ <item name="Javadoc" href="http://myfaces.apache.org/extensions/validator12/javadoc.html"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ <menu name="Foundation" inherit="bottom">
+ <item name="ASF" href="http://www.apache.org/" />
+ <item name="Sponsorship" href="http://www.apache.org/foundation/sponsorship.html" />
+ <item name="Thanks" href="http://www.apache.org/foundation/thanks.html" />
+ </menu>
+ </body>
+</project>
diff --git a/1_2_2_prepare_rc_base/pom.xml b/1_2_2_prepare_rc_base/pom.xml
new file mode 100644
index 0000000..af879d5
--- /dev/null
+++ b/1_2_2_prepare_rc_base/pom.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.myfaces</groupId>
+ <artifactId>myfaces</artifactId>
+ <version>6</version>
+ </parent>
+
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-module</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache MyFaces Extensions-Validator Module</name>
+ <url>http://myfaces.apache.org/extensions/validator12</url>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/validator/trunk/</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/validator/trunk/</developerConnection>
+ <url>http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/</url>
+ </scm>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <uniqueVersion>false</uniqueVersion>
+ <id>apache.snapshots</id>
+ <name>Apache Maven Snapshot Repository</name>
+ <url>scpexe://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository</url>
+ </snapshotRepository>
+ <site>
+ <id>apache-site</id>
+ <url>scpexe://people.apache.org/www/myfaces.apache.org/extensions/validator12</url>
+ </site>
+ </distributionManagement>
+
+ <!-- WARNING: DO NOT GENERATE SITE FROM HERE DIRECTLY
+ Since this project has an async release procedure (not
+ all modules should be released at once), the parent pom.xml
+ is not this (there is a module for that). Use maven site
+ plugin here cause problems when the site is generated.
+ The procedure must execute site commmand first on parent
+ module and then on each module listed below.
+ -->
+
+ <modules>
+ <module>parent</module>
+ <module>core</module>
+ <module>validation-modules</module>
+ <module>component-support</module>
+ <module>examples</module>
+ </modules>
+
+ <profiles>
+ <!-- This profile is invoked by -DprepareRelease=true. This allows mvn release:prepare to
+ run successfully on the assembly projects. -->
+ <profile>
+ <id>prepare-release</id>
+ <activation>
+ <property>
+ <name>prepareRelease</name>
+ </property>
+ </activation>
+ <modules>
+ <module>assembly</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <arguments>-DprepareRelease</arguments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <properties>
+ <jsf.version>1.2.4</jsf.version>
+ </properties>
+</project>
diff --git a/1_2_2_prepare_rc_base/site/pom.xml b/1_2_2_prepare_rc_base/site/pom.xml
new file mode 100644
index 0000000..d8fe0af
--- /dev/null
+++ b/1_2_2_prepare_rc_base/site/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.myfaces</groupId>
+ <artifactId>myfaces</artifactId>
+ <version>6</version>
+ </parent>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-site</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache MyFaces Extensions-Validator</name>
+ <url>http://myfaces.apache.org/extensions/validator</url>
+
+ <build>
+ <defaultGoal>site</defaultGoal>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-ssh-external</artifactId>
+ <version>1.0-alpha-5</version>
+ </extension>
+ </extensions>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/validator/trunk/site</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/validator/trunk/site</developerConnection>
+ <url>http://svn.apache.org/viewcvs.cgi/myfaces/extensions/validator/trunk/site</url>
+ </scm>
+ <distributionManagement>
+ <site>
+ <id>apache-site</id>
+ <name>Apache Website</name>
+ <url>scpexe://people.apache.org/www/myfaces.apache.org/extensions/validator</url>
+ </site>
+ </distributionManagement>
+
+</project>
diff --git a/1_2_2_prepare_rc_base/site/src/site/apt/download.apt b/1_2_2_prepare_rc_base/site/src/site/apt/download.apt
new file mode 100644
index 0000000..f6136a2
--- /dev/null
+++ b/1_2_2_prepare_rc_base/site/src/site/apt/download.apt
@@ -0,0 +1,108 @@
+ ~~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~~ contributor license agreements. See the NOTICE file distributed with
+ ~~ this work for additional information regarding copyright ownership.
+ ~~ The ASF licenses this file to You 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.
+
+ ------
+Download Apache MyFaces Extensions Validator
+ ------
+
+Download Apache MyFaces Extensions Validator
+
+
+ Use the links below to download a distribution of Apache MyFaces Extensions Validator from
+ one of our mirrors. It is good practice to verify the integrity of the
+ distribution files.
+
+ You will be prompted for a mirror - if the file is not found on yours, please be patient, as it may take 24
+ hours to reach all mirrors.
+
+ Apache MyFaces Extensions Validator is distributed as a <<<zip>>> archive (for Windows) and
+ as a <<<tar.gz>>> archive (for UNIX). The content is the same. Please note
+ that the <<<tar.gz>>> archives contain file names longer than 100 characters and have been
+ created using GNU tar extensions. Thus they must be untarred with a GNU compatible
+ version of tar.
+
+ << Apache MyFaces Extensions Validator 1.0.0 Distribution >>
+
+*-------------------------+---------+----------+-----------+
+| | Mirrors | Checksum | Signature |
+*-------------------------+---------+----------+-----------+
+| MyFaces Extensions Validator for JSF 1.1 1.1.1 (tar.gz) | {{{http://www.apache.org/dyn/closer.cgi/myfaces/binaries/myfaces-extval11-1.1.1-bin.tar.gz} myfaces-extval11-1.1.1-bin.tar.gz}} | {{{http://www.apache.org/dist/myfaces/binaries/myfaces-extval11-1.1.1-bin.tar.gz.md5} myfaces-extval11-1.1.1-bin.tar.gz.md5}} | {{{http://www.apache.org/dist/myfaces/binaries/myfaces-extval11-1.1.1-bin.tar.gz.asc} myfaces-extval11-1.1.1-bin.tar.gz.asc}} |
+*-------------------------+---------+----------+-----------+
+| MyFaces Extensions Validator for JSF 1.1 1.1.1 (zip) | {{{http://www.apache.org/dyn/closer.cgi/myfaces/binaries/myfaces-extval11-1.1.1-bin.zip} myfaces-extval11-1.1.1-bin.zip}} | {{{http://www.apache.org/dist/myfaces/binaries/myfaces-extval11-1.1.1-bin.zip.md5} myfaces-extval11-1.1.1-bin.zip.md5}} | {{{http://www.apache.org/dist/myfaces/binaries/myfaces-extval11-1.1.1-bin.zip.asc} myfaces-extval11-1.1.1-bin.zip.asc}} |
+*-------------------------+---------+----------+-----------+
+| MyFaces Extensions Validator for JSF 1.1 1.1.1 Source (tar.gz) | {{{http://www.apache.org/dyn/closer.cgi/myfaces/source/myfaces-extval11-1.1.1-src.tar.gz} myfaces-extval11-1.1.1-src.tar.gz}} | {{{http://www.apache.org/dist/myfaces/source/myfaces-extval11-1.1.1-src.tar.gz.md5} myfaces-extval11-1.1.1-src.tar.gz.md5}} | {{{http://www.apache.org/dist/myfaces/source/myfaces-extval11-1.1.1-src.tar.gz.asc} myfaces-extval11-1.1.1-src.tar.gz.asc}} |
+*-------------------------+---------+----------+-----------+
+| MyFaces Extensions Validator for JSF 1.1 1.1.1 Source (zip) | {{{http://www.apache.org/dyn/closer.cgi/myfaces/source/myfaces-extval11-1.1.1-src.zip} myfaces-extval11-1.1.1-src.zip}} | {{{http://www.apache.org/dist/myfaces/source/myfaces-extval11-1.1.1-src.zip.md5} myfaces-extval11-1.1.1-src.zip.md5}} | {{{http://www.apache.org/dist/myfaces/source/myfaces-extval11-1.1.1-src.zip.asc} myfaces-extval11-1.1.1-src.zip.asc}} |
+*-------------------------+---------+----------+-----------+
+| MyFaces Extensions Validator for JSF 1.2 1.2.1 (tar.gz) | {{{http://www.apache.org/dyn/closer.cgi/myfaces/binaries/myfaces-extval12-1.2.1-bin.tar.gz} myfaces-extval12-1.2.1-bin.tar.gz}} | {{{http://www.apache.org/dist/myfaces/binaries/myfaces-extval12-1.2.1-bin.tar.gz.md5} myfaces-extval12-1.2.1-bin.tar.gz.md5}} | {{{http://www.apache.org/dist/myfaces/binaries/myfaces-extval12-1.2.1-bin.tar.gz.asc} myfaces-extval12-1.2.1-bin.tar.gz.asc}} |
+*-------------------------+---------+----------+-----------+
+| MyFaces Extensions Validator for JSF 1.2 1.2.1 (zip) | {{{http://www.apache.org/dyn/closer.cgi/myfaces/binaries/myfaces-extval12-1.2.1-bin.zip} myfaces-extval12-1.2.1-bin.zip}} | {{{http://www.apache.org/dist/myfaces/binaries/myfaces-extval12-1.2.1-bin.zip.md5} myfaces-extval12-1.2.1-bin.zip.md5}} | {{{http://www.apache.org/dist/myfaces/binaries/myfaces-extval12-1.2.1-bin.zip.asc} myfaces-extval12-1.2.1-bin.zip.asc}} |
+*-------------------------+---------+----------+-----------+
+| MyFaces Extensions Validator for JSF 1.2 1.2.1 Source (tar.gz) | {{{http://www.apache.org/dyn/closer.cgi/myfaces/source/myfaces-extval12-1.2.1-src.tar.gz} myfaces-extval12-1.2.1-src.tar.gz}} | {{{http://www.apache.org/dist/myfaces/source/myfaces-extval12-1.2.1-src.tar.gz.md5} myfaces-extval12-1.2.1-src.tar.gz.md5}} | {{{http://www.apache.org/dist/myfaces/source/myfaces-extval12-1.2.1-src.tar.gz.asc} myfaces-extval12-1.2.1-src.tar.gz.asc}} |
+*-------------------------+---------+----------+-----------+
+| MyFaces Extensions Validator for JSF 1.2 1.2.1 Source (zip) | {{{http://www.apache.org/dyn/closer.cgi/myfaces/source/myfaces-extval12-1.2.1-src.zip} myfaces-extval12-1.2.1-src.zip}} | {{{http://www.apache.org/dist/myfaces/source/myfaces-extval12-1.2.1-src.zip.md5} myfaces-extval12-1.2.1-src.zip.md5}} | {{{http://www.apache.org/dist/myfaces/source/myfaces-extval12-1.2.1-src.zip.asc} myfaces-extval12-1.2.1-src.zip.asc}} |
+*-------------------------+---------+----------+-----------+
+
+Latest source code from SVN repository
+
+ If you want to use the latest Apache MyFaces Extensions Validator features, the source code is under
+ version control with SVN. Click {{{source-repository.html} here }}
+ for information on how to use the ASF Extensions Validator SVN Repository.
+
+Verifying checksums
+
+ It is essential that you verify the integrity of the downloaded
+ files using the PGP and MD5 signatures. MD5 verification ensures the
+ file was not corrupted during the download process. PGP verification
+ ensures that the file came from a certain person.
+
+ To verify the MD5 signature on the files, you need to use a program
+ called <<<md5>>> or <<<md5sum>>>, which is
+ included in many UNIX distributions. It is also available as part of
+ {{{http://www.gnu.org/software/textutils/textutils.html}GNU Textutils}}.
+ Windows users can get binary md5 programs from {{{http://www.fourmilab.ch/md5/}here}},
+ {{{http://www.pc-tools.net/win32/freeware/console/}here}}, or
+ {{{http://www.slavasoft.com/fsum/}here}}.
+
+Verifying signatures
+
+ PGP verification ensures that the file came from a certain person. We strongly recommend
+ you verify your downloads with both PGP and MD5.
+
+ The PGP signatures can be verified using {{{http://www.pgpi.org/}PGP}} or
+ {{{http://www.gnupg.org/}GPG}}. First download the Apache MyFaces
+ {{{http://www.apache.org/dist/myfaces/KEYS}KEYS}} as well as the <<<asc>>> signature file
+ for the particular distribution. It is important that you get these files from the ultimate
+ trusted source - the main ASF distribution site, rather than from a mirror.
+ Then verify the signatures using ...
+
+ <<<
+ % pgpk -a KEYS
+ % pgpv myfaces-extval11-1.1.1-bin.tar.gz.asc myfaces-extval11-1.1.1-bin.tar.gz
+ >>>
+
+ <or>
+
+ <<<
+ % pgp -ka KEYS
+ % pgp myfaces-extval11-1.1.1-bin.tar.gz.asc myfaces-extval11-1.1.1-bin.tar.gz
+ >>>
+
+ <or>
+
+ <<<
+ % gpg --import KEYS
+ % gpg --verify myfaces-extval11-1.1.1-bin.tar.gz.asc myfaces-extval11-1.1.1-bin.tar.gz
+ >>>
diff --git a/1_2_2_prepare_rc_base/site/src/site/apt/index.apt b/1_2_2_prepare_rc_base/site/src/site/apt/index.apt
new file mode 100644
index 0000000..a42539b
--- /dev/null
+++ b/1_2_2_prepare_rc_base/site/src/site/apt/index.apt
@@ -0,0 +1,14 @@
+ ------
+Apache MyFaces Extensions Validator
+ ------
+
+Apache MyFaces Extensions Validator Overview
+
+ MyFaces Extensions Validator is a JSF centric validation framework.
+
+ It offers powerful and easy to use field based validation based on annotations.
+It has a pluggable architecture, so it is possible to add new validation modules or support for component libraries like Trinidad or other 3rd party frameworks.
+
+ MyFaces Extensions Validator is compatible with JSF 1.1.x and JSF 1.2.x. Both versions require Java 1.5+
+
+ Further information are available at the {{{http://wiki.apache.org/myfaces/Extensions/Validator/}Wiki}}.
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/site/src/site/site.xml b/1_2_2_prepare_rc_base/site/src/site/site.xml
new file mode 100644
index 0000000..f2c9e85
--- /dev/null
+++ b/1_2_2_prepare_rc_base/site/src/site/site.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+-->
+
+<project name="Apache Myfaces Extensions Validator">
+ <bannerLeft>
+ <name>Apache MyFaces ExtVal</name>
+ <src>images/extval_logo.png</src>
+ <href>http://myfaces.apache.org/extensions/validator/index.html</href>
+ </bannerLeft>
+
+ <bannerRight>
+ <name>Apache MyFaces</name>
+ <src>img/banners/MyFaces_logo.jpg</src>
+ <href>http://myfaces.apache.org/index.html</href>
+ </bannerRight>
+
+ <publishDate format="dd MMM yyyy"/>
+
+ <skin>
+ <groupId>org.apache.myfaces.maven</groupId>
+ <artifactId>myfaces-site-skin</artifactId>
+ <version>1-SNAPSHOT</version>
+ </skin>
+
+ <body>
+ <links>
+ <item name="Apache" href="http://www.apache.org"/>
+ <item name="MyFaces" href="http://myfaces.apache.org/index.html"/>
+ <item name="Download Myfaces ExtVal" href="download.html"/>
+ </links>
+
+ <menu name="Apache MyFaces" inherit="top">
+ <item name="Overview" href="http://myfaces.apache.org/index.html"/>
+ <item name="Download" href="http://myfaces.apache.org/download.html"/>
+ </menu>
+
+ <menu name="Contents" inherit="top">
+ <item name="Main Site" href="http://myfaces.apache.org/extensions/validator/index.html"/>
+ <item name="ExtVal for JSF 1.1" href="http://myfaces.apache.org/extensions/validator11/index.html" collapse="true">
+ <item name="dummy" href="dummy"/>
+ </item>
+ <item name="ExtVal for JSF 1.2" href="http://myfaces.apache.org/extensions/validator12/index.html" collapse="true">
+ <item name="dummy" href="dummy"/>
+ </item>
+ </menu>
+
+ <menu name="Documentation">
+ <item name="Wiki" href="http://wiki.apache.org/myfaces/Extensions/Validator/"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ <menu name="Foundation" inherit="top">
+ <item name="ASF" href="http://www.apache.org/" />
+ <item name="Sponsorship" href="http://www.apache.org/foundation/sponsorship.html" />
+ <item name="Thanks" href="http://www.apache.org/foundation/thanks.html" />
+ </menu>
+ </body>
+</project>
diff --git a/1_2_2_prepare_rc_base/validation-modules/pom.xml b/1_2_2_prepare_rc_base/validation-modules/pom.xml
new file mode 100644
index 0000000..331ad75
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/pom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <packaging>pom</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>validation-modules-project</artifactId>
+
+ <name>MyFaces Extensions-Validator Validation-Modules</name>
+ <version>1.2.2-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-parent</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/validation-modules</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/validation-modules</developerConnection>
+ <url>http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/1_2_2_rc/validation-modules</url>
+ </scm>
+
+ <modules>
+ <module>property-validation</module>
+ <!--module>bean-validation</module-->
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/pom.xml b/1_2_2_prepare_rc_base/validation-modules/property-validation/pom.xml
new file mode 100644
index 0000000..b8f9e6a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/pom.xml
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>myfaces-extval-property-validation</artifactId>
+
+ <name>MyFaces Extensions-Validator Property-Validation-Module</name>
+ <version>1.2.2-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>validation-modules-project</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>1.2.2-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${jsf.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shale</groupId>
+ <artifactId>shale-test</artifactId>
+ <version>1.0.4</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.myfaces</groupId>
+ <artifactId>myfaces-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.myfaces</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>myfaces</groupId>
+ <artifactId>myfaces-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>myfaces</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/config</directory>
+ <includes>
+ <include>**/*xml</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*properties</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.2</version>
+ <configuration>
+ <excludes>
+ <exclude>**/Abstract*.java</exclude>
+ <exclude>**/TestUtils.java</exclude>
+ <exclude>**/*Bean.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/config/faces-config.xml b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/config/faces-config.xml
new file mode 100644
index 0000000..94c7416
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/config/faces-config.xml
@@ -0,0 +1,30 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+-->
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="1.2">
+ <lifecycle>
+ <phase-listener>org.apache.myfaces.extensions.validator.PropertyValidationModuleStartupListener</phase-listener>
+ </lifecycle>
+
+ <lifecycle>
+ <phase-listener>org.apache.myfaces.extensions.validator.crossval.CrossValidationPhaseListener</phase-listener>
+ </lifecycle>
+</faces-config>
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/META-INF/LICENSE.txt b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/META-INF/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/META-INF/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/META-INF/NOTICE.txt b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/META-INF/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/META-INF/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsComponentInitializer.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsComponentInitializer.java
new file mode 100644
index 0000000..f1c487d
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsComponentInitializer.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator;
+
+import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlInputSecret;
+import javax.faces.component.html.HtmlSelectBooleanCheckbox;
+import javax.faces.component.html.HtmlSelectOneListbox;
+import javax.faces.component.html.HtmlSelectOneMenu;
+import javax.faces.component.html.HtmlSelectOneRadio;
+import javax.faces.component.html.HtmlSelectManyCheckbox;
+import javax.faces.component.html.HtmlSelectManyListbox;
+import javax.faces.component.html.HtmlSelectManyMenu;
+import javax.faces.component.html.HtmlInputTextarea;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class HtmlCoreComponentsComponentInitializer implements ComponentInitializer
+{
+ public void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData)
+ {
+ configureRequiredAttribute(facesContext, uiComponent, metaData);
+ configureMaxLengthAttribute(facesContext, uiComponent, metaData);
+ }
+
+ protected void configureRequiredAttribute(FacesContext facesContext,
+ UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ if(!processComponent(uiComponent))
+ {
+ return;
+ }
+
+ if((Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.WEAK_REQUIRED)) ||
+ Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.REQUIRED)))
+ &&
+ Boolean.TRUE.equals(isComponentRequired(uiComponent)))
+ {
+ ((EditableValueHolder)uiComponent).setRequired(true);
+ }
+ else if(Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.SKIP_VALIDATION)) &&
+ !Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.REQUIRED)))
+ {
+ ((EditableValueHolder)uiComponent).setRequired(false);
+ }
+ }
+
+ protected boolean processComponent(UIComponent uiComponent)
+ {
+ return uiComponent instanceof HtmlInputText ||
+ uiComponent instanceof HtmlInputSecret ||
+ uiComponent instanceof HtmlSelectBooleanCheckbox ||
+ uiComponent instanceof HtmlSelectOneListbox ||
+ uiComponent instanceof HtmlSelectOneMenu ||
+ uiComponent instanceof HtmlSelectOneRadio ||
+ uiComponent instanceof HtmlSelectManyCheckbox ||
+ uiComponent instanceof HtmlSelectManyListbox ||
+ uiComponent instanceof HtmlSelectManyMenu ||
+ uiComponent instanceof HtmlInputTextarea;
+ }
+
+ /**
+ * if there is no special attribute at the component which should overrule
+ * the annotated property return true!
+ *
+ * @param uiComponent component which implements the EditableValueHolder interface
+ * @return false to overrule the annotated property e.g. if component is readonly
+ */
+ protected Boolean isComponentRequired(UIComponent uiComponent)
+ {
+ boolean isReadOnly = !Boolean.FALSE.equals(ReflectionUtils.tryToInvokeMethod(
+ uiComponent, ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "isReadonly")));
+ boolean isDisabled = !Boolean.FALSE.equals(ReflectionUtils.tryToInvokeMethod(
+ uiComponent, ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "isDisabled")));
+
+ return !(isReadOnly || isDisabled);
+ }
+
+ protected void configureMaxLengthAttribute(FacesContext facesContext,
+ UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ if(metaData.containsKey(CommonMetaDataKeys.MAX_LENGTH))
+ {
+ Object maxLength = metaData.get(CommonMetaDataKeys.MAX_LENGTH);
+
+ if(!(maxLength instanceof Integer))
+ {
+ return;
+ }
+ if(uiComponent instanceof HtmlInputText)
+ {
+ HtmlInputText htmlInputText = (HtmlInputText)uiComponent;
+ htmlInputText.setMaxlength((Integer)maxLength);
+ }
+ }
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java
new file mode 100644
index 0000000..27c2a0e
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.message.LabeledMessage;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlInputSecret;
+import javax.faces.component.html.HtmlSelectBooleanCheckbox;
+import javax.faces.component.html.HtmlSelectOneListbox;
+import javax.faces.component.html.HtmlSelectOneMenu;
+import javax.faces.component.html.HtmlSelectOneRadio;
+import javax.faces.component.html.HtmlSelectManyCheckbox;
+import javax.faces.component.html.HtmlSelectManyListbox;
+import javax.faces.component.html.HtmlSelectManyMenu;
+import javax.faces.component.html.HtmlInputTextarea;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class HtmlCoreComponentsValidationExceptionInterceptor implements ValidationExceptionInterceptor
+{
+ public boolean afterThrowing(UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject,
+ ValidatorException validatorException,
+ ValidationStrategy validatorExceptionSource)
+ {
+ if(processComponent(uiComponent))
+ {
+ FacesMessage facesMessage = ExtValUtils.convertFacesMessage(validatorException.getFacesMessage());
+
+ String label = (String) ReflectionUtils.tryToInvokeMethod(uiComponent,
+ ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "getLabel"));
+
+ if(label == null)
+ {
+ label = uiComponent.getClientId(FacesContext.getCurrentInstance());
+ }
+
+ //override the label if the annotation provides a label
+ if(metaDataEntry != null && metaDataEntry.getProperty(PropertyInformationKeys.LABEL) != null)
+ {
+ label = metaDataEntry.getProperty(PropertyInformationKeys.LABEL, String.class);
+ }
+
+ if(facesMessage instanceof LabeledMessage)
+ {
+ ((LabeledMessage)facesMessage).setLabelText(label);
+ }
+ //if someone uses a normal faces message
+ else
+ {
+ for(int i = 0; i < 3; i++)
+ {
+ ExtValUtils.tryToPlaceLabel(facesMessage, label, i);
+ }
+ }
+ }
+ return true;
+ }
+
+ protected boolean processComponent(UIComponent uiComponent)
+ {
+ return uiComponent instanceof HtmlInputText ||
+ uiComponent instanceof HtmlInputSecret ||
+ uiComponent instanceof HtmlSelectBooleanCheckbox ||
+ uiComponent instanceof HtmlSelectOneListbox ||
+ uiComponent instanceof HtmlSelectOneMenu ||
+ uiComponent instanceof HtmlSelectOneRadio ||
+ uiComponent instanceof HtmlSelectManyCheckbox ||
+ uiComponent instanceof HtmlSelectManyListbox ||
+ uiComponent instanceof HtmlSelectManyMenu ||
+ uiComponent instanceof HtmlInputTextarea;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java
new file mode 100644
index 0000000..58360bd
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator;
+
+import org.apache.myfaces.extensions.validator.baseval.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
+import org.apache.myfaces.extensions.validator.core.startup.AbstractStartupListener;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationInterceptor;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticResourceBundleConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticInMemoryConfiguration;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.crossval.recorder.CrossValidationUserInputRecorder;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class PropertyValidationModuleStartupListener extends AbstractStartupListener
+{
+ protected void init()
+ {
+ ExtValContext.getContext().addProcessedInformationRecorder(new CrossValidationUserInputRecorder());
+
+ initStaticStrategyMappings();
+ initDefaultComponentInitializer();
+ initDefaultValidationExceptionInterceptor();
+ addSkipValidationSupport();
+ }
+
+ private void initStaticStrategyMappings()
+ {
+ String jpaBasedValidation = WebXmlParameter.DEACTIVATE_JPA_BASED_VALIDATION;
+ if (jpaBasedValidation == null
+ || !jpaBasedValidation.equalsIgnoreCase("true"))
+ {
+ StaticConfiguration<String, String> staticConfig = new StaticResourceBundleConfiguration();
+ staticConfig.setSourceOfMapping(
+ ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME +".jpa_strategy_mappings");
+
+ ExtValContext.getContext().addStaticConfiguration(
+ StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG, staticConfig);
+ }
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "web.xml parameter to deactivate it")
+ private void initDefaultComponentInitializer()
+ {
+ ExtValContext.getContext().addComponentInitializer(new HtmlCoreComponentsComponentInitializer());
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "web.xml parameter to deactivate it")
+ private void initDefaultValidationExceptionInterceptor()
+ {
+ ExtValContext.getContext().addValidationExceptionInterceptor(
+ new HtmlCoreComponentsValidationExceptionInterceptor());
+ }
+
+ private void addSkipValidationSupport()
+ {
+ if(logger.isInfoEnabled())
+ {
+ logger.info("adding support for @SkipValidation");
+ }
+
+ ExtValContext.getContext().denyRendererInterceptor(ValidationInterceptor.class);
+ ExtValContext.getContext().registerRendererInterceptor(new ValidationInterceptorWithSkipValidationSupport());
+
+ StaticInMemoryConfiguration config = new StaticInMemoryConfiguration();
+ //it's just required to set the target
+ config.addMapping(CommonMetaDataKeys.SKIP_VALIDATION, SkipValidationSupport.class.getName());
+
+ ExtValContext.getContext()
+ .addStaticConfiguration(StaticConfigurationNames.SKIP_VALIDATION_SUPPORT_CONFIG, config);
+
+ //config.addMapping(CommonMetaDataKeys.SKIP_VALIDATION, RequiredStrategy.class.getName());
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/ValidationInterceptorWithSkipValidationSupport.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/ValidationInterceptorWithSkipValidationSupport.java
new file mode 100644
index 0000000..4897726
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/ValidationInterceptorWithSkipValidationSupport.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationInterceptor;
+import org.apache.myfaces.extensions.validator.baseval.strategy.SkipValidationStrategy;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ValidationInterceptorWithSkipValidationSupport extends ValidationInterceptor
+{
+ @Override
+ protected boolean skipValidation(FacesContext facesContext,
+ UIComponent uiComponent,
+ ValidationStrategy validationStrategy,
+ MetaDataEntry metaDataEntry)
+ {
+ if(ExtValUtils.isSkipableValidationStrategy(validationStrategy.getClass()))
+ {
+ Boolean skipValidation = metaDataEntry.getProperty(
+ PropertyInformationKeys.SKIP_VALIDATION, Boolean.class);
+
+ if(Boolean.TRUE.equals(skipValidation))
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("validation of " + validationStrategy.getClass().getName() + " canceled");
+ }
+
+ return true;
+ }
+ }
+ else if(validationStrategy instanceof SkipValidationStrategy)
+ {
+ validationStrategy.validate(facesContext, uiComponent, metaDataEntry, null);
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/WebXmlParameter.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/WebXmlParameter.java
new file mode 100644
index 0000000..b777a4e
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/WebXmlParameter.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval;
+
+import org.apache.myfaces.extensions.validator.util.WebXmlUtils;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * centralized in order that these information arn't spread over the complete code base
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@ToDo(value = Priority.MEDIUM, description = "documentation")
+@UsageInformation(UsageCategory.INTERNAL)
+public interface WebXmlParameter
+{
+ static final String VALIDATION_MESSAGES_JPA = WebXmlUtils
+ .getInitParameter("JPA_VALIDATION_ERROR_MESSAGES");
+ static final String DEACTIVATE_JPA_BASED_VALIDATION = WebXmlUtils
+ .getInitParameter("DEACTIVATE_JPA_BASED_VALIDATION");
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/DoubleRange.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/DoubleRange.java
new file mode 100644
index 0000000..17cd4ef
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/DoubleRange.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface DoubleRange
+{
+ double minimum() default 0;
+
+ double maximum() default Double.MAX_VALUE;
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/JoinValidation.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/JoinValidation.java
new file mode 100644
index 0000000..28b52bf
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/JoinValidation.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface JoinValidation
+{
+ String[] value();
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Length.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Length.java
new file mode 100644
index 0000000..cad75fa
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Length.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface Length
+{
+ int minimum() default 0;
+
+ int maximum() default Integer.MAX_VALUE;
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/LongRange.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/LongRange.java
new file mode 100644
index 0000000..4fc752d
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/LongRange.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface LongRange
+{
+ long minimum() default 0;
+
+ long maximum() default Long.MAX_VALUE;
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java
new file mode 100644
index 0000000..1f77dc8
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface Pattern
+{
+ String[] value();
+
+ String validationErrorMsgKey() default "no_match";
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java
new file mode 100644
index 0000000..a265b3c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface Required
+{
+ /**
+ * to customize the error message or
+ * to override the default jsf required message with the usage of the message resolver mechanism
+ *
+ * @return an optional error message key
+ */
+ String validationErrorMsgKey() default "field_required";
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/SkipValidation.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/SkipValidation.java
new file mode 100644
index 0000000..197ef80
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/SkipValidation.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface SkipValidation
+{
+ String[] value();
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/SkipValidationSupport.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/SkipValidationSupport.java
new file mode 100644
index 0000000..f79f651
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/SkipValidationSupport.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface SkipValidationSupport
+{
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Validator.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Validator.java
new file mode 100644
index 0000000..d9456d0
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Validator.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface Validator
+{
+ Class<? extends javax.faces.validator.Validator>[] value();
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/extractor/DefaultPropertyScanningMetaDataExtractor.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/extractor/DefaultPropertyScanningMetaDataExtractor.java
new file mode 100644
index 0000000..a9e8905
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/extractor/DefaultPropertyScanningMetaDataExtractor.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.annotation.extractor;
+
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.property.DefaultPropertyInformation;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.DefaultComponentMetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultPropertyScanningMetaDataExtractor extends DefaultComponentMetaDataExtractor
+{
+ private DefaultPropertyScanningMetaDataExtractor()
+ {
+ }
+
+ public static MetaDataExtractor getInstance()
+ {
+ return ExtValUtils.createInterceptedMetaDataExtractor(new DefaultPropertyScanningMetaDataExtractor());
+ }
+
+ @Override
+ @ToDo(Priority.MEDIUM)
+ public PropertyInformation extract(FacesContext facesContext, Object object)
+ {
+ PropertyInformation propertyInformation = new DefaultPropertyInformation();
+
+ if (!(object instanceof PropertyDetails))
+ {
+ throw new IllegalStateException(object.getClass() + " is not a " + PropertyDetails.class.getName());
+ }
+
+ PropertyDetails propertyDetails = (PropertyDetails)object;
+
+ Class entityClass = propertyDetails.getBaseObject().getClass();
+
+ //TODO test with complex components
+ propertyInformation.setInformation(
+ PropertyInformationKeys.PROPERTY_DETAILS, propertyDetails);
+
+ /*
+ * find and add annotations
+ */
+ addPropertyAccessAnnotations(entityClass, propertyDetails.getProperty(), propertyInformation);
+ addFieldAccessAnnotations(entityClass, propertyDetails.getProperty(), propertyInformation);
+
+ return propertyInformation;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages.properties
new file mode 100644
index 0000000..08e8012
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+no_match=Invalid format
+no_match_detail=The required formate is: {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ar.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ar.properties
new file mode 100644
index 0000000..97ab543
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ar.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+no_match=\u0627\u0644\u0635\u064a\u063a\u0629 \u062e\u0627\u0637\u0626\u0629
+no_match_detail=\u0627\u0644\u0635\u064a\u063a\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629 \u0647\u0649: {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ca.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ca.properties
new file mode 100644
index 0000000..98d6490
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ca.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+no_match=Format inv\u00e0lid
+no_match_detail=El format requerit \u00e9s: {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_de.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_de.properties
new file mode 100644
index 0000000..9ee701b
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_de.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+no_match=Ungültiges Format
+no_match_detail=Das erforderliche Format ist: {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_en.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_en.properties
new file mode 100644
index 0000000..08e8012
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_en.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+no_match=Invalid format
+no_match_detail=The required formate is: {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_es.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_es.properties
new file mode 100644
index 0000000..5bb1077
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_es.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+no_match=Formato inv\u00e1lido
+no_match_detail=El formato requerido es: {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_fr.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_fr.properties
new file mode 100644
index 0000000..120a223
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_fr.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+no_match=Le format est invalide
+no_match_detail=Le format doit être de la forme: {0}
+
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_it.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_it.properties
new file mode 100644
index 0000000..e18748c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_it.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+no_match=Formato non valido
+no_match_detail=Il formato richiesto è: {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_tr.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_tr.properties
new file mode 100644
index 0000000..a94bc74
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_tr.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+no_match=Ge\u00e7ersiz bi\u00e7im
+no_match_detail=gereken bi\u00e7im: {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/DefaultValidationErrorMessageResolver.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/DefaultValidationErrorMessageResolver.java
new file mode 100644
index 0000000..4aae64b
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/DefaultValidationErrorMessageResolver.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.message.resolver;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultValidationErrorMessageResolver
+ extends
+ org.apache.myfaces.extensions.validator.core.validation.message.resolver.DefaultValidationErrorMessageResolver
+{
+ private static String baseName = null;
+
+ @Override
+ protected String getBaseName()
+ {
+ if (baseName == null)
+ {
+ baseName = super.getBaseName();
+ }
+
+ return baseName;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/JpaValidationErrorMessageResolver.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/JpaValidationErrorMessageResolver.java
new file mode 100644
index 0000000..d476ad9
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/JpaValidationErrorMessageResolver.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.message.resolver;
+
+import org.apache.myfaces.extensions.validator.baseval.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.AbstractValidationErrorMessageResolver;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+/*
+ * the jpa support is an exception in view of some mechanisms - so there's no convention for the message bundle.
+ * instead of the convention there is a global property to have an alternative to web.xml configuration
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class JpaValidationErrorMessageResolver extends AbstractValidationErrorMessageResolver
+{
+ public static final String JPA_VALIDATION_ERROR_MESSAGES = "JPA_VALIDATION_ERROR_MESSAGES";
+
+ private static final String CUSTOM_BASE_NAME = WebXmlParameter.VALIDATION_MESSAGES_JPA;
+ private static final String BASE_NAME = JpaValidationErrorMessageResolver.class
+ .getPackage().getName().replace(".message.resolver", ".message.bundle")+ ".jpa_messages";
+
+ protected String getCustomBaseName()
+ {
+ if(CUSTOM_BASE_NAME != null)
+ {
+ return CUSTOM_BASE_NAME;
+ }
+
+ return (String)ExtValContext.getContext().getGlobalProperty(JPA_VALIDATION_ERROR_MESSAGES);
+ }
+
+ protected String getBaseName()
+ {
+ return BASE_NAME;
+ }
+
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/DoubleRangeMetaDataTransformer.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/DoubleRangeMetaDataTransformer.java
new file mode 100644
index 0000000..d5dd18c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/DoubleRangeMetaDataTransformer.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.DoubleRange;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DoubleRangeMetaDataTransformer implements MetaDataTransformer
+{
+ public Map<String, Object> convertMetaData(MetaDataEntry metaDataEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ DoubleRange annotation = metaDataEntry.getValue(DoubleRange.class);
+
+ double minimum = annotation.minimum();
+
+ results.put(CommonMetaDataKeys.RANGE_MIN, minimum);
+ results.put(CommonMetaDataKeys.RANGE_MAX, annotation.maximum());
+
+ if(minimum > 0)
+ {
+ results.put(CommonMetaDataKeys.WEAK_REQUIRED, true);
+ }
+
+ return results;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JoinMetaDataTransformer.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JoinMetaDataTransformer.java
new file mode 100644
index 0000000..175a159
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JoinMetaDataTransformer.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.JoinValidation;
+import org.apache.myfaces.extensions.validator.baseval.annotation.extractor.DefaultPropertyScanningMetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.context.FacesContext;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class JoinMetaDataTransformer implements MetaDataTransformer
+{
+ public Map<String, Object> convertMetaData(MetaDataEntry metaDataEntry)
+ {
+ MetaDataExtractor extractor = DefaultPropertyScanningMetaDataExtractor.getInstance();
+
+ String[] targetExpressions = metaDataEntry.getValue(JoinValidation.class).value();
+
+ ValidationStrategy validationStrategy;
+ MetaDataTransformer metaDataTransformer;
+
+ Map<String, Object> results = new HashMap<String, Object>();
+
+ PropertyDetails propertyDetails;
+ for (String targetExpression : targetExpressions)
+ {
+ propertyDetails = ExtValUtils
+ .createPropertyDetailsForNewTarget(metaDataEntry, targetExpression);
+
+ for (MetaDataEntry entry : extractor.extract(FacesContext.getCurrentInstance(),
+ propertyDetails).getMetaDataEntries())
+ {
+ validationStrategy = ExtValUtils.getValidationStrategyForMetaData(entry.getKey());
+
+ metaDataTransformer = ExtValUtils.getMetaDataTransformerForValidationStrategy(validationStrategy);
+
+ if (metaDataTransformer != null)
+ {
+ results.putAll(metaDataTransformer.convertMetaData(entry));
+ }
+ }
+ }
+ return results;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JpaMetaDataTransformer.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JpaMetaDataTransformer.java
new file mode 100644
index 0000000..d0bfdba
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JpaMetaDataTransformer.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.util.HashMap;
+import java.util.Map;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class JpaMetaDataTransformer implements MetaDataTransformer
+{
+ @ToDo(value = Priority.MEDIUM, description = "impl. the rest")
+ public Map<String, Object> convertMetaData(MetaDataEntry metaData)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+
+ Annotation annotation = metaData.getValue(Annotation.class);
+
+ if(annotation instanceof Column)
+ {
+ if(!((Column) annotation).nullable())
+ {
+ results.put(CommonMetaDataKeys.REQUIRED, true);
+ }
+
+ results.put(CommonMetaDataKeys.MAX_LENGTH, ((Column) annotation).length());
+ }
+ else if(annotation instanceof Basic)
+ {
+ if(!((Basic) annotation).optional())
+ {
+ results.put(CommonMetaDataKeys.REQUIRED, true);
+ }
+ }
+ else if(annotation instanceof Id)
+ {
+ results.put(CommonMetaDataKeys.REQUIRED, true);
+ }
+ //TODO impl. the rest!!!
+ return results;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LengthMetaDataTransformer.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LengthMetaDataTransformer.java
new file mode 100644
index 0000000..83c5ee3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LengthMetaDataTransformer.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Length;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class LengthMetaDataTransformer implements MetaDataTransformer
+{
+ public Map<String, Object> convertMetaData(MetaDataEntry metaDataEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ Length annotation = metaDataEntry.getValue(Length.class);
+
+ int minimum = annotation.minimum();
+
+ results.put(CommonMetaDataKeys.MIN_LENGTH, minimum);
+ results.put(CommonMetaDataKeys.MAX_LENGTH, annotation.maximum());
+
+ if(minimum > 0)
+ {
+ results.put(CommonMetaDataKeys.WEAK_REQUIRED, true);
+ }
+
+ return results;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LongRangeMetaDataTransformer.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LongRangeMetaDataTransformer.java
new file mode 100644
index 0000000..5485e2f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LongRangeMetaDataTransformer.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.LongRange;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class LongRangeMetaDataTransformer implements MetaDataTransformer
+{
+ public Map<String, Object> convertMetaData(MetaDataEntry metaDataEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ LongRange annotation = metaDataEntry.getValue(LongRange.class);
+
+ long minimum = annotation.minimum();
+
+ results.put(CommonMetaDataKeys.RANGE_MIN, minimum);
+ results.put(CommonMetaDataKeys.RANGE_MAX, annotation.maximum());
+
+ if(minimum > 0)
+ {
+ results.put(CommonMetaDataKeys.WEAK_REQUIRED, true);
+ }
+
+ return results;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/PatternMetaDataTransformer.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/PatternMetaDataTransformer.java
new file mode 100644
index 0000000..944a5b5
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/PatternMetaDataTransformer.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Pattern;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.context.FacesContext;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Locale;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class PatternMetaDataTransformer implements MetaDataTransformer
+{
+ public Map<String, Object> convertMetaData(MetaDataEntry metaDataEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ Pattern annotation = metaDataEntry.getValue(Pattern.class);
+
+ results.put(CommonMetaDataKeys.PATTERN, (annotation).value());
+
+ String validationErrorMsgKey = (annotation).validationErrorMsgKey();
+ Locale currentLocale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
+
+ ValidationStrategy validationStrategy =
+ ExtValUtils.getValidationStrategyForMetaData(annotation.annotationType().getName());
+
+ String validationErrorMsg = ExtValUtils.getMessageResolverForValidationStrategy(validationStrategy)
+ .getMessage(validationErrorMsgKey, currentLocale);
+
+ results.put(CommonMetaDataKeys.PATTERN_VALIDATION_ERROR_MESSAGE, validationErrorMsg);
+ return results;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/RequiredMetaDataTransformer.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/RequiredMetaDataTransformer.java
new file mode 100644
index 0000000..e8f5aa7
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/RequiredMetaDataTransformer.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class RequiredMetaDataTransformer implements MetaDataTransformer
+{
+ public Map<String, Object> convertMetaData(MetaDataEntry metaDataEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ results.put(CommonMetaDataKeys.WEAK_REQUIRED, true);
+ return results;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/SkipMetaDataTransformer.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/SkipMetaDataTransformer.java
new file mode 100644
index 0000000..1fb8257
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/SkipMetaDataTransformer.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class SkipMetaDataTransformer implements MetaDataTransformer
+{
+ public Map<String, Object> convertMetaData(MetaDataEntry metaDataEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ results.put(CommonMetaDataKeys.SKIP_VALIDATION, true);
+ return results;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/ValidatorMetaDataTransformer.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/ValidatorMetaDataTransformer.java
new file mode 100644
index 0000000..7617489
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/ValidatorMetaDataTransformer.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Validator;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ValidatorMetaDataTransformer implements MetaDataTransformer
+{
+ public Map<String, Object> convertMetaData(MetaDataEntry metaDataEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ Validator annotation = metaDataEntry.getValue(Validator.class);
+
+ Class[] validators = annotation.value();
+
+ List<String> value = new ArrayList<String>();
+
+ for(Class currentClass : validators)
+ {
+ if(currentClass.getSimpleName().toLowerCase().contains(CommonMetaDataKeys.EMAIL))
+ {
+ value.add(CommonMetaDataKeys.EMAIL);
+ }
+ value.add(currentClass.getName());
+ }
+
+ results.put(CommonMetaDataKeys.CUSTOM, value);
+
+ return results;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/DoubleRangeStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/DoubleRangeStrategy.java
new file mode 100644
index 0000000..f175933
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/DoubleRangeStrategy.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.DoubleRange;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.DoubleRangeValidator;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@SkipValidationSupport
+@UsageInformation(UsageCategory.INTERNAL)
+public class DoubleRangeStrategy extends AbstractValidationStrategy
+{
+ protected void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, MetaDataEntry metaDataEntry,
+ Object convertedObject) throws ValidatorException
+ {
+
+ DoubleRange annotation = metaDataEntry.getValue(DoubleRange.class);
+ DoubleRangeValidator doubleRangeValidator = (DoubleRangeValidator)facesContext.getApplication()
+ .createValidator("javax.faces.DoubleRange");
+
+ doubleRangeValidator.setMinimum(annotation.minimum());
+ doubleRangeValidator.setMaximum(annotation.maximum());
+
+ doubleRangeValidator.validate(facesContext, uiComponent, convertedObject);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JoinValidationStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JoinValidationStrategy.java
new file mode 100644
index 0000000..b55d4e7
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JoinValidationStrategy.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.JoinValidation;
+import org.apache.myfaces.extensions.validator.baseval.annotation.extractor.DefaultPropertyScanningMetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class JoinValidationStrategy extends AbstractValidationStrategy
+{
+ public void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, MetaDataEntry metaDataEntry,
+ Object convertedObject) throws ValidatorException
+ {
+ MetaDataExtractor extractor = DefaultPropertyScanningMetaDataExtractor.getInstance();
+
+ String[] targetExpressions = metaDataEntry.getValue(JoinValidation.class).value();
+
+ ValidationStrategy validationStrategy;
+
+ PropertyDetails propertyDetails;
+ for (String targetExpression : targetExpressions)
+ {
+ propertyDetails = ExtValUtils
+ .createPropertyDetailsForNewTarget(metaDataEntry, targetExpression);
+
+ for (MetaDataEntry entry : extractor.extract(facesContext, propertyDetails).getMetaDataEntries())
+ {
+ validationStrategy = ExtValUtils.getValidationStrategyForMetaData(entry.getKey());
+
+ if (validationStrategy != null)
+ {
+ validationStrategy.validate(facesContext, uiComponent, entry, convertedObject);
+ }
+ else
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("no validation strategy found for " + entry.getValue());
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java
new file mode 100644
index 0000000..d914d8e
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractAnnotationValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.AbstractValidationErrorMessageResolver;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import javax.faces.application.FacesMessage;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Id;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class JpaValidationStrategy extends AbstractAnnotationValidationStrategy
+{
+ private boolean useFacesBundle = false;
+ private static final String VALIDATE_LENGTH = "length";
+
+ private String violation;
+ private int maxLength;
+
+ public void processValidation(FacesContext facesContext,
+ UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject) throws ValidatorException
+ {
+ Annotation annotation = metaDataEntry.getValue(Annotation.class);
+ if (annotation instanceof Column)
+ {
+ validateColumnAnnotation((Column) annotation, convertedObject);
+ }
+ else if (annotation instanceof Basic)
+ {
+ validateBasicAnnotation((Basic) annotation, convertedObject);
+ }
+ else if (annotation instanceof Id)
+ {
+ checkRequiredConvertedObject(convertedObject);
+ }
+ else if (annotation instanceof OneToOne)
+ {
+ validateOneToOneAnnotation((OneToOne) annotation, convertedObject);
+ }
+ else if (annotation instanceof ManyToOne)
+ {
+ validateManyToOneAnnotation((ManyToOne) annotation, convertedObject);
+ }
+ }
+
+ private void validateColumnAnnotation(Column column, Object convertedObject) throws ValidatorException
+ {
+ if (!column.nullable())
+ {
+ checkRequiredConvertedObject(convertedObject);
+ }
+
+ if (convertedObject == null)
+ {
+ return;
+ }
+
+ if (convertedObject instanceof String
+ && column.length() < ((String) convertedObject).length())
+ {
+ this.violation = VALIDATE_LENGTH;
+ this.maxLength = column.length();
+ throw new ValidatorException(getValidationErrorFacesMassage(null));
+ }
+ }
+
+ private void validateBasicAnnotation(Basic basic, Object convertedObject) throws ValidatorException
+ {
+ if (!basic.optional())
+ {
+ checkRequiredConvertedObject(convertedObject);
+ }
+ }
+
+ private void validateOneToOneAnnotation(OneToOne oneToOne, Object convertedObject)
+ {
+ if (!oneToOne.optional())
+ {
+ checkRequiredConvertedObject(convertedObject);
+ }
+ }
+
+ private void validateManyToOneAnnotation(ManyToOne manyToOne, Object convertedObject)
+ {
+ if (!manyToOne.optional())
+ {
+ checkRequiredConvertedObject(convertedObject);
+ }
+ }
+
+ @ToDo(Priority.MEDIUM)
+ private void checkRequiredConvertedObject(Object convertedObject) throws ValidatorException
+ {
+ if (convertedObject == null || convertedObject.equals(""))
+ {
+ this.violation = CommonMetaDataKeys.REQUIRED;
+ throw new ValidatorException(getValidationErrorFacesMassage(null));
+ }
+ }
+
+ protected String getValidationErrorMsgKey(Annotation annotation)
+ {
+ if (VALIDATE_LENGTH.equals(this.violation))
+ {
+ return "field_too_long";
+ }
+ else
+ {
+ return "field_required";
+ }
+ }
+
+ protected String getErrorMessageDetail(Annotation annotation)
+ {
+ String message = super.getErrorMessageDetail(annotation);
+
+ if (VALIDATE_LENGTH.equals(this.violation))
+ {
+ return message.replace("{0}", "" + this.maxLength);
+ }
+ else
+ {
+ return message;
+ }
+ }
+
+ @Override
+ protected String resolveMessage(String key)
+ {
+ String result = super.resolveMessage(key);
+ String marker = AbstractValidationErrorMessageResolver.MISSING_RESOURCE_MARKER;
+
+ if((marker + key + marker).equals(result))
+ {
+ this.useFacesBundle = true;
+ }
+
+ return result;
+ }
+
+ @Override
+ protected boolean processAfterValidatorException(FacesContext facesContext,
+ UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject,
+ ValidatorException e)
+ {
+ FacesMessage facesMessage = e.getFacesMessage();
+
+ if(this.useFacesBundle)
+ {
+ if(VALIDATE_LENGTH.equals(this.violation))
+ {
+ ExtValUtils.replaceWithDefaultMaximumMessage(facesMessage, this.maxLength);
+ }
+ else
+ {
+ ExtValUtils.replaceWithDefaultRequiredMessage(facesMessage);
+ }
+ }
+
+ return super.processAfterValidatorException(facesContext, uiComponent, metaDataEntry, convertedObject, e);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LengthStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LengthStrategy.java
new file mode 100644
index 0000000..9cd0558
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LengthStrategy.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Length;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.LengthValidator;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@SkipValidationSupport
+@UsageInformation(UsageCategory.INTERNAL)
+public class LengthStrategy extends AbstractValidationStrategy
+{
+ protected void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, MetaDataEntry metaDataEntry,
+ Object convertedObject) throws ValidatorException
+ {
+ Length annotation = metaDataEntry.getValue(Length.class);
+ LengthValidator lengthValidator = (LengthValidator)facesContext.getApplication()
+ .createValidator("javax.faces.Length");
+
+ lengthValidator.setMinimum(annotation.minimum());
+ lengthValidator.setMaximum(annotation.maximum());
+
+ lengthValidator.validate(facesContext, uiComponent, convertedObject);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LongRangeStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LongRangeStrategy.java
new file mode 100644
index 0000000..6358202
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LongRangeStrategy.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.LongRange;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.LongRangeValidator;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@SkipValidationSupport
+@UsageInformation(UsageCategory.INTERNAL)
+public class LongRangeStrategy extends AbstractValidationStrategy
+{
+ protected void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, MetaDataEntry metaDataEntry,
+ Object convertedObject) throws ValidatorException
+ {
+
+ LongRange annotation = metaDataEntry.getValue(LongRange.class);
+ LongRangeValidator longRangeValidator = (LongRangeValidator)facesContext.getApplication()
+ .createValidator("javax.faces.LongRange");
+
+ longRangeValidator.setMinimum(annotation.minimum());
+ longRangeValidator.setMaximum(annotation.maximum());
+
+ longRangeValidator.validate(facesContext, uiComponent, convertedObject);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/PatternStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/PatternStrategy.java
new file mode 100644
index 0000000..202839a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/PatternStrategy.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Pattern;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractAnnotationValidationStrategy;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@SkipValidationSupport
+@UsageInformation(UsageCategory.INTERNAL)
+public class PatternStrategy extends AbstractAnnotationValidationStrategy
+{
+ protected void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, MetaDataEntry metaDataEntry,
+ Object convertedObject) throws ValidatorException
+ {
+ Pattern annotation = metaDataEntry.getValue(Pattern.class);
+
+ for (String expression : annotation.value())
+ {
+ if (convertedObject == null
+ || !java.util.regex.Pattern.compile(expression).matcher(
+ convertedObject.toString()).matches())
+ {
+ throw new ValidatorException(new FacesMessage(
+ FacesMessage.SEVERITY_ERROR,
+ getErrorMessageSummary(annotation),
+ getErrorMessageDetail(annotation).replace("{0}", expression)));
+ }
+ }
+ }
+
+ protected String getValidationErrorMsgKey(Annotation annotation)
+ {
+ return ((Pattern) annotation).validationErrorMsgKey();
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.java
new file mode 100644
index 0000000..ec8f996
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractAnnotationValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.AbstractValidationErrorMessageResolver;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import java.lang.annotation.Annotation;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@SkipValidationSupport
+@UsageInformation(UsageCategory.INTERNAL)
+public class RequiredStrategy extends AbstractAnnotationValidationStrategy
+{
+ private boolean useFacesBundle = false;
+
+ public void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, MetaDataEntry metaDataEntry,
+ Object convertedObject) throws ValidatorException
+ {
+ if (convertedObject == null || convertedObject.equals("") ||
+ (convertedObject instanceof Collection && ((Collection)convertedObject).isEmpty()) ||
+ (convertedObject instanceof Map && ((Map)convertedObject).isEmpty()))
+ {
+ throw new ValidatorException(getValidationErrorFacesMassage(metaDataEntry.getValue(Annotation.class)));
+ }
+ }
+
+ protected String getValidationErrorMsgKey(Annotation annotation)
+ {
+ return ((Required) annotation).validationErrorMsgKey();
+ }
+
+ @Override
+ protected String resolveMessage(String key)
+ {
+ String result = super.resolveMessage(key);
+ String marker = AbstractValidationErrorMessageResolver.MISSING_RESOURCE_MARKER;
+
+ if((marker + key + marker).equals(result))
+ {
+ this.useFacesBundle = true;
+ }
+
+ return result;
+ }
+
+ @Override
+ protected boolean processAfterValidatorException(FacesContext facesContext,
+ UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject,
+ ValidatorException e)
+ {
+ if(this.useFacesBundle)
+ {
+ ExtValUtils.replaceWithDefaultRequiredMessage(e.getFacesMessage());
+ }
+
+ return super.processAfterValidatorException(facesContext, uiComponent, metaDataEntry, convertedObject, e);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/SkipValidationStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/SkipValidationStrategy.java
new file mode 100644
index 0000000..4e86103
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/SkipValidationStrategy.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidation;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class SkipValidationStrategy implements ValidationStrategy
+{
+ public void validate(FacesContext facesContext,
+ UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject) throws ValidatorException
+ {
+ String[] valueBindingExpressions = metaDataEntry.getValue(SkipValidation.class).value();
+
+ for(String valueBindingExpression : valueBindingExpressions)
+ {
+ if(Boolean.TRUE.equals(ExtValUtils.getELHelper().getValueOfExpression(
+ facesContext, new ValueBindingExpression(valueBindingExpression))))
+ {
+ metaDataEntry.setProperty(PropertyInformationKeys.SKIP_VALIDATION, true);
+ break;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/ValidatorStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/ValidatorStrategy.java
new file mode 100644
index 0000000..bb3cc91
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/ValidatorStrategy.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Validator;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@SkipValidationSupport
+@UsageInformation(UsageCategory.INTERNAL)
+public class ValidatorStrategy extends AbstractValidationStrategy
+{
+ protected void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, MetaDataEntry metaDataEntry,
+ Object convertedObject) throws ValidatorException
+ {
+
+ Class<? extends javax.faces.validator.Validator>[] validatorClasses =
+ metaDataEntry.getValue(Validator.class).value();
+
+ javax.faces.validator.Validator validator;
+ for (Class validatorClassName : validatorClasses)
+ {
+ validator = (javax.faces.validator.Validator) ClassUtils
+ .tryToInstantiateClass(validatorClassName);
+
+ if (validator == null)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(validatorClassName.getName() + " not found");
+ }
+
+ continue;
+ }
+ validator.validate(facesContext, uiComponent, convertedObject);
+ }
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java
new file mode 100644
index 0000000..8566a41
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval;
+
+import org.apache.myfaces.extensions.validator.util.CrossValidationUtils;
+import org.apache.myfaces.extensions.validator.util.JsfUtils;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.crossval.strategy.AbstractCrossValidationStrategy;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import javax.faces.validator.ValidatorException;
+import javax.faces.FacesException;
+
+/**
+ * This phase listener processes cross validation as soon as it finds a special request scoped storage.<br/>
+ * So it's possible to add information during the process validation phase. At the end of this phase it gets processed.
+ * After that the storage gets reseted.<p/>
+ * If you provide a custom extension and you add the same storage type within a different phase,
+ * it also gets processed at the end of that phase.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class CrossValidationPhaseListener implements PhaseListener
+{
+ private boolean isInitialized = false;
+
+ public void afterPhase(PhaseEvent event)
+ {
+ try
+ {
+ CrossValidationStorage crossValidationStorage = CrossValidationUtils.getOrInitCrossValidationStorage();
+ for (CrossValidationStorageEntry entry : crossValidationStorage.getCrossValidationStorageEntries())
+ {
+ try
+ {
+ if(entry.getValidationStrategy() instanceof AbstractCrossValidationStrategy)
+ {
+ ReflectionUtils.tryToInvokeMethod(
+ entry.getValidationStrategy(),
+ ReflectionUtils.tryToGetMethod(
+ entry.getValidationStrategy().getClass(),
+ "initCrossValidation",
+ CrossValidationStorageEntry.class),
+ entry);
+ }
+
+ entry.getValidationStrategy().processCrossValidation(entry, crossValidationStorage);
+ }
+ catch (ValidatorException validatorException)
+ {
+ boolean addMessage = true;
+
+ if(entry.getValidationStrategy() instanceof AbstractCrossValidationStrategy)
+ {
+ try
+ {
+ addMessage = (Boolean)ReflectionUtils.tryToInvokeMethod(
+ entry.getValidationStrategy(),
+ ReflectionUtils.tryToGetMethod(
+ entry.getValidationStrategy().getClass(),
+ "processAfterCrossValidatorException",
+ CrossValidationStorageEntry.class,
+ validatorException.getClass()),
+ entry,
+ validatorException);
+ }
+ catch (Throwable e)
+ {
+ throw new FacesException(e);
+ }
+ }
+
+ if(addMessage)
+ {
+ FacesMessage facesMessage = validatorException.getFacesMessage();
+
+ if (facesMessage != null &&
+ facesMessage.getSummary() != null && facesMessage.getDetail() != null)
+ {
+ event.getFacesContext().addMessage(entry.getClientId(), facesMessage);
+ }
+
+ event.getFacesContext().renderResponse();
+ }
+ }
+ }
+ }
+ finally
+ {
+ CrossValidationUtils.resetCrossValidationStorage();
+ }
+ }
+
+ public void beforePhase(PhaseEvent event)
+ {
+ if (!isInitialized)
+ {
+ if (WebXmlParameter.DEACTIVATE_CROSSVALIDATION != null
+ && WebXmlParameter.DEACTIVATE_CROSSVALIDATION.equalsIgnoreCase("true"))
+ {
+ JsfUtils.deregisterPhaseListener(this);
+ }
+ else
+ {
+ isInitialized = true;
+ }
+ }
+ }
+
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.ANY_PHASE;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorage.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorage.java
new file mode 100644
index 0000000..cfb3df0
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorage.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public class CrossValidationStorage
+{
+ private List<CrossValidationStorageEntry> crossValidationStorageEntries =
+ new ArrayList<CrossValidationStorageEntry>();
+
+ public void add(CrossValidationStorageEntry entry)
+ {
+ this.crossValidationStorageEntries.add(entry);
+ }
+
+ public List<CrossValidationStorageEntry> getCrossValidationStorageEntries()
+ {
+ return crossValidationStorageEntries;
+ }
+
+ public void setCrossValidationStorageEntries(List<CrossValidationStorageEntry> crossValidationStorageEntries)
+ {
+ this.crossValidationStorageEntries = crossValidationStorageEntries;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorageEntry.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorageEntry.java
new file mode 100644
index 0000000..9d4c040
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorageEntry.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.crossval.strategy.CrossValidationStrategy;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public class CrossValidationStorageEntry
+{
+ private MetaDataEntry metaDataEntry;
+ //for complex components (e.g. a table) stores the object of entry (#{entry.property})
+ private UIComponent component;
+ private Object convertedObject;
+ private CrossValidationStrategy validationStrategy;
+ //just for input components within complex components e.g. dataTable,...
+ private String clientId;
+
+ public MetaDataEntry getMetaDataEntry()
+ {
+ return metaDataEntry;
+ }
+
+ public void setMetaDataEntry(MetaDataEntry metaDataEntry)
+ {
+ this.metaDataEntry = metaDataEntry;
+ }
+
+ public UIComponent getComponent()
+ {
+ return component;
+ }
+
+ public void setComponent(UIComponent component)
+ {
+ this.component = component;
+ }
+
+ public Object getConvertedObject()
+ {
+ return convertedObject;
+ }
+
+ public void setConvertedObject(Object convertedObject)
+ {
+ this.convertedObject = convertedObject;
+ }
+
+ public CrossValidationStrategy getValidationStrategy()
+ {
+ return validationStrategy;
+ }
+
+ public void setValidationStrategy(CrossValidationStrategy validationStrategy)
+ {
+ this.validationStrategy = validationStrategy;
+ }
+
+ public String getClientId()
+ {
+ return clientId;
+ }
+
+ public void setClientId(String clientId)
+ {
+ this.clientId = clientId;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/ProcessedInformationEntry.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/ProcessedInformationEntry.java
new file mode 100644
index 0000000..29313d8
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/ProcessedInformationEntry.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * In order to build up a mapping which is used for cross-validation.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ProcessedInformationEntry
+{
+ private Object bean;
+ private Object convertedValue;
+ private UIComponent component;
+ //for complex components (e.g. a table there are multiple entries with
+ //the same key (here the el expression #{entry.property})
+ //however, don't override the previous entry - they arn't the same;
+ private List<ProcessedInformationEntry> furtherEntries;
+ //just for input components within complex components e.g. dataTable,...
+ private String clientId;
+
+ /*
+ * generated
+ */
+ public Object getBean()
+ {
+ return bean;
+ }
+
+ public void setBean(Object bean)
+ {
+ this.bean = bean;
+ }
+
+ public Object getConvertedValue()
+ {
+ return convertedValue;
+ }
+
+ public void setConvertedValue(Object convertedValue)
+ {
+ this.convertedValue = convertedValue;
+ }
+
+ public UIComponent getComponent()
+ {
+ return component;
+ }
+
+ public void setComponent(UIComponent component)
+ {
+ this.component = component;
+ }
+
+ public String getClientId()
+ {
+ return clientId;
+ }
+
+ public void setClientId(String clientId)
+ {
+ this.clientId = clientId;
+ }
+
+ public List<ProcessedInformationEntry> getFurtherEntries()
+ {
+ return furtherEntries;
+ }
+
+ public void setFurtherEntries(List<ProcessedInformationEntry> furtherEntries)
+ {
+ this.furtherEntries = furtherEntries;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/WebXmlParameter.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/WebXmlParameter.java
new file mode 100644
index 0000000..1c40279
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/WebXmlParameter.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval;
+
+import org.apache.myfaces.extensions.validator.util.WebXmlUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * centralized in order that these information arn't spread over the complete code base
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface WebXmlParameter
+{
+ static final String DEACTIVATE_CROSSVALIDATION = WebXmlUtils
+ .getInitParameter("DEACTIVATE_CROSSVALIDATION");
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java
new file mode 100644
index 0000000..f235a1d
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import java.text.DateFormat;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface DateIs
+{
+ String[] valueOf();
+
+ /*
+ * optional section
+ */
+
+ DateIsType type() default DateIsType.same;
+
+ String validationErrorMsgKey() default "";
+
+ String notBeforeErrorMsgKey() default "wrong_date_not_before";
+
+ String notAfterErrorMsgKey() default "wrong_date_not_after";
+
+ String notEqualErrorMsgKey() default "wrong_date_not_equal";
+
+ int errorMessageDateStyle() default DateFormat.MEDIUM;
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIsType.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIsType.java
new file mode 100644
index 0000000..7c5f482
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIsType.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@ToDo(value = Priority.MEDIUM, description = "beforeOrSame, afterOrSame")
+@UsageInformation(UsageCategory.API)
+public enum DateIsType
+{
+ before, after, same
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/Equals.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/Equals.java
new file mode 100644
index 0000000..9447898
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/Equals.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface Equals
+{
+ String[] value();
+
+ String validationErrorMsgKey() default "duplicated_content_required";
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/NotEquals.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/NotEquals.java
new file mode 100644
index 0000000..a881762
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/NotEquals.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface NotEquals
+{
+ String[] value();
+
+ String validationErrorMsgKey() default "duplicated_content_denied";
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIf.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIf.java
new file mode 100644
index 0000000..1bb6db1
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIf.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface RequiredIf
+{
+ String[] valueOf();
+
+ /*
+ * optional section
+ */
+
+ RequiredIfType is() default RequiredIfType.not_empty;
+
+ String validationErrorMsgKey() default "empty_field";
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIfType.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIfType.java
new file mode 100644
index 0000000..61c58d9
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIfType.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public enum RequiredIfType
+{
+ empty, not_empty
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties
new file mode 100644
index 0000000..ef60759
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+duplicated_content_required=Input is different
+duplicated_content_required_detail=Input is different
+
+duplicated_content_denied=Same input isn't allowed
+duplicated_content_denied_detail=Same input isn't allowed
+
+wrong_date=Wrong date
+wrong_date_detail=Wrong date
+
+wrong_date_not_before=Date has to be after {0}
+wrong_date_not_before_detail=Date has to be after {0}
+
+wrong_date_not_after=Date has to be before {0}
+wrong_date_not_after_detail=Date has to be before {0}
+
+wrong_date_not_equal=Date isn't equal to {0}
+wrong_date_not_equal_detail=Date isn't equal to {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_ar.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_ar.properties
new file mode 100644
index 0000000..9ff93c4
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_ar.properties
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+duplicated_content_required=\u0627\u0644\u0625\u062f\u062e\u0627\u0644 \u0645\u062e\u062a\u0644\u0641
+duplicated_content_required_detail=\u0627\u0644\u0625\u062f\u062e\u0627\u0644 \u0645\u062e\u062a\u0644\u0641
+
+duplicated_content_denied=\u063a\u064a\u0631 \u0645\u0633\u0645\u0648\u062d \u0628\u0625\u062f\u062e\u0627\u0644 \u0646 \u0641\u0633 \u0642\u064a\u0645\u0629 \u0627\u0644\u0625\u062f\u062e\u0627\u0644
+duplicated_content_denied_detail=\u063a\u064a\u0631 \u0645\u0633\u0645\u0648\u062d \u0628\u0625\u062f\u062e\u0627\u0644 \u0646\u0641\u0633 \u0642\u064a\u0645\u0629 \u0627\u0644\u0625\u062f\u062e\u0627\u0644
+
+wrong_date=\u0627\u0644\u062a\u0627\u0631\u064a\u062e \u062e\u0627\u0637\u0649\u0621
+wrong_date_detail=\u0627\u0644\u062a\u0627\u0631\u064a\u062e \u062e\u0627\u0637\u0649\u0621
+
+wrong_date_not_before=\u0627\u0644\u062a\u0627\u0631\u064a\u062e \u064a\u062c\u0628 \u0623\u0646 \u064a\u0643\u0648 \u0646 \u0628\u0639\u062f {0}
+wrong_date_not_before_detail=\u0627\u0644\u062a\u0627\u0631\u064a\u062e \u064a\u062c\u0628 \u0623\u0646 \u064a\u0643 \u0648\u0646 \u0628\u0639\u062f {0}
+
+wrong_date_not_after=\u0627\u0644\u062a\u0627\u0631\u064a\u062e \u064a\u062c\u0628 \u0623\u0646 \u064a\u0643\u0648 \u0646 \u0642\u0628\u0644 {0}
+wrong_date_not_after_detail=\u0627\u0644\u062a\u0627\u0631\u064a\u062e \u064a\u062c\u0628 \u0623\u0646 \u064a\u0643 \u0648\u0646 \u0642\u0628\u0644 {0}
+
+wrong_date_not_equal=\u0627\u0644\u062a\u0627\u0631\u064a\u062e \u0644\u0627 \u064a\u0633\u0627\u0648\u0649 {0}
+wrong_date_not_equal_detail=\u0627\u0644\u062a\u0627\u0631\u064a\u062e \u0644\u0627 \u064a\u0633\u0627\u0648\u0649 {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_ca.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_ca.properties
new file mode 100644
index 0000000..2854ed2
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_ca.properties
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+duplicated_content_required=el valor \u00e9 diferent
+duplicated_content_required_detail=el valor \u00e9 diferent
+
+duplicated_content_denied=no es permet el mateix valor
+duplicated_content_denied_detail=no es permet el mateix valor
+
+wrong_date=data err\u00f2nia
+wrong_date_detail=data err\u00f2nia
+
+wrong_date_not_before=la data ha de ser posterior a {0}
+wrong_date_not_before_detail=la data ha de ser posterior a {0}
+
+wrong_date_not_after=la data ha de ser anterior a {0}
+wrong_date_not_after_detail=la data ha de ser posterior a {0}
+
+wrong_date_not_equal=la data no \u000e9s igual a {0}
+wrong_date_not_equal_detail=la data no \u000e9s igual a {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_de.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_de.properties
new file mode 100644
index 0000000..9d87234
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_de.properties
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+duplicated_content_required=Eingabe ist unterschiedlich
+duplicated_content_required_detail=Eingabe ist unterschiedlich
+
+duplicated_content_denied=Der gleiche Wert ist nicht erlaubt
+duplicated_content_denied_detail=Der gleiche Wert ist nicht erlaubt
+
+wrong_date=Datum inkorrekt
+wrong_date_detail=Datum inkorrekt
+
+wrong_date_not_before=Das Datum muss nach dem {0} sein
+wrong_date_not_before_detail=Das Datum muss nach dem {0} sein
+
+wrong_date_not_after=Das Datum muss vor dem {0} sein
+wrong_date_not_after_detail=Das Datum muss vor dem {0} sein
+
+wrong_date_not_equal=Das Datum entspricht nicht dem {0}
+wrong_date_not_equal_detail=Das Datum entspricht nicht dem {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_en.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_en.properties
new file mode 100644
index 0000000..ef60759
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_en.properties
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+duplicated_content_required=Input is different
+duplicated_content_required_detail=Input is different
+
+duplicated_content_denied=Same input isn't allowed
+duplicated_content_denied_detail=Same input isn't allowed
+
+wrong_date=Wrong date
+wrong_date_detail=Wrong date
+
+wrong_date_not_before=Date has to be after {0}
+wrong_date_not_before_detail=Date has to be after {0}
+
+wrong_date_not_after=Date has to be before {0}
+wrong_date_not_after_detail=Date has to be before {0}
+
+wrong_date_not_equal=Date isn't equal to {0}
+wrong_date_not_equal_detail=Date isn't equal to {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_es.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_es.properties
new file mode 100644
index 0000000..4338524
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_es.properties
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+duplicated_content_required=la entrada es diferente
+duplicated_content_required_detail=la entrada es diferente
+
+duplicated_content_denied=no se permiten entradas iguales
+duplicated_content_denied_detail=no se permiten entradas iguales
+
+wrong_date=fecha equivocada
+wrong_date_detail=fecha equivocada
+
+wrong_date_not_before=la fecha tiene que ser luego de {0}
+wrong_date_not_before_detail=la fecha tiene que ser luego de {0}
+
+wrong_date_not_after=la fecha tiene que ser antes de {0}
+wrong_date_not_after_detail=la fecha tiene que ser antes de {0}
+
+wrong_date_not_equal=la fecha no es igual a {0}
+wrong_date_not_equal_detail=la fecha no es igual a {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_fr.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_fr.properties
new file mode 100644
index 0000000..c5f0218
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_fr.properties
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+duplicated_content_required=Les champs sont différents
+duplicated_content_required_detail=Les champs sont différents
+
+duplicated_content_denied=Les champs doivent être différents
+duplicated_content_denied_detail=Les champs doivent être différents
+
+wrong_date=La date est incorrecte
+wrong_date_detail=La date est incorrecte
+
+wrong_date_not_before=La date doit être après {0}
+wrong_date_not_before_detail=La date doit être après {0}
+
+wrong_date_not_after=La date doit être avant {0}
+wrong_date_not_after_detail=La date doit être avant {0}
+
+wrong_date_not_equal=La date n'est pas égale à {0}
+wrong_date_not_equal_detail=La date n'est pas égale à {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_it.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_it.properties
new file mode 100644
index 0000000..b042801
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_it.properties
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+duplicated_content_required=Valori non uguali
+duplicated_content_required_detail=I valori inseriti non coincidono
+
+duplicated_content_denied=Lo stesso valore non è permesso
+duplicated_content_denied_detail=Lo stesso valore non è permesso
+
+wrong_date=Data errata
+wrong_date_detail=Data errata
+
+wrong_date_not_before=La data deve essere dopo di {0}
+wrong_date_not_before_detail=La data deve essere dopo di {0}
+
+wrong_date_not_after=La data deve essere prima di {0}
+wrong_date_not_after_detail=La data deve essere prima di {0}
+
+wrong_date_not_equal=La data non è uguale a {0}
+wrong_date_not_equal_detail=La data non è uguale a {0}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_tr.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_tr.properties
new file mode 100644
index 0000000..aaf6a9d
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_tr.properties
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+
+duplicated_content_required=girilen de\u011fer farkl\u0131
+duplicated_content_required_detail=girilen de\u011fer farkl\u0131
+
+duplicated_content_denied=ayn\u0131 de\u011fer girilemez
+duplicated_content_denied_detail=ayn\u0131 de\u011fer girilemez
+
+wrong_date=yanl\u0131\u015f tarih
+wrong_date_detail=yanl\u0131\u015f tarih
+
+wrong_date_not_before=tarih {0} de\u011ferinden sonra olmal\u0131d\u0131r
+wrong_date_not_before_detail=tarih {0} de\u011ferinden sonra olmal\u0131d\u0131r
+
+wrong_date_not_after=tarih {0} de\u011ferinden \u00f6nce olmal\u0131d\u0131r
+wrong_date_not_after_detail=tarih {0} de\u011ferinden \u00f6nce olmal\u0131d\u0131r
+
+wrong_date_not_equal=tarih {0} de\u011ferine e\u015fit de\u011fil
+wrong_date_not_equal_detail=tarih {0} de\u011ferine e\u015fit de\u011fil
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/resolver/DefaultValidationErrorMessageResolver.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/resolver/DefaultValidationErrorMessageResolver.java
new file mode 100644
index 0000000..3d7659e
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/resolver/DefaultValidationErrorMessageResolver.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.message.resolver;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultValidationErrorMessageResolver
+ extends
+ org.apache.myfaces.extensions.validator.core.validation.message.resolver.DefaultValidationErrorMessageResolver
+{
+ private static String baseName = null;
+
+ @Override
+ protected String getBaseName()
+ {
+ if (baseName == null)
+ {
+ baseName = super.getBaseName();
+ }
+
+ return baseName;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/recorder/CrossValidationUserInputRecorder.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/recorder/CrossValidationUserInputRecorder.java
new file mode 100644
index 0000000..bc40a03
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/recorder/CrossValidationUserInputRecorder.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.recorder;
+
+import org.apache.myfaces.extensions.validator.core.recorder.ProcessedInformationRecorder;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.crossval.ProcessedInformationEntry;
+import org.apache.myfaces.extensions.validator.util.CrossValidationUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class CrossValidationUserInputRecorder implements ProcessedInformationRecorder
+{
+ public void recordUserInput(UIComponent uiComponent, Object value)
+ {
+ if (!(uiComponent instanceof EditableValueHolder))
+ {
+ return;
+ }
+
+ //to support local cross-validation (within the same entity)
+ Map<String, ProcessedInformationEntry> keyToConvertedValueMapping = CrossValidationUtils
+ .getOrInitKeyToConvertedValueMapping();
+
+ ProcessedInformationEntry entry;
+
+ PropertyDetails propertyDetails =
+ ExtValUtils.getELHelper().getPropertyDetailsOfValueBinding(uiComponent);
+
+ if(propertyDetails == null)
+ {
+ return;
+ }
+
+ entry = new ProcessedInformationEntry();
+ entry.setBean(propertyDetails.getBaseObject());
+ entry.setConvertedValue(value);
+ entry.setComponent(uiComponent);
+ entry.setClientId(uiComponent.getClientId(FacesContext.getCurrentInstance()));
+
+ String key = propertyDetails.getKey();
+
+ //for local cross-validation
+ if (keyToConvertedValueMapping.containsKey(key) &&
+ keyToConvertedValueMapping.get(key).getBean() != null &&
+ !keyToConvertedValueMapping.get(key).getBean().equals(entry.getBean()))
+ {
+ //for the validation within a complex component e.g. a table
+ //don't override existing expression (style: #{entry.property}) - make a special mapping
+
+ List<ProcessedInformationEntry> furtherEntries =
+ keyToConvertedValueMapping.get(key).getFurtherEntries();
+
+ if (furtherEntries == null)
+ {
+ furtherEntries = new ArrayList<ProcessedInformationEntry>();
+
+ keyToConvertedValueMapping.get(key).setFurtherEntries(furtherEntries);
+ }
+
+ furtherEntries.add(entry);
+ }
+ else
+ {
+ //for normal validation
+ keyToConvertedValueMapping.put(key, entry);
+ }
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java
new file mode 100644
index 0000000..d3c1544
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java
@@ -0,0 +1,308 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorage;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public abstract class AbstractCompareStrategy extends AbstractCrossValidationStrategy
+{
+ protected static List<ReferencingStrategy> referencingStrategies;
+ protected Map<Object, Object> violationResultStorage = new HashMap<Object, Object>();
+
+ public AbstractCompareStrategy()
+ {
+ initReferencingStrategies();
+ }
+
+ protected void initReferencingStrategies()
+ {
+ if (referencingStrategies == null)
+ {
+ referencingStrategies = new ArrayList<ReferencingStrategy>();
+
+ String customReferencingStrategyClassName =
+ ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInformation.BASE_PACKAGE) + "ReferencingStrategy";
+
+ ReferencingStrategy customReferencingStrategy = (ReferencingStrategy) ClassUtils
+ .tryToInstantiateClassForName(customReferencingStrategyClassName);
+
+ if (customReferencingStrategy != null)
+ {
+ referencingStrategies.add(customReferencingStrategy);
+ }
+
+ referencingStrategies.add(new ELCompareStrategy());
+ //referencingStrategies.add(new AliasCompareStrategy());
+ referencingStrategies.add(new LocalCompareStrategy());
+ referencingStrategies.add(new LocalPropertyChainCompareStrategy());
+ }
+ }
+
+ public void processCrossValidation(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage) throws ValidatorException
+ {
+ //initCrossValidation is done in the CrossValidationPhaseListener
+
+ String[] validationTargets = getValidationTargets(
+ crossValidationStorageEntry.getMetaDataEntry().getValue(Annotation.class));
+
+ for (String validationTarget : validationTargets)
+ {
+ validationTarget = validationTarget.trim();
+
+ //select validation method
+ tryToValidate(crossValidationStorageEntry, crossValidationStorage, validationTarget);
+ }
+ }
+
+ private boolean tryToValidate(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String validationTarget)
+ {
+ for (ReferencingStrategy referencingStrategy : referencingStrategies)
+ {
+ if (referencingStrategy.evaluateReferenceAndValidate(
+ crossValidationStorageEntry, crossValidationStorage, validationTarget, this))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @SuppressWarnings({"ThrowableInstanceNeverThrown"})
+ protected final void processTargetComponentAfterViolation(
+ CrossValidationStorageEntry entryOfSource,
+ CrossValidationStorageEntry entryOfTarget)
+ {
+ if (!handleTargetViolation(entryOfSource, entryOfTarget))
+ {
+ //no target - because there is no target component - value was validated against the model
+ if(entryOfTarget == null)
+ {
+ processTargetComponentAsSourceComponentAfterViolation(entryOfSource);
+ return;
+ }
+
+ return;
+ }
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ //get validation error messages for the target component
+ String summary = getErrorMessageSummary(entryOfSource.getMetaDataEntry().getValue(Annotation.class), true);
+ String details = getErrorMessageDetail(entryOfSource.getMetaDataEntry().getValue(Annotation.class), true);
+
+ //validation target isn't bound to a component withing the current page
+ //(see validateFoundEntry, tryToValidateLocally and tryToValidateBindingOnly)
+ if (entryOfTarget == null)
+ {
+ entryOfTarget = entryOfSource;
+ }
+
+ FacesMessage message;
+ if (entryOfTarget.getMetaDataEntry() != null)
+ {
+ message = getTargetComponentErrorMessage(
+ entryOfTarget.getMetaDataEntry().getValue(Annotation.class), summary, details);
+ }
+ else
+ {
+ //TODO document possible side effects
+ //due to a missing target annotation (see: tryToValidateLocally)
+ message = getTargetComponentErrorMessage(
+ entryOfSource.getMetaDataEntry().getValue(Annotation.class), summary, details);
+ }
+
+ if ((message.getSummary() != null || message.getDetail() != null) &&
+ entryOfSource.getClientId() != null && !entryOfSource.getClientId().equals(entryOfTarget.getClientId()))
+ {
+ ValidatorException validatorException = new ValidatorException(message);
+
+ if(ExtValUtils.executeAfterThrowingInterceptors(
+ entryOfTarget.getComponent(), entryOfTarget.getMetaDataEntry(),
+ entryOfTarget.getConvertedObject(), validatorException, this))
+ {
+ facesContext.addMessage(entryOfTarget.getClientId(),
+ ExtValUtils.convertFacesMessage(validatorException.getFacesMessage()));
+ }
+ }
+ }
+
+ private void processTargetComponentAsSourceComponentAfterViolation(CrossValidationStorageEntry entryOfSource)
+ {
+ //get validation error messages for the current component
+ String summary = getReverseErrorMessageSummary(entryOfSource.getMetaDataEntry().getValue(Annotation.class));
+ String details = getReverseErrorMessageDetail(entryOfSource.getMetaDataEntry().getValue(Annotation.class));
+
+ FacesMessage message = getSourceComponentErrorMessage(
+ entryOfSource.getMetaDataEntry().getValue(Annotation.class), summary, details);
+
+ if (message.getSummary() != null || message.getDetail() != null)
+ {
+ //TODO
+ throw new ValidatorException(message);
+ }
+ else
+ {
+ //TODO logging
+ }
+ }
+
+ protected final void processSourceComponentAfterViolation(CrossValidationStorageEntry entryOfSource)
+ {
+ if (handleSourceViolation(entryOfSource))
+ {
+ //get validation error messages for the current component
+ String summary = getErrorMessageSummary(entryOfSource.getMetaDataEntry().getValue(Annotation.class), false);
+ String details = getErrorMessageDetail(entryOfSource.getMetaDataEntry().getValue(Annotation.class), false);
+
+ FacesMessage message = getSourceComponentErrorMessage(
+ entryOfSource.getMetaDataEntry().getValue(Annotation.class), summary, details);
+
+ if (message.getSummary() != null || message.getDetail() != null)
+ {
+ //TODO
+ throw new ValidatorException(message);
+ }
+ }
+
+ //just throw a new message - the error message is at the target
+ throw new ValidatorException(new FacesMessage());
+ }
+
+ protected FacesMessage getSourceComponentErrorMessage(Annotation annotation, String summary, String detail)
+ {
+ return ExtValUtils.createFacesMessage(summary, detail);
+ }
+
+ protected FacesMessage getTargetComponentErrorMessage(Annotation foundAnnotation, String summary, String detail)
+ {
+ return ExtValUtils.createFacesMessage(summary, detail);
+ }
+
+ protected String getErrorMessageSummary(Annotation annotation, boolean isTargetComponent)
+ {
+ return resolveMessage(getValidationErrorMsgKey(annotation, isTargetComponent));
+ }
+
+ protected String getErrorMessageDetail(Annotation annotation, boolean isTargetComponent)
+ {
+ try
+ {
+ String key = getValidationErrorMsgKey(annotation, isTargetComponent);
+ return (key != null) ? resolveMessage(key + DETAIL_MESSAGE_KEY_POSTFIX) : null;
+ }
+ catch (MissingResourceException e)
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("couldn't find key " + getValidationErrorMsgKey(annotation, isTargetComponent)
+ + DETAIL_MESSAGE_KEY_POSTFIX, e);
+ }
+ }
+ return null;
+ }
+
+ protected String getValidationErrorMsgKey(Annotation annotation)
+ {
+ return getValidationErrorMsgKey(annotation, false);
+ }
+
+ protected boolean handleTargetViolation(
+ CrossValidationStorageEntry entryOfSource,
+ CrossValidationStorageEntry entryOfTarget)
+ {
+ return entryOfTarget != null && entryOfTarget.getComponent() != null;
+ }
+
+ protected boolean handleSourceViolation(CrossValidationStorageEntry entryOfSource)
+ {
+ return true;
+ }
+
+ protected boolean useTargetComponentToDisplayErrorMsg(CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ return handleTargetViolation(crossValidationStorageEntry, null);
+ }
+
+ /*
+ * no target component (validation against the model) -> get reverse message for source component
+ */
+ protected String getReverseErrorMessageSummary(Annotation annotation)
+ {
+ //if the message is neutral
+ return getErrorMessageSummary(annotation, true);
+ }
+
+ /*
+ * no target component (validation against the model) -> get reverse message for source component
+ */
+ protected String getReverseErrorMessageDetail(Annotation annotation)
+ {
+ //if the message is neutral
+ return getErrorMessageDetail(annotation, true);
+ }
+
+ /*
+ * abstract methods
+ */
+
+ protected abstract String getValidationErrorMsgKey(Annotation annotation, boolean isTargetComponent);
+
+ /*
+ * implements the specific validation logic
+ */
+
+ public abstract boolean isViolation(Object object1, Object object2, Annotation annotation);
+
+ /*
+ * returns the referenced validation targets of the annotation
+ * e.g. @DateIs(type = DateIsType.before, value = "finalExam")
+ * -> method returns an array with one value ("finalExam")
+ */
+ public abstract String[] getValidationTargets(Annotation annotation);
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.java
new file mode 100644
index 0000000..b5c81bb
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractAnnotationValidationStrategy;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.util.CrossValidationUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public abstract class AbstractCrossValidationStrategy extends
+ AbstractAnnotationValidationStrategy implements CrossValidationStrategy
+{
+ //init cross-validation
+ public void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject) throws ValidatorException
+ {
+ CrossValidationStorageEntry entry =
+ getCrossValidationStorageEntry(facesContext, uiComponent, metaDataEntry, convertedObject);
+
+ CrossValidationUtils.getOrInitCrossValidationStorage().add(entry);
+ }
+
+ public CrossValidationStorageEntry getCrossValidationStorageEntry(
+ FacesContext facesContext, UIComponent uiComponent,
+ MetaDataEntry metaDataEntry, Object convertedObject)
+ {
+ CrossValidationStorageEntry entry = new CrossValidationStorageEntry();
+
+ entry.setMetaDataEntry(metaDataEntry);
+ entry.setComponent(uiComponent);
+ entry.setClientId(uiComponent.getClientId(facesContext));
+ entry.setConvertedObject(convertedObject);
+ entry.setValidationStrategy(this);
+
+ return entry;
+ }
+
+ @Override
+ protected final boolean processAfterValidatorException(FacesContext facesContext,
+ UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject,
+ ValidatorException validatorException)
+ {
+ throw new IllegalStateException("not available for cross validation - use processAfterCrossValidatorException");
+ }
+
+ @Override
+ protected final String getLabel(FacesContext facesContext, UIComponent uiComponent, MetaDataEntry metaDataEntry)
+ {
+ throw new IllegalStateException("not available for cross validation");
+ }
+
+ @Override
+ protected final void initValidation(FacesContext facesContext,
+ UIComponent uiComponent,
+ MetaDataEntry metaDataEntry,
+ Object convertedObject)
+ {
+ //not available for cross validation - use initCrossValidation
+ }
+
+ protected void initCrossValidation(CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ //override if needed
+ }
+
+ //override if needed
+ protected boolean processAfterCrossValidatorException(CrossValidationStorageEntry crossValidationStorageEntry,
+ ValidatorException validatorException)
+ {
+ return ExtValUtils.executeAfterThrowingInterceptors(
+ crossValidationStorageEntry.getComponent(), crossValidationStorageEntry.getMetaDataEntry(),
+ crossValidationStorageEntry.getConvertedObject(), validatorException, this);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/CrossValidationHelper.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/CrossValidationHelper.java
new file mode 100644
index 0000000..fcf7de3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/CrossValidationHelper.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.ProcessedInformationEntry;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class CrossValidationHelper
+{
+ public static void crossValidateCompareStrategy(AbstractCompareStrategy compareStrategy,
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ ProcessedInformationEntry validationTargetEntry,
+ boolean isModelAwareValidation)
+ {
+ if (compareStrategy.isViolation(
+ crossValidationStorageEntry.getConvertedObject(),
+ validationTargetEntry.getConvertedValue(),
+ crossValidationStorageEntry.getMetaDataEntry().getValue(Annotation.class)))
+ {
+ //process after violation
+ //just add messages
+ if(!isModelAwareValidation)
+ {
+ processTargetAfterCrossComponentValidation(
+ compareStrategy, crossValidationStorageEntry, validationTargetEntry);
+ }
+ else
+ {
+ processTargetAfterModelAwareCrossValidation(
+ compareStrategy, crossValidationStorageEntry);
+ }
+
+ //thow exception
+ compareStrategy.processSourceComponentAfterViolation(crossValidationStorageEntry);
+ }
+ }
+
+ private static void processTargetAfterCrossComponentValidation(
+ AbstractCompareStrategy compareStrategy,
+ CrossValidationStorageEntry sourceCrossValidationStorageEntry,
+ ProcessedInformationEntry validationTargetEntry)
+ {
+ CrossValidationStorageEntry targetCrossValidationStorageEntry = new CrossValidationStorageEntry();
+
+ if (compareStrategy.useTargetComponentToDisplayErrorMsg(sourceCrossValidationStorageEntry))
+ {
+ targetCrossValidationStorageEntry.setComponent(validationTargetEntry.getComponent());
+ targetCrossValidationStorageEntry.setClientId(validationTargetEntry.getClientId());
+ }
+ else
+ {
+ targetCrossValidationStorageEntry.setComponent(sourceCrossValidationStorageEntry.getComponent());
+ targetCrossValidationStorageEntry.setClientId(sourceCrossValidationStorageEntry.getClientId());
+ }
+
+ targetCrossValidationStorageEntry.setConvertedObject(validationTargetEntry.getConvertedValue());
+ targetCrossValidationStorageEntry.setValidationStrategy(compareStrategy);
+
+ //add message
+ compareStrategy.processTargetComponentAfterViolation(
+ sourceCrossValidationStorageEntry, targetCrossValidationStorageEntry);
+ }
+
+ private static void processTargetAfterModelAwareCrossValidation(
+ AbstractCompareStrategy compareStrategy,
+ CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ //no target - because there is no target component - value was validated against the model
+ compareStrategy.processTargetComponentAfterViolation(crossValidationStorageEntry, null);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/CrossValidationStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/CrossValidationStrategy.java
new file mode 100644
index 0000000..bc7d872
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/CrossValidationStrategy.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorage;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface CrossValidationStrategy extends ValidationStrategy
+{
+ CrossValidationStorageEntry getCrossValidationStorageEntry(
+ FacesContext facesContext, UIComponent uiComponent,
+ MetaDataEntry metaDataEntry, Object convertedObject);
+
+ void processCrossValidation(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage)
+ throws ValidatorException;
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/DateIsStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/DateIsStrategy.java
new file mode 100644
index 0000000..6c2fa71
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/DateIsStrategy.java
@@ -0,0 +1,261 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIs;
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIsType;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.context.FacesContext;
+import java.lang.annotation.Annotation;
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.MissingResourceException;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@SkipValidationSupport
+@UsageInformation(UsageCategory.INTERNAL)
+public class DateIsStrategy extends AbstractCompareStrategy
+{
+ protected static final String TOO_EARLY = "early";
+ protected static final String TOO_LATE = "late";
+ protected static final String NOT_EQUAL_DATE_TIME = "not equal";
+ protected static final String RESULT_KEY = "result";
+ protected static final String COMPARED_VALUE_KEY = "target value";
+ protected static final String REVERSE_COMPARED_VALUE_KEY = "reverse target value";
+
+ public boolean useTargetComponentToDisplayErrorMsg(
+ CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ return true;
+ }
+
+ //TODO test & remove
+ @Override
+ protected boolean handleSourceViolation(CrossValidationStorageEntry entryOfSource)
+ {
+ return false;
+ }
+
+ public boolean isViolation(Object object1, Object object2, Annotation annotation)
+ {
+ boolean violationFound;
+
+ if (((DateIs) annotation).type().equals(DateIsType.same))
+ {
+ violationFound = object1 != null && !object1.equals(object2);
+
+ if (violationFound)
+ {
+ this.violationResultStorage.put(RESULT_KEY, NOT_EQUAL_DATE_TIME);
+ }
+ }
+ else if (((DateIs) annotation).type().equals(DateIsType.before))
+ {
+ violationFound = object1 != null && object2 != null &&
+ (!new Date(((Date) object1).getTime()).before((Date) object2) || object1.equals(object2));
+
+ if (violationFound)
+ {
+ this.violationResultStorage.put(RESULT_KEY, TOO_LATE);
+ }
+ }
+ else
+ {
+ violationFound = object1 != null && object2 != null &&
+ (!new Date(((Date) object1).getTime()).after((Date) object2) || object1.equals(object2));
+
+ if (violationFound)
+ {
+ this.violationResultStorage.put(RESULT_KEY, TOO_EARLY);
+ }
+ }
+
+ if (violationFound)
+ {
+ this.violationResultStorage.put(COMPARED_VALUE_KEY, object1);
+ this.violationResultStorage.put(REVERSE_COMPARED_VALUE_KEY, object2);
+ }
+
+ return violationFound;
+ }
+
+ public String[] getValidationTargets(Annotation annotation)
+ {
+ return ((DateIs) annotation).valueOf();
+ }
+
+ /*
+ * protected
+ */
+ protected String getValidationErrorMsgKey(Annotation annotation, boolean isTargetComponent)
+ {
+ String result = (String) this.violationResultStorage.get(RESULT_KEY);
+
+ if (!isTargetComponent)
+ {
+ result = reverseResult(result);
+ }
+
+ if (TOO_EARLY.equals(result))
+ {
+ return getNotAfterErrorMsgKey((DateIs) annotation);
+ }
+ else if (TOO_LATE.equals(result))
+ {
+ return getNotBeforeErrorMsgKey((DateIs) annotation);
+ }
+ else
+ {
+ return getNotEqualErrorMsgKey((DateIs) annotation);
+ }
+ }
+
+ private String reverseResult(String result)
+ {
+ if (TOO_EARLY.equals(result))
+ {
+ return TOO_LATE;
+ }
+ else
+ {
+ return TOO_EARLY;
+ }
+ }
+
+ @Override
+ protected String getErrorMessageSummary(Annotation annotation, boolean isTargetComponent)
+ {
+ if (!isTargetComponent)
+ {
+ return super.getErrorMessageSummary(annotation, isTargetComponent);
+ }
+
+ return getErrorMessage(getValidationErrorMsgKey(annotation, isTargetComponent), annotation, isTargetComponent);
+ }
+
+ @Override
+ protected String getErrorMessageDetail(Annotation annotation, boolean isTargetComponent)
+ {
+ if (!isTargetComponent)
+ {
+ return super.getErrorMessageDetail(annotation, isTargetComponent);
+ }
+
+ try
+ {
+ return getErrorMessage(getValidationErrorMsgKey(annotation, isTargetComponent)
+ + DETAIL_MESSAGE_KEY_POSTFIX, annotation, isTargetComponent);
+ }
+ catch (MissingResourceException e)
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("couldn't find key " + getValidationErrorMsgKey(annotation, isTargetComponent)
+ + DETAIL_MESSAGE_KEY_POSTFIX, e);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected String getReverseErrorMessageSummary(Annotation annotation)
+ {
+ return getErrorMessage(getValidationErrorMsgKey(annotation, false), annotation, false);
+ }
+
+ @Override
+ protected String getReverseErrorMessageDetail(Annotation annotation)
+ {
+ try
+ {
+ return getErrorMessage(getValidationErrorMsgKey(annotation, false)
+ + DETAIL_MESSAGE_KEY_POSTFIX, annotation, false);
+ }
+ catch (MissingResourceException e)
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("couldn't find key " + getValidationErrorMsgKey(annotation)
+ + DETAIL_MESSAGE_KEY_POSTFIX, e);
+ }
+ }
+ return null;
+ }
+
+ protected String getErrorMessage(String key, Annotation annotation, boolean isTargetComponent)
+ {
+ String message = resolveMessage(key);
+
+ DateFormat dateFormat = DateFormat.getDateInstance(((DateIs) annotation).errorMessageDateStyle(),
+ FacesContext.getCurrentInstance().getViewRoot().getLocale());
+
+ String result;
+
+ if(isTargetComponent)
+ {
+ result = message.replace("{0}",
+ dateFormat.format((Date) this.violationResultStorage.get(COMPARED_VALUE_KEY)));
+ }
+ else
+ {
+ result = message.replace("{0}",
+ dateFormat.format((Date) this.violationResultStorage.get(REVERSE_COMPARED_VALUE_KEY)));
+ }
+
+ //replace placeholder with the value of the other component
+ return result;
+ }
+
+ /*
+ * private
+ */
+ private String getNotAfterErrorMsgKey(DateIs annotation)
+ {
+ if (annotation.validationErrorMsgKey().equals(""))
+ {
+ return annotation.notAfterErrorMsgKey();
+ }
+ return annotation.validationErrorMsgKey();
+ }
+
+ private String getNotBeforeErrorMsgKey(DateIs annotation)
+ {
+ if (annotation.validationErrorMsgKey().equals(""))
+ {
+ return annotation.notBeforeErrorMsgKey();
+ }
+ return annotation.validationErrorMsgKey();
+ }
+
+ private String getNotEqualErrorMsgKey(DateIs annotation)
+ {
+ if (annotation.validationErrorMsgKey().equals(""))
+ {
+ return annotation.notEqualErrorMsgKey();
+ }
+ return annotation.validationErrorMsgKey();
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/ELCompareStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/ELCompareStrategy.java
new file mode 100644
index 0000000..8846a26
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/ELCompareStrategy.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.ProcessedInformationEntry;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorage;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.util.CrossValidationUtils;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * referencing validation targets - possible formats:
+ * "#{[bean_name].[property_name]}" ... cross-entity validation with value binding
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class ELCompareStrategy implements ReferencingStrategy
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public boolean evaluateReferenceAndValidate(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String validationTarget, AbstractCompareStrategy compareStrategy)
+ {
+ if (ExtValUtils.getELHelper().isELTermWellFormed(validationTarget) &&
+ ExtValUtils.getELHelper().isELTermValid(FacesContext.getCurrentInstance(), validationTarget))
+ {
+ tryToValidateValueBinding(
+ crossValidationStorageEntry,
+ new ValueBindingExpression(validationTarget), crossValidationStorage, compareStrategy);
+
+ return true;
+ }
+ return false;
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "test")
+ protected boolean tryToValidateValueBinding(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ ValueBindingExpression validationTarget,
+ CrossValidationStorage crossValidationStorage,
+ AbstractCompareStrategy compareStrategy)
+ {
+ ProcessedInformationEntry validationTargetEntry =
+ resolveTargetForCrossComponentValidation(crossValidationStorageEntry, validationTarget);
+
+ if(validationTargetEntry != null)
+ {
+ processCrossComponentValidation(compareStrategy, crossValidationStorageEntry, validationTargetEntry);
+ }
+ else
+ {
+ processModelAwareCrossValidation(compareStrategy, crossValidationStorageEntry, validationTarget);
+ }
+
+ return true;
+ }
+
+ private ProcessedInformationEntry resolveTargetForCrossComponentValidation(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ ValueBindingExpression validationTarget)
+ {
+ Map<String, ProcessedInformationEntry> keyConvertedValueMapping =
+ CrossValidationUtils.getOrInitKeyToConvertedValueMapping();
+
+ return CrossValidationUtils.resolveValidationTargetEntry(
+ keyConvertedValueMapping,
+ CrossValidationUtils.convertValueBindingExpressionToProcessedInformationKey(validationTarget),
+ crossValidationStorageEntry);
+ }
+
+ private void processCrossComponentValidation(
+ AbstractCompareStrategy compareStrategy,
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ ProcessedInformationEntry validationTargetEntry)
+ {
+ CrossValidationHelper
+ .crossValidateCompareStrategy(
+ compareStrategy, crossValidationStorageEntry, validationTargetEntry, false);
+ }
+
+ private void processModelAwareCrossValidation(
+ AbstractCompareStrategy compareStrategy,
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ ValueBindingExpression validationTarget)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ Object targetValue = ExtValUtils.getELHelper().getValueOfExpression(facesContext, validationTarget);
+
+ ProcessedInformationEntry targetEntry = new ProcessedInformationEntry();
+ targetEntry.setBean(
+ ExtValUtils.getELHelper().getValueOfExpression(facesContext, validationTarget.getBaseExpression()));
+ targetEntry.setConvertedValue(targetValue);
+
+ CrossValidationHelper
+ .crossValidateCompareStrategy(compareStrategy, crossValidationStorageEntry, targetEntry, true);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/EqualsStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/EqualsStrategy.java
new file mode 100644
index 0000000..2d476ca
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/EqualsStrategy.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@SkipValidationSupport
+@UsageInformation(UsageCategory.INTERNAL)
+public class EqualsStrategy extends AbstractCompareStrategy
+{
+ public boolean useTargetComponentToDisplayErrorMsg(CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ return true;
+ }
+
+ protected String getValidationErrorMsgKey(Annotation annotation, boolean isTargetComponent)
+ {
+ return ((Equals) annotation).validationErrorMsgKey();
+ }
+
+ public boolean isViolation(Object object1, Object object2, Annotation annotation)
+ {
+ return object1 != null && !object1.equals(object2);
+ }
+
+ public String[] getValidationTargets(Annotation annotation)
+ {
+ return ((Equals) annotation).value();
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/LocalCompareStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/LocalCompareStrategy.java
new file mode 100644
index 0000000..1d8d98c
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/LocalCompareStrategy.java
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.ProcessedInformationEntry;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorage;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.util.CrossValidationUtils;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Map;
+import java.lang.reflect.Method;
+
+/**
+ * "[property_name]" ... local validation -> cross-component, but no cross-entity validation
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class LocalCompareStrategy implements ReferencingStrategy
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public boolean evaluateReferenceAndValidate(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String validationTarget, AbstractCompareStrategy compareStrategy)
+ {
+ if(validationTarget.contains("."))
+ {
+ //LocalPropertyChainCompareStrategy will continue
+ return false;
+ }
+
+ return tryToValidateLocally(
+ crossValidationStorageEntry,
+ crossValidationStorage,
+ validationTarget,
+ compareStrategy);
+ }
+
+ protected boolean tryToValidateLocally(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String targetKey,
+ AbstractCompareStrategy compareStrategy)
+ {
+ Map<String, ProcessedInformationEntry> keyConvertedValueMapping =
+ CrossValidationUtils.getOrInitKeyToConvertedValueMapping();
+
+ boolean isModelAwareValidation =
+ isModelAwareCrossValidation(crossValidationStorageEntry, keyConvertedValueMapping, targetKey);
+
+ String targetProperty = targetKey;
+
+ String sourceKey = resolveSourceKey(crossValidationStorageEntry);
+ targetKey = sourceKey.substring(0, sourceKey.lastIndexOf(".") + 1) + targetKey;
+
+ ProcessedInformationEntry validationTargetEntry = CrossValidationUtils.resolveValidationTargetEntry(
+ keyConvertedValueMapping, targetKey, crossValidationStorageEntry);
+
+ if (validationTargetEntry != null && validationTargetEntry.getComponent() != null && !isModelAwareValidation)
+ {
+ processCrossComponentValidation(compareStrategy, crossValidationStorageEntry, validationTargetEntry);
+ }
+ //no target - because there is no target component - value was validated against the model
+ else if(isModelAwareValidation)
+ {
+ processModelAwareCrossValidation(compareStrategy, crossValidationStorageEntry, targetProperty);
+ }
+ else
+ {
+ unsupportedCase(crossValidationStorageEntry);
+ }
+
+ return true;
+ }
+
+ protected String createTargetKey(CrossValidationStorageEntry crossValidationStorageEntry, String targetKey)
+ {
+ //no real value binding expression
+ //ValueBindingExpression just hepls to replace the property of the key
+ //here only dot-notation is allowed -> no problem
+ ValueBindingExpression baseExpression =
+ new ValueBindingExpression("#{" + crossValidationStorageEntry.getMetaDataEntry()
+ .getProperty(PropertyInformationKeys.PROPERTY_DETAILS,
+ PropertyDetails.class).getKey() + "}");
+
+ String result = ValueBindingExpression.replaceOrAddProperty(baseExpression, targetKey)
+ .getExpressionString();
+ return result.substring(2, result.length() -1);
+ }
+
+ protected Object getValueOfProperty(Object base, String property)
+ {
+ property = property.substring(0,1).toUpperCase() + property.substring(1, property.length());
+ Method targetMethod = ReflectionUtils.tryToGetMethod(base.getClass(), "get" + property);
+
+ if(targetMethod == null)
+ {
+ targetMethod = ReflectionUtils.tryToGetMethod(base.getClass(), "is" + property);
+ }
+
+ if(targetMethod == null)
+ {
+ throw new IllegalStateException(
+ "class " + base.getClass() + " has no public get/is " + property.toLowerCase());
+ }
+ return ReflectionUtils.tryToInvokeMethod(base, targetMethod);
+ }
+
+ private boolean isModelAwareCrossValidation(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ Map<String, ProcessedInformationEntry> keyConvertedValueMapping,
+ String targetKey)
+ {
+ String newKey = createTargetKey(crossValidationStorageEntry, targetKey);
+
+ return !keyConvertedValueMapping.containsKey(newKey);
+
+ }
+
+ private String resolveSourceKey(CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ PropertyDetails propertyDetails = crossValidationStorageEntry.getMetaDataEntry()
+ .getProperty(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);
+
+ String sourceKey = propertyDetails.getKey();
+
+ if(!sourceKey.contains("."))
+ {
+ throw new IllegalStateException("source path: " + sourceKey + " invalid");
+ }
+
+ return sourceKey;
+ }
+
+ private void unsupportedCase(CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("couldn't find converted object for " + crossValidationStorageEntry.getMetaDataEntry()
+ .getProperty(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class).getKey());
+ }
+ }
+
+ private void processCrossComponentValidation(
+ AbstractCompareStrategy compareStrategy,
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ ProcessedInformationEntry validationTargetEntry)
+ {
+ CrossValidationHelper
+ .crossValidateCompareStrategy(
+ compareStrategy, crossValidationStorageEntry, validationTargetEntry, false);
+ }
+
+ private void processModelAwareCrossValidation(
+ AbstractCompareStrategy compareStrategy,
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ String targetProperty)
+ {
+ ProcessedInformationEntry targetEntry = new ProcessedInformationEntry();
+
+ targetEntry.setBean(
+ crossValidationStorageEntry.getMetaDataEntry()
+ .getProperty(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class).getBaseObject());
+ targetEntry
+ .setConvertedValue(getValueOfProperty(targetEntry.getBean(), targetProperty));
+
+ CrossValidationHelper
+ .crossValidateCompareStrategy(compareStrategy, crossValidationStorageEntry, targetEntry, true);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/LocalPropertyChainCompareStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/LocalPropertyChainCompareStrategy.java
new file mode 100644
index 0000000..27af4ba
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/LocalPropertyChainCompareStrategy.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorage;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.crossval.ProcessedInformationEntry;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.CrossValidationUtils;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+
+import java.lang.annotation.Annotation;
+import java.util.Map;
+
+/**
+ * "[local_property.property1.property2]"
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class LocalPropertyChainCompareStrategy extends LocalCompareStrategy
+{
+ @Override
+ public boolean evaluateReferenceAndValidate(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String validationTarget, AbstractCompareStrategy compareStrategy)
+ {
+ if(!validationTarget.contains("."))
+ {
+ //not supported - TODO add logging
+ return false;
+ }
+
+ return tryToValidateLocally(
+ crossValidationStorageEntry,
+ crossValidationStorage,
+ validationTarget,
+ compareStrategy);
+ }
+
+ @Override
+ protected boolean tryToValidateLocally(CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String targetKey,
+ AbstractCompareStrategy compareStrategy)
+ {
+ Map<String, ProcessedInformationEntry> keyConvertedValueMapping =
+ CrossValidationUtils.getOrInitKeyToConvertedValueMapping();
+
+ String newKey = createTargetKey(crossValidationStorageEntry, targetKey);
+
+ if (keyConvertedValueMapping.containsKey(newKey))
+ {
+ ProcessedInformationEntry validationTargetEntry = keyConvertedValueMapping.get(newKey);
+
+ processCrossComponentValidation(compareStrategy, crossValidationStorageEntry, validationTargetEntry);
+ }
+ //no target - because there is no target component - value was validated against the model
+ else
+ {
+ processModelAwareCrossValidation(compareStrategy, crossValidationStorageEntry, targetKey);
+ }
+
+ return true;
+ }
+
+ private void processCrossComponentValidation(
+ AbstractCompareStrategy compareStrategy,
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ ProcessedInformationEntry targetInformationEntry)
+ {
+ if (compareStrategy.isViolation(
+ crossValidationStorageEntry.getConvertedObject(),
+ targetInformationEntry.getConvertedValue(),
+ crossValidationStorageEntry.getMetaDataEntry().getValue(Annotation.class)))
+ {
+ CrossValidationStorageEntry tmpCrossValidationStorageEntry = new CrossValidationStorageEntry();
+ tmpCrossValidationStorageEntry.setComponent(crossValidationStorageEntry.getComponent());
+ tmpCrossValidationStorageEntry.setClientId(targetInformationEntry.getClientId());
+ tmpCrossValidationStorageEntry.setConvertedObject(targetInformationEntry.getConvertedValue());
+ tmpCrossValidationStorageEntry.setValidationStrategy(compareStrategy);
+
+ //process after violation
+ //just add messages
+ if(crossValidationStorageEntry.getComponent() != null)
+ {
+ compareStrategy.processTargetComponentAfterViolation(
+ crossValidationStorageEntry, tmpCrossValidationStorageEntry);
+ }
+ else
+ {
+ compareStrategy.processTargetComponentAfterViolation(crossValidationStorageEntry, null);
+ }
+
+ //thow exception
+ compareStrategy.processSourceComponentAfterViolation(crossValidationStorageEntry);
+ }
+ }
+
+ private void processModelAwareCrossValidation(
+ AbstractCompareStrategy compareStrategy,
+ CrossValidationStorageEntry crossValidationStorageEntry, String targetKey)
+ {
+ PropertyDetails propertyDetails = crossValidationStorageEntry.getMetaDataEntry()
+ .getProperty(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);
+
+ Object newBase = ReflectionUtils
+ .getBaseOfPropertyChain(propertyDetails.getBaseObject(), targetKey);
+
+ if(targetKey.contains("."))
+ {
+ //find the last property
+ targetKey = targetKey.substring(targetKey.lastIndexOf(".") + 1, targetKey.length());
+ }
+
+ Object targetValue = getValueOfProperty(newBase, targetKey);
+
+ ProcessedInformationEntry targetEntry = new ProcessedInformationEntry();
+ targetEntry.setBean(newBase);
+ targetEntry.setConvertedValue(targetValue);
+
+ CrossValidationHelper
+ .crossValidateCompareStrategy(
+ compareStrategy, crossValidationStorageEntry, targetEntry, true);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/NotEqualsStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/NotEqualsStrategy.java
new file mode 100644
index 0000000..dd15e20
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/NotEqualsStrategy.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.NotEquals;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@SkipValidationSupport
+@UsageInformation(UsageCategory.INTERNAL)
+public class NotEqualsStrategy extends EqualsStrategy
+{
+ @Override
+ protected String getValidationErrorMsgKey(Annotation annotation, boolean isTargetComponent)
+ {
+ return ((NotEquals) annotation).validationErrorMsgKey();
+ }
+
+ @Override
+ public boolean isViolation(Object object1, Object object2,
+ Annotation annotation)
+ {
+ return !super.isViolation(object1, object2, annotation);
+ }
+
+ @Override
+ public String[] getValidationTargets(Annotation annotation)
+ {
+ return ((NotEquals) annotation).value();
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/ReferencingStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/ReferencingStrategy.java
new file mode 100644
index 0000000..ee36dfa
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/ReferencingStrategy.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorage;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * Internal interface to allow multiple referencing strategies for cross component validation.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+interface ReferencingStrategy
+{
+ boolean evaluateReferenceAndValidate(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String validationTarget,
+ AbstractCompareStrategy abstractCompareStrategy);
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/RequiredIfStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/RequiredIfStrategy.java
new file mode 100644
index 0000000..6d05a5f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/RequiredIfStrategy.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.crossval.annotation.RequiredIf;
+import org.apache.myfaces.extensions.validator.crossval.annotation.RequiredIfType;
+import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.AbstractValidationErrorMessageResolver;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.validator.ValidatorException;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@SkipValidationSupport
+@UsageInformation(UsageCategory.INTERNAL)
+public class RequiredIfStrategy extends AbstractCompareStrategy
+{
+ private boolean useFacesBundle = false;
+
+ public boolean useTargetComponentToDisplayErrorMsg(CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ return false;
+ }
+
+ @Override
+ protected String resolveMessage(String key)
+ {
+ String result = super.resolveMessage(key);
+ String marker = AbstractValidationErrorMessageResolver.MISSING_RESOURCE_MARKER;
+
+ if((marker + key + marker).equals(result))
+ {
+ this.useFacesBundle = true;
+ }
+
+ return result;
+ }
+
+ protected String getValidationErrorMsgKey(Annotation annotation, boolean isTargetComponent)
+ {
+ return ((RequiredIf) annotation).validationErrorMsgKey();
+ }
+
+ public boolean isViolation(Object object1, Object object2, Annotation annotation)
+ {
+ boolean violationFound = false;
+
+ if (((RequiredIf) annotation).is().equals(RequiredIfType.empty))
+ {
+ violationFound = (object2 == null || object2.equals("")) && (object1 == null || object1.equals(""));
+ }
+ else if (((RequiredIf) annotation).is().equals(RequiredIfType.not_empty))
+ {
+ violationFound = (object2 != null && !object2.equals("")) && (object1 == null || object1.equals(""));
+ }
+
+ return violationFound;
+ }
+
+ public String[] getValidationTargets(Annotation annotation)
+ {
+ return ((RequiredIf) annotation).valueOf();
+ }
+
+ @Override
+ protected boolean processAfterCrossValidatorException(
+ CrossValidationStorageEntry crossValidationStorageEntry, ValidatorException validatorException)
+ {
+ if(this.useFacesBundle)
+ {
+ ExtValUtils.replaceWithDefaultRequiredMessage(validatorException.getFacesMessage());
+ }
+
+ return super.processAfterCrossValidatorException(crossValidationStorageEntry, validatorException);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/jpa_strategy_mappings.properties b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/jpa_strategy_mappings.properties
new file mode 100644
index 0000000..c7d9929
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/jpa_strategy_mappings.properties
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+javax.persistence.Column=org.apache.myfaces.extensions.validator.baseval.strategy.JpaValidationStrategy
+javax.persistence.Basic=org.apache.myfaces.extensions.validator.baseval.strategy.JpaValidationStrategy
+javax.persistence.Id=org.apache.myfaces.extensions.validator.baseval.strategy.JpaValidationStrategy
+javax.persistence.OneToOne=org.apache.myfaces.extensions.validator.baseval.strategy.JpaValidationStrategy
+javax.persistence.ManyToOne=org.apache.myfaces.extensions.validator.baseval.strategy.JpaValidationStrategy
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/util/CrossValidationUtils.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/util/CrossValidationUtils.java
new file mode 100644
index 0000000..8d3c3ad
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/util/CrossValidationUtils.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.util;
+
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorage;
+import org.apache.myfaces.extensions.validator.crossval.ProcessedInformationEntry;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
+
+import javax.faces.context.FacesContext;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class CrossValidationUtils
+{
+ public static final String CROSS_VALIDATION_STORAGE_KEY = CrossValidationStorage.class.getName();
+
+ public static CrossValidationStorage getOrInitCrossValidationStorage()
+ {
+ Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+
+ if (!requestMap.containsKey(CROSS_VALIDATION_STORAGE_KEY))
+ {
+ resetCrossValidationStorage();
+ }
+
+ return (CrossValidationStorage) requestMap.get(CROSS_VALIDATION_STORAGE_KEY);
+ }
+
+ public static void resetCrossValidationStorage()
+ {
+ FacesContext
+ .getCurrentInstance()
+ .getExternalContext()
+ .getRequestMap()
+ .put(CROSS_VALIDATION_STORAGE_KEY, new CrossValidationStorage());
+ }
+
+ public static final String KEY_TO_CONVERTED_VALUE_MAPPING_KEY = CrossValidationUtils.class.getName();
+
+ public static Map<String, ProcessedInformationEntry> getOrInitKeyToConvertedValueMapping()
+ {
+ Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+
+ if (!requestMap.containsKey(KEY_TO_CONVERTED_VALUE_MAPPING_KEY))
+ {
+ resetKeyToConvertedValueMapping();
+ }
+
+ return (Map<String, ProcessedInformationEntry>) requestMap.get(KEY_TO_CONVERTED_VALUE_MAPPING_KEY);
+ }
+
+ public static void resetKeyToConvertedValueMapping()
+ {
+ FacesContext.getCurrentInstance().getExternalContext().getRequestMap()
+ .put(KEY_TO_CONVERTED_VALUE_MAPPING_KEY, new HashMap<String, ProcessedInformationEntry>());
+ }
+
+ public static ProcessedInformationEntry resolveValidationTargetEntry(
+ Map<String, ProcessedInformationEntry> keyToConvertedValueMapping,
+ String targetKey, CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ ProcessedInformationEntry processedInformationEntry =
+ keyToConvertedValueMapping.get(targetKey);
+
+ //value not submitted at this request - use model value (validation against the model)
+ if(processedInformationEntry == null)
+ {
+ return null;
+ }
+
+ //simple case
+ if (processedInformationEntry.getFurtherEntries() == null)
+ {
+ return processedInformationEntry;
+ }
+
+ PropertyDetails propertyDetails = crossValidationStorageEntry.getMetaDataEntry()
+ .getProperty(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);
+
+ Object targetBean = propertyDetails.getBaseObject();
+
+ //process complex component entries (e.g. a table)
+ //supported: cross-component but no cross-entity validation (= locale validation)
+ if (processedInformationEntry.getBean().equals(targetBean))
+ {
+ return processedInformationEntry;
+ }
+
+ for (ProcessedInformationEntry entry : processedInformationEntry.getFurtherEntries())
+ {
+ if (entry.getBean().equals(targetBean))
+ {
+ return entry;
+ }
+ }
+
+ return null;
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "support for map syntax")
+ public static String convertValueBindingExpressionToProcessedInformationKey(ValueBindingExpression vbe)
+ {
+ return vbe.getExpressionString().replace("#{", "").replace("}", "");
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/resources/LICENSE.txt b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/resources/LICENSE.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/resources/NOTICE.txt b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/main/resources/NOTICE.txt
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/site/apt/index.apt b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/site/apt/index.apt
new file mode 100644
index 0000000..c339255
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/site/apt/index.apt
@@ -0,0 +1,10 @@
+ ------
+Apache MyFaces Extensions Property Validation Module
+ ------
+
+Apache MyFaces Extensions Property Validation Module Overview
+
+ MyFaces Extensions Validator Property Validation provides annotation based validation for bean properties.
+ It also provides JPA 1.0 based validation Support.
+
+ MyFaces Extensions Validator is compatible with JSF 1.1.x and JSF 1.2.x. Both versions require Java 1.5+
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/AbstractExValViewControllerTestCase.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/AbstractExValViewControllerTestCase.java
new file mode 100644
index 0000000..2fb1d90
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/AbstractExValViewControllerTestCase.java
@@ -0,0 +1,281 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test;
+
+import java.io.StringWriter;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Iterator;
+
+import javax.faces.FactoryFinder;
+import javax.faces.el.ValueBinding;
+import javax.faces.application.ApplicationFactory;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.render.RenderKit;
+import javax.faces.render.RenderKitFactory;
+import javax.el.ValueExpression;
+
+import junit.framework.TestCase;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.DefaultRenderKitWrapperFactory;
+import org.apache.myfaces.extensions.validator.core.startup.ExtValStartupListener;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationPhaseListener;
+import org.apache.myfaces.extensions.validator.test.crossval.MockValidationStrategyFactory;
+import org.apache.myfaces.extensions.validator.test.util.TestUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.test.mock.ExtValMockApplicationFactory;
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.PropertyValidationModuleStartupListener;
+import org.apache.myfaces.shared_impl.config.MyfacesConfig;
+import org.apache.shale.test.mock.MockApplication;
+import org.apache.shale.test.mock.MockExternalContext;
+import org.apache.shale.test.mock.MockFacesContext;
+import org.apache.shale.test.mock.MockFacesContextFactory;
+import org.apache.shale.test.mock.MockHttpServletRequest;
+import org.apache.shale.test.mock.MockHttpServletResponse;
+import org.apache.shale.test.mock.MockHttpSession;
+import org.apache.shale.test.mock.MockLifecycle;
+import org.apache.shale.test.mock.MockLifecycleFactory;
+import org.apache.shale.test.mock.MockRenderKit;
+import org.apache.shale.test.mock.MockResponseWriter;
+import org.apache.shale.test.mock.MockServletConfig;
+import org.apache.shale.test.mock.MockServletContext;
+import org.apache.shale.test.el.MockExpressionFactory;
+
+/**
+ * Abstract Shale Test base class, which sets up the JSF environment. If the test
+ * overrides <code>setUp()</code> and/or <code>tearDown()</code>, then those
+ * methods but call the overwitten method to insure a valid test environment.
+ */
+public abstract class AbstractExValViewControllerTestCase extends TestCase
+{
+ protected MockApplication application;
+ protected MockServletConfig config;
+ protected MockExternalContext externalContext;
+ protected MockFacesContext facesContext;
+ protected MockFacesContextFactory facesContextFactory;
+ protected MockLifecycle lifecycle;
+ protected MockLifecycleFactory lifecycleFactory;
+ protected RenderKit renderKit;
+ protected MockHttpServletRequest request;
+ protected MockHttpServletResponse response;
+ protected MockServletContext servletContext;
+ protected MockHttpSession session;
+ protected MockExpressionFactory expressionFactory;
+ private ClassLoader threadContextClassLoader;
+
+ /** Response Writer */
+ private MockResponseWriter writer;
+
+ /**
+ * Construct a new instance of the test.
+ *
+ * @param name Name of the test.
+ */
+ public AbstractExValViewControllerTestCase(String name)
+ {
+ super(name);
+ application = null;
+ config = null;
+ externalContext = null;
+ facesContext = null;
+ facesContextFactory = null;
+ lifecycle = null;
+ lifecycleFactory = null;
+ renderKit = null;
+ request = null;
+ response = null;
+ servletContext = null;
+ session = null;
+ expressionFactory = null;
+ threadContextClassLoader = null;
+ }
+
+ /**
+ * Setup the test environment, including the following:
+ * <ul>
+ * <li>Set the Application Map.</li>
+ * <li>Set a response writer</li>
+ * <li>Add Tomahawk's renderers to the faces context.</li>
+ * </ul>
+ */
+ protected void setUp() throws Exception
+ {
+ threadContextClassLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(new URLClassLoader(new URL[0], getClass().getClassLoader()));
+ servletContext = new MockServletContext();
+ //for testing the fallback
+ //servletContext.addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_EL_RESOLVER", "true");
+ servletContext.addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".CUSTOM_VALIDATION_STRATEGY_FACTORY", MockValidationStrategyFactory.class.getName());
+ config = new MockServletConfig(servletContext);
+ session = new MockHttpSession();
+ session.setServletContext(servletContext);
+ request = new MockHttpServletRequest(session);
+ request.setServletContext(servletContext);
+ response = new MockHttpServletResponse();
+ FactoryFinder.releaseFactories();
+ FactoryFinder.setFactory("javax.faces.application.ApplicationFactory", ExtValMockApplicationFactory.class.getName());
+ FactoryFinder.setFactory("javax.faces.context.FacesContextFactory", "org.apache.shale.test.mock.MockFacesContextFactory");
+ FactoryFinder.setFactory("javax.faces.lifecycle.LifecycleFactory", "org.apache.shale.test.mock.MockLifecycleFactory");
+ FactoryFinder.setFactory("javax.faces.render.RenderKitFactory", "org.apache.shale.test.mock.MockRenderKitFactory");
+ externalContext = new MockExternalContext(servletContext, request, response);
+ lifecycleFactory = (MockLifecycleFactory)FactoryFinder.getFactory("javax.faces.lifecycle.LifecycleFactory");
+ lifecycle = (MockLifecycle)lifecycleFactory.getLifecycle("DEFAULT");
+ facesContextFactory = (MockFacesContextFactory)FactoryFinder.getFactory("javax.faces.context.FacesContextFactory");
+ facesContext = (MockFacesContext)facesContextFactory.getFacesContext(servletContext, request, response, lifecycle);
+ externalContext = (MockExternalContext)facesContext.getExternalContext();
+ UIViewRoot root = new UIViewRoot();
+ root.setViewId("/viewId");
+ root.setRenderKitId("HTML_BASIC");
+ facesContext.setViewRoot(root);
+ ApplicationFactory applicationFactory = (ApplicationFactory)FactoryFinder.getFactory("javax.faces.application.ApplicationFactory");
+ application = (MockApplication)applicationFactory.getApplication();
+ facesContext.setApplication(application);
+ RenderKitFactory renderKitFactory = (RenderKitFactory)FactoryFinder.getFactory("javax.faces.render.RenderKitFactory");
+ //Wrap renderers with proper exval wrapper
+ renderKit = new DefaultRenderKitWrapperFactory().create(new MockRenderKit());
+ renderKitFactory.addRenderKit("HTML_BASIC", renderKit);
+
+ // additional setup not provided automatically by the shale mock stuff
+ facesContext.getExternalContext().getApplicationMap().put(MyfacesConfig.class.getName(), new MyfacesConfig());
+ writer = new MockResponseWriter(new StringWriter(), null, null);
+ facesContext.setResponseWriter(writer);
+
+ TestUtils.addDefaultRenderers(facesContext);
+ TestUtils.addDefaultValidators(facesContext);
+
+ expressionFactory = (MockExpressionFactory)application.getExpressionFactory();
+
+ //execute startup listener
+ new ExtValStartupListener() {
+ @Override
+ protected void init()
+ {
+ super.init();
+ }
+ }.init();
+
+ new PropertyValidationModuleStartupListener(){
+ @Override
+ protected void init()
+ {
+ super.init();
+ }
+ }.init();
+ }
+
+ /**
+ * Tear down the test environment.
+ */
+ protected void tearDown() throws Exception
+ {
+ application = null;
+ config = null;
+ externalContext = null;
+ facesContext.release();
+ facesContext = null;
+ lifecycle = null;
+ lifecycleFactory = null;
+ renderKit = null;
+ request = null;
+ response = null;
+ servletContext = null;
+ session = null;
+ FactoryFinder.releaseFactories();
+ Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+ expressionFactory = null;
+ threadContextClassLoader = null;
+ }
+
+ protected void processCrossValValidation()
+ {
+ new CrossValidationPhaseListener().afterPhase(new PhaseEvent((FacesContext)facesContext,PhaseId.ANY_PHASE,lifecycle));
+ }
+
+ protected void checkMessageCount(int expected)
+ {
+ int actual = 0;
+ for(Iterator messages = facesContext.getMessages(); messages.hasNext();)
+ {
+ messages.next();
+ actual++;
+ }
+
+ assertEquals("Complete message count", expected, actual);
+ }
+
+ protected void checkMessageCount(String clientId, int expected)
+ {
+ int actual = 0;
+ for(Iterator messages = facesContext.getMessages(clientId); messages.hasNext();)
+ {
+ messages.next();
+ actual++;
+ }
+
+ assertEquals("Complete message count", expected, actual);
+ }
+
+ /**
+ * Verify the following:
+ * <ul>
+ * <li>id is not null</li>
+ * <li>Response is complete</li>
+ * <li>Responce contains the id</li>
+ * </ul>
+ *
+ * @param id ID to verify
+ */
+ protected void assertIdExists(String id)
+ {
+ assertNotNull("ID is not null", id);
+ assertTrue("Response Complete", facesContext.getResponseComplete());
+ String output = writer.getWriter().toString();
+ assertNotNull("Has output", output);
+ assertTrue("Contains id '" + id + "'", output.indexOf(id) != -1);
+ }
+
+ protected void createValueBinding(UIInput uiInput, String name, String expression)
+ {
+ ValueBinding valueBinding = application.createValueBinding(expression);
+ ValueExpression valueExpression = expressionFactory.createValueExpression(
+ facesContext.getELContext(), expression, Object.class);
+
+ if(uiInput != null)
+ {
+ uiInput.setValueBinding(name, valueBinding);
+ uiInput.setValueExpression(name, valueExpression);
+ }
+ }
+
+ protected void createRequestScopedBean(String name, Object instance)
+ {
+ createValueBinding(null, "value", "#{" + name + "}");
+ facesContext.getExternalContext().getRequestMap().put(name, instance);
+ }
+
+ protected <T> T resolveBean(String name, Class<T> targetClass)
+ {
+ return (T)ExtValUtils.getELHelper().getBean(name);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/BaseValTestBean.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/BaseValTestBean.java
new file mode 100644
index 0000000..8bf847f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/BaseValTestBean.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.baseval;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.DoubleRange;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Length;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Pattern;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+/**
+ * @author Leonardo Uribe
+ */
+public class BaseValTestBean
+{
+ @Required
+ private String name;
+
+ @Length(minimum=2,maximum=3)
+ private String name1;
+
+ @Pattern("[A-Z][a-z]+")
+ private String patternName;
+
+ @DoubleRange(minimum=-300d)
+ private Double doubleValue1;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName1()
+ {
+ return name1;
+ }
+
+ public void setName1(String name1)
+ {
+ this.name1 = name1;
+ }
+
+ public String getPatternName()
+ {
+ return patternName;
+ }
+
+ public void setPatternName(String patternName)
+ {
+ this.patternName = patternName;
+ }
+
+ public Double getDoubleValue1()
+ {
+ return doubleValue1;
+ }
+
+ public void setDoubleValue1(Double doubleValue1)
+ {
+ this.doubleValue1 = doubleValue1;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/BaseValTestCase.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/BaseValTestCase.java
new file mode 100644
index 0000000..3c96a24
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/BaseValTestCase.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.baseval;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.el.ValueBinding;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.myfaces.extensions.validator.test.AbstractExValViewControllerTestCase;
+
+/**
+ * @author Leonardo Uribe
+ */
+public class BaseValTestCase extends AbstractExValViewControllerTestCase
+{
+
+ HtmlInputText inputComponent = null;
+
+ UIViewRoot rootComponent = null;
+
+ BaseValTestBean bean = null;
+
+ public BaseValTestCase(String name)
+ {
+ super(name);
+ inputComponent = null;
+ rootComponent = null;
+ bean = null;
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(BaseValTestCase.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ bean = new BaseValTestBean();
+ ValueBinding vb = application.createValueBinding("#{testBean}");
+ facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+ rootComponent = new UIViewRoot();
+ HtmlForm form = new HtmlForm();
+ form.setId("form");
+ rootComponent.getChildren().add(form);
+ inputComponent = new HtmlInputText();
+ form.getChildren().add(inputComponent);
+ inputComponent.setId("input1");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ inputComponent = null;
+ rootComponent = null;
+ bean = null;
+ }
+
+ public void testNameRequiredFail() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.name}");
+
+ inputComponent.setSubmittedValue("");
+
+ inputComponent.validate(facesContext);
+
+ assertFalse(inputComponent.isValid());
+ checkMessageCount(1);
+ }
+
+ public void testName1LenghtMaxFail() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.name1}");
+
+ //decode
+ inputComponent.setSubmittedValue("12345");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertFalse(inputComponent.isValid());
+ checkMessageCount(1);
+ }
+
+ public void testName1LenghtCorrect() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.name1}");
+
+ //decode
+ inputComponent.setSubmittedValue("1d3");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertTrue(inputComponent.isValid());
+ checkMessageCount(0);
+ }
+
+ public void testName1LenghtMinFail() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.name1}");
+
+ //decode
+ inputComponent.setSubmittedValue("x");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertFalse(inputComponent.isValid());
+ checkMessageCount(1);
+ }
+
+ public void testPatternNameFail() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.patternName}");
+
+ //decode
+ inputComponent.setSubmittedValue("Peter1");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertFalse(inputComponent.isValid());
+ checkMessageCount(1);
+ }
+
+ public void testPatternNameCorrect() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.patternName}");
+
+ //decode
+ inputComponent.setSubmittedValue("Peter");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertTrue(inputComponent.isValid());
+ checkMessageCount(0);
+ }
+
+ public void testDoubleValueFail() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.doubleValue1}");
+
+ //decode
+ inputComponent.setSubmittedValue("-301");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertFalse(inputComponent.isValid());
+ checkMessageCount(1);
+ }
+
+ public void testDoubleValueCorrect() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.doubleValue1}");
+
+ //decode
+ inputComponent.setSubmittedValue("200");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertTrue(inputComponent.isValid());
+ checkMessageCount(0);
+ assertEquals(200d, inputComponent.getValue());
+
+ inputComponent.updateModel(facesContext);
+ assertEquals(200d, bean.getDoubleValue1());
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/CrossValTestBean.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/CrossValTestBean.java
new file mode 100644
index 0000000..026b7c2
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/CrossValTestBean.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+
+/**
+ * @author Leonardo Uribe
+ */
+public class CrossValTestBean
+{
+
+ private String property1;
+
+ @Equals("property1")
+ private String property2;
+
+ public String getProperty1()
+ {
+ return property1;
+ }
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+ public String getProperty2()
+ {
+ return property2;
+ }
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/CrossValTestCase.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/CrossValTestCase.java
new file mode 100644
index 0000000..d8e8085
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/CrossValTestCase.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.myfaces.extensions.validator.test.AbstractExValViewControllerTestCase;
+
+/**
+ * @author Leonardo Uribe
+ */
+public class CrossValTestCase extends AbstractExValViewControllerTestCase
+{
+
+ HtmlInputText inputComponent1 = null;
+ HtmlInputText inputComponent2 = null;
+
+ UIViewRoot rootComponent = null;
+
+ public CrossValTestCase(String name)
+ {
+ super(name);
+ inputComponent1 = null;
+ inputComponent2 = null;
+ rootComponent = null;
+ }
+
+ public static Test suite() {
+ return new TestSuite(CrossValTestCase.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ CrossValTestBean bean = new CrossValTestBean();
+ createValueBinding(null, "value", "#{testBean}");
+ facesContext.getExternalContext().getRequestMap().put("testBean",bean);
+
+ rootComponent = new UIViewRoot();
+ HtmlForm form = new HtmlForm();
+ form.setId("form");
+ rootComponent.getChildren().add(form);
+ inputComponent1 = new HtmlInputText();
+ form.getChildren().add(inputComponent1);
+ inputComponent1.setId("input1");
+ inputComponent2 = new HtmlInputText();
+ form.getChildren().add(inputComponent2);
+ inputComponent2.setId("input2");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testEqualsCorrect() throws Exception
+ {
+ createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+ createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+ //decode
+ inputComponent1.setSubmittedValue("1d3");
+ inputComponent2.setSubmittedValue("1d3");
+
+ //validate
+ inputComponent1.validate(facesContext);
+ inputComponent2.validate(facesContext);
+
+ processCrossValValidation();
+ checkMessageCount(0);
+
+ //no update model needed
+ }
+
+ public void testEqualsFail() throws Exception
+ {
+ createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+ createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+ //decode
+ inputComponent1.setSubmittedValue("1d3");
+ inputComponent2.setSubmittedValue("1d4");
+
+ //validate
+ inputComponent1.validate(facesContext);
+ inputComponent2.validate(facesContext);
+
+
+ processCrossValValidation();
+ checkMessageCount(2);
+
+ //no update model needed
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/ELCrossValReverseMessageTestCase.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/ELCrossValReverseMessageTestCase.java
new file mode 100644
index 0000000..af1f678
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/ELCrossValReverseMessageTestCase.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticInMemoryConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.test.util.MethodUtils;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ELCrossValReverseMessageTestCase extends ELCrossValTestCase
+{
+ public ELCrossValReverseMessageTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ELCrossValReverseMessageTestCase.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ StaticInMemoryConfiguration config = new StaticInMemoryConfiguration();
+
+ config.addMapping(Equals.class.getName(), MockEqualsValidationStrategy.class.getName());
+ ExtValContext.getContext().addStaticConfiguration(StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG, config);
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationCorrect() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationFailedValidation() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationCorrect();
+ assertFalse(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ }
+
+ public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationFailedValidation();
+ assertTrue(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ //1x getReverseErrorMessageSummary and 1x getReverseErrorMessageDetail
+ assertTrue(MethodUtils.checkMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage", 2));
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/ELCrossValTestCase.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/ELCrossValTestCase.java
new file mode 100644
index 0000000..17d8952
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/ELCrossValTestCase.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.convert.DateTimeConverter;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.myfaces.extensions.validator.test.AbstractExValViewControllerTestCase;
+
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ELCrossValTestCase extends AbstractExValViewControllerTestCase
+{
+ HtmlInputText inputComponent1 = null;
+ HtmlInputText inputComponent2 = null;
+
+ UIViewRoot rootComponent = null;
+
+ public ELCrossValTestCase(String name)
+ {
+ super(name);
+ inputComponent1 = null;
+ inputComponent2 = null;
+ rootComponent = null;
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ELCrossValTestCase.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ createRequestScopedBean("bean1", getEntityInstance());
+ createRequestScopedBean("bean2", getEntityInstance());
+
+
+ rootComponent = new UIViewRoot();
+ HtmlForm form = new HtmlForm();
+ form.setId("form");
+ rootComponent.getChildren().add(form);
+
+ //input1
+ inputComponent1 = new HtmlInputText();
+ inputComponent1.setId("input1");
+ inputComponent1.setConverter(new DateTimeConverter());
+ ((DateTimeConverter)inputComponent1.getConverter()).setPattern("dd.MM.yyyy");
+ form.getChildren().add(inputComponent1);
+
+ //input2
+ inputComponent2 = new HtmlInputText();
+ inputComponent2.setId("input2");
+ inputComponent2.setConverter(new DateTimeConverter());
+ ((DateTimeConverter)inputComponent2.getConverter()).setPattern("dd.MM.yyyy");
+ form.getChildren().add(inputComponent2);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testCrossComponentEqualsValidationCorrect() throws Exception
+ {
+ validateELCrossComponentValidationUseCase("14.05.1983", "14.05.1983", "14.05.1983", "14.05.1983");
+
+ checkMessageCount(0);
+ }
+
+ public void testCrossComponentEqualsValidationFailedValidation() throws Exception
+ {
+ validateELCrossComponentValidationUseCase("14.05.1983", "14.05.1983", "14.05.1983", "12.12.2008");
+
+ checkMessageCount(2);
+ }
+
+ private void validateELCrossComponentValidationUseCase(String valueBean1Property1, String valueBean1Property2, String valueBean2Property1, String valueBean2Property2)
+ {
+ createValueBinding(inputComponent1, "value", "#{bean1.date1}");
+ createValueBinding(inputComponent2, "value", "#{bean2.date2}");
+
+ //set model values
+ resolveBean("bean1", getEntityInstance().getClass()).setDate2((Date)inputComponent1.getConverter().getAsObject(facesContext, inputComponent1, valueBean1Property2));
+ resolveBean("bean2", getEntityInstance().getClass()).setDate1((Date)inputComponent2.getConverter().getAsObject(facesContext, inputComponent2, valueBean2Property1));
+
+
+ //decode
+ inputComponent1.setSubmittedValue(valueBean1Property1);
+ inputComponent2.setSubmittedValue(valueBean2Property2);
+
+ //validate
+ inputComponent1.validate(facesContext);
+ inputComponent2.validate(facesContext);
+
+ processCrossValValidation();
+
+ //no update model needed
+ }
+
+ public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+ {
+ validateELModelAwareCrossValidationUseCase("14.05.1983", "14.05.1983", "14.05.1983", "14.05.1983");
+
+ checkMessageCount(0);
+ }
+
+ public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+ {
+ validateELModelAwareCrossValidationUseCase("14.05.1983", "14.05.1983", "14.05.1983", "12.12.2008");
+
+ checkMessageCount(1);
+ }
+
+ private void validateELModelAwareCrossValidationUseCase(String valueBean1Property1, String valueBean1Property2, String valueBean2Property1, String valueBean2Property2)
+ {
+ createValueBinding(inputComponent1, "value", "#{bean1.date1}");
+
+ //set model values
+ resolveBean("bean1", getEntityInstance().getClass()).setDate2((Date)inputComponent1.getConverter().getAsObject(facesContext, inputComponent1, valueBean1Property2));
+ resolveBean("bean2", getEntityInstance().getClass()).setDate1((Date)inputComponent2.getConverter().getAsObject(facesContext, inputComponent2, valueBean2Property1));
+ resolveBean("bean2", getEntityInstance().getClass()).setDate2((Date)inputComponent2.getConverter().getAsObject(facesContext, inputComponent2, valueBean2Property2));
+
+
+ //decode
+ inputComponent1.setSubmittedValue(valueBean1Property1);
+
+ //validate
+ inputComponent1.validate(facesContext);
+
+ processCrossValValidation();
+
+ //no update model needed
+ }
+
+ protected ELCrossValTestDateBean getEntityInstance()
+ {
+ return new ELCrossValTestDateBean();
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/ELCrossValTestDateBean.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/ELCrossValTestDateBean.java
new file mode 100644
index 0000000..4a5f44b
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/ELCrossValTestDateBean.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ELCrossValTestDateBean
+{
+ private static final Date DEFAULT_DATE = new Date();
+
+ @Equals("#{bean2.date2}")
+ private Date date1 = DEFAULT_DATE;
+
+ private Date date2 = DEFAULT_DATE;
+
+ public Date getDate1()
+ {
+ return date1;
+ }
+
+ public void setDate1(Date date1)
+ {
+ this.date1 = date1;
+ }
+
+ public Date getDate2()
+ {
+ return date2;
+ }
+
+ public void setDate2(Date date2)
+ {
+ this.date2 = date2;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/LocalPropertyCrossValReverseMessageTestCase.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/LocalPropertyCrossValReverseMessageTestCase.java
new file mode 100644
index 0000000..59065d8
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/LocalPropertyCrossValReverseMessageTestCase.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticInMemoryConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+import org.apache.myfaces.extensions.validator.test.util.MethodUtils;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class LocalPropertyCrossValReverseMessageTestCase extends LocalPropertyCrossValTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(LocalPropertyCrossValReverseMessageTestCase.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ StaticInMemoryConfiguration config = new StaticInMemoryConfiguration();
+
+ config.addMapping(Equals.class.getName(), MockEqualsValidationStrategy.class.getName());
+ ExtValContext.getContext().addStaticConfiguration(StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG, config);
+ }
+
+ public LocalPropertyCrossValReverseMessageTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationCorrect() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationFailedValidation() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ @Override
+ public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationCorrect();
+ assertFalse(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ }
+
+ @Override
+ public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationFailedValidation();
+ assertTrue(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ //1x getReverseErrorMessageSummary and 1x getReverseErrorMessageDetail
+ assertTrue(MethodUtils.checkMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage", 2));
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/LocalPropertyCrossValTestCase.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/LocalPropertyCrossValTestCase.java
new file mode 100644
index 0000000..c6f13ab
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/LocalPropertyCrossValTestCase.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class LocalPropertyCrossValTestCase extends ELCrossValTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(LocalPropertyCrossValTestCase.class);
+ }
+
+ public LocalPropertyCrossValTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected ELCrossValTestDateBean getEntityInstance()
+ {
+ return new LocalPropertyCrossValTestDateBean();
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/LocalPropertyCrossValTestDateBean.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/LocalPropertyCrossValTestDateBean.java
new file mode 100644
index 0000000..eaa8909
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/LocalPropertyCrossValTestDateBean.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class LocalPropertyCrossValTestDateBean extends ELCrossValTestDateBean
+{
+ private static final Date DEFAULT_DATE = new Date();
+
+ @Equals("date2")
+ private Date date1 = DEFAULT_DATE;
+
+ private Date date2 = DEFAULT_DATE;
+
+ public Date getDate1()
+ {
+ return date1;
+ }
+
+ public void setDate1(Date date1)
+ {
+ this.date1 = date1;
+ }
+
+ public Date getDate2()
+ {
+ return date2;
+ }
+
+ public void setDate2(Date date2)
+ {
+ this.date2 = date2;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/MockEqualsValidationStrategy.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/MockEqualsValidationStrategy.java
new file mode 100644
index 0000000..9af9336
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/MockEqualsValidationStrategy.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.strategy.EqualsStrategy;
+import org.apache.myfaces.extensions.validator.test.util.MethodUtils;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class MockEqualsValidationStrategy extends EqualsStrategy
+{
+ public MockEqualsValidationStrategy()
+ {
+ MethodUtils.signalClassUsed(getClass());
+ }
+
+ @Override
+ protected String getReverseErrorMessageSummary(Annotation annotation)
+ {
+ MethodUtils.signalMethodCalled(getClass(), "reverseMessage");
+ return super.getReverseErrorMessageSummary(annotation);
+ }
+
+ @Override
+ protected String getReverseErrorMessageDetail(Annotation annotation)
+ {
+ MethodUtils.signalMethodCalled(getClass(), "reverseMessage");
+ return super.getReverseErrorMessageDetail(annotation);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/MockValidationStrategyFactory.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/MockValidationStrategyFactory.java
new file mode 100644
index 0000000..441f0fb
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/MockValidationStrategyFactory.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.DefaultValidationStrategyFactory;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class MockValidationStrategyFactory extends DefaultValidationStrategyFactory
+{
+ @Override
+ public ValidationStrategy create(String metaDataKey)
+ {
+ //force init so that every test-case setup method can add a mock validation strategy via extval java-api
+ ReflectionUtils.tryToInvokeMethod(this,ReflectionUtils.tryToGetMethod(getClass(), "initStaticMappings"));
+ return super.create(metaDataKey);
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValReverseMessageTestCase.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValReverseMessageTestCase.java
new file mode 100644
index 0000000..e693b4f
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValReverseMessageTestCase.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticInMemoryConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.test.util.MethodUtils;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class PropertyChainCrossValReverseMessageTestCase extends PropertyChainCrossValTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(PropertyChainCrossValReverseMessageTestCase.class);
+ }
+
+ public PropertyChainCrossValReverseMessageTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ StaticInMemoryConfiguration config = new StaticInMemoryConfiguration();
+
+ config.addMapping(Equals.class.getName(), MockEqualsValidationStrategy.class.getName());
+ ExtValContext.getContext().addStaticConfiguration(StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG, config);
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationCorrect() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationFailedValidation() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationCorrect();
+ assertFalse(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ }
+
+ public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationFailedValidation();
+ assertTrue(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ //1x getReverseErrorMessageSummary and 1x getReverseErrorMessageDetail
+ assertTrue(MethodUtils.checkMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage", 2));
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValTestCase.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValTestCase.java
new file mode 100644
index 0000000..3216dcd
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValTestCase.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.test.AbstractExValViewControllerTestCase;
+
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.UIViewRoot;
+import javax.faces.convert.DateTimeConverter;
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class PropertyChainCrossValTestCase extends AbstractExValViewControllerTestCase
+{
+ HtmlInputText inputComponent1 = null;
+ HtmlInputText inputComponent2 = null;
+
+ UIViewRoot rootComponent = null;
+
+ public static Test suite()
+ {
+ return new TestSuite(PropertyChainCrossValTestCase.class);
+ }
+
+ public PropertyChainCrossValTestCase(String name)
+ {
+ super(name);
+ inputComponent1 = null;
+ inputComponent2 = null;
+ rootComponent = null;
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ createRequestScopedBean("bean1", getEntityInstance());
+
+ rootComponent = new UIViewRoot();
+ HtmlForm form = new HtmlForm();
+ form.setId("form");
+ rootComponent.getChildren().add(form);
+
+ //input1
+ inputComponent1 = new HtmlInputText();
+ inputComponent1.setId("input1");
+ inputComponent1.setConverter(new DateTimeConverter());
+ ((DateTimeConverter)inputComponent1.getConverter()).setPattern("dd.MM.yyyy");
+ form.getChildren().add(inputComponent1);
+
+ //input2
+ inputComponent2 = new HtmlInputText();
+ inputComponent2.setId("input2");
+ inputComponent2.setConverter(new DateTimeConverter());
+ ((DateTimeConverter)inputComponent2.getConverter()).setPattern("dd.MM.yyyy");
+ form.getChildren().add(inputComponent2);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testCrossComponentEqualsValidationCorrect() throws Exception
+ {
+ validatePropertyChainCrossComponentValidationUseCase("14.05.1983", "14.05.1983");
+
+ checkMessageCount(0);
+ }
+
+ public void testCrossComponentEqualsValidationFailedValidation() throws Exception
+ {
+ validatePropertyChainCrossComponentValidationUseCase("14.05.1983", "12.12.2008");
+
+ checkMessageCount(2);
+ }
+
+ private void validatePropertyChainCrossComponentValidationUseCase(String valueBean1Property1, String valueBean2Property2)
+ {
+ createValueBinding(inputComponent1, "value", "#{bean1.date1}");
+ createValueBinding(inputComponent2, "value", "#{bean1.subBean.date2}");
+
+ //decode
+ inputComponent1.setSubmittedValue(valueBean1Property1);
+ inputComponent2.setSubmittedValue(valueBean2Property2);
+
+ //validate
+ inputComponent1.validate(facesContext);
+ inputComponent2.validate(facesContext);
+
+ processCrossValValidation();
+
+ //no update model needed
+ }
+
+ public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+ {
+ validateELModelAwareCrossValidationUseCase("14.05.1983", "14.05.1983");
+
+ checkMessageCount(0);
+ }
+
+ public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+ {
+ validateELModelAwareCrossValidationUseCase("14.05.1983", "12.12.2008");
+
+ checkMessageCount(1);
+ }
+
+ private void validateELModelAwareCrossValidationUseCase(String valueBean1Property1, String valueBean2Property1)
+ {
+ createValueBinding(inputComponent1, "value", "#{bean1.date1}");
+
+ //set model values
+ resolveBean("bean1", getEntityInstance().getClass()).getSubBean().setDate2((Date)inputComponent2.getConverter().getAsObject(facesContext, inputComponent2, valueBean2Property1));
+
+
+ //decode
+ inputComponent1.setSubmittedValue(valueBean1Property1);
+
+ //validate
+ inputComponent1.validate(facesContext);
+
+ processCrossValValidation();
+
+ //no update model needed
+ }
+
+ protected PropertyChainCrossValTestDateBean getEntityInstance()
+ {
+ return new PropertyChainCrossValTestDateBean();
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValTestDateBean.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValTestDateBean.java
new file mode 100644
index 0000000..1c21f25
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValTestDateBean.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class PropertyChainCrossValTestDateBean
+{
+ private static final Date DEFAULT_DATE = new Date();
+
+ @Equals("subBean.date2")
+ private Date date1 = DEFAULT_DATE;
+
+ private PropertyChainCrossValTestDateSubBean subBean = new PropertyChainCrossValTestDateSubBean();
+
+ public Date getDate1()
+ {
+ return date1;
+ }
+
+ public void setDate1(Date date1)
+ {
+ this.date1 = date1;
+ }
+
+ public PropertyChainCrossValTestDateSubBean getSubBean()
+ {
+ return subBean;
+ }
+
+ public void setSubBean(PropertyChainCrossValTestDateSubBean subBean)
+ {
+ this.subBean = subBean;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValTestDateSubBean.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValTestDateSubBean.java
new file mode 100644
index 0000000..ee853fc
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/crossval/PropertyChainCrossValTestDateSubBean.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.crossval;
+
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class PropertyChainCrossValTestDateSubBean
+{
+ private static final Date DEFAULT_DATE = new Date();
+
+ private Date date2 = DEFAULT_DATE;
+
+ public Date getDate2()
+ {
+ return date2;
+ }
+
+ public void setDate2(Date date2)
+ {
+ this.date2 = date2;
+ }
+}
\ No newline at end of file
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/el/ValueBindingExpressionTestCase.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/el/ValueBindingExpressionTestCase.java
new file mode 100644
index 0000000..943f5cd
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/el/ValueBindingExpressionTestCase.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.el;
+
+import org.apache.myfaces.extensions.validator.test.AbstractExValViewControllerTestCase;
+import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.2
+ */
+public class ValueBindingExpressionTestCase extends AbstractExValViewControllerTestCase
+{
+ public ValueBindingExpressionTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ValueBindingExpressionTestCase.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testStandardSyntax() throws Exception
+ {
+ ValueBindingExpression valueBindingExpression = new ValueBindingExpression("#{bean1.property1}");
+
+ assertEquals(valueBindingExpression.getExpressionString(), "#{bean1.property1}");
+ assertEquals(valueBindingExpression.getBaseExpression().getExpressionString(), "#{bean1}");
+ assertEquals(valueBindingExpression.getProperty(), "property1");
+
+ valueBindingExpression = new ValueBindingExpression("#{bean1['property1']}");
+
+ assertEquals(valueBindingExpression.getExpressionString(), "#{bean1['property1']}");
+ assertEquals(valueBindingExpression.getBaseExpression().getExpressionString(), "#{bean1}");
+ assertEquals(valueBindingExpression.getProperty(), "property1");
+
+ valueBindingExpression = new ValueBindingExpression("#{bean1['bean2'].property1}");
+
+ assertEquals(valueBindingExpression.getExpressionString(), "#{bean1['bean2'].property1}");
+ assertEquals(valueBindingExpression.getBaseExpression().getExpressionString(), "#{bean1['bean2']}");
+ assertEquals(valueBindingExpression.getBaseExpression().getBaseExpression().getExpressionString(), "#{bean1}");
+ assertEquals(valueBindingExpression.getProperty(), "property1");
+ }
+
+ public void testStandardSyntaxReplaceProperty() throws Exception
+ {
+ ValueBindingExpression valueBindingExpression = new ValueBindingExpression("#{bean1.property1}");
+
+ valueBindingExpression = ValueBindingExpression.replaceProperty(valueBindingExpression, "property2");
+
+ assertEquals(valueBindingExpression.getExpressionString(), "#{bean1.property2}");
+ assertEquals(valueBindingExpression.getBaseExpression().getExpressionString(), "#{bean1}");
+ assertEquals(valueBindingExpression.getProperty(), "property2");
+
+ valueBindingExpression = new ValueBindingExpression("#{bean1['property1']}");
+
+ valueBindingExpression = ValueBindingExpression.replaceProperty(valueBindingExpression, "property2");
+
+ //TODO restore original syntax
+ assertEquals(valueBindingExpression.getExpressionString(), "#{bean1.property2}");
+ assertEquals(valueBindingExpression.getBaseExpression().getExpressionString(), "#{bean1}");
+ assertEquals(valueBindingExpression.getProperty(), "property2");
+
+ valueBindingExpression = new ValueBindingExpression("#{bean1['bean2'].property1}");
+
+ valueBindingExpression = ValueBindingExpression.replaceProperty(valueBindingExpression, "property2");
+
+ assertEquals(valueBindingExpression.getExpressionString(), "#{bean1['bean2'].property2}");
+ assertEquals(valueBindingExpression.getBaseExpression().getExpressionString(), "#{bean1['bean2']}");
+ assertEquals(valueBindingExpression.getBaseExpression().getBaseExpression().getExpressionString(), "#{bean1}");
+ assertEquals(valueBindingExpression.getProperty(), "property2");
+ }
+
+ public void testStandardSyntaxAddProperty() throws Exception
+ {
+ ValueBindingExpression valueBindingExpression = new ValueBindingExpression("#{bean1.bean2}");
+
+ valueBindingExpression = ValueBindingExpression.addProperty(valueBindingExpression, "property1");
+
+ assertEquals(valueBindingExpression.getExpressionString(), "#{bean1.bean2.property1}");
+ assertEquals(valueBindingExpression.getBaseExpression().getExpressionString(), "#{bean1.bean2}");
+ assertEquals(valueBindingExpression.getProperty(), "property1");
+
+ valueBindingExpression = new ValueBindingExpression("#{bean1['bean2']}");
+
+ valueBindingExpression = ValueBindingExpression.addProperty(valueBindingExpression, "property1");
+
+ assertEquals(valueBindingExpression.getExpressionString(), "#{bean1['bean2'].property1}");
+ assertEquals(valueBindingExpression.getBaseExpression().getExpressionString(), "#{bean1['bean2']}");
+ assertEquals(valueBindingExpression.getProperty(), "property1");
+
+ valueBindingExpression = new ValueBindingExpression("#{bean1['bean2'].bean3}");
+
+ valueBindingExpression = ValueBindingExpression.addProperty(valueBindingExpression, "property1");
+
+ assertEquals(valueBindingExpression.getExpressionString(), "#{bean1['bean2'].bean3.property1}");
+ assertEquals(valueBindingExpression.getBaseExpression().getExpressionString(), "#{bean1['bean2'].bean3}");
+ assertEquals(valueBindingExpression
+ .getBaseExpression().getBaseExpression().getExpressionString(), "#{bean1['bean2']}");
+ assertEquals(valueBindingExpression.getProperty(), "property1");
+ }
+
+ public void testFaceletsCustomComponentSyntax() throws Exception
+ {
+ ValueBindingExpression valueBindingExpression = new ValueBindingExpression("#{entity[fieldName]}");
+
+ assertEquals(valueBindingExpression.getExpressionString(), "#{entity[fieldName]}");
+ assertEquals(valueBindingExpression.getBaseExpression().getExpressionString(), "#{entity}");
+ assertEquals(valueBindingExpression.getProperty(), "fieldName");
+ }
+
+ public void testFaceletsCustomComponentSyntaxReplaceProperty() throws Exception
+ {
+ ValueBindingExpression valueBindingExpression = new ValueBindingExpression("#{entity[fieldName]}");
+
+ valueBindingExpression = ValueBindingExpression.replaceProperty(valueBindingExpression, "newFieldName");
+
+ //TODO restore original syntax
+ assertEquals(valueBindingExpression.getExpressionString(), "#{entity.newFieldName}");
+ assertEquals(valueBindingExpression.getBaseExpression().getExpressionString(), "#{entity}");
+ assertEquals(valueBindingExpression.getProperty(), "newFieldName");
+ }
+
+ public void testComplexMapSyntax() throws Exception
+ {
+ ValueBindingExpression valueBindingExpression
+ = new ValueBindingExpression("#{bean1[bean2[bean3['key1']]].property1}");
+
+ //TODO
+ //assertEquals(valueBindingExpression.getExpressionString(), "#{bean1[bean2[bean3['key1']]].property1}");
+ assertEquals(valueBindingExpression.getProperty(), "property1");
+ }
+
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockApplication.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockApplication.java
new file mode 100644
index 0000000..75cbcd0
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockApplication.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.mock;
+
+import org.apache.shale.test.mock.MockApplication;
+
+import javax.el.ELContextListener;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.ELException;
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ExtValMockApplication extends MockApplication
+{
+ private Application wrapped;
+
+ public ExtValMockApplication()
+ {
+ super();
+ }
+
+ public ExtValMockApplication(Application application)
+ {
+ super();
+ this.wrapped = application;
+ }
+
+ @Override
+ public ELContextListener[] getELContextListeners()
+ {
+ return new ELContextListener[0];
+ }
+
+ @Override
+ public ELResolver getELResolver()
+ {
+ return this.wrapped.getELResolver();
+ }
+
+ @Override
+ public ExpressionFactory getExpressionFactory()
+ {
+ return new ExtValMockExpressionFactory();
+ }
+
+ @Override
+ public Object evaluateExpressionGet(FacesContext facesContext, String expression, Class aClass) throws ELException
+ {
+ return wrapped.evaluateExpressionGet(facesContext, expression, aClass);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockApplicationFactory.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockApplicationFactory.java
new file mode 100644
index 0000000..1c8c576
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockApplicationFactory.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.mock;
+
+import org.apache.shale.test.mock.MockApplicationFactory;
+
+import javax.faces.application.Application;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ExtValMockApplicationFactory extends MockApplicationFactory
+{
+ @Override
+ public Application getApplication()
+ {
+ return new ExtValMockApplication(super.getApplication());
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockExpressionFactory.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockExpressionFactory.java
new file mode 100644
index 0000000..119e233
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockExpressionFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.mock;
+
+import org.apache.shale.test.el.MockExpressionFactory;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ExtValMockExpressionFactory extends MockExpressionFactory
+{
+ @Override
+ public ValueExpression createValueExpression(ELContext context, String expression, Class expectedType)
+ {
+ return new ExtValMockValueExpression(expression, expectedType);
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockValueExpression.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockValueExpression.java
new file mode 100644
index 0000000..6bcc08a
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/mock/ExtValMockValueExpression.java
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.mock;
+
+import org.apache.myfaces.extensions.validator.core.el.ExtValELResolver;
+import org.apache.shale.test.el.MockValueExpression;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ */
+//TODO improve
+public class ExtValMockValueExpression extends MockValueExpression
+{
+ private String[] elements = null;
+ private String expression = null;
+
+ public ExtValMockValueExpression(String expression, Class expectedType)
+ {
+ super(expression, expectedType);
+
+ if (expression == null)
+ {
+ throw new NullPointerException("Expression string cannot be null");
+ }
+
+ this.expression = expression;
+ parse();
+ }
+
+ @Override
+ public Object getValue(ELContext context)
+ {
+ ELResolver resolver = context.getELResolver();
+
+ if (resolver instanceof ExtValELResolver)
+ {
+ return getBase(context, resolver);
+ }
+
+ return super.getValue(context);
+ }
+
+ @Override
+ public void setValue(ELContext context, Object value)
+ {
+ if (context.getELResolver() instanceof ExtValELResolver)
+ {
+ context.getELResolver().setValue(context, getValue(context), elements[elements.length - 1], null);
+ }
+ else
+ {
+ Object base = getBase(context, context.getELResolver());
+ String setter = "set" + createPropertyString();
+
+ try
+ {
+ Method setterMethod = base.getClass().getDeclaredMethod(setter, value != null ? value.getClass() : Object.class);
+ setterMethod.invoke(base, value);
+ }
+ catch (Throwable e)
+ {
+ throw new IllegalStateException();
+ }
+ }
+ }
+
+ @Override
+ public Class getType(ELContext context)
+ {
+ if (context == null)
+ {
+ throw new NullPointerException();
+ }
+
+ Object base = getBase(context, context.getELResolver());
+
+ if (base == null)
+ {
+ return null;
+ }
+ else
+ {
+ String getter = "get" + createPropertyString();
+
+ try
+ {
+ Method getterMethod = base.getClass().getDeclaredMethod(getter);
+ return getterMethod.getReturnType();
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new IllegalStateException();
+ }
+ }
+ }
+
+ private void parse()
+ {
+
+ if (isLiteralText())
+ {
+ elements = new String[0];
+ return;
+ }
+
+ if (expression.startsWith("${") || expression.startsWith("#{"))
+ {
+ if (expression.endsWith("}"))
+ {
+ List names = new ArrayList();
+ StringBuffer expr = new StringBuffer(expression.substring(2, expression.length() - 1).replaceAll(" ", ""));
+ boolean isBlockOn = false;
+ for (int i = expr.length() - 1; i > -1; i--)
+ {
+ if (expr.charAt(i) == ' ')
+ {
+ expr.deleteCharAt(i);
+ }
+ else if (expr.charAt(i) == ']')
+ {
+ expr.deleteCharAt(i);
+ }
+ else if (expr.charAt(i) == '[')
+ {
+ expr.deleteCharAt(i);
+ }
+ else if (expr.charAt(i) == '\'')
+ {
+ if (!isBlockOn)
+ {
+ expr.deleteCharAt(i);
+ }
+ else
+ {
+ names.add(0, expr.substring(i + 1));
+ expr.delete(i, expr.length());
+ }
+ isBlockOn = !isBlockOn;
+ }
+ else if (expr.charAt(i) == '.' && !isBlockOn)
+ {
+ names.add(0, expr.substring(i + 1));
+ expr.delete(i, expr.length());
+ }
+ }
+ if (expr.length() > 0)
+ {
+ names.add(0, expr.toString());
+ }
+
+ elements = (String[]) names.toArray(new String[names.size()]);
+ }
+ else
+ {
+ throw new IllegalArgumentException(expression);
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException(expression);
+ }
+
+ }
+
+ public Object getBase(ELContext context, ELResolver resolver)
+ {
+ Object base = null;
+ for (int i = 0; i < elements.length - 1; i++)
+ {
+ base = resolver.getValue(context, base, elements[i]);
+ }
+ return base;
+ }
+
+ private String createPropertyString()
+ {
+ String property = elements[elements.length - 1];
+ return property.substring(0, 1).toUpperCase() + property.substring(1, property.length());
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/util/MethodUtils.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/util/MethodUtils.java
new file mode 100644
index 0000000..4069fc7
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/util/MethodUtils.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.util;
+
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ */
+//TODO
+public class MethodUtils
+{
+ private MethodUtils()
+ {
+ }
+
+ public static boolean checkMethodCalled(Class usedClass, String methodName, int callCount)
+ {
+ checkRequiredClass(usedClass);
+
+ return callCount == getMethodCallCount(usedClass, methodName);
+ }
+
+ public static boolean isMethodCalled(Class usedClass, String methodName)
+ {
+ checkRequiredClass(usedClass);
+
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestMap()
+ .containsKey(usedClass.getName() + "#" + methodName);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public static void signalMethodCalled(Class usedClass, String methodName)
+ {
+ Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+
+ int methodCallCount = 0;
+ String key = usedClass.getName() + "#" + methodName;
+
+ if(requestMap.containsKey(key))
+ {
+ methodCallCount = (Integer)requestMap.get(key);
+ }
+
+ requestMap.put(key, ++methodCallCount);
+ }
+
+ private static int getMethodCallCount(Class usedClass, String methodName)
+ {
+ Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+
+ String key = usedClass.getName() + "#" + methodName;
+
+ if(requestMap.containsKey(key))
+ {
+ return (Integer)requestMap.get(key);
+ }
+
+ return 0;
+ }
+
+ public static void signalClassUsed(Class mockClass)
+ {
+ FacesContext.getCurrentInstance().getExternalContext().getRequestMap()
+ .put(mockClass.getName() + ":used", true);
+ }
+
+ public static boolean isClassUsed(Class mockClass)
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestMap()
+ .containsKey(mockClass.getName() + ":used");
+ }
+
+ private static void checkRequiredClass(Class usedClass)
+ {
+ if (!isClassUsed(usedClass))
+ {
+ throw new IllegalStateException(usedClass.getName() + " not used");
+ }
+ }
+}
diff --git a/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/util/TestUtils.java b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/util/TestUtils.java
new file mode 100644
index 0000000..3eed161
--- /dev/null
+++ b/1_2_2_prepare_rc_base/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/util/TestUtils.java
@@ -0,0 +1,280 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.extensions.validator.test.util;
+
+import java.io.IOException;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.render.RenderKit;
+import javax.faces.render.Renderer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public final class TestUtils
+{
+ /** Default Logger */
+ private static final Log log = LogFactory.getLog(TestUtils.class);
+
+ /** utility class, do not instantiate */
+ private TestUtils()
+ {
+ // utility class, disable instantiation
+ }
+
+ public static void addDefaultValidators(FacesContext facesContext)
+ {
+ addValidator(facesContext,"javax.faces.DoubleRange", "javax.faces.validator.DoubleRangeValidator");
+ addValidator(facesContext,"javax.faces.Length", "javax.faces.validator.LengthValidator");
+ addValidator(facesContext,"javax.faces.LongRange", "javax.faces.validator.LongRangeValidator");
+ }
+
+ public static void addValidator(FacesContext facesContext,
+ String validatorId, String validatorClass)
+ {
+ facesContext.getApplication().addValidator(validatorId, validatorClass);
+ }
+
+ /**
+ * Add all of JSF 1.2 default renderers. Currently this is not tied to
+ * faces-config.xml, so all change to the file MUST also be made here.
+ *
+ * @param facesContext
+ * @todo Do not add renderer if renderer is already added.
+ */
+ public static void addDefaultRenderers(FacesContext facesContext)
+ {
+ // Standard HTML Renderers
+ addRenderer(facesContext, "javax.faces.Command", "javax.faces.Button",
+ "org.apache.myfaces.renderkit.html.HtmlButtonRenderer");
+
+ addRenderer(facesContext, "javax.faces.SelectBoolean",
+ "javax.faces.Checkbox",
+ "org.apache.myfaces.renderkit.html.HtmlCheckboxRenderer");
+
+ addRenderer(facesContext, "javax.faces.SelectMany",
+ "javax.faces.Checkbox",
+ "org.apache.myfaces.renderkit.html.HtmlCheckboxRenderer");
+
+ addRenderer(facesContext, "javax.faces.Form", "javax.faces.Form",
+ "org.apache.myfaces.renderkit.html.HtmlFormRenderer");
+
+ addRenderer(facesContext, "javax.faces.Panel", "javax.faces.Grid",
+ "org.apache.myfaces.renderkit.html.HtmlGridRenderer");
+
+ addRenderer(facesContext, "javax.faces.Panel", "javax.faces.Group",
+ "org.apache.myfaces.renderkit.html.HtmlGroupRenderer");
+
+ addRenderer(facesContext, "javax.faces.Input", "javax.faces.Hidden",
+ "org.apache.myfaces.renderkit.html.HtmlHiddenRenderer");
+
+ addRenderer(facesContext, "javax.faces.Graphic", "javax.faces.Image",
+ "org.apache.myfaces.renderkit.html.HtmlImageRenderer");
+
+ addRenderer(facesContext, "javax.faces.Output", "javax.faces.Label",
+ "org.apache.myfaces.renderkit.html.HtmlLabelRenderer");
+
+ addRenderer(facesContext, "javax.faces.Output", "javax.faces.Link",
+ "org.apache.myfaces.renderkit.html.HtmlLinkRenderer");
+
+ addRenderer(facesContext, "javax.faces.Command", "javax.faces.Link",
+ "org.apache.myfaces.renderkit.html.HtmlLinkRenderer");
+
+ addRenderer(facesContext, "javax.faces.SelectOne",
+ "javax.faces.Listbox",
+ "org.apache.myfaces.renderkit.html.HtmlListboxRenderer");
+
+ addRenderer(facesContext, "javax.faces.SelectMany",
+ "javax.faces.Listbox",
+ "org.apache.myfaces.renderkit.html.HtmlListboxRenderer");
+
+ addRenderer(facesContext, "javax.faces.SelectOne", "javax.faces.Menu",
+ "org.apache.myfaces.renderkit.html.HtmlMenuRenderer");
+
+ addRenderer(facesContext, "javax.faces.SelectMany", "javax.faces.Menu",
+ "org.apache.myfaces.renderkit.html.HtmlMenuRenderer");
+
+ addRenderer(facesContext, "javax.faces.Message", "javax.faces.Message",
+ "org.apache.myfaces.renderkit.html.HtmlMessageRenderer");
+
+ addRenderer(facesContext, "javax.faces.Output", "javax.faces.Format",
+ "org.apache.myfaces.renderkit.html.HtmlFormatRenderer");
+
+ addRenderer(facesContext, "javax.faces.Messages",
+ "javax.faces.Messages",
+ "org.apache.myfaces.renderkit.html.HtmlMessagesRenderer");
+
+ addRenderer(facesContext, "javax.faces.SelectOne", "javax.faces.Radio",
+ "org.apache.myfaces.renderkit.html.HtmlRadioRenderer");
+
+ addRenderer(facesContext, "javax.faces.Input", "javax.faces.Secret",
+ "org.apache.myfaces.renderkit.html.HtmlSecretRenderer");
+
+ addRenderer(facesContext, "javax.faces.Data", "javax.faces.Table",
+ "org.apache.myfaces.renderkit.html.HtmlTableRenderer");
+
+ addRenderer(facesContext, "javax.faces.Input", "javax.faces.Textarea",
+ "org.apache.myfaces.renderkit.html.HtmlTextareaRenderer");
+
+ addRenderer(facesContext, "javax.faces.Input", "javax.faces.Text",
+ "org.apache.myfaces.renderkit.html.HtmlTextRenderer");
+
+ addRenderer(facesContext, "javax.faces.Output", "javax.faces.Text",
+ "org.apache.myfaces.renderkit.html.HtmlTextRenderer");
+ }
+
+ /**
+ * Add a renderer to the FacesContext.
+ *
+ * @param facesContext Faces Context
+ * @param family Componenet Family
+ * @param rendererType Component Type
+ * @param renderClassName Class Name of Renderer
+ */
+ public static void addRenderer(FacesContext facesContext, String family,
+ String rendererType, String renderClassName)
+ {
+ Renderer renderer = (javax.faces.render.Renderer) newInstance(renderClassName);
+ RenderKit kit = facesContext.getRenderKit();
+ kit.addRenderer(family, rendererType, renderer);
+ }
+
+ /**
+ * Tries a Class.loadClass with the context class loader of the current thread first and
+ * automatically falls back to the ClassUtils class loader (i.e. the loader of the
+ * myfaces.jar lib) if necessary.
+ *
+ * Note: This was copied from org.apache.myfaces.shared.util.ClassUtils
+ *
+ * @param type fully qualified name of a non-primitive non-array class
+ * @return the corresponding Class
+ * @throws NullPointerException if type is null
+ * @throws ClassNotFoundException
+ */
+ private static Class classForName(String type)
+ throws ClassNotFoundException
+ {
+ if (type == null)
+ throw new NullPointerException("type");
+ try
+ {
+ // Try WebApp ClassLoader first
+ return Class.forName(type, false, // do not initialize for faster startup
+ Thread.currentThread().getContextClassLoader());
+ }
+ catch (ClassNotFoundException ignore)
+ {
+ // fallback: Try ClassLoader for ClassUtils (i.e. the myfaces.jar lib)
+ return Class.forName(type, false, // do not initialize for faster startup
+ TestUtils.class.getClassLoader());
+ }
+ }
+
+ /**
+ * Same as {@link #classForName(String)}, but throws a RuntimeException
+ * (FacesException) instead of a ClassNotFoundException.
+ *
+ * Note: This was copied from org.apache.myfaces.shared.util.ClassUtils
+ *
+ * @return the corresponding Class
+ * @throws NullPointerException if type is null
+ * @throws FacesException if class not found
+ */
+ private static Class simpleClassForName(String type)
+ {
+ try
+ {
+ return classForName(type);
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.error("Class " + type + " not found", e);
+ throw new FacesException(e);
+ }
+ }
+
+ /**
+ * Create an instance of the class with the type of <code>type</code>.
+ *
+ * Note: This was copied from org.apache.myfaces.shared.util.ClassUtils
+ *
+ * @param type Type of new class.
+ * @return Instance of the class <code>type</code>
+ * @throws FacesException
+ */
+ private static Object newInstance(String type) throws FacesException
+ {
+ if (type == null)
+ return null;
+ return newInstance(simpleClassForName(type));
+ }
+
+ /**
+ * Create an instance of the class <code>clazz</code>.
+ *
+ * Note: This was copied from org.apache.myfaces.shared.util.ClassUtils
+ *
+ * @param clazz Class to create an instance of.
+ * @return Instance of the class <code>clazz</code>
+ * @throws FacesException
+ */
+ private static Object newInstance(Class clazz) throws FacesException
+ {
+ try
+ {
+ return clazz.newInstance();
+ }
+ catch (NoClassDefFoundError e)
+ {
+ log.error("Class : " + clazz.getName() + " not found.", e);
+ throw new FacesException(e);
+ }
+ catch (InstantiationException e)
+ {
+ log.error(e.getMessage(), e);
+ throw new FacesException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ log.error(e.getMessage(), e);
+ throw new FacesException(e);
+ }
+ }
+
+ /**
+ * Renderered a component, including it's children, then complete the reponse.
+ *
+ * @param context Faces Context
+ * @param component Component to be rendered.
+ * @throws IOException Thrown while rendering.
+ */
+ public static void renderComponent(FacesContext context,
+ UIComponent component) throws IOException
+ {
+ Renderer renderer = context.getRenderKit().getRenderer(
+ component.getFamily(), component.getRendererType());
+ renderer.encodeBegin(context, component);
+ renderer.encodeChildren(context, component);
+ renderer.encodeEnd(context, component);
+ context.responseComplete();
+ context.renderResponse();
+ }
+}