state before generic meta-data validation
git-svn-id: https://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/annotation_only_based_validation@703719 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/1.0.1-SNAPSHOT/component-support/generic-support/pom.xml b/1.0.1-SNAPSHOT/component-support/generic-support/pom.xml
new file mode 100644
index 0000000..f043b45
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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>${build.version}</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>component-support-modules-project</artifactId>
+ <version>${build.version}</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>compile</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.0.1-SNAPSHOT/component-support/generic-support/src/main/config/faces-config.xml b/1.0.1-SNAPSHOT/component-support/generic-support/src/main/config/faces-config.xml
new file mode 100644
index 0000000..f5ece55
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/generic-support/src/main/config/faces-config.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.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.
+-->
+
+<faces-config>
+ <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.0.1-SNAPSHOT/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRenderKit.java b/1.0.1-SNAPSHOT/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRenderKit.java
new file mode 100644
index 0000000..456ccdb
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRenderKit.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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
+ */
+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);
+ }
+
+ @UsageInformation({UsageCategory.REUSE, UsageCategory.CUSTOMIZABLE})
+ protected Renderer createWrapper(Renderer renderer)
+ {
+ return ExtValGenericRendererWrapper.newInstance(renderer);
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRendererWrapper.java b/1.0.1-SNAPSHOT/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRendererWrapper.java
new file mode 100644
index 0000000..e524177
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java b/1.0.1-SNAPSHOT/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java
new file mode 100644
index 0000000..455fe11
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.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.generic.renderkit;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.AbstractRenderKitWrapperFactory;
+
+import javax.faces.render.RenderKit;
+
+/**
+ * @author Gerhard Petracek
+ */
+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);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/startup/GenericModuleStartupListener.java b/1.0.1-SNAPSHOT/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/startup/GenericModuleStartupListener.java
new file mode 100644
index 0000000..8af34a9
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/startup/GenericModuleStartupListener.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.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;
+
+/**
+ * @author Gerhard Petracek
+ */
+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.0.1-SNAPSHOT/component-support/generic-support/src/main/resources/LICENSE.txt b/1.0.1-SNAPSHOT/component-support/generic-support/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/component-support/generic-support/src/main/resources/NOTICE.txt b/1.0.1-SNAPSHOT/component-support/generic-support/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/component-support/pom.xml b/1.0.1-SNAPSHOT/component-support/pom.xml
new file mode 100644
index 0000000..f38c7e4
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/pom.xml
@@ -0,0 +1,56 @@
+<?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>${build.version}</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-parent</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+
+ <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>${build.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <trinidad.version>1.0.8</trinidad.version>
+ </properties>
+</project>
diff --git a/1.0.1-SNAPSHOT/component-support/trinidad-support/pom.xml b/1.0.1-SNAPSHOT/component-support/trinidad-support/pom.xml
new file mode 100644
index 0000000..2a9b007
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/pom.xml
@@ -0,0 +1,112 @@
+<?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>${build.version}</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>component-support-modules-project</artifactId>
+ <version>${build.version}</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</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>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>${build.version}</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.0.1-SNAPSHOT/component-support/trinidad-support/src/main/config/faces-config.xml b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/config/faces-config.xml
new file mode 100644
index 0000000..52ee385
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/config/faces-config.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.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.
+-->
+
+<faces-config>
+ <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>
diff --git a/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/ExtValTrinidadValidationPhaseListener.java b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/ExtValTrinidadValidationPhaseListener.java
new file mode 100644
index 0000000..e8be5b3
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/ExtValTrinidadValidationPhaseListener.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.trinidad;
+
+import org.apache.myfaces.extensions.validator.trinidad.renderkit.ExtValTrinidadRenderKit;
+
+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
+ */
+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.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/WebXmlParameter.java b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/WebXmlParameter.java
new file mode 100644
index 0000000..834220b
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/WebXmlParameter.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.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.API)
+public interface WebXmlParameter
+{
+ /*
+ * deactivate
+ */
+ static final String DEACTIVATE_CLIENT_SIDE_TRINIDAD_VALIDATION = WebXmlUtils
+ .getInitParameter("DEACTIVATE_CLIENT_SIDE_TRINIDAD_VALIDATION");
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/DoubleRangeInitializer.java b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/DoubleRangeInitializer.java
new file mode 100644
index 0000000..6ad1bd4
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/DoubleRangeInitializer.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.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.trinidad.validator.DoubleRangeValidator;
+
+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")
+public class DoubleRangeInitializer extends TrinidadComponentInitializer
+{
+ @Override
+ public boolean configureTrinidadComponent(FacesContext facesContext, UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ boolean informationAdded = false;
+ DoubleRangeValidator lengthValidator = (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)
+ {
+ lengthValidator.setMinimum((Double)min);
+ informationAdded = true;
+ }
+ }
+
+ if(metaData.containsKey(CommonMetaDataKeys.RANGE_MAX))
+ {
+ Object maxLength = metaData.get(CommonMetaDataKeys.RANGE_MAX);
+
+ if(maxLength instanceof Double)
+ {
+ lengthValidator.setMaximum((Double)maxLength);
+ informationAdded = true;
+ }
+ }
+ if(informationAdded)
+ {
+ ((EditableValueHolder)uiComponent).addValidator(lengthValidator);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LengthInitializer.java b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LengthInitializer.java
new file mode 100644
index 0000000..df559e7
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LengthInitializer.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.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 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")
+public 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
+ .tryToInvokeMethodOfClassAndMethodName(uiComponent.getClass().getName(), "setMaximumLength",
+ new Object[] {maxLength}, new Class[] {int.class});
+ }
+ lengthValidator.setMaximum((Integer)maxLength);
+ informationAdded = true;
+ }
+ }
+
+ //reInitValidators((EditableValueHolder)uiComponent, metaData); //search wrappers and call .deactivate
+
+ if(informationAdded)
+ {
+ ((EditableValueHolder)uiComponent).addValidator(lengthValidator);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LongRangeInitializer.java b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LongRangeInitializer.java
new file mode 100644
index 0000000..4ef2f3e
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/LongRangeInitializer.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.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.trinidad.validator.LongRangeValidator;
+
+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")
+public class LongRangeInitializer extends TrinidadComponentInitializer
+{
+ @Override
+ public boolean configureTrinidadComponent(FacesContext facesContext, UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ boolean informationAdded = false;
+ LongRangeValidator lengthValidator = (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)
+ {
+ lengthValidator.setMinimum((Long)min);
+ informationAdded = true;
+ }
+ }
+
+ if(metaData.containsKey(CommonMetaDataKeys.RANGE_MAX))
+ {
+ Object maxLength = metaData.get(CommonMetaDataKeys.RANGE_MAX);
+
+ if(maxLength instanceof Long)
+ {
+ lengthValidator.setMaximum((Long)maxLength);
+ informationAdded = true;
+ }
+ }
+ if(informationAdded)
+ {
+ ((EditableValueHolder)uiComponent).addValidator(lengthValidator);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/PatternInitializer.java b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/PatternInitializer.java
new file mode 100644
index 0000000..f46dca6
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/PatternInitializer.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.trinidad.validator.RegExpValidator;
+
+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")
+public 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));
+
+ ((EditableValueHolder)uiComponent).addValidator(regExpValidator);
+ }
+ return true;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/RequiredInitializer.java b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/RequiredInitializer.java
new file mode 100644
index 0000000..3f6e5fe
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/RequiredInitializer.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.util.ReflectionUtils;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public 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.WEAK_REQUIRED)) &&
+ Boolean.TRUE.equals(isComponentRequired(uiComponent)))
+ ||
+ (Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.REQUIRED)) &&
+ Boolean.TRUE.equals(isComponentRequired(uiComponent))))
+ {
+ ((EditableValueHolder)uiComponent).setRequired(true);
+ return true;
+ }
+ else if(metaData.containsKey(CommonMetaDataKeys.SKIP_VALIDATION) &&
+ ((List)metaData.get(CommonMetaDataKeys.SKIP_VALIDATION)).contains(CommonMetaDataKeys.WEAK_REQUIRED)&&
+ !Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.REQUIRED)))
+ {
+ ((EditableValueHolder)uiComponent).setRequired(false);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected Boolean isComponentRequired(UIComponent uiComponent)
+ {
+ //compare with false so true = true or null
+ boolean isReadOnly = !Boolean.FALSE.equals(ReflectionUtils
+ .tryToInvokeMethodOfClassAndMethodName(uiComponent.getClass().getName(), "isReadOnly"));
+ boolean isDisabled = !Boolean.FALSE.equals(ReflectionUtils
+ .tryToInvokeMethodOfClassAndMethodName(uiComponent.getClass().getName(), "isDisabled"));
+
+ return !(isReadOnly || isDisabled);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/TrinidadComponentInitializer.java b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/TrinidadComponentInitializer.java
new file mode 100644
index 0000000..6563794
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/TrinidadComponentInitializer.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.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
+ */
+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.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/ValidatorInitializer.java b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/ValidatorInitializer.java
new file mode 100644
index 0000000..cdbcd0c
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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")
+public 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
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRenderKit.java b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRenderKit.java
new file mode 100644
index 0000000..b072f23
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/renderkit/ExtValTrinidadRenderKit.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.trinidad.renderkit;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRenderKit;
+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
+ */
+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;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java
new file mode 100644
index 0000000..c3dcd22
--- /dev/null
+++ b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.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.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.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.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+
+/**
+ * alternative approach for ExtValRenderKitFactory
+ *
+ * @author Gerhard Petracek
+ */
+public class TrinidadModuleStartupListener extends AbstractStartupListener
+{
+ @ToDo(value = Priority.MEDIUM, description = "web.xml parameter to deactivate it")
+ 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());
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/resources/LICENSE.txt b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..dd5b3a5
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/component-support/trinidad-support/src/main/resources/NOTICE.txt b/1.0.1-SNAPSHOT/component-support/trinidad-support/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..5daae65
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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
+------------------------------------------------------------------------
diff --git a/1.0.1-SNAPSHOT/core/pom.xml b/1.0.1-SNAPSHOT/core/pom.xml
new file mode 100644
index 0000000..0daa747
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/pom.xml
@@ -0,0 +1,100 @@
+<?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.0.1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <name>MyFaces Extensions-Validator Core</name>
+ <version>${build.version}</version>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ </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.0.1-SNAPSHOT/core/src/main/config/faces-config.xml b/1.0.1-SNAPSHOT/core/src/main/config/faces-config.xml
new file mode 100644
index 0000000..a304476
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/config/faces-config.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.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.
+-->
+
+<faces-config>
+ <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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/ExtValInformation.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/ExtValInformation.java
new file mode 100644
index 0000000..7bb3daa
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/ExtValInformation.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;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * 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 = "1.0.1";
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInfo.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInfo.java
new file mode 100644
index 0000000..d214721
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInfo.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;
+
+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 CustomInfo
+{
+ BASE_PACKAGE,
+ COMPONENT_ANNOTATION_EXTRACTOR,
+
+ VALIDATION_STRATEGY_POSTFIX,
+ VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX,
+ META_DATA_TRANSFORMER_POSTFIX,
+
+ VALIDATION_STRATEGY_TO_MSG_RESOLVER_NAME_MAPPER,
+ ANNOTATION_TO_VALIDATION_STRATEGY_NAME_MAPPER,
+ VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER,
+
+ STARTUP_LISTENER,
+ COMPONENT_INITIALIZER,
+
+ MESSAGE_RESOLVER_FACTORY,
+ VALIDATION_STRATEGY_FACTORY,
+ COMPONENT_INITIALIZER_FACTORY,
+ COMPONENT_ANNOTATION_EXTRACTOR_FACTORY,
+ META_DATA_TRANSFORMER_FACTORY,
+
+ CONVENTION_FOR_CUSTOM_MESSAGE_BUNDLE,
+ STATIC_STRATEGY_MAPPING_SOURCE
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java
new file mode 100644
index 0000000..d12a440
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.component.DefaultComponentInitializer;
+import org.apache.myfaces.extensions.validator.core.interceptor.RendererInterceptor;
+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.loader.StaticMappingConfigLoader;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigLoaderNames;
+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 = new DefaultFactoryFinder();
+ private Map<String, RendererInterceptor> rendererInterceptors = new HashMap<String, RendererInterceptor>();
+ private List<String> deniedInterceptors = new ArrayList<String>();
+ private List<ProcessedInformationRecorder> processedInformationRecorders =
+ new ArrayList<ProcessedInformationRecorder>();
+
+ private Map<String, Object> globalProperties = new HashMap<String, Object>();
+
+ private Map<StaticMappingConfigLoaderNames, List<StaticMappingConfigLoader<String, String>>>
+ staticMappingConfigLoaderMap
+ = new HashMap<StaticMappingConfigLoaderNames, List<StaticMappingConfigLoader<String, String>>>();
+
+ 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)
+ {
+ DefaultComponentInitializer.addComponentInitializer(componentInitializer);
+ }
+
+ 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<StaticMappingConfigLoader<String, String>> getStaticMappingConfigLoaders(
+ StaticMappingConfigLoaderNames name)
+ {
+ if(!this.staticMappingConfigLoaderMap.containsKey(name))
+ {
+ List<StaticMappingConfigLoader<String, String>> staticMappingConfigLoaderList
+ = new ArrayList<StaticMappingConfigLoader<String, String>>();
+ this.staticMappingConfigLoaderMap.put(name, staticMappingConfigLoaderList);
+ }
+ return this.staticMappingConfigLoaderMap.get(name);
+ }
+
+ public void addStaticMappingConfigLoader(StaticMappingConfigLoaderNames name, StaticMappingConfigLoader<String,
+ String> staticMappingConfigLoader)
+ {
+ synchronized (this)
+ {
+ List<StaticMappingConfigLoader<String, String>> staticMappingConfigLoaderList;
+ if(!this.staticMappingConfigLoaderMap.containsKey(name))
+ {
+ staticMappingConfigLoaderList = new ArrayList<StaticMappingConfigLoader<String, String>>();
+ this.staticMappingConfigLoaderMap.put(name, staticMappingConfigLoaderList);
+ }
+ this.staticMappingConfigLoaderMap.get(name).add(staticMappingConfigLoader);
+ }
+ }
+
+ 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
+ {
+ logger.warn("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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java
new file mode 100644
index 0000000..dc4f194
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.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;
+
+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<CustomInfo, String> customizableInfos = new HashMap<CustomInfo, 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(CustomInfo.BASE_PACKAGE, basePackage);
+
+ customizableInfos.put(CustomInfo.COMPONENT_ANNOTATION_EXTRACTOR, "ComponentAnnotationExtractor");
+
+ customizableInfos.put(CustomInfo.VALIDATION_STRATEGY_POSTFIX, "ValidationStrategy");
+ customizableInfos.put(CustomInfo.META_DATA_TRANSFORMER_POSTFIX, "MetaDataTransformer");
+ customizableInfos.put(CustomInfo.VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX, "ValidationErrorMessageResolver");
+
+ customizableInfos.put(CustomInfo.COMPONENT_INITIALIZER, "ComponentInitializer");
+
+ customizableInfos.put(CustomInfo.VALIDATION_STRATEGY_TO_MSG_RESOLVER_NAME_MAPPER,
+ "ValidationStrategyToMsgResolverNameMapper");
+ customizableInfos.put(CustomInfo.ANNOTATION_TO_VALIDATION_STRATEGY_NAME_MAPPER,
+ "AnnotationToValidationStrategyNameMapper");
+ customizableInfos.put(CustomInfo.VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER,
+ "ValidationStrategyToMetaDataTransformerNameMapper");
+
+ customizableInfos.put(CustomInfo.STARTUP_LISTENER, "StartupListener");
+
+ customizableInfos.put(CustomInfo.MESSAGE_RESOLVER_FACTORY, "MessageResolverFactory");
+ customizableInfos.put(CustomInfo.VALIDATION_STRATEGY_FACTORY, "ValidationStrategyFactory");
+ customizableInfos.put(CustomInfo.COMPONENT_INITIALIZER_FACTORY, "ComponentInitializerFactory");
+ customizableInfos.put(CustomInfo.COMPONENT_ANNOTATION_EXTRACTOR_FACTORY, "ComponentAnnotationExtractorFactory");
+ customizableInfos.put(CustomInfo.META_DATA_TRANSFORMER_FACTORY, "MetaDataTransformerFactory");
+
+ //conventions (the rest of the conventions are built with the help of name mappers,...
+ customizableInfos.put(CustomInfo.CONVENTION_FOR_CUSTOM_MESSAGE_BUNDLE, "validation_messages");
+ //static strategy mappings (name of property files)
+ customizableInfos.put(CustomInfo.STATIC_STRATEGY_MAPPING_SOURCE, "strategy_mappings");
+ }
+
+ protected void applyCustomValues(Map<CustomInfo, String> map)
+ {
+ //override to customize information
+ }
+
+ public final String get(CustomInfo customInfo)
+ {
+ String value = customizableInfos.get(customInfo);
+
+ switch (customInfo)
+ {
+ 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(CustomInfo.BASE_PACKAGE) + value;
+ }
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/InternalConventionProvider.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/InternalConventionProvider.java
new file mode 100644
index 0000000..f261790
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/InternalConventionProvider.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @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)
+ {
+ 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(Annotation annotation)
+ {
+ return annotation.annotationType().getName().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;
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java
new file mode 100644
index 0000000..e98d29d
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.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;
+
+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.API)
+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_ANNOTATION_EXTRACTOR = WebXmlUtils
+ .getInitParameter("CUSTOM_COMPONENT_ANNOTATION_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");
+
+ /*
+ * 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_ANNOTATION_TO_VALIDATION_STRATEGY_NAME_MAPPER = WebXmlUtils
+ .getInitParameter("CUSTOM_ANNOTATION_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_ANNOTATION_EXTRACTOR_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_COMPONENT_ANNOTATION_EXTRACTOR_FACTORY");
+
+ static final String CUSTOM_META_DATA_TRANSFORMER_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_META_DATA_TRANSFORMER_FACTORY");
+
+ static final String CUSTOM_COMPONENT_INITIALIZER_FACTORY = WebXmlUtils
+ .getInitParameter("CUSTOM_COMPONENT_INITIALIZER_FACTORY");
+
+ /*
+ * deactivate
+ */
+ static final String DEACTIVATE_RENDERKIT = WebXmlUtils
+ .getInitParameter("DEACTIVATE_RENDERKIT");
+
+ static final String DEACTIVATE_DEFAULT_CONVENTION = WebXmlUtils
+ .getInitParameter("DEACTIVATE_DEFAULT_CONVENTION");
+
+ //there is nothing like DEACTIVATE_DEFAULT_VALIDATION_INTERCEPTOR
+ //use ExtValContext.getContext().denyRendererInterceptor(...) within an extval-StartupListener
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/AnnotationEntry.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/AnnotationEntry.java
new file mode 100644
index 0000000..4770f94
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/AnnotationEntry.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.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * Data holder which stores the annotation and some information where the annotation was around.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public class AnnotationEntry
+{
+ private Annotation annotation;
+ private String valueBindingExpression;
+ //e.g. valueBindingName, DefaultValueBindingScanningAnnotationExtractor uses it for the variable-/method-name
+ private String boundTo;
+ private Class entityClass;
+
+ //requested by bernhard huemer
+ public <T> T getAnnotation(Class<T> targetClass)
+ {
+ return (T) annotation;
+ }
+
+ /*
+ * generated
+ */
+ public Annotation getAnnotation()
+ {
+ return annotation;
+ }
+
+ public void setAnnotation(Annotation annotation)
+ {
+ this.annotation = annotation;
+ }
+
+ public String getValueBindingExpression()
+ {
+ return valueBindingExpression;
+ }
+
+ public void setValueBindingExpression(String valueBindingExpression)
+ {
+ this.valueBindingExpression = valueBindingExpression;
+ }
+
+ public String getBoundTo()
+ {
+ return boundTo;
+ }
+
+ public void setBoundTo(String boundTo)
+ {
+ this.boundTo = boundTo;
+ }
+
+ public Class getEntityClass()
+ {
+ return entityClass;
+ }
+
+ public void setEntityClass(Class entityClass)
+ {
+ this.entityClass = entityClass;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/AnnotationExtractor.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/AnnotationExtractor.java
new file mode 100644
index 0000000..1c1859c
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/AnnotationExtractor.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.annotation.extractor;
+
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import javax.faces.context.FacesContext;
+import java.util.List;
+
+/**
+ * An annotation extractor is responsible to analyze an object
+ * and returns all available annotations
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface AnnotationExtractor
+{
+ List<AnnotationEntry> extractAnnotations(FacesContext facesContext, Object object);
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/AnnotationExtractorFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/AnnotationExtractorFactory.java
new file mode 100644
index 0000000..f262fef
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/AnnotationExtractorFactory.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.annotation.extractor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * The interface for all factories which create annotation extractors
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface AnnotationExtractorFactory
+{
+ AnnotationExtractor create();
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/DefaultComponentAnnotationExtractor.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/DefaultComponentAnnotationExtractor.java
new file mode 100644
index 0000000..28a3b13
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/DefaultComponentAnnotationExtractor.java
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.annotation.extractor;
+
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
+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.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Default implementation which extracts the annotations of the value binding of a component.
+ * It extracts the annotation 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 DefaultComponentAnnotationExtractor implements AnnotationExtractor
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public DefaultComponentAnnotationExtractor()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ @ToDo(Priority.MEDIUM)
+ public List<AnnotationEntry> extractAnnotations(FacesContext facesContext, Object object)
+ {
+ //should never occur
+ if (!(object instanceof UIComponent))
+ {
+ return new ArrayList<AnnotationEntry>();
+ }
+
+ UIComponent uiComponent = (UIComponent) object;
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start extracting annotations of " + uiComponent.getClass().getName());
+ }
+
+ List<AnnotationEntry> annotationEntries = new ArrayList<AnnotationEntry>();
+
+ ValueBindingExpression vbe =
+ ExtValUtils.getELHelper().getValueBindingExpression(uiComponent);
+
+ if (vbe == null)
+ {
+ return new ArrayList<AnnotationEntry>();
+ }
+
+ /*
+ * get bean class and property name
+ */
+ Class entityClass = ExtValUtils.getELHelper()
+ .getTypeOfValueBindingForExpression(facesContext, vbe.getBaseExpression());
+
+ //create template entry
+ AnnotationEntry templateEntry = new AnnotationEntry();
+ //TODO test with complex components
+ templateEntry.setValueBindingExpression(vbe.getExpressionString());
+ templateEntry.setEntityClass(entityClass);
+ templateEntry.setBoundTo("value");
+
+ /*
+ * find and add annotations
+ */
+ Class currentClass = entityClass;
+
+ while (!Object.class.getName().equals(currentClass.getName()))
+ {
+ //TODO map syntax support
+ addPropertyAccessAnnotations(currentClass, vbe.getProperty(), annotationEntries, templateEntry);
+ addFieldAccessAnnotations(currentClass, vbe.getProperty(), annotationEntries, templateEntry);
+
+ currentClass = currentClass.getSuperclass();
+ }
+
+ for (Class currentInterface : entityClass.getInterfaces())
+ {
+ currentClass = currentInterface;
+
+ while (currentClass != null)
+ {
+ addPropertyAccessAnnotations(currentClass, vbe.getProperty(), annotationEntries, templateEntry);
+
+ currentClass = currentClass.getSuperclass();
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("extractAnnotations finished");
+ }
+
+ return annotationEntries;
+ }
+
+ protected void addPropertyAccessAnnotations(Class entity, String property,
+ List<AnnotationEntry> annotationEntries,
+ AnnotationEntry templateEntry)
+ {
+ 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(annotationEntries, Arrays.asList(method.getAnnotations()), templateEntry);
+ }
+
+ protected void addFieldAccessAnnotations(Class entity, String property,
+ List<AnnotationEntry> annotationEntries,
+ AnnotationEntry templateEntry)
+ {
+ 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(annotationEntries, Arrays.asList(field.getAnnotations()), templateEntry);
+ }
+
+ protected void addAnnotationToAnnotationEntries(
+ List<AnnotationEntry> annotationEntries,
+ List<Annotation> annotations, AnnotationEntry templateEntry)
+ {
+ for (Annotation annotation : annotations)
+ {
+ annotationEntries.add(createAnnotationEntry(annotation, templateEntry));
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(annotation.getClass().getName() + " found");
+ }
+ }
+ }
+
+ protected AnnotationEntry createAnnotationEntry(Annotation foundAnnotation, AnnotationEntry templateEntry)
+ {
+ AnnotationEntry entry = new AnnotationEntry();
+
+ entry.setAnnotation(foundAnnotation);
+
+ entry.setEntityClass(templateEntry.getEntityClass());
+ entry.setValueBindingExpression(templateEntry.getValueBindingExpression());
+ entry.setBoundTo(templateEntry.getBoundTo());
+
+ return entry;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/DefaultComponentAnnotationExtractorFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/DefaultComponentAnnotationExtractorFactory.java
new file mode 100644
index 0000000..62a299c
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/annotation/extractor/DefaultComponentAnnotationExtractorFactory.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.annotation.extractor;
+
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInfo;
+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.List;
+
+/**
+ * This factory creates an annotation extractor which extracts the annotation
+ * of the value binding of a component.
+ * <p/>
+ * order:<br/>
+ * <ol>
+ * <li>configured annotation extractor (web.xml)</li>
+ * <li>configured annotation extractor (information provider bean)</li>
+ * <li>default implementation</li>
+ * </ol>
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultComponentAnnotationExtractorFactory implements AnnotationExtractorFactory
+{
+ private final Log logger = LogFactory.getLog(getClass());
+
+ private static AnnotationExtractor annotationExtractor = null;
+
+ public DefaultComponentAnnotationExtractorFactory()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "logging")
+ public AnnotationExtractor create()
+ {
+ if (annotationExtractor == null)
+ {
+ List<String> annotationExtractorClassNames = new ArrayList<String>();
+
+ annotationExtractorClassNames.add(WebXmlParameter.CUSTOM_COMPONENT_ANNOTATION_EXTRACTOR);
+ annotationExtractorClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInfo.COMPONENT_ANNOTATION_EXTRACTOR));
+ annotationExtractorClassNames.add(DefaultComponentAnnotationExtractor.class.getName());
+
+ for (String className : annotationExtractorClassNames)
+ {
+ annotationExtractor = (AnnotationExtractor) ClassUtils.tryToInstantiateClassForName(className);
+
+ if (annotationExtractor != null)
+ {
+ break;
+ }
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(annotationExtractor.getClass().getName() + " created");
+ }
+
+ return annotationExtractor;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/AbstractELHelperFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/AbstractELHelperFactory.java
new file mode 100644
index 0000000..c2b11cf
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.API, 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();
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelper.java
new file mode 100644
index 0000000..cf1442f
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelper.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import java.io.Externalizable;
+
+/**
+ * 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.)
+ */
+@ToDo(Priority.MEDIUM)
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultELHelper implements ELHelper
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public DefaultELHelper()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public Class getTypeOfValueBindingForExpression(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().getVariableResolver().resolveVariable(facesContext, beanName);
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "refactor - problem - static values - jsf 1.2 e.g.: ${value}")
+ public Object getBaseObject(ValueBindingExpression valueBindingExpression, UIComponent uiComponent)
+ {
+ if(valueBindingExpression.getBaseExpression() == null)
+ {
+ return uiComponent.getValueBinding("value").getValue(FacesContext.getCurrentInstance());
+ }
+ return getBaseObject(valueBindingExpression);
+ }
+
+ public Object getBaseObject(ValueBindingExpression valueBindingExpression)
+ {
+ return getValueOfExpression(FacesContext.getCurrentInstance(),
+ valueBindingExpression.getBaseExpression());
+ }
+
+ public Object getValueOfExpression(FacesContext facesContext,
+ ValueBindingExpression valueBindingExpression)
+ {
+ return (valueBindingExpression != null) ? facesContext.getApplication()
+ .createValueBinding(valueBindingExpression.getExpressionString()).getValue(facesContext) : null;
+ }
+
+ public boolean isExpressionValid(FacesContext facesContext, String valueBindingExpression)
+ {
+ return facesContext.getApplication().createValueBinding(valueBindingExpression) != null;
+ }
+
+ public ValueBindingExpression getValueBindingExpression(UIComponent uiComponent)
+ {
+ String valueBindingExpression = getOriginalValueBindingExpression(uiComponent);
+
+ //for input components without value-binding
+ //(e.g. for special component libs -> issue with ExtValRendererWrapper#encodeBegin)
+ if(valueBindingExpression == null)
+ {
+ //TODO logging
+ return null;
+ }
+
+ if (getTypeOfValueBindingForExpression(FacesContext.getCurrentInstance(),
+ new ValueBindingExpression(valueBindingExpression).getBaseExpression()) == null)
+ {
+ valueBindingExpression = FaceletsTaglibExpressionHelper.
+ tryToCreateValueBindingForFaceletsBinding(uiComponent);
+ }
+ return new ValueBindingExpression(valueBindingExpression);
+ }
+
+ static String getOriginalValueBindingExpression(UIComponent uiComponent)
+ {
+ ValueBinding valueExpression = uiComponent.getValueBinding("value");
+
+ return (valueExpression != null) ? valueExpression.getExpressionString() : null;
+ }
+
+ public Class getTypeOfValueBindingForComponent(FacesContext facesContext, UIComponent uiComponent)
+ {
+ ValueBinding valueBinding = uiComponent.getValueBinding("value");
+
+ return (valueBinding != null) ? valueBinding.getType(facesContext) : null;
+ }
+
+ public boolean isELTerm(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.getValueBinding(name);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelperFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelperFactory.java
new file mode 100644
index 0000000..b5e8062
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelperFactory.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.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;
+
+ protected ELHelper createELHelper()
+ {
+ if(this.elHelper == null)
+ {
+ this.elHelper = new DefaultELHelper();
+ }
+ return this.elHelper;
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.java
new file mode 100644
index 0000000..a655580
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.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.el;
+
+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;
+
+/**
+ * in order to centralize the jsf version dependency within the core
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface ELHelper
+{
+ Class getTypeOfValueBindingForExpression(FacesContext facesContext, ValueBindingExpression valueBindingExpression);
+
+ Class getTypeOfValueBindingForComponent(FacesContext facesContext, UIComponent uiComponent);
+
+ Object getBean(String beanName);
+
+ Object getBaseObject(ValueBindingExpression valueBindingExpression);
+
+ Object getBaseObject(ValueBindingExpression valueBindingExpression, UIComponent uiComponent);
+
+ Object getValueOfExpression(FacesContext facesContext, ValueBindingExpression valueBindingExpression);
+
+ ValueBindingExpression getValueBindingExpression(UIComponent uiComponent);
+
+ boolean isExpressionValid(FacesContext facesContext, String valueBindingExpression);
+
+ boolean isELTerm(Object o);
+
+ Object getBindingOfComponent(UIComponent uiComponent, String name);
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/FaceletsTaglibExpressionHelper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/FaceletsTaglibExpressionHelper.java
new file mode 100644
index 0000000..9cccb89
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/FaceletsTaglibExpressionHelper.java
@@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 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;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class FaceletsTaglibExpressionHelper
+{
+ public static String tryToCreateValueBindingForFaceletsBinding(
+ UIComponent uiComponent)
+ {
+ String faceletsValueBindingExpression = DefaultELHelper.getOriginalValueBindingExpression(uiComponent);
+
+ try
+ {
+ List<String> foundBindings = extractELTerms(
+ ExtValUtils.getELHelper().getBindingOfComponent(uiComponent, "value"));
+
+ return faceletsValueBindingExpression.substring(0, 1) + "{" + createBinding(foundBindings) + "}";
+ }
+ catch (Throwable t)
+ {
+ return faceletsValueBindingExpression;
+ }
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "logging")
+ private static String createBinding(List<String> expressions)
+ {
+ String result = "";
+
+ String prevFaceletsAttributeName = null;
+ String currentBinding;
+ String partOfBinding;
+
+ int indexOfBindingDetails;
+ String[] foundBindingDetails;
+ String[] bindingDetails;
+
+ 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];
+ if (prevFaceletsAttributeName != null)
+ {
+ partOfBinding = currentBinding.substring(currentBinding.indexOf(prevFaceletsAttributeName)
+ + prevFaceletsAttributeName.length(), currentBinding.indexOf("}"));
+ result = result + partOfBinding;
+ }
+ else
+ {
+ result = currentBinding.substring(currentBinding.indexOf("{") + 1, currentBinding.indexOf("}"));
+ }
+
+ prevFaceletsAttributeName = bindingDetails[0];
+ }
+ return result;
+ }
+
+ 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())
+ {
+ elCount += resolveELTerms(entry, visited, foundELTerms, count + 1);
+ }
+ return elCount;
+ }
+
+ if (ExtValUtils.getELHelper().isELTerm(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().isELTerm(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 = (Field[]) 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().isELTerm(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;
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ValueBindingExpression.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ValueBindingExpression.java
new file mode 100644
index 0000000..55d8b98
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ValueBindingExpression.java
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.util.ExtValUtils;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@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)
+ {
+ return addProperty(valueBindingExpression.getBaseExpression(), newProperty);
+ }
+
+ public static ValueBindingExpression addProperty(ValueBindingExpression valueBindingExpression, String newProperty)
+ {
+ String sourceExpression = valueBindingExpression.getExpressionString();
+ String result = sourceExpression.substring(0, sourceExpression.length() - 1);
+
+ if(newProperty.startsWith("["))
+ {
+ return new ValueBindingExpression(result + newProperty + "}");
+ }
+ else
+ {
+ return new ValueBindingExpression(result + "." + newProperty + "}");
+ }
+ }
+
+ public ValueBindingExpression(String expression)
+ {
+ if(!ExtValUtils.getELHelper().isELTerm(expression))
+ {
+ throw new IllegalStateException(expression + " is no valid el-expression");
+ }
+
+ int index1 = expression.lastIndexOf("]");
+ int index2 = expression.lastIndexOf(".");
+
+ if(index1 > index2)
+ {
+ expression = expression.substring(0, index1);
+
+ int index3 = findIndexOfStartingBracket(expression);
+ this.value = expression.substring(index3 + 1, index1);
+ this.base = new ValueBindingExpression(expression.substring(0, index3) + "}");
+ this.token = "[";
+ }
+ 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()
+ {
+ if("[".equals(this.token))
+ {
+ 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 + "]}";
+ }
+ 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();
+ }
+
+ 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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java
new file mode 100644
index 0000000..440dbdf
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java
@@ -0,0 +1,241 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.core.annotation.extractor.DefaultComponentAnnotationExtractorFactory;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInfo;
+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.initializer.component.DefaultComponentInitializerFactory;
+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.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>();
+
+ public DefaultFactoryFinder()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ 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_ANNOTATION_EXTRACTOR_FACTORY:
+ factory = createComponentAnnotationExtractorFactory();
+ break;
+
+ case VALIDATION_STRATEGY_FACTORY:
+ factory = createValidationStrategyFactory();
+ break;
+
+ case MESSAGE_RESOLVER_FACTORY:
+ factory = createMessageResolverFactory();
+ break;
+
+ case META_DATA_TRANSFORMER_FACTORY:
+ factory = createMetaDataTransformerFactory();
+ break;
+
+ case COMPONENT_INITIALIZER_FACTORY:
+ factory = createComponentInitializerFactory();
+ break;
+
+ case RENDERKIT_WRAPPER_FACTORY:
+ factory = createRenderKitWrapperFactory();
+ break;
+
+ case EL_HELPER_FACTORY:
+ factory = createELHelperFactory();
+ break;
+ default: //required by checkstyle
+ }
+
+ if(factory == null)
+ {
+ throw new IllegalStateException("not possible to create factory " + factoryName);
+ }
+
+ factoryMap.put(factoryName, factory);
+ }
+
+ protected Object createComponentAnnotationExtractorFactory()
+ {
+ Object factory = null;
+
+ List<String> annotationExtractorFactoryClassNames = new ArrayList<String>();
+
+ annotationExtractorFactoryClassNames.add(WebXmlParameter.CUSTOM_COMPONENT_ANNOTATION_EXTRACTOR_FACTORY);
+ annotationExtractorFactoryClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInfo.COMPONENT_ANNOTATION_EXTRACTOR_FACTORY));
+ annotationExtractorFactoryClassNames.add(DefaultComponentAnnotationExtractorFactory.class.getName());
+
+ for (String className : annotationExtractorFactoryClassNames)
+ {
+ factory = ClassUtils.tryToInstantiateClassForName(className);
+
+ if (factory != null)
+ {
+ break;
+ }
+ }
+ return factory;
+ }
+
+ 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(CustomInfo.VALIDATION_STRATEGY_FACTORY));
+ validationStrategyFactoryClassNames.add(DefaultValidationStrategyFactory.class.getName());
+
+ for (String className : validationStrategyFactoryClassNames)
+ {
+ factory = ClassUtils.tryToInstantiateClassForName(className);
+
+ if (factory != null)
+ {
+ break;
+ }
+ }
+
+ return factory;
+ }
+
+ 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(CustomInfo.MESSAGE_RESOLVER_FACTORY));
+ messageResolverFactoryClassNames
+ .add(DefaultMessageResolverFactory.class.getName());
+
+ for (String className : messageResolverFactoryClassNames)
+ {
+ factory = ClassUtils.tryToInstantiateClassForName(className);
+
+ if (factory != null)
+ {
+ break;
+ }
+ }
+
+ return factory;
+ }
+
+ 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(CustomInfo.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 createComponentInitializerFactory()
+ {
+ Object factory = null;
+ List<String> componentInitializerFactoryClassNames = new ArrayList<String>();
+
+ componentInitializerFactoryClassNames.add(WebXmlParameter.CUSTOM_COMPONENT_INITIALIZER_FACTORY);
+ componentInitializerFactoryClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean().get(CustomInfo.COMPONENT_INITIALIZER_FACTORY));
+ componentInitializerFactoryClassNames.add(DefaultComponentInitializerFactory.class.getName());
+
+ for (String className : componentInitializerFactoryClassNames)
+ {
+ factory = ClassUtils.tryToInstantiateClassForName(className);
+
+ if (factory != null)
+ {
+ break;
+ }
+ }
+
+ return factory;
+ }
+
+ protected Object createRenderKitWrapperFactory()
+ {
+ return new DefaultRenderKitWrapperFactory();
+ }
+
+ private Object createELHelperFactory()
+ {
+ return new DefaultELHelperFactory();
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryFinder.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryFinder.java
new file mode 100644
index 0000000..a4f2625
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java
new file mode 100644
index 0000000..a895a52
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.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.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_ANNOTATION_EXTRACTOR_FACTORY,
+ VALIDATION_STRATEGY_FACTORY,
+ MESSAGE_RESOLVER_FACTORY,
+ META_DATA_TRANSFORMER_FACTORY,
+ COMPONENT_INITIALIZER_FACTORY,
+ RENDERKIT_WRAPPER_FACTORY,
+ EL_HELPER_FACTORY
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/ComponentInitializer.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/ComponentInitializer.java
new file mode 100644
index 0000000..e0d94ca
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/ComponentInitializer.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.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;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface ComponentInitializer
+{
+ void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData);
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/DefaultComponentInitializer.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/DefaultComponentInitializer.java
new file mode 100644
index 0000000..7305e29
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/DefaultComponentInitializer.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.initializer.component;
+
+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.component.UIComponent;
+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 DefaultComponentInitializer implements ComponentInitializer
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+ private static List<ComponentInitializer> componentInitializers = new ArrayList<ComponentInitializer>();
+
+ public DefaultComponentInitializer()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData)
+ {
+ for(ComponentInitializer componentInitializer : componentInitializers)
+ {
+ componentInitializer.configureComponent(facesContext, uiComponent, metaData);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("configureComponent of " + componentInitializer.getClass().getName() + " called");
+ }
+ }
+ }
+
+ @UsageInformation(UsageCategory.INTERNAL)
+ public static void addComponentInitializer(ComponentInitializer componentInitializer)
+ {
+ synchronized (DefaultComponentInitializer.class)
+ {
+ componentInitializers.add(componentInitializer);
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/DefaultComponentInitializerFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/DefaultComponentInitializerFactory.java
new file mode 100644
index 0000000..471f478
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/component/DefaultComponentInitializerFactory.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.core.mapper.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInfo;
+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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+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.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultComponentInitializerFactory implements
+ ClassMappingFactory<UIComponent, ComponentInitializer>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private static Map<String, ComponentInitializer> componentToComponentInitializerMapping
+ = new HashMap<String, ComponentInitializer>();
+ private static List<String> componentInitializerClassNames = new ArrayList<String>();
+
+ static
+ {
+ componentInitializerClassNames
+ .add(WebXmlParameter.CUSTOM_COMPONENT_INITIALIZER);
+ componentInitializerClassNames
+ .add(ExtValContext.getContext().getInformationProviderBean().get(CustomInfo.COMPONENT_INITIALIZER));
+ componentInitializerClassNames
+ .add(DefaultComponentInitializer.class.getName());
+ }
+
+ public DefaultComponentInitializerFactory()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public ComponentInitializer create(UIComponent uiComponent)
+ {
+ String componentKey = uiComponent.getClass().getName();
+
+ if (componentToComponentInitializerMapping.containsKey(componentKey))
+ {
+ return componentToComponentInitializerMapping.get(componentKey);
+ }
+
+ ComponentInitializer componentInitializer;
+
+ for (String componentInitializerName : componentInitializerClassNames)
+ {
+ componentInitializer =
+ (ComponentInitializer) ClassUtils.tryToInstantiateClassForName(componentInitializerName);
+
+ if (componentInitializer != null)
+ {
+ componentToComponentInitializerMapping.put(componentKey, componentInitializer);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(componentInitializer.getClass().getName() + " used for " + componentKey);
+ }
+
+ return componentInitializer;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractRendererInterceptor.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractRendererInterceptor.java
new file mode 100644
index 0000000..84d3f07
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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
+ {
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/RendererInterceptor.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/RendererInterceptor.java
new file mode 100644
index 0000000..74aafc8
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/RendererInterceptor.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.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;
+
+/**
+ * @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;
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java
new file mode 100644
index 0000000..ad19457
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.annotation.extractor.AnnotationExtractor;
+import org.apache.myfaces.extensions.validator.core.annotation.extractor.AnnotationExtractorFactory;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+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 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
+ {
+ 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;
+
+ AnnotationExtractor annotationExtractor = ExtValContext.getContext().getFactoryFinder().getFactory(
+ FactoryNames.COMPONENT_ANNOTATION_EXTRACTOR_FACTORY, AnnotationExtractorFactory.class).create();
+
+ Map<String, Object> metaData;
+ for (AnnotationEntry entry : annotationExtractor.extractAnnotations(facesContext, uiComponent))
+ {
+
+ validationStrategy = ExtValUtils.getValidationStrategyForAnnotation(entry.getAnnotation());
+
+ 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>();
+ }
+
+ //get component initializer for the current component and configure it
+ 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
+ {
+ 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");
+ }
+ }
+
+ processValidation(facesContext, uiComponent, convertedObject);
+ }
+
+ protected void processValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject)
+ {
+ if (!(uiComponent instanceof EditableValueHolder))
+ {
+ return;
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start validation");
+ }
+
+ ValidationStrategy validationStrategy;
+
+ AnnotationExtractor annotationExtractor = ExtValUtils.getAnnotationExtractor();
+
+ for (AnnotationEntry entry : annotationExtractor.extractAnnotations(facesContext, uiComponent))
+ {
+ validationStrategy = ExtValUtils.getValidationStrategyForAnnotation(entry.getAnnotation());
+
+ if (validationStrategy != null)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("validate " + entry.getAnnotation().getClass().getName() + " with " +
+ validationStrategy.getClass().getName());
+ }
+
+ validationStrategy.validate(facesContext, uiComponent, entry, convertedObject);
+ }
+ else
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("no validation strategy found for "
+ + entry.getAnnotation().annotationType().getName());
+ }
+ }
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("validation finished");
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticInMemoryMappingConfig.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticInMemoryMappingConfig.java
new file mode 100644
index 0000000..fc76575
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticInMemoryMappingConfig.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.loader;
+
+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 StaticInMemoryMappingConfig implements StaticMappingConfigLoader<String, String>
+{
+ private List<StaticMappingConfigEntry<String, String>> mappings
+ = new ArrayList<StaticMappingConfigEntry<String, String>>();;
+
+ public void setSourceOfMapping(String path)
+ {
+ }
+
+ public List<StaticMappingConfigEntry<String, String>> getMapping()
+ {
+ return mappings;
+ }
+
+ public void addMapping(String source, String target)
+ {
+ StaticMappingConfigEntry<String, String> entry = new StaticMappingConfigEntry<String, String>();
+ entry.setSource(source);
+ entry.setTarget(target);
+ this.mappings.add(entry);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticMappingConfigEntry.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticMappingConfigEntry.java
new file mode 100644
index 0000000..f84f890
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticMappingConfigEntry.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.loader;
+
+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 StaticMappingConfigEntry<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;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticMappingConfigLoader.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticMappingConfigLoader.java
new file mode 100644
index 0000000..01e4427
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticMappingConfigLoader.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.loader;
+
+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 StaticMappingConfigLoader<T, R>
+{
+ void setSourceOfMapping(String path);
+ List<StaticMappingConfigEntry<T, R>> getMapping();
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticMappingConfigLoaderNames.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticMappingConfigLoaderNames.java
new file mode 100644
index 0000000..9b01ffe
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticMappingConfigLoaderNames.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.loader;
+
+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 StaticMappingConfigLoaderNames
+{
+ ANNOTATION_TO_VALIDATION_STRATEGY_CONFIG_LOADER,
+ VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_CONFIG_LOADER,
+ VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_CONFIG_LOADER
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticResourceBundleLoader.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticResourceBundleLoader.java
new file mode 100644
index 0000000..6f285f9
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/loader/StaticResourceBundleLoader.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.loader;
+
+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 StaticResourceBundleLoader implements StaticMappingConfigLoader<String, String>
+{
+ private String path;
+ private List<StaticMappingConfigEntry<String, String>> mappings;
+
+ public void setSourceOfMapping(String path)
+ {
+ this.path = path;
+ //force reload
+ mappings = null;
+ }
+
+ public List<StaticMappingConfigEntry<String, String>> getMapping()
+ {
+ if(mappings != null)
+ {
+ return mappings;
+ }
+
+ mappings = new ArrayList<StaticMappingConfigEntry<String, String>>();
+
+ ResourceBundle mapping = ResourceBundle.getBundle(path);
+
+ if (mapping == null)
+ {
+ //logging
+ return new ArrayList<StaticMappingConfigEntry<String, String>>();
+ }
+
+ Enumeration keys = mapping.getKeys();
+
+ String annotationClassName;
+ String validationStrategyClassName;
+
+ while (keys.hasMoreElements())
+ {
+ annotationClassName = (String) keys.nextElement();
+ validationStrategyClassName = mapping.getString(annotationClassName);
+
+ addMapping(annotationClassName, validationStrategyClassName);
+ }
+ return mappings;
+ }
+
+ private void addMapping(String annotationClassName, String validationStrategyClassName)
+ {
+ StaticMappingConfigEntry<String, String> entry = new StaticMappingConfigEntry<String, String>();
+ entry.setSource(annotationClassName);
+ entry.setTarget(validationStrategyClassName);
+ this.mappings.add(entry);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/AbstractCustomNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/AbstractCustomNameMapper.java
new file mode 100644
index 0000000..9f578c5
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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();
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/ClassMappingFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/ClassMappingFactory.java
new file mode 100644
index 0000000..f68d73c
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/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.mapper;
+
+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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/NameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/mapper/NameMapper.java
new file mode 100644
index 0000000..f94db42
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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. Annotation -> ValidationStrategy
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface NameMapper<T>
+{
+ String createName(T source);
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/CommonMetaDataKeys.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/CommonMetaDataKeys.java
new file mode 100644
index 0000000..5af33e6
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/CommonMetaDataKeys.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.metadata;
+
+/**
+ * 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)
+ */
+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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/AbstractMetaDataTransformer.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/AbstractMetaDataTransformer.java
new file mode 100644
index 0000000..6457196
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/AbstractMetaDataTransformer.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.core.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+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;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+//long term target: skipValidation for all annotations (if possible)
+public abstract class AbstractMetaDataTransformer implements MetaDataTransformer
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ protected AbstractMetaDataTransformer()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public final Map<String, Object> convertMetaData(AnnotationEntry annotationEntry)
+ {
+ if(skipValidation(annotationEntry))
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(getClass() + " validation skiped");
+ }
+ Map<String, Object> results = new HashMap<String, Object>();
+ results.put(CommonMetaDataKeys.SKIP_VALIDATION, getMetaDataKeys());
+ return results;
+ }
+
+ return convert(annotationEntry);
+ }
+
+ protected boolean skipValidation(AnnotationEntry annotationEntry)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ Boolean result = (Boolean) ExtValUtils.getELHelper()
+ .getValueOfExpression(facesContext, new ValueBindingExpression(getSkipExpression(annotationEntry)));
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(getClass() + "#skipValidation result of getSkipExpression: "
+ + getSkipExpression(annotationEntry));
+ }
+
+ return result;
+ }
+
+ protected String getSkipExpression(AnnotationEntry annotationEntry)
+ {
+ return "#{false}"; //default - don't skip
+ }
+
+ /**
+ * if the current annotation is skiped provide the meta-data keys which are irrelevant
+ * -> component initializers have to reset these properties
+ */
+ protected List<String> getMetaDataKeys()
+ {
+ return new ArrayList<String>();
+ }
+
+ protected abstract Map<String, Object> convert(AnnotationEntry annotation);
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapter.java b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapterImpl.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapterImpl.java
new file mode 100644
index 0000000..acdda62
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/BeanMetaDataTransformerAdapterImpl.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.annotation.AnnotationEntry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Map;
+import java.util.List;
+
+/**
+ * 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 extends AbstractMetaDataTransformer
+ implements BeanMetaDataTransformerAdapter
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private MetaDataTransformer metaDataTransformer;
+ private String metaDataTransformerClassName;
+
+ public Map<String, Object> convert(AnnotationEntry annotationEntry)
+ {
+ if(this.metaDataTransformer instanceof AbstractMetaDataTransformer)
+ {
+ return ((AbstractMetaDataTransformer)this.metaDataTransformer).convert(annotationEntry);
+ }
+ return this.metaDataTransformer.convertMetaData(annotationEntry);
+ }
+
+ @Override
+ protected String getSkipExpression(AnnotationEntry annotation)
+ {
+ if(this.metaDataTransformer instanceof AbstractMetaDataTransformer)
+ {
+ return ((AbstractMetaDataTransformer)this.metaDataTransformer).getSkipExpression(annotation);
+ }
+ return super.getSkipExpression(annotation);
+ }
+
+ @Override
+ protected List<String> getMetaDataKeys()
+ {
+ if(this.metaDataTransformer instanceof AbstractMetaDataTransformer)
+ {
+ return ((AbstractMetaDataTransformer)this.metaDataTransformer).getMetaDataKeys();
+ }
+ return super.getMetaDataKeys();
+ }
+
+ 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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/DefaultMetaDataTransformerFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/DefaultMetaDataTransformerFactory.java
new file mode 100644
index 0000000..a42e936
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/DefaultMetaDataTransformerFactory.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.mapper.ClassMappingFactory;
+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.metadata.transformer.mapper
+ .CustomConfiguredValidationStrategyToMetaDataTransformerNameMapper;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.mapper
+ .CustomConventionValidationStrategyToMetaDataTransformerNameMapper;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.mapper
+ .DefaultValidationStrategyToMetaDataTransformerNameMapper;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.mapper
+ .SimpleValidationStrategyToMetaDataTransformerNameMapper;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.mapper
+ .BeanValidationStrategyToMetaDataTransformerNameMapper;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigLoader;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigLoaderNames;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigEntry;
+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 Annotation -> MetaDataTransformer
+ * to avoid a second static mapping e.g. for jpa annotations
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultMetaDataTransformerFactory implements
+ ClassMappingFactory<ValidationStrategy, MetaDataTransformer>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private static Map<String, String> validationStrategyToMetaDataTransformerMapping;
+ private static List<NameMapper<ValidationStrategy>> nameMapperList
+ = new ArrayList<NameMapper<ValidationStrategy>>();
+
+ static
+ {
+ nameMapperList
+ .add(new CustomConfiguredValidationStrategyToMetaDataTransformerNameMapper());
+ nameMapperList
+ .add(new CustomConventionValidationStrategyToMetaDataTransformerNameMapper());
+ nameMapperList
+ .add(new DefaultValidationStrategyToMetaDataTransformerNameMapper());
+ nameMapperList
+ .add(new SimpleValidationStrategyToMetaDataTransformerNameMapper());
+ nameMapperList
+ .add(new BeanValidationStrategyToMetaDataTransformerNameMapper());
+ }
+
+ 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 void initStaticMappings()
+ {
+ synchronized (DefaultMetaDataTransformerFactory.class)
+ {
+ validationStrategyToMetaDataTransformerMapping = new HashMap<String, String>();
+
+ //setup internal static mappings
+ for (StaticMappingConfigLoader<String, String> staticMappingConfigLoader :
+ ExtValContext.getContext().getStaticMappingConfigLoaders(
+ StaticMappingConfigLoaderNames.VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_CONFIG_LOADER))
+ {
+ setupStrategyMappings(staticMappingConfigLoader.getMapping());
+ }
+ }
+ }
+
+ private void setupStrategyMappings(List<StaticMappingConfigEntry<String, String>> mappings)
+ {
+ for(StaticMappingConfigEntry<String, String> mapping : mappings)
+ {
+ addMapping(mapping.getSource(), mapping.getTarget());
+ }
+ }
+
+ private void addMapping(String validationStrategyName, String transformerName)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("adding validation strategy to meta-data transformer mapping: "
+ + validationStrategyName + " -> " + transformerName);
+ }
+
+ synchronized (DefaultMetaDataTransformerFactory.class)
+ {
+ validationStrategyToMetaDataTransformerMapping.put(validationStrategyName, transformerName);
+ }
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/MetaDataTransformer.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/MetaDataTransformer.java
new file mode 100644
index 0000000..3c1b50d
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/MetaDataTransformer.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.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.annotation.AnnotationEntry;
+
+import java.util.Map;
+
+/**
+ * @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(AnnotationEntry annotation);
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/AbstractValidationStrategyToMetaDataTransformerNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/AbstractValidationStrategyToMetaDataTransformerNameMapper.java
new file mode 100644
index 0000000..1002132
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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, UsageCategory.ALTERNATIVE})
+public abstract class AbstractValidationStrategyToMetaDataTransformerNameMapper
+ implements NameMapper<ValidationStrategy>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public AbstractValidationStrategyToMetaDataTransformerNameMapper()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/BeanValidationStrategyToMetaDataTransformerNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/BeanValidationStrategyToMetaDataTransformerNameMapper.java
new file mode 100644
index 0000000..902dd9b
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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, UsageCategory.ALTERNATIVE})
+public class BeanValidationStrategyToMetaDataTransformerNameMapper extends
+ AbstractValidationStrategyToMetaDataTransformerNameMapper
+{
+ public String createName(ValidationStrategy validationStrategy)
+ {
+ if(validationStrategy instanceof BeanValidationStrategyAdapter)
+ {
+ return ((BeanValidationStrategyAdapter)validationStrategy).getMetaDataTransformerClassName();
+ }
+ return null;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/CustomConfiguredValidationStrategyToMetaDataTransformerNameMapper.java b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/CustomConventionValidationStrategyToMetaDataTransformerNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/CustomConventionValidationStrategyToMetaDataTransformerNameMapper.java
new file mode 100644
index 0000000..62e6ddd
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.CustomInfo;
+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(CustomInfo.VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/DefaultValidationStrategyToMetaDataTransformerNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/DefaultValidationStrategyToMetaDataTransformerNameMapper.java
new file mode 100644
index 0000000..1ebedb0
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/SimpleValidationStrategyToMetaDataTransformerNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/transformer/mapper/SimpleValidationStrategyToMetaDataTransformerNameMapper.java
new file mode 100644
index 0000000..27ceedb
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.CustomInfo;
+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, UsageCategory.ALTERNATIVE})
+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(CustomInfo.META_DATA_TRANSFORMER_POSTFIX);
+
+ if(validationStrategyClassName.endsWith("ValidationStrategy") ||
+ validationStrategyClassName.endsWith("Strategy"))
+ {
+ return validationStrategyPackageName + validationStrategyClassName
+ .replace(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInfo.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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/recorder/ProcessedInformationRecorder.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/recorder/ProcessedInformationRecorder.java
new file mode 100644
index 0000000..026903f
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/recorder/ProcessedInformationRecorder.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.recorder;
+
+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 interface ProcessedInformationRecorder
+{
+ void recordUserInput(UIComponent uiComponent, Object value);
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/AbstractRenderKitWrapperFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/AbstractRenderKitWrapperFactory.java
new file mode 100644
index 0000000..e425a69
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.mapper.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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/DefaultRenderKitWrapperFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/DefaultRenderKitWrapperFactory.java
new file mode 100644
index 0000000..147e050
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKit.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKit.java
new file mode 100644
index 0000000..fd41d84
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKit.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.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);
+ return renderer instanceof ExtValRendererWrapper ? renderer : createWrapper(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, UsageCategory.CUSTOMIZABLE})
+ protected Renderer createWrapper(Renderer renderer)
+ {
+ return new ExtValRendererWrapper(renderer);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKitFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKitFactory.java
new file mode 100644
index 0000000..f2d20c6
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRenderKitFactory.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.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);
+
+ 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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererProxy.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererProxy.java
new file mode 100644
index 0000000..c176b76
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererProxy.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private 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);
+ wrapped.decode(facesContext, uiComponent);
+ }
+ }
+
+ @Override
+ public void encodeBegin(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ RendererProxyEntry entry = getOrInitEntry(facesContext, uiComponent);
+
+ if (!entry.isEncodeBeginCalled())
+ {
+ entry.setEncodeBeginCalled(true);
+ wrapped.encodeBegin(facesContext, uiComponent);
+ }
+ }
+
+ @Override
+ public void encodeChildren(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ RendererProxyEntry entry = getOrInitEntry(facesContext, uiComponent);
+
+ if (!entry.isEncodeChildrenCalled())
+ {
+ entry.setEncodeChildrenCalled(true);
+ wrapped.encodeChildren(facesContext, uiComponent);
+ }
+ }
+
+ @Override
+ public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ RendererProxyEntry entry = getOrInitEntry(facesContext, uiComponent);
+
+ if (!entry.isEncodeEndCalled())
+ {
+ entry.setEncodeEndCalled(true);
+ wrapped.encodeEnd(facesContext, uiComponent);
+ }
+ }
+
+ @Override
+ public String convertClientId(FacesContext facesContext, String s)
+ {
+ return wrapped.convertClientId(facesContext, s);
+ }
+
+ @Override
+ public boolean getRendersChildren()
+ {
+ return wrapped.getRendersChildren();
+ }
+
+ @Override
+ public Object getConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object o)
+ throws ConverterException
+ {
+ RendererProxyEntry entry = getOrInitEntry(facesContext, uiComponent);
+
+ if (entry.getConvertedValue() == null)
+ {
+ entry.setConvertedValue(wrapped.getConvertedValue(facesContext, uiComponent, o));
+ }
+ return entry.getConvertedValue();
+ }
+
+ private RendererProxyEntry getOrInitEntry(FacesContext facesContext, UIComponent uiComponent)
+ {
+ String clientId = uiComponent.getClientId(facesContext);
+
+ if (!getOrInitComponentProxyMapping().containsKey(clientId))
+ {
+ getOrInitComponentProxyMapping().put(clientId, new RendererProxyEntry());
+ }
+ return getOrInitComponentProxyMapping().get(clientId);
+ }
+
+ 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);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererWrapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererWrapper.java
new file mode 100644
index 0000000..4badfa2
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/ExtValRendererWrapper.java
@@ -0,0 +1,495 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.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;
+
+/**
+ * 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)
+ {
+ this.wrapped = new ExtValRendererProxy(renderer);
+
+ 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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/RendererProxyEntry.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/RendererProxyEntry.java
new file mode 100644
index 0000000..9963910
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipAfterInterceptorsException.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipAfterInterceptorsException.java
new file mode 100644
index 0000000..08e3fc1
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipAfterInterceptorsException.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class SkipAfterInterceptorsException extends Exception
+{
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipBeforeInterceptorsException.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipBeforeInterceptorsException.java
new file mode 100644
index 0000000..1707ddf
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipBeforeInterceptorsException.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class SkipBeforeInterceptorsException extends Exception
+{
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipRendererDelegationException.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipRendererDelegationException.java
new file mode 100644
index 0000000..0945464
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/renderkit/exception/SkipRendererDelegationException.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.renderkit.exception;
+
+import org.apache.myfaces.extensions.validator.core.interceptor.RendererInterceptor;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+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;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/AbstractStartupListener.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/AbstractStartupListener.java
new file mode 100644
index 0000000..ecb7aba
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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();
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java
new file mode 100644
index 0000000..5c4af33
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.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.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.CustomInfo;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+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())
+ {
+ logger.info("starting up MyFaces Extensions Validator v" + ExtValInformation.VERSION);
+ }
+
+ ExtValContext.getContext().registerRendererInterceptor(new ValidationInterceptor());
+
+ executeCustomStartupListener();
+ }
+
+ private void executeCustomStartupListener()
+ {
+ String customStartupListenerName = ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInfo.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");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java
new file mode 100644
index 0000000..421a872
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.CustomInfo;
+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
+{
+ 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)
+ return (customMessage != null) ? customMessage
+ : (getBaseName() != null) ? ResourceBundle.getBundle(getBaseName(), locale).getString(key) : null;
+ }
+
+ 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(CustomInfo.CONVENTION_FOR_CUSTOM_MESSAGE_BUNDLE), 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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java
new file mode 100644
index 0000000..e090ce2
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.mapper.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+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.DefaultModuleValidationStrategyToMsgResolverNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.message.
+ resolver.mapper.DefaultValidationStrategyToMsgResolverNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.message.
+ resolver.mapper.SimpleValidationStrategyToMsgResolverNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigLoader;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigEntry;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigLoaderNames;
+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 implements
+ ClassMappingFactory<ValidationStrategy, MessageResolver>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private static Map<String, String> strategyMessageResolverMapping;
+ private static List<NameMapper<ValidationStrategy>> nameMapperList =
+ new ArrayList<NameMapper<ValidationStrategy>>();
+
+ static
+ {
+ nameMapperList
+ .add(new CustomConfiguredValidationStrategyToMsgResolverNameMapper());
+ nameMapperList
+ .add(new CustomConventionValidationStrategyToMsgResolverNameMapper());
+ nameMapperList
+ .add(new DefaultValidationStrategyToMsgResolverNameMapper());
+ nameMapperList
+ .add(new DefaultModuleValidationStrategyToMsgResolverNameMapper());
+ nameMapperList
+ .add(new SimpleValidationStrategyToMsgResolverNameMapper());
+ }
+
+ 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 void initStaticMappings()
+ {
+ synchronized (DefaultMessageResolverFactory.class)
+ {
+ strategyMessageResolverMapping = new HashMap<String, String>();
+
+ //setup internal static mappings
+ for (StaticMappingConfigLoader<String, String> staticMappingConfigLoader :
+ ExtValContext.getContext().getStaticMappingConfigLoaders(
+ StaticMappingConfigLoaderNames.VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_CONFIG_LOADER))
+ {
+ setupStrategyMappings(staticMappingConfigLoader.getMapping());
+ }
+ }
+ }
+
+ private void setupStrategyMappings(List<StaticMappingConfigEntry<String,String>> mappings)
+ {
+ for(StaticMappingConfigEntry<String, String> mapping : mappings)
+ {
+ addMapping(mapping.getSource(), mapping.getTarget());
+ }
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "logging")
+ private void addMapping(String validationStrategyName, String messageResolverName)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("adding static validation strategy to message resolver mapping: "
+ + validationStrategyName + " -> " + messageResolverName);
+ }
+
+ synchronized (DefaultMessageResolverFactory.class)
+ {
+ strategyMessageResolverMapping.put(validationStrategyName, messageResolverName);
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultValidationErrorMessageResolver.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultValidationErrorMessageResolver.java
new file mode 100644
index 0000000..a99274a
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultValidationErrorMessageResolver.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.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;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java
new file mode 100644
index 0000000..434f863
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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);
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/AbstractValidationStrategyToMsgResolverNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/AbstractValidationStrategyToMsgResolverNameMapper.java
new file mode 100644
index 0000000..594c4d6
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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");
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/CustomConfiguredValidationStrategyToMsgResolverNameMapper.java b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/CustomConventionValidationStrategyToMsgResolverNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/CustomConventionValidationStrategyToMsgResolverNameMapper.java
new file mode 100644
index 0000000..1b03bf6
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.CustomInfo;
+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(CustomInfo.VALIDATION_STRATEGY_TO_MSG_RESOLVER_NAME_MAPPER);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultModuleValidationStrategyToMsgResolverNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultModuleValidationStrategyToMsgResolverNameMapper.java
new file mode 100644
index 0000000..6cdf42b
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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();
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java
new file mode 100644
index 0000000..015c117
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java
new file mode 100644
index 0000000..2dd64d8
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.CustomInfo;
+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, UsageCategory.ALTERNATIVE})
+public class SimpleValidationStrategyToMsgResolverNameMapper extends
+ DefaultValidationStrategyToMsgResolverNameMapper
+{
+ protected String getClassName(String strategyClassName)
+ {
+ String customPostfix = ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInfo.VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX);
+ return InternalConventionProvider.getValidationStrategyBasedName(strategyClassName, customPostfix);
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java
new file mode 100644
index 0000000..e9070b6
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.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 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 AbstractValidationStrategy extends
+ AbstractValidatorAdapter
+{
+ protected static final String DETAIL_MESSAGE_KEY_POSTFIX = "_details";
+ 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 getErrorMessageDetails(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 new FacesMessage(FacesMessage.SEVERITY_ERROR,
+ getErrorMessageSummary(annotation), getErrorMessageDetails(annotation));
+ }
+
+ protected abstract String getValidationErrorMsgKey(Annotation annotation);
+
+ public void setMessageResolver(MessageResolver messageResolver)
+ {
+ this.messageResolver = messageResolver;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java
new file mode 100644
index 0000000..dfa0ab0
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
+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.convert.ConverterException;
+import javax.faces.validator.ValidatorException;
+import java.lang.annotation.Annotation;
+
+/**
+ * Provides the ability to use ValidatorException (as expected by the user) instead of ConverterException.
+ * Furthermore it provides:<br/>
+ * initValidation<br/>
+ * processAfterValidatorException
+ * <p/>
+ * adds support for "skipable" validation strategies
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.REUSE})
+public abstract class AbstractValidatorAdapter implements ValidationStrategy
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+ private static final String DO_NOT_SKIP = "#{false}"; //don't skip
+
+ protected AbstractValidatorAdapter()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public void validate(FacesContext facesContext, UIComponent uiComponent,
+ AnnotationEntry annotationEntry, Object convertedObject)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start initValidation of " + getClass().getName());
+ }
+
+ if(skipValidation(facesContext, uiComponent, annotationEntry, convertedObject))
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(getClass() + " validation skiped");
+ }
+ return;
+ }
+
+ initValidation(facesContext, uiComponent, annotationEntry, 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, annotationEntry, convertedObject);
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("processValidation of " + getClass().getName() + " finished");
+ }
+ }
+ catch (ValidatorException e)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("start processAfterValidatorException of " + getClass().getName());
+ }
+
+ if (processAfterValidatorException(facesContext, uiComponent,
+ annotationEntry, convertedObject, e))
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(getClass().getName() +
+ ": throw original exception after processAfterValidatorException");
+ }
+
+ throw new ConverterException(e.getFacesMessage(), e);
+ }
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(getClass().getName() +
+ ": original exception after processAfterValidatorException not thrown");
+ }
+ }
+ }
+
+ protected boolean skipValidation(FacesContext facesContext, UIComponent uiComponent,
+ AnnotationEntry annotationEntry, Object convertedObject)
+ {
+ String expression = getSkipExpression(annotationEntry.getAnnotation());
+
+ //just for a better performance for "none-skipable" strategies
+ if(DO_NOT_SKIP.equals(expression))
+ {
+ return false;
+ }
+
+ Boolean result = (Boolean)ExtValUtils.getELHelper()
+ .getValueOfExpression(facesContext, new ValueBindingExpression(expression));
+
+ if(logger.isTraceEnabled())
+ {
+ logger.trace(getClass() + "#skipValidation result of getSkipExpression: " + expression);
+ }
+
+ return result;
+ }
+
+ protected String getSkipExpression(Annotation annotation)
+ {
+ return DO_NOT_SKIP;
+ }
+
+ protected void initValidation(FacesContext facesContext,
+ UIComponent uiComponent,
+ AnnotationEntry annotationEntry,
+ Object convertedObject)
+ {
+ //override if needed
+ }
+
+ //override if needed
+ protected boolean processAfterValidatorException(FacesContext facesContext,
+ UIComponent uiComponent, AnnotationEntry annotationEntry,
+ Object convertedObject, ValidatorException e)
+ {
+ return true;
+ }
+
+ protected abstract void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, AnnotationEntry annotationEntry,
+ Object convertedObject) throws ValidatorException;
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapter.java b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapterImpl.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapterImpl.java
new file mode 100644
index 0000000..acd592d
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.annotation.AnnotationEntry;
+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,
+ AnnotationEntry annotationEntry,
+ Object convertedObject)
+ {
+ this.validationStrategy.validate(facesContext, uiComponent, annotationEntry, 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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java
new file mode 100644
index 0000000..a6c95dc
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java
@@ -0,0 +1,227 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.mapper.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInfo;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigLoader;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigEntry;
+import org.apache.myfaces.extensions.validator.core.loader.StaticResourceBundleLoader;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigLoaderNames;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper
+ .AnnotationToValidationStrategyBeanNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper
+ .CustomConfiguredAnnotationToValidationStrategyNameMapper;
+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
+ .SimpleAnnotationToValidationStrategyNameMapper;
+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.lang.annotation.Annotation;
+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 annotation
+ *
+ * @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 DefaultValidationStrategyFactory implements ClassMappingFactory<Annotation, ValidationStrategy>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private static Map<String, String> annotationStrategyMapping = null;
+ private static List<NameMapper<Annotation>> nameMapperList = new ArrayList<NameMapper<Annotation>>();
+
+ static
+ {
+ nameMapperList
+ .add(new CustomConfiguredAnnotationToValidationStrategyNameMapper());
+ nameMapperList
+ .add(new CustomConventionAnnotationToValidationStrategyNameMapper());
+ nameMapperList
+ .add(new DefaultAnnotationToValidationStrategyNameMapper());
+ nameMapperList
+ .add(new SimpleAnnotationToValidationStrategyNameMapper());
+
+ nameMapperList
+ .add(new AnnotationToValidationStrategyBeanNameMapper(
+ new CustomConfiguredAnnotationToValidationStrategyNameMapper()));
+ nameMapperList
+ .add(new AnnotationToValidationStrategyBeanNameMapper(
+ new CustomConventionAnnotationToValidationStrategyNameMapper()));
+ nameMapperList.add(new AnnotationToValidationStrategyBeanNameMapper(
+ new DefaultAnnotationToValidationStrategyNameMapper()));
+ nameMapperList.add(new AnnotationToValidationStrategyBeanNameMapper(
+ new SimpleAnnotationToValidationStrategyNameMapper()));
+ }
+
+ public DefaultValidationStrategyFactory()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+
+ public ValidationStrategy create(Annotation annotation)
+ {
+ if (annotationStrategyMapping == null)
+ {
+ initStaticMappings();
+ }
+
+ String annotationName = annotation.annotationType().getName();
+
+ if (annotationStrategyMapping.containsKey(annotationName))
+ {
+ return getValidationStrategyInstance(annotationStrategyMapping.get(annotationName));
+ }
+
+ ValidationStrategy validationStrategy;
+ String strategyName;
+ //null -> use name mappers
+ for (NameMapper<Annotation> nameMapper : nameMapperList)
+ {
+ strategyName = nameMapper.createName(annotation);
+
+ if (strategyName == null)
+ {
+ continue;
+ }
+
+ validationStrategy = getValidationStrategyInstance(strategyName);
+
+ if (validationStrategy != null)
+ {
+ addMapping(annotationName, 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 void addMapping(String annotationName, String validationStrategyName)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("adding annotation to validation strategy mapping: "
+ + annotationName + " -> " + validationStrategyName);
+ }
+
+ synchronized (DefaultValidationStrategyFactory.class)
+ {
+ annotationStrategyMapping.put(annotationName, validationStrategyName);
+ }
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "logging")
+ private void initStaticMappings()
+ {
+ synchronized (DefaultValidationStrategyFactory.class)
+ {
+ annotationStrategyMapping = new HashMap<String, String>();
+
+ //setup internal static mappings
+ for (StaticMappingConfigLoader<String, String> staticMappingConfigLoader :
+ ExtValContext.getContext().getStaticMappingConfigLoaders(
+ StaticMappingConfigLoaderNames.ANNOTATION_TO_VALIDATION_STRATEGY_CONFIG_LOADER))
+ {
+ setupStrategyMappings(staticMappingConfigLoader.getMapping());
+ }
+
+ StaticMappingConfigLoader<String, String> staticMappingConfigLoader = new StaticResourceBundleLoader();
+ //try to setup mapping with base name by convention - overrides default mapping
+ try
+ {
+ //build convention (strategy mapping)
+ staticMappingConfigLoader.setSourceOfMapping(ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInfo.STATIC_STRATEGY_MAPPING_SOURCE));
+
+ setupStrategyMappings(staticMappingConfigLoader.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
+ {
+ staticMappingConfigLoader = new StaticResourceBundleLoader();
+ staticMappingConfigLoader.setSourceOfMapping(customMappingBaseName);
+ setupStrategyMappings(staticMappingConfigLoader.getMapping());
+ }
+ catch (MissingResourceException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private void setupStrategyMappings(List<StaticMappingConfigEntry<String,String>> mappings)
+ {
+ for(StaticMappingConfigEntry<String, String> mapping : mappings)
+ {
+ addMapping(mapping.getSource(), mapping.getTarget());
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.java
new file mode 100644
index 0000000..c80d6b9
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.annotation.AnnotationEntry;
+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,
+ AnnotationEntry annotationEntry, Object convertedObject);
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AbstractAnnotationToValidationStrategyNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AbstractAnnotationToValidationStrategyNameMapper.java
new file mode 100644
index 0000000..2fe7aeb
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AbstractAnnotationToValidationStrategyNameMapper.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.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;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public abstract class AbstractAnnotationToValidationStrategyNameMapper implements NameMapper<Annotation>
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public AbstractAnnotationToValidationStrategyNameMapper()
+ {
+ if(logger.isDebugEnabled())
+ {
+ logger.debug(getClass().getName() + " instantiated");
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AnnotationToValidationStrategyBeanNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AnnotationToValidationStrategyBeanNameMapper.java
new file mode 100644
index 0000000..7f7f4ff
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AnnotationToValidationStrategyBeanNameMapper.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 java.lang.annotation.Annotation;
+
+/**
+ * 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
+ AbstractAnnotationToValidationStrategyNameMapper
+{
+ public static final String PREFIX_FOR_BEAN_MAPPING = "bean:";
+ private NameMapper<Annotation> wrapped;
+
+ public AnnotationToValidationStrategyBeanNameMapper(NameMapper<Annotation> nameMapper)
+ {
+ this.wrapped = nameMapper;
+ }
+
+ public String createName(Annotation 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.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConfiguredAnnotationToValidationStrategyNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConfiguredAnnotationToValidationStrategyNameMapper.java
new file mode 100644
index 0000000..1e44555
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConfiguredAnnotationToValidationStrategyNameMapper.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.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;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * 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<Annotation>
+{
+ protected String getCustomNameMapperClassName()
+ {
+ return WebXmlParameter.CUSTOM_ANNOTATION_TO_VALIDATION_STRATEGY_NAME_MAPPER;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java
new file mode 100644
index 0000000..19fb55e
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.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.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.CustomInfo;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * 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<Annotation>
+{
+ protected String getCustomNameMapperClassName()
+ {
+ return ExtValContext.getContext().getInformationProviderBean()
+ .get(CustomInfo.ANNOTATION_TO_VALIDATION_STRATEGY_NAME_MAPPER);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.java
new file mode 100644
index 0000000..c8b682e
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.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.InternalConventionProvider;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * Default implementation which maps ExtVal Annotations to ExtVal ValidationStrategies.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultAnnotationToValidationStrategyNameMapper extends
+ AbstractAnnotationToValidationStrategyNameMapper
+{
+ public String createName(Annotation annotation)
+ {
+ return InternalConventionProvider.getValidationStrategyClassName(annotation);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.java
new file mode 100644
index 0000000..7bc88c8
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.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.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInfo;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * It's an alternative Mapper to place Annotations and ValidationStrategies in the same package.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.ALTERNATIVE})
+public class SimpleAnnotationToValidationStrategyNameMapper extends
+ AbstractAnnotationToValidationStrategyNameMapper
+{
+ public String createName(Annotation annotation)
+ {
+ return annotation.annotationType().getName() +
+ ExtValContext.getContext().getInformationProviderBean().get(CustomInfo.VALIDATION_STRATEGY_POSTFIX);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/internal/Priority.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/internal/Priority.java
new file mode 100644
index 0000000..57947d5
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/internal/ToDo.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/internal/ToDo.java
new file mode 100644
index 0000000..1e3b094
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/internal/ToDo.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.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 "";
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageCategory.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageCategory.java
new file mode 100644
index 0000000..e5ca388
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageCategory.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.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 artifact.
+ * 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.
+ * <p/>
+ * FALLBACK and ALTERNATIVE
+ * e.g.: some mechanisms aren't deprecated, because it makes sense to use them.
+ * however, it's not the default approach
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public enum UsageCategory
+{
+ API,
+ INTERNAL,
+ CUSTOMIZABLE,
+ REUSE,
+ FALLBACK,
+ ALTERNATIVE
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageInformation.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageInformation.java
new file mode 100644
index 0000000..a99495f
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageInformation.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.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
+ * <p/>
+ * e.g.: some mechanisms aren't deprecated
+ * they are e.g. fallbacks, alternatives,...
+ * in order to avoid the deprecated annotation it's possible to use this one.
+ * you can tell other developers:
+ * this artifact isn't used for the desired approach, however, it's still essential to have it as ...
+ * <p/>
+ * idea: unify small parts of information which are frequently used
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({TYPE, METHOD, FIELD})
+public @interface UsageInformation
+{
+ UsageCategory[] value();
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java
new file mode 100644
index 0000000..df275ea
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.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.util;
+
+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 ClassUtils
+{
+ 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();
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
new file mode 100644
index 0000000..d7520f4
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.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.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.mapper.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+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.annotation.extractor.AnnotationExtractor;
+import org.apache.myfaces.extensions.validator.core.annotation.extractor.AnnotationExtractorFactory;
+import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+import java.lang.annotation.Annotation;
+
+
+/**
+ * @author Gerhard Petracek
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValUtils
+{
+ public static ValidationStrategy getValidationStrategyForAnnotation(Annotation annotation)
+ {
+ return ((ClassMappingFactory<Annotation, ValidationStrategy>) ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.VALIDATION_STRATEGY_FACTORY, ClassMappingFactory.class))
+ .create(annotation);
+ }
+
+ 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 AnnotationExtractor getAnnotationExtractor()
+ {
+ return ExtValContext.getContext().getFactoryFinder()
+ .getFactory(FactoryNames.COMPONENT_ANNOTATION_EXTRACTOR_FACTORY, AnnotationExtractorFactory.class)
+ .create();
+ }
+
+ public static void configureComponentWithMetaData(FacesContext facesContext,
+ UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+ ((ClassMappingFactory<UIComponent, ComponentInitializer>)ExtValContext.getContext().getFactoryFinder()
+ .getFactory(FactoryNames.COMPONENT_INITIALIZER_FACTORY, ClassMappingFactory.class))
+ .create(uiComponent)
+ .configureComponent(facesContext, uiComponent, metaData);
+ }
+
+ public static MessageResolver getMessageResolverForValidationStrategy(ValidationStrategy validationStrategy)
+ {
+ return ((ClassMappingFactory<ValidationStrategy, MessageResolver>)ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.MESSAGE_RESOLVER_FACTORY, ClassMappingFactory.class))
+ .create(validationStrategy);
+ }
+
+ public static ELHelper getELHelper()
+ {
+ return ExtValContext.getContext().getFactoryFinder()
+ .getFactory(FactoryNames.EL_HELPER_FACTORY, AbstractELHelperFactory.class).create();
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/JsfUtils.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/JsfUtils.java
new file mode 100644
index 0000000..61ba44e
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/JsfUtils.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.util;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.FactoryFinder;
+import javax.faces.event.PhaseListener;
+import javax.faces.lifecycle.Lifecycle;
+import javax.faces.lifecycle.LifecycleFactory;
+import java.util.Iterator;
+
+
+/**
+ * @author Gerhard Petracek
+ */
+@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);
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/ReflectionUtils.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/ReflectionUtils.java
new file mode 100644
index 0000000..bfb0df0
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/ReflectionUtils.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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;
+
+/**
+ * @author Gerhard Petracek
+ */
+@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
+ {
+ return targetClass.getMethod(targetMethodName, parameterTypes);
+ }
+
+ 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 tryToInvokeMethodOfClassAndMethodName(String className, String methodName)
+ {
+ return tryToInvokeMethodOfClassAndMethodName(className, methodName, null);
+ }
+
+ public static Object tryToInvokeMethodOfClassAndMethodName(String className, String methodName, Object[] args)
+ {
+ Class[] targetArgs = new Class[0];
+
+ if(args != null)
+ {
+ targetArgs = new Class[args.length];
+
+ for(int i = 0; i < args.length; i++)
+ {
+ targetArgs[i] = args[i].getClass();
+ }
+ }
+
+ return tryToInvokeMethodOfClassAndMethodName(className, methodName, args, targetArgs);
+ }
+
+ public static Object tryToInvokeMethodOfClassAndMethodName(String className, String methodName,
+ Object[] args, Class[] argTypes)
+ {
+ Class targetClass = ClassUtils.tryToLoadClassForName(className);
+ Method targetMethod = tryToGetMethod(targetClass, methodName, argTypes);
+ return tryToInvokeMethodOfClass(targetClass, targetMethod, args);
+ }
+
+ 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 method.invoke(target, 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
+ {
+ return method.invoke(target, args);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/WebXmlUtils.java b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/WebXmlUtils.java
new file mode 100644
index 0000000..8659dda
--- /dev/null
+++ b/1.0.1-SNAPSHOT/core/src/main/java/org/apache/myfaces/extensions/validator/util/WebXmlUtils.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.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
+ */
+@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.0.1-SNAPSHOT/core/src/main/resources/LICENSE.txt b/1.0.1-SNAPSHOT/core/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/core/src/main/resources/NOTICE.txt b/1.0.1-SNAPSHOT/core/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/examples/feature-set_01/pom.xml b/1.0.1-SNAPSHOT/examples/feature-set_01/pom.xml
new file mode 100644
index 0000000..9fadb34
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/feature-set_01/pom.xml
@@ -0,0 +1,136 @@
+<?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>
+ <version>${build.version}</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-project</artifactId>
+ <version>${build.version}</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>${build.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>myfaces-extval-property-validation</artifactId>
+ <version>${build.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>myfaces-extval-trinidad-support</artifactId>
+ <version>${build.version}</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>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>el-impl</groupId>
+ <artifactId>el-impl</artifactId>
+ <version>1.0</version>
+ <scope>compile</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.0.1-SNAPSHOT/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties
new file mode 100644
index 0000000..88c7d0d
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties
@@ -0,0 +1,3 @@
+# this message bundle is picked up via convention
+repeated_password_required=please retype the password
+repeated_password_required_details=please retype the password
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/domain/Person.java b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/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.0.1-SNAPSHOT/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/gui/beans/RegistrationPage.java b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/gui/beans/RegistrationPage.java
new file mode 100644
index 0000000..5c16a1b
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/demo/gui/beans/RegistrationPage.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.custom.emailvalidator.EmailValidator;
+
+public class RegistrationPage
+{
+
+ //the old password of the person isn't used within the page
+ //-> validate with value of the model
+ @Equals("person.password")
+ @NotEquals("password")
+ private String oldPassword;
+
+ @Required
+ @Equals("passwordRepeated")
+ @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:
+ @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 "";
+ }
+
+ //combine gui related annotations with the annoations of the domain model
+ @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.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/WEB-INF/LICENSE.txt b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/WEB-INF/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/WEB-INF/NOTICE.txt b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/WEB-INF/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/WEB-INF/faces-config.xml b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..c69df4f
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.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.
+-->
+
+<faces-config>
+ <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.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/WEB-INF/web.xml b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..62852c8
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,186 @@
+<?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>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.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/index.html b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/index.html
new file mode 100644
index 0000000..04324aa
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/index.html
@@ -0,0 +1,6 @@
+<html>
+
+<head>
+ <meta http-equiv="refresh" content="0; URL=pages/home.faces">
+</head>
+</html>
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/layout/template.xhtml b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/layout/template.xhtml
new file mode 100644
index 0000000..63a41a5
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/layout/template.xhtml
@@ -0,0 +1,35 @@
+<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.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/change_nickName.xhtml b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/change_nickName.xhtml
new file mode 100644
index 0000000..89dcd03
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/change_nickName.xhtml
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<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.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/change_password.xhtml b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/change_password.xhtml
new file mode 100644
index 0000000..fe400c4
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/change_password.xhtml
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<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>
+
+ <tr:inputText label="old password" value="#{registrationPage.oldPassword}" secret="true"/>
+
+ <tr:inputText label="new password" value="#{registrationPage.password}" secret="true"/>
+ <tr:inputText label="re-enter password" value="#{registrationPage.passwordRepeated}" secret="true"/>
+
+ </tr:panelFormLayout>
+ <tr:commandButton text="save" action="#{registrationPage.finish}"/>
+ <tr:commandLink text="mode: #{registrationPage.person.role}"
+ action="#{registrationPage.switchMode}" immediate="true"/>
+
+ </ui:define>
+</ui:composition>
+
+</body>
+</html>
diff --git a/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/home.xhtml b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/home.xhtml
new file mode 100644
index 0000000..8c0b29d
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/home.xhtml
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<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"/>
+ </ui:define>
+</ui:composition>
+
+</body>
+</html>
diff --git a/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/registration.xhtml b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/registration.xhtml
new file mode 100644
index 0000000..8340418
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/feature-set_01/src/main/webapp/pages/registration.xhtml
@@ -0,0 +1,46 @@
+<!DOCTYPE html PUBLIC
+ "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<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>
+
+ <tr:inputText label="nick name" value="#{registrationPage.person.nickName}"/>
+ <tr:inputText label="e-mail" value="#{registrationPage.email}"/>
+
+ <tr:inputText label="first name" value="#{registrationPage.person.firstName}"/>
+ <tr:inputText label="last name" value="#{registrationPage.person.lastName}"/>
+ <tr:inputDate label="birthday" value="#{registrationPage.person.birthday}">
+ <tr:convertDateTime type="date" dateStyle="short"/>
+ </tr:inputDate>
+ <tr:inputDate label="final exam" value="#{registrationPage.person.finalExam}">
+ <tr:convertDateTime type="date" dateStyle="short"/>
+ </tr:inputDate>
+
+ <tr:inputText label="number of siblings" value="#{registrationPage.numberOfSiblings}"/>
+
+ <tr:inputText label="password" value="#{registrationPage.password}" secret="true"/>
+ <tr:inputText label="re-enter password" value="#{registrationPage.passwordRepeated}" secret="true"/>
+
+ </tr:panelFormLayout>
+ <tr:commandButton text="save" action="#{registrationPage.finish}"/>
+
+ </ui:define>
+</ui:composition>
+
+</body>
+</html>
diff --git a/1.0.1-SNAPSHOT/examples/hello_jpa/pom.xml b/1.0.1-SNAPSHOT/examples/hello_jpa/pom.xml
new file mode 100644
index 0000000..113cf79
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_jpa/pom.xml
@@ -0,0 +1,87 @@
+<?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_jpa</artifactId>
+
+ <name>MyFaces Extensions-Validator examples hello jpa</name>
+ <version>${build.version}</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-project</artifactId>
+ <version>${build.version}</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>${build.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>myfaces-extval-property-validation</artifactId>
+ <version>${build.version}</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>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>el-impl</groupId>
+ <artifactId>el-impl</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/java/log4j.properties b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/java/log4j.properties
new file mode 100644
index 0000000..c7fa04b
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/java/log4j.properties
@@ -0,0 +1,8 @@
+# root logger
+log4j.rootLogger=DEBUG, CustomConsoleAppender
+
+log4j.appender.CustomConsoleAppender=org.apache.log4j.ConsoleAppender
+log4j.appender.CustomConsoleAppender.layout=org.apache.log4j.PatternLayout
+log4j.appender.CustomConsoleAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS}#%5p#[%t]#%m#%C{1}#%M#%L#%n
+log4j.category.org.apache=WARN
+log4j.category.org.apache.myfaces.extensions.validator=DEBUG
diff --git a/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/java/org/apache/myfaces/blank/HelloWorldController.java b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
new file mode 100644
index 0000000..e672b58
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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
+{
+
+ //properties
+ private Person person;
+
+ /**
+ * default empty constructor
+ */
+ public HelloWorldController()
+ {
+ }
+
+ //-------------------getter & setter
+
+ public Person getPerson()
+ {
+ return person;
+ }
+
+ public void setPerson(Person person)
+ {
+ this.person = person;
+ }
+
+ /**
+ * 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";
+ }
+}
diff --git a/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/java/org/apache/myfaces/blank/domain/Person.java b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/java/org/apache/myfaces/blank/domain/Person.java
new file mode 100644
index 0000000..23a50bb
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/java/org/apache/myfaces/blank/domain/Person.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.blank.domain;
+
+import javax.persistence.Column;
+
+public class Person
+{
+ @Column(nullable = false, length = 10)
+ private String name;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/WEB-INF/faces-config.xml b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..3e82b88
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.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.
+-->
+
+<faces-config>
+
+ <!-- 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-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.blank.domain.Person</managed-bean-class>
+ <managed-bean-scope>session</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.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/WEB-INF/web.xml b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..9a4a183
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_jpa/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.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/helloWorld.jsp b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/helloWorld.jsp
new file mode 100644
index 0000000..c549cbf
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/helloWorld.jsp
@@ -0,0 +1,22 @@
+<%@ 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="name" value="Please enter your name" />
+ <h:inputText id="name" value="#{helloWorld.person.name}"/>
+ <h:message for="name" showSummary="false" showDetail="true"/>
+
+ <h:commandButton value="Press me" action="#{helloWorld.send}"/>
+ <h:panelGroup/>
+ <h:panelGroup/>
+ </h:panelGrid>
+ </h:form>
+ </f:view>
+ </body>
+</html>
diff --git a/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/index.jsp b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/index.jsp
new file mode 100644
index 0000000..a29c228
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/index.jsp
@@ -0,0 +1,4 @@
+<%@ page session="false"%>
+<%
+response.sendRedirect("helloWorld.jsf");
+%>
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/page2.jsp b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/page2.jsp
new file mode 100644
index 0000000..be6c75f
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_jpa/src/main/webapp/page2.jsp
@@ -0,0 +1,17 @@
+<%@ 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.name}. We hope you enjoy Apache MyFaces"/></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.0.1-SNAPSHOT/examples/hello_world/pom.xml b/1.0.1-SNAPSHOT/examples/hello_world/pom.xml
new file mode 100644
index 0000000..85babcd
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_world/pom.xml
@@ -0,0 +1,82 @@
+<?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>${build.version}</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-project</artifactId>
+ <version>${build.version}</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>${build.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>myfaces-extval-property-validation</artifactId>
+ <version>${build.version}</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>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>el-impl</groupId>
+ <artifactId>el-impl</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/1.0.1-SNAPSHOT/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java b/1.0.1-SNAPSHOT/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
new file mode 100644
index 0000000..4b6b71d
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_world/src/main/java/org/apache/myfaces/blank/HelloWorldController.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.extensions.validator.baseval.annotation.Required;
+
+/**
+ * A typical simple backing bean, that is backed to <code>helloworld.jsp</code>
+ *
+ */
+public class HelloWorldController
+{
+
+ //properties
+ @Required
+ private String name;
+
+ /**
+ * default empty constructor
+ */
+ public HelloWorldController()
+ {
+ }
+
+ //-------------------getter & setter
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * 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";
+ }
+}
diff --git a/1.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/WEB-INF/faces-config.xml b/1.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/WEB-INF/faces-config.xml
new file mode 100644
index 0000000..46644d0
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/WEB-INF/faces-config.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.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.
+-->
+
+<faces-config>
+
+ <!-- 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.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/WEB-INF/web.xml b/1.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..9a4a183
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/helloWorld.jsp b/1.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/helloWorld.jsp
new file mode 100644
index 0000000..7565a3f
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/helloWorld.jsp
@@ -0,0 +1,22 @@
+<%@ 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="name" value="Please enter your name" />
+ <h:inputText id="name" value="#{helloWorld.name}"/>
+ <h:message for="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.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/index.jsp b/1.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/index.jsp
new file mode 100644
index 0000000..a29c228
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/index.jsp
@@ -0,0 +1,4 @@
+<%@ page session="false"%>
+<%
+response.sendRedirect("helloWorld.jsf");
+%>
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/page2.jsp b/1.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/page2.jsp
new file mode 100644
index 0000000..6d12c41
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/hello_world/src/main/webapp/page2.jsp
@@ -0,0 +1,17 @@
+<%@ 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.name}. We hope you enjoy Apache MyFaces"/></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.0.1-SNAPSHOT/examples/pom.xml b/1.0.1-SNAPSHOT/examples/pom.xml
new file mode 100644
index 0000000..0c6fd38
--- /dev/null
+++ b/1.0.1-SNAPSHOT/examples/pom.xml
@@ -0,0 +1,49 @@
+<?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>${build.version}</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-parent</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+
+ <modules>
+ <module>hello_world</module>
+ <module>hello_jpa</module>
+ <module>feature-set_01</module>
+ </modules>
+
+ <properties>
+ <trinidad.version>1.0.5</trinidad.version>
+ </properties>
+
+</project>
diff --git a/1.0.1-SNAPSHOT/parent/LICENSE.txt b/1.0.1-SNAPSHOT/parent/LICENSE.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/parent/NOTICE.txt b/1.0.1-SNAPSHOT/parent/NOTICE.txt
new file mode 100644
index 0000000..fa3dbd6
--- /dev/null
+++ b/1.0.1-SNAPSHOT/parent/NOTICE.txt
@@ -0,0 +1,16 @@
+=========================================================================
+== NOTICE file corresponding to section 4(d) of the Apache License, ==
+== Version 2.0, in this case for the Apache MyFaces Maven Plugins ==
+=========================================================================
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were originally based on the following:
+
+ - software copyright (c) 2000-2006, Oracle Corp, <http://www.oracle.com/>.
+and are licensed to the Apache Software Foundation under the
+"Software Grant and Corporate Contribution License Agreement"
+
+See the LICENSE.txt file for information on all licenses
+associated with this software.
diff --git a/1.0.1-SNAPSHOT/parent/pom.xml b/1.0.1-SNAPSHOT/parent/pom.xml
new file mode 100644
index 0000000..9c07dd3
--- /dev/null
+++ b/1.0.1-SNAPSHOT/parent/pom.xml
@@ -0,0 +1,277 @@
+<?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.0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Apache MyFaces Extensions-Validator Project Parent</name>
+
+ <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>
+ </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-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-normal.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/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/validator</url>
+ </site>
+ </distributionManagement>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+ <!--
+ NOTE: Execute this profile like
+ mvn clean source:jar install deploy -DaltDeploymentRepository=matzew::default::file://FOLDER -Prelease
+ -->
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.0-alpha-4</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.3</version>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-scm-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <id>getting-scm.revision</id>
+ <goals>
+ <goal>update</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <properties>
+ <build.version>1.0.1-SNAPSHOT</build.version>
+ <jsf.version>1.1.6</jsf.version>
+ </properties>
+</project>
diff --git a/1.0.1-SNAPSHOT/pom.xml b/1.0.1-SNAPSHOT/pom.xml
new file mode 100644
index 0000000..65bb97c
--- /dev/null
+++ b/1.0.1-SNAPSHOT/pom.xml
@@ -0,0 +1,44 @@
+<?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>
+
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-module</artifactId>
+ <version>${build.version}</version>
+ <packaging>pom</packaging>
+ <name>Apache MyFaces Extensions-Validator Module</name>
+ <url>http://myfaces.apache.org/extensions/validator</url>
+
+ <modules>
+ <module>parent</module>
+ <module>core</module>
+ <module>validation-modules</module>
+ <module>component-support</module>
+ <module>examples</module>
+ </modules>
+
+ <properties>
+ <build.version>1.0.1-SNAPSHOT</build.version>
+ <jsf.version>1.1.6</jsf.version>
+ </properties>
+</project>
diff --git a/1.0.1-SNAPSHOT/validation-modules/pom.xml b/1.0.1-SNAPSHOT/validation-modules/pom.xml
new file mode 100644
index 0000000..950d7bf
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/pom.xml
@@ -0,0 +1,53 @@
+<?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>${build.version}</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-parent</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+
+ <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>${build.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/pom.xml b/1.0.1-SNAPSHOT/validation-modules/property-validation/pom.xml
new file mode 100644
index 0000000..0cbbea4
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/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>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>${build.version}</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>validation-modules-project</artifactId>
+ <version>${build.version}</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>${build.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/config/faces-config.xml b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/config/faces-config.xml
new file mode 100644
index 0000000..1854bf6
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/config/faces-config.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.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.
+-->
+
+<faces-config>
+ <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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsComponentInitializer.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsComponentInitializer.java
new file mode 100644
index 0000000..fa54b65
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsComponentInitializer.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;
+
+import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+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(metaData.containsKey(CommonMetaDataKeys.REQUIRED) || metaData.containsKey(CommonMetaDataKeys.WEAK_REQUIRED)||
+ metaData.containsKey(CommonMetaDataKeys.SKIP_VALIDATION))
+ {
+ if((Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.WEAK_REQUIRED)) &&
+ Boolean.TRUE.equals(isComponentRequired(uiComponent)))
+ ||
+ (Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.REQUIRED)) &&
+ Boolean.TRUE.equals(isComponentRequired(uiComponent))))
+ {
+ ((EditableValueHolder)uiComponent).setRequired(true);
+ }
+ else if(metaData.containsKey(CommonMetaDataKeys.SKIP_VALIDATION) &&
+ ((List)metaData.get(CommonMetaDataKeys.SKIP_VALIDATION)).contains(CommonMetaDataKeys.WEAK_REQUIRED)&&
+ !Boolean.TRUE.equals(metaData.get(CommonMetaDataKeys.REQUIRED)))
+ {
+ ((EditableValueHolder)uiComponent).setRequired(false);
+ }
+ }
+ }
+
+ /**
+ * 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)
+ {
+ if(uiComponent instanceof HtmlInputText)
+ {
+ HtmlInputText htmlInputText = (HtmlInputText)uiComponent;
+ return !(htmlInputText.isReadonly() || htmlInputText.isDisabled());
+ }
+
+ return null;
+ }
+
+ 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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java
new file mode 100644
index 0000000..461df04
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.core.startup.AbstractStartupListener;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.loader.StaticResourceBundleLoader;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigLoader;
+import org.apache.myfaces.extensions.validator.core.loader.StaticMappingConfigLoaderNames;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.crossval.recorder.CrossValidationUserInputRecorder;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class PropertyValidationModuleStartupListener extends AbstractStartupListener
+{
+ protected void init()
+ {
+ ExtValContext.getContext().addProcessedInformationRecorder(new CrossValidationUserInputRecorder());
+
+ initStaticStrategyMappings();
+ initDefaultComponentInitializerName();
+ }
+
+ private void initStaticStrategyMappings()
+ {
+ String jpaBasedValidation = WebXmlParameter.DEACTIVATE_JPA_BASED_VALIDATION;
+ if (jpaBasedValidation == null
+ || !jpaBasedValidation.equalsIgnoreCase("true"))
+ {
+ StaticMappingConfigLoader<String, String> staticMappingConfigLoader = new StaticResourceBundleLoader();
+ staticMappingConfigLoader.setSourceOfMapping(
+ ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME +".jpa_strategy_mappings");
+
+ ExtValContext.getContext().addStaticMappingConfigLoader(
+ StaticMappingConfigLoaderNames.ANNOTATION_TO_VALIDATION_STRATEGY_CONFIG_LOADER, staticMappingConfigLoader);
+ }
+ }
+
+ @ToDo(value = Priority.MEDIUM, description = "web.xml parameter to deactivate it")
+ private void initDefaultComponentInitializerName()
+ {
+ ExtValContext.getContext().addComponentInitializer(new HtmlCoreComponentsComponentInitializer());
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/WebXmlParameter.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/WebXmlParameter.java
new file mode 100644
index 0000000..bf0e0f9
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/WebXmlParameter.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.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;
+
+/**
+ * centralized in order that these information arn't spread over the complete code base
+ *
+ * @author Gerhard Petracek
+ */
+@ToDo(value = Priority.HIGH, description = "documentation")
+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");
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/DoubleRange.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/DoubleRange.java
new file mode 100644
index 0000000..282f049
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/DoubleRange.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.baseval.annotation;
+
+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
+ */
+@Target( { METHOD, FIELD })
+@Retention(RUNTIME)
+public @interface DoubleRange
+{
+ double minimum() default 0;
+
+ double maximum() default Double.MAX_VALUE;
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/JoinValidation.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/JoinValidation.java
new file mode 100644
index 0000000..5a64f0d
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/JoinValidation.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.baseval.annotation;
+
+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
+ */
+@Target( { METHOD, FIELD })
+@Retention(RUNTIME)
+public @interface JoinValidation
+{
+ String[] value();
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Length.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Length.java
new file mode 100644
index 0000000..f89ac66
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Length.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.baseval.annotation;
+
+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
+ */
+@Target( { METHOD, FIELD })
+@Retention(RUNTIME)
+public @interface Length
+{
+ int minimum() default 0;
+
+ int maximum() default Integer.MAX_VALUE;
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/LongRange.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/LongRange.java
new file mode 100644
index 0000000..53d3b7f
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/LongRange.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.baseval.annotation;
+
+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
+ */
+@Target( { METHOD, FIELD })
+@Retention(RUNTIME)
+public @interface LongRange
+{
+ long minimum() default 0;
+
+ long maximum() default Long.MAX_VALUE;
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.java
new file mode 100644
index 0000000..5dd8446
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Pattern.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.baseval.annotation;
+
+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
+ */
+@Target( { METHOD, FIELD })
+@Retention(RUNTIME)
+public @interface Pattern
+{
+ String[] value();
+
+ String validationErrorMsgKey() default "no_match";
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java
new file mode 100644
index 0000000..c557437
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.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.baseval.annotation;
+
+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
+ */
+@Target( { METHOD, FIELD })
+@Retention(RUNTIME)
+public @interface Required
+{
+ String validationErrorMsgKey() default "field_required";
+
+ String skipValidation() default "#{false}"; //default - don't skip
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Validator.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Validator.java
new file mode 100644
index 0000000..ed08ef0
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Validator.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.baseval.annotation;
+
+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
+ */
+@Target( { METHOD, FIELD })
+@Retention(RUNTIME)
+public @interface Validator
+{
+ Class[] value();
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/extractor/DefaultPropertyScanningAnnotationExtractor.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/extractor/DefaultPropertyScanningAnnotationExtractor.java
new file mode 100644
index 0000000..11eb7bc
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/extractor/DefaultPropertyScanningAnnotationExtractor.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.baseval.annotation.extractor;
+
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.annotation.extractor.DefaultComponentAnnotationExtractor;
+import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
+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 javax.faces.context.FacesContext;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class DefaultPropertyScanningAnnotationExtractor extends DefaultComponentAnnotationExtractor
+{
+
+ @Override
+ @ToDo(Priority.MEDIUM)
+ public List<AnnotationEntry> extractAnnotations(FacesContext facesContext, Object object)
+ {
+ //should never occur
+ if (!(object instanceof String))
+ {
+ return new ArrayList<AnnotationEntry>();
+ }
+
+ ValueBindingExpression valueBindingExpression = new ValueBindingExpression(((String) object).trim());
+
+ List<AnnotationEntry> annotationEntries = new ArrayList<AnnotationEntry>();
+
+ Class entityClass = ExtValUtils.getELHelper()
+ .getTypeOfValueBindingForExpression(facesContext, valueBindingExpression.getBaseExpression());
+
+ //create template entry
+ AnnotationEntry templateEntry = new AnnotationEntry();
+ templateEntry.setEntityClass(entityClass);
+ //TODO complex components
+ templateEntry.setValueBindingExpression(valueBindingExpression.getExpressionString());
+ templateEntry.setBoundTo("value");
+
+ /*
+ * find and add annotations
+ */
+ if (entityClass != null)
+ {
+ //TODO map syntax support
+ addPropertyAccessAnnotations(entityClass, valueBindingExpression.getProperty(),
+ annotationEntries, templateEntry);
+ addFieldAccessAnnotations(entityClass, valueBindingExpression.getProperty(), annotationEntries,
+ templateEntry);
+ }
+
+ return annotationEntries;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages.properties b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages.properties
new file mode 100644
index 0000000..1ef4565
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages.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.
+
+field_required=field is required
+field_required_details=field is required
+
+field_too_long=field too long
+field_too_long_details=field too long (max. length: {0})
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ar.properties b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ar.properties
new file mode 100644
index 0000000..4885bf0
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ar.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.
+
+field_required=\u0645\u0637\u0644\u0648\u0628 \u0625\u062f\u062e\u0627\u0644 \u0642\u064a\u0645\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644
+field_required_details=\u0645\u0637\u0644\u0648\u0628 \u0625\u062f\u062e\u0627\u0644 \u0642\u064a\u0645 \u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644
+
+field_too_long = \u0637\u0648\u0644 \u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644 \u062a\u0639 \u062f\u0649 \u0627\u0644\u0642\u064a\u0645\u0629 \u0627\u0644\u0645\u0633\u0645\u0648\u062d \u0628 \u0647\u0627
+field_too_long_details=\u0637\u0648\u0644 \u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644 \u062a\u0639 \u062f\u0649 \u0627\u0644\u0642\u064a\u0645\u0629 \u0627\u0644\u0645\u0633\u0645\u0648\u062d \u0628 \u0647\u0627 (\u0623\u0642\u0635\u0649 \u0637\u0648\u0644 \u0644\u0644\u062d\u0642\u0644: {0})
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_tr.properties b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_tr.properties
new file mode 100644
index 0000000..0bda42a
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_tr.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.
+
+field_required=alan zorunludur
+field_required_details=alan zorunludur
+
+field_too_long=de\u011fer \u00e7ok uzun
+field_too_long_details=de\u011fer \u00e7ok uzun (maks. uzunluk: {0})
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages.properties b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages.properties
new file mode 100644
index 0000000..86ef47b
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages.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.
+
+field_required=field is required
+field_required_details=field is required
+
+no_match=invalid format
+no_match_details=the required formate is: {0}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ar.properties b/1.0.1-SNAPSHOT/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..63a6dbf
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ar.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.
+
+field_required=\u0645\u0637\u0644\u0648\u0628 \u0625\u062f\u062e\u0627\u0644 \u0642\u064a\u0645\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644
+field_required_details=\u0645\u0637\u0644\u0648\u0628 \u0625\u062f\u062e\u0627\u0644 \u0642\u064a\u0645\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644
+
+no_match=\u0627\u0644\u0635\u064a\u063a\u0629 \u062e\u0627\u0637\u0626\u0629
+no_match_details=\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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_tr.properties b/1.0.1-SNAPSHOT/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..d949c87
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_tr.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.
+
+field_required=alan zorunludur
+field_required_details=alan zorunludur
+
+no_match=ge\u00e7ersiz bi\u00e7im
+no_match_details=gereken bi\u00e7im: {0}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/DefaultValidationErrorMessageResolver.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/DefaultValidationErrorMessageResolver.java
new file mode 100644
index 0000000..ef2b9f6
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/DefaultValidationErrorMessageResolver.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.message.resolver;
+
+/**
+ * @author Gerhard Petracek
+ */
+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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/JpaValidationErrorMessageResolver.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/JpaValidationErrorMessageResolver.java
new file mode 100644
index 0000000..29971b3
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/resolver/JpaValidationErrorMessageResolver.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.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;
+
+/**
+ * @author Gerhard Petracek
+ */
+/*
+ * 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
+ */
+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;
+ }
+
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/DoubleRangeMetaDataTransformer.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/DoubleRangeMetaDataTransformer.java
new file mode 100644
index 0000000..3ade25b
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/DoubleRangeMetaDataTransformer.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.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.transformer.AbstractMetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class DoubleRangeMetaDataTransformer extends AbstractMetaDataTransformer
+{
+ protected Map<String, Object> convert(AnnotationEntry annotationEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ Annotation annotation = annotationEntry.getAnnotation();
+
+ double minimum = ((DoubleRange)annotation).minimum();
+
+ results.put(CommonMetaDataKeys.RANGE_MIN, minimum);
+ results.put(CommonMetaDataKeys.RANGE_MAX, ((DoubleRange)annotation).maximum());
+
+ if(minimum > 0)
+ {
+ results.put(CommonMetaDataKeys.REQUIRED, true);
+ }
+
+ return results;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JoinMetaDataTransformer.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JoinMetaDataTransformer.java
new file mode 100644
index 0000000..e53f7ad
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JoinMetaDataTransformer.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.baseval.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.JoinValidation;
+import org.apache.myfaces.extensions.validator.baseval.annotation.extractor.DefaultPropertyScanningAnnotationExtractor;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.annotation.extractor.AnnotationExtractor;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.AbstractMetaDataTransformer;
+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 javax.faces.context.FacesContext;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class JoinMetaDataTransformer extends AbstractMetaDataTransformer
+{
+ protected Map<String, Object> convert(AnnotationEntry annotationEntry)
+ {
+ AnnotationExtractor extractor = new DefaultPropertyScanningAnnotationExtractor();
+
+ String[] targetExpressions = ((JoinValidation)(annotationEntry).getAnnotation()).value();
+
+ ValidationStrategy validationStrategy;
+ MetaDataTransformer metaDataTransformer;
+
+ Map<String, Object> results = new HashMap<String, Object>();
+
+ for (String targetExpression : targetExpressions)
+ {
+ targetExpression = createValidBinding(annotationEntry, targetExpression);
+
+ for (AnnotationEntry entry : extractor
+ .extractAnnotations(FacesContext.getCurrentInstance(), targetExpression))
+ {
+ validationStrategy = ExtValUtils.getValidationStrategyForAnnotation(entry.getAnnotation());
+
+ metaDataTransformer = ExtValUtils.getMetaDataTransformerForValidationStrategy(validationStrategy);
+
+ if (metaDataTransformer != null)
+ {
+ results.putAll(metaDataTransformer.convertMetaData(entry));
+ }
+ }
+ }
+ return results;
+ }
+
+ private String createValidBinding(AnnotationEntry annotationEntry, String targetExpression)
+ {
+ if(ExtValUtils.getELHelper().isELTerm(targetExpression))
+ {
+ return targetExpression;
+ }
+
+ ValueBindingExpression baseExpression = new ValueBindingExpression(annotationEntry.getValueBindingExpression());
+ return ValueBindingExpression.replaceOrAddProperty(baseExpression, targetExpression).getExpressionString();
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JpaMetaDataTransformer.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JpaMetaDataTransformer.java
new file mode 100644
index 0000000..db23921
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/JpaMetaDataTransformer.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.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class JpaMetaDataTransformer implements MetaDataTransformer
+{
+ @ToDo(value = Priority.HIGH, description = "impl. the rest")
+ public Map<String, Object> convertMetaData(AnnotationEntry annotation)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+
+ 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);
+ }
+ }
+ //TODO impl. the rest!!!
+ return results;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LengthMetaDataTransformer.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LengthMetaDataTransformer.java
new file mode 100644
index 0000000..6edf602
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LengthMetaDataTransformer.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.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.AbstractMetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class LengthMetaDataTransformer extends AbstractMetaDataTransformer
+{
+ protected Map<String, Object> convert(AnnotationEntry annotationEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ Annotation annotation = annotationEntry.getAnnotation();
+
+ int minimum = ((Length)annotation).minimum();
+
+ results.put(CommonMetaDataKeys.MIN_LENGTH, minimum);
+ results.put(CommonMetaDataKeys.MAX_LENGTH, ((Length)annotation).maximum());
+
+ if(minimum > 0)
+ {
+ results.put(CommonMetaDataKeys.REQUIRED, true);
+ }
+
+ return results;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LongRangeMetaDataTransformer.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LongRangeMetaDataTransformer.java
new file mode 100644
index 0000000..ba32690
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/LongRangeMetaDataTransformer.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.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.transformer.AbstractMetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class LongRangeMetaDataTransformer extends AbstractMetaDataTransformer
+{
+ protected Map<String, Object> convert(AnnotationEntry annotationEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ Annotation annotation = annotationEntry.getAnnotation();
+
+ long minimum = ((LongRange)annotation).minimum();
+
+ results.put(CommonMetaDataKeys.RANGE_MIN, minimum);
+ results.put(CommonMetaDataKeys.RANGE_MAX, ((LongRange)annotation).maximum());
+
+ if(minimum > 0)
+ {
+ results.put(CommonMetaDataKeys.REQUIRED, true);
+ }
+
+ return results;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/PatternMetaDataTransformer.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/PatternMetaDataTransformer.java
new file mode 100644
index 0000000..46d2efb
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/PatternMetaDataTransformer.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.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.AbstractMetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Pattern;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.context.FacesContext;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Locale;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class PatternMetaDataTransformer extends AbstractMetaDataTransformer
+{
+ protected Map<String, Object> convert(AnnotationEntry annotationEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ Annotation annotation = annotationEntry.getAnnotation();
+
+ results.put(CommonMetaDataKeys.PATTERN, ((Pattern)annotation).value());
+
+ String validationErrorMsgKey = ((Pattern)annotation).validationErrorMsgKey();
+ Locale currentLocale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
+
+ ValidationStrategy validationStrategy = ExtValUtils.getValidationStrategyForAnnotation(annotation);
+
+ String validationErrorMsg = ExtValUtils.getMessageResolverForValidationStrategy(validationStrategy)
+ .getMessage(validationErrorMsgKey, currentLocale);
+
+ results.put(CommonMetaDataKeys.PATTERN_VALIDATION_ERROR_MESSAGE, validationErrorMsg);
+ return results;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/RequiredMetaDataTransformer.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/RequiredMetaDataTransformer.java
new file mode 100644
index 0000000..c656794
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/RequiredMetaDataTransformer.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.metadata.transformer;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.AbstractMetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class RequiredMetaDataTransformer extends AbstractMetaDataTransformer
+{
+ protected Map<String, Object> convert(AnnotationEntry annotationEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ results.put(CommonMetaDataKeys.WEAK_REQUIRED, true);
+ return results;
+ }
+
+ @Override
+ protected String getSkipExpression(AnnotationEntry annotationEntry)
+ {
+ return ((Required)(annotationEntry).getAnnotation()).skipValidation();
+ }
+
+ //returns the key of the skiped meta-data e.g.
+ @Override
+ protected List<String> getMetaDataKeys()
+ {
+ List<String> skippedMetaDataList = new ArrayList<String>();
+ skippedMetaDataList.add(CommonMetaDataKeys.WEAK_REQUIRED);
+ return skippedMetaDataList;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/ValidatorMetaDataTransformer.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/ValidatorMetaDataTransformer.java
new file mode 100644
index 0000000..19ca588
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/transformer/ValidatorMetaDataTransformer.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.transformer.AbstractMetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class ValidatorMetaDataTransformer extends AbstractMetaDataTransformer
+{
+ protected Map<String, Object> convert(AnnotationEntry annotationEntry)
+ {
+ Map<String, Object> results = new HashMap<String, Object>();
+ Annotation annotation = annotationEntry.getAnnotation();
+
+ Class[] validators = ((Validator)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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/DoubleRangeStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/DoubleRangeStrategy.java
new file mode 100644
index 0000000..733c843
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/DoubleRangeStrategy.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.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.DoubleRange;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidatorAdapter;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.DoubleRangeValidator;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class DoubleRangeStrategy extends AbstractValidatorAdapter
+{
+
+ protected void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, AnnotationEntry annotationEntry,
+ Object convertedObject) throws ValidatorException
+ {
+
+ DoubleRange annotation = annotationEntry
+ .getAnnotation(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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JoinValidationStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JoinValidationStrategy.java
new file mode 100644
index 0000000..f17cac4
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JoinValidationStrategy.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.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.JoinValidation;
+import org.apache.myfaces.extensions.validator.baseval.annotation.extractor.DefaultPropertyScanningAnnotationExtractor;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.annotation.extractor.AnnotationExtractor;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidatorAdapter;
+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 javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class JoinValidationStrategy extends AbstractValidatorAdapter
+{
+ public void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, AnnotationEntry annotationEntry,
+ Object convertedObject) throws ValidatorException
+ {
+ AnnotationExtractor extractor = new DefaultPropertyScanningAnnotationExtractor();
+
+ String[] targetExpressions = annotationEntry.getAnnotation(JoinValidation.class).value();
+
+ ValidationStrategy validationStrategy;
+
+ for (String targetExpression : targetExpressions)
+ {
+ targetExpression = createValidBinding(annotationEntry, targetExpression);
+
+ for (AnnotationEntry entry : extractor.extractAnnotations(facesContext, targetExpression))
+ {
+ validationStrategy = ExtValUtils.getValidationStrategyForAnnotation(entry.getAnnotation());
+
+ if (validationStrategy != null)
+ {
+ validationStrategy.validate(facesContext, uiComponent, entry, convertedObject);
+ }
+ else
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("no validation strategy found for "
+ + entry.getAnnotation().annotationType().getName());
+ }
+ }
+ }
+ }
+ }
+
+ private String createValidBinding(AnnotationEntry annotationEntry, String targetExpression)
+ {
+ if(ExtValUtils.getELHelper().isELTerm(targetExpression))
+ {
+ return targetExpression;
+ }
+
+ ValueBindingExpression baseExpression = new ValueBindingExpression(annotationEntry.getValueBindingExpression());
+ return ValueBindingExpression.replaceOrAddProperty(baseExpression, targetExpression).getExpressionString();
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java
new file mode 100644
index 0000000..0d317b3
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.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.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class JpaValidationStrategy extends AbstractValidationStrategy
+{
+
+ private static final String VALIDATE_LENGTH = "length";
+
+ private String violation;
+ private int maxLength;
+
+ public void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, AnnotationEntry annotationEntry,
+ Object convertedObject) throws ValidatorException
+ {
+ Annotation annotation = annotationEntry.getAnnotation();
+ if (annotation instanceof Column)
+ {
+ validateColumnAnnotation((Column) annotation, convertedObject);
+ }
+ else if (annotation instanceof Basic)
+ {
+ validateBasicAnnotation((Basic) annotation, 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 getErrorMessageDetails(Annotation annotation)
+ {
+ String message = super.getErrorMessageDetails(annotation);
+
+ if (VALIDATE_LENGTH.equals(this.violation))
+ {
+ return message.replace("{0}", "" + this.maxLength);
+ }
+ else
+ {
+ return message;
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LengthStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LengthStrategy.java
new file mode 100644
index 0000000..ed4c9a1
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LengthStrategy.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.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Length;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidatorAdapter;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.LengthValidator;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class LengthStrategy extends AbstractValidatorAdapter
+{
+ protected void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, AnnotationEntry annotationEntry,
+ Object convertedObject) throws ValidatorException
+ {
+ Length annotation = annotationEntry.getAnnotation(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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LongRangeStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LongRangeStrategy.java
new file mode 100644
index 0000000..8e34673
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LongRangeStrategy.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.baseval.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.LongRange;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidatorAdapter;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.LongRangeValidator;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class LongRangeStrategy extends AbstractValidatorAdapter
+{
+
+ protected void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, AnnotationEntry annotationEntry,
+ Object convertedObject) throws ValidatorException
+ {
+
+ LongRange annotation = annotationEntry.getAnnotation(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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/PatternStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/PatternStrategy.java
new file mode 100644
index 0000000..7a1506c
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/PatternStrategy.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
+
+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
+ */
+public class PatternStrategy extends AbstractValidationStrategy
+{
+
+ protected void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, AnnotationEntry annotationEntry,
+ Object convertedObject) throws ValidatorException
+ {
+
+ Pattern annotation = annotationEntry.getAnnotation(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),
+ getErrorMessageDetails(annotation).replace("{0}",
+ expression)));
+ }
+ }
+ }
+
+ protected String getValidationErrorMsgKey(Annotation annotation)
+ {
+ return ((Pattern) annotation).validationErrorMsgKey();
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.java
new file mode 100644
index 0000000..aba9cd3
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.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.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
+
+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
+ */
+public class RequiredStrategy extends AbstractValidationStrategy
+{
+ public void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, AnnotationEntry annotationEntry,
+ 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(annotationEntry
+ .getAnnotation()));
+ }
+ }
+
+ protected String getValidationErrorMsgKey(Annotation annotation)
+ {
+ return ((Required) annotation).validationErrorMsgKey();
+ }
+
+ @Override
+ protected String getSkipExpression(Annotation annotation)
+ {
+ return ((Required)annotation).skipValidation();
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/ValidatorStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/ValidatorStrategy.java
new file mode 100644
index 0000000..b2ec6b4
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/ValidatorStrategy.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.strategy;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Validator;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidatorAdapter;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ValidatorStrategy extends AbstractValidatorAdapter
+{
+
+ protected void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, AnnotationEntry annotationEntry,
+ Object convertedObject) throws ValidatorException
+ {
+
+ Class[] validatorClasses = annotationEntry.getAnnotation(
+ 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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java
new file mode 100644
index 0000000..f048b79
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.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.crossval;
+
+import org.apache.myfaces.extensions.validator.util.CrossValidationUtils;
+import org.apache.myfaces.extensions.validator.util.JsfUtils;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import javax.faces.validator.ValidatorException;
+import java.util.MissingResourceException;
+
+/**
+ * @author Gerhard Petracek
+ */
+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
+ {
+ entry.getValidationStrategy().processCrossValidation(entry,
+ crossValidationStorage);
+ }
+ catch (ValidatorException e)
+ {
+
+ FacesMessage facesMessage = e.getFacesMessage();
+
+ if (facesMessage != null
+ && facesMessage.getSummary() != null
+ && facesMessage.getDetail() != null)
+ {
+ UIComponent component = entry.getComponent();
+ String clientId = null;
+
+ //TODO
+ if (component != null)
+ {
+ clientId = component.getClientId(event
+ .getFacesContext());
+ }
+
+ event.getFacesContext().addMessage(clientId,
+ facesMessage);
+ }
+
+ event.getFacesContext().renderResponse();
+ }
+ catch (MissingResourceException e)
+ {
+ event.getFacesContext().addMessage(
+ null,
+ new FacesMessage(FacesMessage.SEVERITY_ERROR,
+ "custom validation message not found", e
+ .toString()));
+ event.getFacesContext().renderResponse();
+ throw e;
+ }
+ }
+ }
+ 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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorage.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorage.java
new file mode 100644
index 0000000..ce15847
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorage.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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ */
+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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorageEntry.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorageEntry.java
new file mode 100644
index 0000000..d59d15c
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationStorageEntry.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.crossval;
+
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.crossval.strategy.CrossValidationStrategy;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class CrossValidationStorageEntry
+{
+ private AnnotationEntry annotationEntry;
+ //for complex components (e.g. a table) stores the object of entry (#{entry.property})
+ private Object bean;
+ private UIComponent component;
+ private Object convertedObject;
+ private CrossValidationStrategy validationStrategy;
+
+ public AnnotationEntry getAnnotationEntry()
+ {
+ return annotationEntry;
+ }
+
+ public void setAnnotationEntry(AnnotationEntry annotationEntry)
+ {
+ this.annotationEntry = annotationEntry;
+ }
+
+ public Object getBean()
+ {
+ return bean;
+ }
+
+ public void setBean(Object bean)
+ {
+ this.bean = bean;
+ }
+
+ 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;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/ProcessedInformationEntry.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/ProcessedInformationEntry.java
new file mode 100644
index 0000000..418512b
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/ProcessedInformationEntry.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.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;
+
+ /*
+ * 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 List<ProcessedInformationEntry> getFurtherEntries()
+ {
+ return furtherEntries;
+ }
+
+ public void setFurtherEntries(List<ProcessedInformationEntry> furtherEntries)
+ {
+ this.furtherEntries = furtherEntries;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/WebXmlParameter.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/WebXmlParameter.java
new file mode 100644
index 0000000..2f8d513
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/WebXmlParameter.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;
+
+import org.apache.myfaces.extensions.validator.util.WebXmlUtils;
+
+/**
+ * centralized in order that these information arn't spread over the complete code base
+ *
+ * @author Gerhard Petracek
+ */
+public interface WebXmlParameter
+{
+ static final String DEACTIVATE_CROSSVALIDATION = WebXmlUtils
+ .getInitParameter("DEACTIVATE_CROSSVALIDATION");
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java
new file mode 100644
index 0000000..6cd03e2
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.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.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+
+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
+ */
+@Target( { METHOD, FIELD })
+@Retention(RUNTIME)
+@ToDo(value = Priority.MEDIUM, description = "DateIsEntry (value, type)")
+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;
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIsType.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIsType.java
new file mode 100644
index 0000000..af9cf30
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIsType.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.crossval.annotation;
+
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+
+/**
+ * @author Gerhard Petracek
+ */
+@ToDo(value = Priority.MEDIUM, description = "beforeOrSame, afterOrSame")
+public enum DateIsType
+{
+ before, after, same
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/Equals.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/Equals.java
new file mode 100644
index 0000000..760c340
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/Equals.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.crossval.annotation;
+
+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
+ */
+@Target( { METHOD, FIELD })
+@Retention(RUNTIME)
+public @interface Equals
+{
+ String[] value();
+
+ String validationErrorMsgKey() default "duplicated_content_required";
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/NotEquals.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/NotEquals.java
new file mode 100644
index 0000000..8e14620
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/NotEquals.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.crossval.annotation;
+
+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
+ */
+@Target( { METHOD, FIELD })
+@Retention(RUNTIME)
+public @interface NotEquals
+{
+ String[] value();
+
+ String validationErrorMsgKey() default "duplicated_content_denied";
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIf.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIf.java
new file mode 100644
index 0000000..888b848
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIf.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.crossval.annotation;
+
+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
+ */
+@Target( { METHOD, FIELD })
+@Retention(RUNTIME)
+public @interface RequiredIf
+{
+ String[] valueOf();
+
+ /*
+ * optional section
+ */
+
+ RequiredIfType is() default RequiredIfType.not_empty;
+
+ String validationErrorMsgKey() default "empty_field";
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIfType.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIfType.java
new file mode 100644
index 0000000..807a2ef
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/RequiredIfType.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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;
+
+/**
+ * @author Gerhard Petracek
+ */
+public enum RequiredIfType
+{
+ empty, not_empty
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/extractor/DefaultValueBindingScanningAnnotationExtractor.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/extractor/DefaultValueBindingScanningAnnotationExtractor.java
new file mode 100644
index 0000000..cba2d0c
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/extractor/DefaultValueBindingScanningAnnotationExtractor.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.annotation.extractor;
+
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.annotation.extractor.DefaultComponentAnnotationExtractor;
+import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.context.FacesContext;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * to support the usage of vb-xpressions (to reference the target bean)
+ *
+ * @author Gerhard Petracek
+ */
+public class DefaultValueBindingScanningAnnotationExtractor extends
+ DefaultComponentAnnotationExtractor
+{
+
+ @Override
+ public List<AnnotationEntry> extractAnnotations(FacesContext facesContext,
+ Object object)
+ {
+ //should never occur
+ if (!(object instanceof String))
+ {
+ return new ArrayList<AnnotationEntry>();
+ }
+
+ ValueBindingExpression valueBindingExpression = new ValueBindingExpression(((String) object).trim());
+
+ List<AnnotationEntry> annotationEntries = new ArrayList<AnnotationEntry>();
+
+ Class entity = ExtValUtils.getELHelper().getTypeOfValueBindingForExpression(facesContext,
+ valueBindingExpression);
+
+ if (entity != null)
+ {
+ //find and add annotations
+ addPropertyAccessAnnotations(entity, annotationEntries, valueBindingExpression.getExpressionString());
+ addFieldAccessAnnotations(entity, annotationEntries, valueBindingExpression.getExpressionString());
+ }
+
+ return annotationEntries;
+ }
+
+ protected void addPropertyAccessAnnotations(Class entity,
+ List<AnnotationEntry> annotationEntries,
+ String valueBindingExpression)
+ {
+ AnnotationEntry templateEntry;
+
+ for (Method method : entity.getDeclaredMethods())
+ {
+ templateEntry = new AnnotationEntry();
+ templateEntry.setEntityClass(entity.getClass());
+ templateEntry.setValueBindingExpression(valueBindingExpression);
+ templateEntry.setBoundTo("[method]:" + method.getName());
+
+ addAnnotationToAnnotationEntries(annotationEntries, Arrays
+ .asList(method.getAnnotations()), templateEntry);
+ }
+ }
+
+ protected void addFieldAccessAnnotations(Class entity,
+ List<AnnotationEntry> annotationEntries,
+ String valueBindingExpression)
+ {
+ AnnotationEntry templateEntry;
+
+ for (Field field : entity.getDeclaredFields())
+ {
+ templateEntry = new AnnotationEntry();
+ templateEntry.setEntityClass(entity.getClass());
+ templateEntry.setValueBindingExpression(valueBindingExpression);
+ templateEntry.setBoundTo("[field]:" + field.getName());
+
+ addAnnotationToAnnotationEntries(annotationEntries, Arrays
+ .asList(field.getAnnotations()), templateEntry);
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties
new file mode 100644
index 0000000..ff3f017
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties
@@ -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.
+
+duplicated_content_required=input is different
+duplicated_content_required_details=input is different
+
+duplicated_content_denied=same input isn't allowed
+duplicated_content_denied_details=same input isn't allowed
+
+wrong_date=wrong date
+wrong_date_details=wrong date
+
+wrong_date_not_before=date has to be after {0}
+wrong_date_not_before_details=date has to be after {0}
+
+wrong_date_not_after=date has to be before {0}
+wrong_date_not_after_details=date has to be before {0}
+
+wrong_date_not_equal=date isn't equal to {0}
+wrong_date_not_equal_details=date isn't equal to {0}
+
+empty_field=field is required
+empty_field_details=field is required
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_ar.properties b/1.0.1-SNAPSHOT/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..1a8c896
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_ar.properties
@@ -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.
+
+duplicated_content_required=\u0627\u0644\u0625\u062f\u062e\u0627\u0644 \u0645\u062e\u062a\u0644\u0641
+duplicated_content_required_details=\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_details=\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_details=\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_details=\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_details=\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_details=\u0627\u0644\u062a\u0627\u0631\u064a\u062e \u0644\u0627 \u064a\u0633\u0627\u0648\u0649 {0}
+
+empty_field=\u0645\u0637\u0644\u0648\u0628 \u0625\u062f\u062e\u0627\u0644 \u0642\u064a\u0645\u0629 \u0644\u0647 \u0630\u0627 \u0627\u0644\u062d\u0642\u0644
+empty_field_details=\u0645\u0637\u0644\u0648\u0628 \u0625\u062f\u062e\u0627\u0644 \u0642\u064a\u0645\u0629 \u0644\u0647 \u0630\u0627 \u0627\u0644\u062d\u0642\u0644
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_tr.properties b/1.0.1-SNAPSHOT/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..6acaa76
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_tr.properties
@@ -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.
+
+
+duplicated_content_required=girilen de\u011fer farkl\u0131
+duplicated_content_required_details=girilen de\u011fer farkl\u0131
+
+duplicated_content_denied=ayn\u0131 de\u011fer girilemez
+duplicated_content_denied_details=ayn\u0131 de\u011fer girilemez
+
+wrong_date=yanl\u0131\u015f tarih
+wrong_date_details=yanl\u0131\u015f tarih
+
+wrong_date_not_before=tarih {0} de\u011ferinden sonra olmal\u0131d\u0131r
+wrong_date_not_before_details=tarih {0} de\u011ferinden sonra olmal\u0131d\u0131r
+
+wrong_date_not_after=tarih {0} de\u011ferinden \u00f6nce olmal\u0131d\u0131r
+wrong_date_not_after_details=tarih {0} de\u011ferinden \u00f6nce olmal\u0131d\u0131r
+
+wrong_date_not_equal=tarih {0} de\u011ferine e\u015fit de\u011fil
+wrong_date_not_equal_details=tarih {0} de\u011ferine e\u015fit de\u011fil
+
+empty_field=alan zorunludur
+empty_field_details=alan zorunludur
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/resolver/DefaultValidationErrorMessageResolver.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/resolver/DefaultValidationErrorMessageResolver.java
new file mode 100644
index 0000000..0fd7c1e
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/resolver/DefaultValidationErrorMessageResolver.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.message.resolver;
+
+/**
+ * @author Gerhard Petracek
+ */
+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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/recorder/CrossValidationUserInputRecorder.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/recorder/CrossValidationUserInputRecorder.java
new file mode 100644
index 0000000..a7a70dc
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/recorder/CrossValidationUserInputRecorder.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.el.ValueBindingExpression;
+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 javax.faces.component.UIComponent;
+import javax.faces.component.EditableValueHolder;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ */
+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> valueBindingConvertedValueMapping = CrossValidationUtils
+ .getOrInitValueBindingConvertedValueMapping();
+
+ ProcessedInformationEntry entry;
+
+ ValueBindingExpression vbe =
+ ExtValUtils.getELHelper().getValueBindingExpression(uiComponent);
+
+ if (vbe == null)
+ {
+ return;
+ }
+
+ entry = new ProcessedInformationEntry();
+ entry.setBean(ExtValUtils.getELHelper().getBaseObject(vbe, uiComponent));
+ entry.setConvertedValue(value);
+ entry.setComponent(uiComponent);
+
+ String key = vbe.getExpressionString();
+ //for local cross-validation
+ if (valueBindingConvertedValueMapping.containsKey(key) &&
+ !valueBindingConvertedValueMapping.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 =
+ valueBindingConvertedValueMapping.get(key).getFurtherEntries();
+
+ if (furtherEntries == null)
+ {
+ furtherEntries = new ArrayList<ProcessedInformationEntry>();
+
+ valueBindingConvertedValueMapping.get(key).setFurtherEntries(furtherEntries);
+ }
+
+ furtherEntries.add(entry);
+ }
+ else
+ {
+ //for normal validation
+ valueBindingConvertedValueMapping.put(key, entry);
+ }
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/ELCompareStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/ELCompareStrategy.java
new file mode 100644
index 0000000..9e6f09d
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/ELCompareStrategy.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.referencing.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.crossval.strategy.AbstractCompareStrategy;
+import org.apache.myfaces.extensions.validator.util.CrossValidationUtils;
+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.core.el.ValueBindingExpression;
+
+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
+ */
+public class ELCompareStrategy implements ReferencingStrategy
+{
+ public boolean evalReferenceAndValidate(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String validationTarget, AbstractCompareStrategy compareStrategy)
+ {
+ if (ExtValUtils.getELHelper().isELTerm(validationTarget) &&
+ ExtValUtils.getELHelper().isExpressionValid(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)
+ {
+ boolean violationFound = false;
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ if (compareStrategy.isViolation(crossValidationStorageEntry
+ .getConvertedObject(), ExtValUtils.getELHelper().getValueOfExpression(
+ facesContext, validationTarget), crossValidationStorageEntry
+ .getAnnotationEntry().getAnnotation()))
+ {
+
+ ProcessedInformationEntry validationTargetEntry;
+ Map<String, ProcessedInformationEntry> valueBindingConvertedValueMapping = CrossValidationUtils
+ .getOrInitValueBindingConvertedValueMapping();
+
+ validationTargetEntry = valueBindingConvertedValueMapping
+ .get(validationTarget);
+
+ CrossValidationStorageEntry tmpCrossValidationStorageEntry = null;
+
+ if (validationTargetEntry != null)
+ {
+ tmpCrossValidationStorageEntry = new CrossValidationStorageEntry();
+ //TODO test
+ if (compareStrategy
+ .useTargetComponentToDisplayErrorMsg(crossValidationStorageEntry))
+ {
+ tmpCrossValidationStorageEntry
+ .setComponent(validationTargetEntry.getComponent());
+ }
+ else
+ {
+ tmpCrossValidationStorageEntry
+ .setComponent(crossValidationStorageEntry
+ .getComponent());
+ }
+ tmpCrossValidationStorageEntry
+ .setConvertedObject(validationTargetEntry
+ .getConvertedValue());
+ tmpCrossValidationStorageEntry
+ .setValidationStrategy(compareStrategy);
+ }
+
+ compareStrategy
+ .processTargetComponentAfterViolation(
+ crossValidationStorageEntry,
+ tmpCrossValidationStorageEntry);
+
+ violationFound = true;
+ }
+
+ if (violationFound)
+ {
+ compareStrategy
+ .processSourceComponentAfterViolation(crossValidationStorageEntry);
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/LocalCompareStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/LocalCompareStrategy.java
new file mode 100644
index 0000000..032c9bd
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/LocalCompareStrategy.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.referencing.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.crossval.strategy.AbstractCompareStrategy;
+import org.apache.myfaces.extensions.validator.util.CrossValidationUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+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;
+
+/**
+ * "[property_name]" ... local validation -> cross-component, but no cross-entity validation
+ *
+ * @author Gerhard Petracek
+ */
+public class LocalCompareStrategy implements ReferencingStrategy
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public boolean evalReferenceAndValidate(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String validationTarget, AbstractCompareStrategy compareStrategy)
+ {
+ return tryToValidateLocally(
+ crossValidationStorageEntry,
+ crossValidationStorage,
+ validationTarget,
+ compareStrategy);
+ }
+
+ protected boolean tryToValidateLocally(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String validationTarget,
+ AbstractCompareStrategy compareStrategy)
+ {
+ String targetValueBindingExpression;
+
+ targetValueBindingExpression
+ = createTargetValueBindingExpression(crossValidationStorageEntry, validationTarget);
+
+ return targetValueBindingExpression != null &&
+ validateELExpression(crossValidationStorageEntry,
+ crossValidationStorage,
+ targetValueBindingExpression,
+ compareStrategy);
+
+ }
+
+ protected String createTargetValueBindingExpression(CrossValidationStorageEntry crossValidationStorageEntry,
+ String validationTarget)
+ {
+ ValueBindingExpression baseExpression =
+ new ValueBindingExpression(crossValidationStorageEntry.getAnnotationEntry().getValueBindingExpression());
+ return ValueBindingExpression.replaceOrAddProperty(baseExpression, validationTarget).getExpressionString();
+ }
+
+ protected boolean validateELExpression(CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String validationTarget,
+ AbstractCompareStrategy compareStrategy)
+ {
+ if (!ExtValUtils.getELHelper().isExpressionValid(FacesContext.getCurrentInstance(), validationTarget))
+ {
+ throw new IllegalStateException(
+ "invalid reference used: "
+ + validationTarget
+ + " please check your extval annotations");
+ }
+
+ boolean violationFound = false;
+ Map<String, ProcessedInformationEntry> valueBindingConvertedValueMapping = CrossValidationUtils
+ .getOrInitValueBindingConvertedValueMapping();
+ ProcessedInformationEntry validationTargetEntry;
+
+ if (!valueBindingConvertedValueMapping.containsKey(validationTarget))
+ {
+ return false;
+ }
+ validationTargetEntry = compareStrategy.resolveValidationTargetEntry(
+ valueBindingConvertedValueMapping,
+ validationTarget, crossValidationStorageEntry.getBean());
+
+ if (validationTargetEntry == null)
+ {
+ if(logger.isWarnEnabled())
+ {
+ logger.warn("couldn't find converted object for " + validationTarget);
+ }
+
+ return false;
+ }
+
+ if (compareStrategy.isViolation(crossValidationStorageEntry
+ .getConvertedObject(), validationTargetEntry
+ .getConvertedValue(), crossValidationStorageEntry
+ .getAnnotationEntry().getAnnotation()))
+ {
+
+ CrossValidationStorageEntry tmpCrossValidationStorageEntry = new CrossValidationStorageEntry();
+ if (compareStrategy.useTargetComponentToDisplayErrorMsg(crossValidationStorageEntry))
+ {
+ tmpCrossValidationStorageEntry.setComponent(validationTargetEntry.getComponent());
+ }
+ else
+ {
+ tmpCrossValidationStorageEntry.setComponent(crossValidationStorageEntry.getComponent());
+ }
+ tmpCrossValidationStorageEntry.setConvertedObject(validationTargetEntry.getConvertedValue());
+ tmpCrossValidationStorageEntry.setValidationStrategy(compareStrategy);
+
+ compareStrategy
+ .processTargetComponentAfterViolation(crossValidationStorageEntry, tmpCrossValidationStorageEntry);
+
+ violationFound = true;
+ }
+
+ if (violationFound)
+ {
+ compareStrategy.processSourceComponentAfterViolation(crossValidationStorageEntry);
+ }
+
+ return true;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/LocalPropertyChainCompareStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/LocalPropertyChainCompareStrategy.java
new file mode 100644
index 0000000..3e28183
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/LocalPropertyChainCompareStrategy.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.crossval.referencing.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorage;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.crossval.strategy.AbstractCompareStrategy;
+
+/**
+ * "[local_property.property1.property2]"
+ *
+ * @author Gerhard Petracek
+ */
+public class LocalPropertyChainCompareStrategy extends LocalCompareStrategy
+{
+ protected boolean validateELExpression(CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String validationTarget,
+ AbstractCompareStrategy compareStrategy)
+ {
+ return new ELCompareStrategy().evalReferenceAndValidate(
+ crossValidationStorageEntry,
+ crossValidationStorage,
+ validationTarget,
+ compareStrategy);
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/ReferencingStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/ReferencingStrategy.java
new file mode 100644
index 0000000..f76f47f
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/referencing/strategy/ReferencingStrategy.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.crossval.referencing.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorage;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.crossval.strategy.AbstractCompareStrategy;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ */
+@UsageInformation(UsageCategory.API)
+public interface ReferencingStrategy
+{
+ boolean evalReferenceAndValidate(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage,
+ String validationTarget,
+ AbstractCompareStrategy abstractCompareStrategy);
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java
new file mode 100644
index 0000000..d837b61
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCompareStrategy.java
@@ -0,0 +1,337 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.ProcessedInformationEntry;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorage;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.crossval.referencing.strategy.ELCompareStrategy;
+import org.apache.myfaces.extensions.validator.crossval.referencing.strategy.LocalCompareStrategy;
+import org.apache.myfaces.extensions.validator.crossval.referencing.strategy.ReferencingStrategy;
+import org.apache.myfaces.extensions.validator.crossval.referencing.strategy.LocalPropertyChainCompareStrategy;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInfo;
+
+/**
+ * @author Gerhard Petracek
+ */
+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(CustomInfo.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
+ {
+
+ initValidation(crossValidationStorageEntry);
+ String[] validationTargets = getValidationTargets(crossValidationStorageEntry
+ .getAnnotationEntry().getAnnotation());
+
+ 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.evalReferenceAndValidate(
+ crossValidationStorageEntry, crossValidationStorage,
+ validationTarget, this))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ //has to be public for custom referencing strategies!!!
+ public final void processTargetComponentAfterViolation(
+ CrossValidationStorageEntry entryOfSource,
+ CrossValidationStorageEntry entryOfTarget)
+ {
+ if (!handleTargetViolation(entryOfSource, entryOfTarget))
+ {
+ return;
+ }
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ //get validation error messages for the target component
+ String summary = getErrorMessageSummary(entryOfSource
+ .getAnnotationEntry().getAnnotation(), true);
+ String details = getErrorMessageDetails(entryOfSource
+ .getAnnotationEntry().getAnnotation(), 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.getAnnotationEntry() != null)
+ {
+ message = getTargetComponentErrorMessage(entryOfTarget
+ .getAnnotationEntry().getAnnotation(), summary, details);
+ }
+ else
+ {
+ //TODO document possible side effects
+ //due to a missing target annotation (see: tryToValidateLocally)
+ message = getTargetComponentErrorMessage(entryOfSource
+ .getAnnotationEntry().getAnnotation(), summary, details);
+ }
+
+ if (message.getSummary() != null || message.getDetail() != null)
+ {
+ facesContext.addMessage(entryOfTarget.getComponent().getClientId(
+ facesContext), message);
+ }
+ }
+
+ //has to be public for custom referencing strategies!!!
+ public final void processSourceComponentAfterViolation(
+ CrossValidationStorageEntry entryOfSource)
+ {
+ if (!handleSourceViolation(entryOfSource))
+ {
+ return;
+ }
+
+ //get validation error messages for the current component
+ String summary = getErrorMessageSummary(entryOfSource
+ .getAnnotationEntry().getAnnotation(), false);
+ String details = getErrorMessageDetails(entryOfSource
+ .getAnnotationEntry().getAnnotation(), false);
+
+ FacesMessage message = getSourceComponentErrorMessage(entryOfSource
+ .getAnnotationEntry().getAnnotation(), summary, details);
+
+ if (message.getSummary() != null || message.getDetail() != null)
+ {
+ //TODO
+ throw new ValidatorException(message);
+ }
+ else
+ {
+ throw new ValidatorException(new FacesMessage());
+ }
+ }
+
+ //has to be public for custom referencing strategies!!!
+ public FacesMessage getSourceComponentErrorMessage(Annotation annotation,
+ String summary, String details)
+ {
+ FacesMessage message = new FacesMessage();
+
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ message.setSummary(summary);
+ message.setDetail(details);
+
+ return message;
+ }
+
+ //has to be public for custom referencing strategies!!!
+ public FacesMessage getTargetComponentErrorMessage(
+ Annotation foundAnnotation, String summary, String details)
+ {
+ FacesMessage message = new FacesMessage();
+
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ message.setSummary(summary);
+ message.setDetail(details);
+
+ return message;
+ }
+
+ //has to be public for custom referencing strategies!!!
+ public ProcessedInformationEntry resolveValidationTargetEntry(
+ Map<String, ProcessedInformationEntry> valueBindingConvertedValueMapping,
+ String targetValueBinding, Object bean)
+ {
+ ProcessedInformationEntry processedInformationEntry = valueBindingConvertedValueMapping
+ .get(targetValueBinding);
+
+ //simple case
+ if (processedInformationEntry.getFurtherEntries() == null)
+ {
+ return processedInformationEntry;
+ }
+
+ //process complex component entries (e.g. a table)
+ //supported: cross-component but no cross-entity validation (= locale validation)
+ if (processedInformationEntry.getBean().equals(bean))
+ {
+ return processedInformationEntry;
+ }
+
+ for (ProcessedInformationEntry entry : processedInformationEntry
+ .getFurtherEntries())
+ {
+ if (entry.getBean().equals(bean))
+ {
+ return entry;
+ }
+ }
+
+ return null;
+ }
+
+ protected String getErrorMessageSummary(Annotation annotation,
+ boolean isTargetComponent)
+ {
+ return resolveMessage(getValidationErrorMsgKey(annotation,
+ isTargetComponent));
+ }
+
+ protected String getErrorMessageDetails(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);
+ }
+
+ /*
+ * optional methods - recommended to override - have to be public for custom referencing strategies!!!
+ */
+ /**
+ * the usage of this method requires a new instance
+ * -> in case of validation strategy beans application/singleton isn't allowed
+ */
+ protected void initValidation(
+ CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ }
+
+ protected boolean handleTargetViolation(
+ CrossValidationStorageEntry entryOfSource,
+ CrossValidationStorageEntry entryOfTarget)
+ {
+ return true;
+ }
+
+ protected boolean handleSourceViolation(
+ CrossValidationStorageEntry entryOfSource)
+ {
+ return true;
+ }
+
+ public boolean useTargetComponentToDisplayErrorMsg(
+ CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ return handleTargetViolation(crossValidationStorageEntry, null);
+ }
+
+ /*
+ * 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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.java
new file mode 100644
index 0000000..65fb261
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.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.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
+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 javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractCrossValidationStrategy extends
+ AbstractValidationStrategy implements CrossValidationStrategy
+{
+
+ //init cross-validation
+ public void processValidation(FacesContext facesContext,
+ UIComponent uiComponent, AnnotationEntry annotationEntry,
+ Object convertedObject) throws ValidatorException
+ {
+ CrossValidationStorageEntry entry = getCrossValidationStorageEntry(
+ facesContext, uiComponent, annotationEntry, convertedObject);
+
+ CrossValidationUtils.getOrInitCrossValidationStorage().add(entry);
+ }
+
+ public CrossValidationStorageEntry getCrossValidationStorageEntry(
+ FacesContext facesContext, UIComponent uiComponent,
+ AnnotationEntry annotationEntry, Object convertedObject)
+ {
+ CrossValidationStorageEntry entry = new CrossValidationStorageEntry();
+
+ entry.setAnnotationEntry(annotationEntry);
+ String vbe = annotationEntry.getValueBindingExpression();
+ entry.setBean(ExtValUtils.getELHelper().getBaseObject(new ValueBindingExpression(vbe)));
+ entry.setComponent(uiComponent);
+ entry.setConvertedObject(convertedObject);
+ entry.setValidationStrategy(this);
+
+ return entry;
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/CrossValidationStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/CrossValidationStrategy.java
new file mode 100644
index 0000000..d746220
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/CrossValidationStrategy.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.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+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
+ */
+@UsageInformation(UsageCategory.API)
+public interface CrossValidationStrategy extends ValidationStrategy
+{
+ CrossValidationStorageEntry getCrossValidationStorageEntry(
+ FacesContext facesContext, UIComponent uiComponent,
+ AnnotationEntry annotationEntry, Object convertedObject);
+
+ void processCrossValidation(
+ CrossValidationStorageEntry crossValidationStorageEntry,
+ CrossValidationStorage crossValidationStorage)
+ throws ValidatorException;
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/DateIsStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/DateIsStrategy.java
new file mode 100644
index 0000000..b2a0b8f
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/DateIsStrategy.java
@@ -0,0 +1,210 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 javax.faces.context.FacesContext;
+import java.lang.annotation.Annotation;
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.MissingResourceException;
+
+/**
+ * @author Gerhard Petracek
+ */
+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";
+
+ public boolean useTargetComponentToDisplayErrorMsg(
+ CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ return true;
+ }
+
+ 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);
+ }
+
+ return violationFound;
+ }
+
+ public String[] getValidationTargets(Annotation annotation)
+ {
+ return ((DateIs) annotation).valueOf();
+ }
+
+ /*
+ * protected
+ */
+ protected String getValidationErrorMsgKey(Annotation annotation,
+ boolean isTargetComponent)
+ {
+ if (!isTargetComponent)
+ {
+ return null;
+ }
+
+ String result = (String) this.violationResultStorage.get(RESULT_KEY);
+ if (TOO_EARLY.equals(result))
+ {
+ return getNotAfterErrorMsgKey((DateIs) annotation);
+ }
+ else if (TOO_LATE.equals(result))
+ {
+ return getNotBeforeErrorMsgKey((DateIs) annotation);
+ }
+ else
+ {
+ return getNotEqualErrorMsgKey((DateIs) annotation);
+ }
+ }
+
+ @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 getErrorMessageDetails(Annotation annotation,
+ boolean isTargetComponent)
+ {
+ if (!isTargetComponent)
+ {
+ return super.getErrorMessageDetails(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;
+ }
+
+ protected String getErrorMessage(String key, Annotation annotation,
+ boolean isTargetComponent)
+ {
+ String message = resolveMessage(key);
+
+ DateFormat dateFormat = DateFormat.getDateInstance(
+ ((DateIs) annotation).errorMessageDateStyle(), FacesContext
+ .getCurrentInstance().getViewRoot().getLocale());
+
+ //replace placeholder with the value of the other component
+ return message.replace("{0}", dateFormat
+ .format((Date) this.violationResultStorage
+ .get(COMPARED_VALUE_KEY)));
+ }
+
+ /*
+ * 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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/EqualsStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/EqualsStrategy.java
new file mode 100644
index 0000000..bdd8c54
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/EqualsStrategy.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.CrossValidationStorageEntry;
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ */
+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();
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/NotEqualsStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/NotEqualsStrategy.java
new file mode 100644
index 0000000..d11edd4
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/NotEqualsStrategy.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.crossval.strategy;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.NotEquals;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ */
+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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/RequiredIfStrategy.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/RequiredIfStrategy.java
new file mode 100644
index 0000000..eee4d1a
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/RequiredIfStrategy.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class RequiredIfStrategy extends AbstractCompareStrategy
+{
+
+ public boolean useTargetComponentToDisplayErrorMsg(
+ CrossValidationStorageEntry crossValidationStorageEntry)
+ {
+ return false;
+ }
+
+ 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();
+ }
+}
\ No newline at end of file
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/jpa_strategy_mappings.properties b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/jpa_strategy_mappings.properties
new file mode 100644
index 0000000..d5519ad
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/jpa_strategy_mappings.properties
@@ -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.
+
+javax.persistence.Column=org.apache.myfaces.extensions.validator.baseval.strategy.JpaValidationStrategy
+javax.persistence.Basic=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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/util/CrossValidationUtils.java b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/util/CrossValidationUtils.java
new file mode 100644
index 0000000..63b8a5e
--- /dev/null
+++ b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/util/CrossValidationUtils.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.util;
+
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationStorage;
+import org.apache.myfaces.extensions.validator.crossval.ProcessedInformationEntry;
+
+import javax.faces.context.FacesContext;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Gerhard Petracek
+ */
+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 VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY = JsfUtils.class.getName();
+
+ public static Map<String, ProcessedInformationEntry> getOrInitValueBindingConvertedValueMapping()
+ {
+ Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+
+ if (!requestMap.containsKey(VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY))
+ {
+ resetValueBindingConvertedValueMapping();
+ }
+
+ return (Map<String, ProcessedInformationEntry>) requestMap.get(VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY);
+ }
+
+ public static void resetValueBindingConvertedValueMapping()
+ {
+ FacesContext.getCurrentInstance().getExternalContext().getRequestMap()
+ .put(VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY, new HashMap<String, ProcessedInformationEntry>());
+ }
+}
diff --git a/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/resources/LICENSE.txt b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/resources/LICENSE.txt
new file mode 100644
index 0000000..c6055ec
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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.0.1-SNAPSHOT/validation-modules/property-validation/src/main/resources/NOTICE.txt b/1.0.1-SNAPSHOT/validation-modules/property-validation/src/main/resources/NOTICE.txt
new file mode 100644
index 0000000..4278ef3
--- /dev/null
+++ b/1.0.1-SNAPSHOT/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