You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2009/11/13 03:48:58 UTC
svn commit: r835712 [2/19] - in
/myfaces/extensions/validator/branches/branch_for_jsf_2_0: ./ assembly/
assembly/src/ assembly/src/main/ assembly/src/main/assembly/
assembly/src/main/resources/ component-support/
component-support/generic-support/ comp...
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/assembly/corebin.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/assembly/corebin.xml?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/assembly/corebin.xml (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/assembly/corebin.xml Fri Nov 13 02:48:45 2009
@@ -0,0 +1,32 @@
+<assembly>
+ <id>corebin</id>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>README*</include>
+ <include>LICENSE*</include>
+ <include>NOTICE*</include>
+ <include>RELEASE*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/javadoc</directory>
+ <outputDirectory>javadoc</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/assembly/coresrc.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/assembly/coresrc.xml?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/assembly/coresrc.xml (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/assembly/coresrc.xml Fri Nov 13 02:48:45 2009
@@ -0,0 +1,27 @@
+<assembly>
+ <id>coresrc</id>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>README*</include>
+ <include>LICENSE*</include>
+ <include>NOTICE*</include>
+ <include>RELEASE*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/src</directory>
+ <outputDirectory>src</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
+
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/resources/LICENSE.txt
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/resources/LICENSE.txt?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/resources/LICENSE.txt (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/resources/LICENSE.txt Fri Nov 13 02:48:45 2009
@@ -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.
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/resources/NOTICE.txt
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/resources/NOTICE.txt?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/resources/NOTICE.txt (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/assembly/src/main/resources/NOTICE.txt Fri Nov 13 02:48:45 2009
@@ -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
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/pom.xml?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/pom.xml (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/pom.xml Fri Nov 13 02:48:45 2009
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <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>2.0.3-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>component-support-modules-project</artifactId>
+ <version>2.0.3-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</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>
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/config/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/config/faces-config.xml?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/config/faces-config.xml (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/config/faces-config.xml Fri Nov 13 02:48:45 2009
@@ -0,0 +1,28 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="2.0">
+ <lifecycle>
+ <phase-listener>
+ org.apache.myfaces.extensions.validator.generic.startup.GenericModuleStartupListener
+ </phase-listener>
+ </lifecycle>
+</faces-config>
\ No newline at end of file
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRenderKit.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRenderKit.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRenderKit.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRenderKit.java Fri Nov 13 02:48:45 2009
@@ -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.generic.renderkit;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRenderKit;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.render.RenderKit;
+import javax.faces.render.Renderer;
+import java.lang.reflect.Method;
+
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodProxy;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValGenericRenderKit extends ExtValRenderKit implements MethodInterceptor
+{
+ public static RenderKit newInstance(RenderKit renderKit)
+ {
+ Class currentClass = renderKit.getClass();
+
+ //it's not possible to wrap the converter again - occurs e.g. under solaris + bea weblogic
+ if (currentClass.getName().contains("$$EnhancerByCGLIB$$")
+ || currentClass.getName().contains("$$FastClassByCGLIB$$"))
+ {
+ return renderKit;
+ }
+
+ Enhancer enhancer = new Enhancer();
+ enhancer.setSuperclass(renderKit.getClass());
+ enhancer.setCallback(new ExtValGenericRenderKit(renderKit));
+ enhancer.setClassLoader(Thread.currentThread().getContextClassLoader());
+
+ return (RenderKit) enhancer.create();
+ }
+
+ public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable
+ {
+ if(method.getName().equals("getRenderer"))
+ {
+ return getRenderer((String)args[0], (String)args[1]);
+ }
+ else if(method.getName().equals("addRenderer"))
+ {
+ addRenderer((String)args[0], (String)args[1], (Renderer)args[2]);
+ }
+ else
+ {
+ return proxy.invokeSuper(obj, args);
+ }
+
+ return null;
+ }
+
+ public ExtValGenericRenderKit(RenderKit wrapped)
+ {
+ super(wrapped);
+ }
+
+ @Override
+ protected Renderer createWrapper(Renderer renderer)
+ {
+ return ExtValGenericRendererWrapper.newInstance(renderer);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRendererWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRendererWrapper.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRendererWrapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/ExtValGenericRendererWrapper.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.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));
+ enhancer.setClassLoader(Thread.currentThread().getContextClassLoader());
+
+ 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);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/renderkit/GenericRenderKitWrapperFactory.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.generic.renderkit;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.AbstractRenderKitWrapperFactory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.render.RenderKit;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class GenericRenderKitWrapperFactory extends AbstractRenderKitWrapperFactory
+{
+ protected RenderKit createWrapper(RenderKit renderKit)
+ {
+ if(logger.isTraceEnabled())
+ {
+ logger.trace("extval renderkit wrapper created for " + renderKit.getClass().getName() + " via cglib");
+ }
+
+ return ExtValGenericRenderKit.newInstance(renderKit);
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/startup/GenericModuleStartupListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/startup/GenericModuleStartupListener.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/startup/GenericModuleStartupListener.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/java/org/apache/myfaces/extensions/validator/generic/startup/GenericModuleStartupListener.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.generic.startup;
+
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.renderkit.AbstractRenderKitWrapperFactory;
+import org.apache.myfaces.extensions.validator.core.startup.AbstractStartupListener;
+import org.apache.myfaces.extensions.validator.generic.renderkit.GenericRenderKitWrapperFactory;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class GenericModuleStartupListener extends AbstractStartupListener
+{
+ private static final long serialVersionUID = 4392156032877519556L;
+
+ protected void init()
+ {
+ ExtValContext.getContext().getFactoryFinder().getFactory(FactoryNames.RENDERKIT_WRAPPER_FACTORY,
+ AbstractRenderKitWrapperFactory.class).addRenderKitWrapperFactory(new GenericRenderKitWrapperFactory());
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/resources/LICENSE.txt
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/resources/LICENSE.txt?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/resources/LICENSE.txt (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/resources/LICENSE.txt Fri Nov 13 02:48:45 2009
@@ -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.
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/resources/NOTICE.txt
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/resources/NOTICE.txt?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/resources/NOTICE.txt (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/main/resources/NOTICE.txt Fri Nov 13 02:48:45 2009
@@ -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
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/site/apt/index.apt?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/site/apt/index.apt (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/generic-support/src/site/apt/index.apt Fri Nov 13 02:48:45 2009
@@ -0,0 +1,9 @@
+ ------
+Apache MyFaces Extensions Validator Generic Support Module
+ ------
+
+Apache MyFaces Extensions Validator Generic Support Module Overview
+
+ MyFaces Extensions Validator Generic Support Module provides generic Support for JSF component frameworks which have special requirements (e.g. RichFaces, MyFaces Tobago, ...).
+
+ MyFaces Extensions Validator is compatible with JSF 1.1.x and JSF 1.2.x. Both versions require Java 1.5+
\ No newline at end of file
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/pom.xml?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/pom.xml (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/component-support/pom.xml Fri Nov 13 02:48:45 2009
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <packaging>pom</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>component-support-modules-project</artifactId>
+
+ <name>MyFaces Extensions-Validator Component-Support Modules</name>
+ <version>2.0.3-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-parent</artifactId>
+ <version>2.0.3-SNAPSHOT</version>
+ </parent>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/component-support</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/component-support</developerConnection>
+ <url>http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/1_2_2_rc/component-support</url>
+ </scm>
+
+ <modules>
+ <!--module>trinidad-support</module-->
+ <module>generic-support</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>2.0.3-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <properties>
+ <trinidad.version>1.2.9</trinidad.version>
+ </properties>
+</project>
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/pom.xml?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/pom.xml (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/pom.xml Fri Nov 13 02:48:45 2009
@@ -0,0 +1,108 @@
+<?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>2.0.3-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <name>MyFaces Extensions-Validator Core</name>
+ <version>2.0.3-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/core</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/core</developerConnection>
+ <url>http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/1_2_2_rc/core</url>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/config</directory>
+ <includes>
+ <include>**/*xml</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*properties</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/config/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/config/faces-config.xml?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/config/faces-config.xml (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/config/faces-config.xml Fri Nov 13 02:48:45 2009
@@ -0,0 +1,31 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
+ version="2.0">
+ <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
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/ExtValInformation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/ExtValInformation.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/ExtValInformation.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/ExtValInformation.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+
+/**
+ * dont't move to an other package!!!
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface ExtValInformation
+{
+ static final String EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME = ExtValInformation.class.getPackage().getName();
+ static final String WEBXML_PARAM_PREFIX = ExtValInformation.class.getPackage().getName();
+ static final String VERSION = ClassUtils.getJarVersion(ExtValInformation.class);
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInformation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInformation.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInformation.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInformation.java Fri Nov 13 02:48:45 2009
@@ -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.core;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.API})
+public enum CustomInformation
+{
+ BASE_PACKAGE,
+ EXTVAL_CONTEXT,
+
+ COMPONENT_META_DATA_EXTRACTOR,
+ VALIDATION_PARAMETER_EXTRACTOR,
+
+ VALIDATION_STRATEGY_POSTFIX,
+ VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX,
+ META_DATA_TRANSFORMER_POSTFIX,
+
+ VALIDATION_STRATEGY_TO_MSG_RESOLVER_NAME_MAPPER,
+ META_DATA_TO_VALIDATION_STRATEGY_NAME_MAPPER,
+ VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER,
+
+ STARTUP_LISTENER,
+ COMPONENT_INITIALIZER,
+ VALIDATION_EXCEPTION_INTERCEPTOR,
+ PROPERTY_VALIDATION_INTERCEPTOR,
+ META_DATA_EXTRACTION_INTERCEPTOR,
+
+ MESSAGE_RESOLVER_FACTORY,
+ VALIDATION_STRATEGY_FACTORY,
+ COMPONENT_META_DATA_EXTRACTOR_FACTORY,
+ VALIDATION_PARAMETER_EXTRACTOR_FACTORY,
+ META_DATA_TRANSFORMER_FACTORY,
+ FACES_MESSAGE_FACTORY,
+ STORAGE_MANAGER_FACTORY,
+
+ MESSAGE_BUNDLE_NAME,
+ STATIC_STRATEGY_MAPPING_SOURCE,
+
+ META_DATA_STORAGE_FILTER
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,399 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.extensions.validator.core.factory.DefaultFactoryFinder;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryFinder;
+import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.interceptor.MetaDataExtractionInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.PropertyValidationInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.RendererInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.recorder.ProcessedInformationRecorder;
+import org.apache.myfaces.extensions.validator.core.validation.SkipValidationEvaluator;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverityInterpreter;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+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 javax.faces.component.UIComponent;
+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;
+
+ private ViolationSeverityInterpreter violationSeverityInterpreter;
+ private FactoryFinder factoryFinder = DefaultFactoryFinder.getInstance();
+ private Map<String, RendererInterceptor> rendererInterceptors = new HashMap<String, RendererInterceptor>();
+ private List<String> deniedInterceptors = new ArrayList<String>();
+ private List<ProcessedInformationRecorder> processedInformationRecorders =
+ new ArrayList<ProcessedInformationRecorder>();
+
+ private SkipValidationEvaluator skipValidationEvaluator;
+
+ private Map<String, Object> globalProperties = new HashMap<String, Object>();
+
+ private Map<StaticConfigurationNames, List<StaticConfiguration<String, String>>> staticConfigMap
+ = new HashMap<StaticConfigurationNames, List<StaticConfiguration<String, String>>>();
+
+ private ExtValContextInternals contextHelper;
+ private ExtValContextInvocationOrderAwareInternals invocationOrderAwareContextHelper;
+
+ private ExtValContext()
+ {
+ this.contextHelper = new ExtValContextInternals();
+ this.invocationOrderAwareContextHelper = new ExtValContextInvocationOrderAwareInternals(this.contextHelper);
+ }
+
+ public static ExtValContext getContext()
+ {
+ if (extValContext == null)
+ {
+ extValContext = new ExtValContext();
+
+ if(ExtValUtils.isApplicationInitialized())
+ {
+ Object customExtValContext = ExtValUtils.getELHelper().getBean(
+ extValContext.getInformationProviderBean().get(CustomInformation.EXTVAL_CONTEXT));
+
+ if (customExtValContext instanceof ExtValContext)
+ {
+ extValContext = (ExtValContext) customExtValContext;
+ }
+ }
+ else
+ {
+ //TODO try to use web.xml context-param
+ }
+ }
+ return extValContext;
+ }
+
+ public void setViolationSeverityInterpreter(ViolationSeverityInterpreter violationSeverityInterpreter)
+ {
+ setViolationSeverityInterpreter(violationSeverityInterpreter, true);
+ }
+
+ public void setViolationSeverityInterpreter(
+ ViolationSeverityInterpreter violationSeverityInterpreter, boolean forceOverride)
+ {
+ if (this.violationSeverityInterpreter == null || forceOverride)
+ {
+ if (this.logger.isInfoEnabled() && violationSeverityInterpreter != null)
+ {
+ this.logger.info(violationSeverityInterpreter.getClass() + " is used");
+ }
+ this.violationSeverityInterpreter = violationSeverityInterpreter;
+ }
+ }
+
+ public ViolationSeverityInterpreter getViolationSeverityInterpreter()
+ {
+ return this.violationSeverityInterpreter;
+ }
+
+ /*
+ * FactoryFinder
+ */
+ public FactoryFinder getFactoryFinder()
+ {
+ return this.factoryFinder;
+ }
+
+ public void setFactoryFinder(FactoryFinder factoryFinder)
+ {
+ if (factoryFinder != null)
+ {
+ this.factoryFinder = factoryFinder;
+ }
+ }
+
+ /*
+ * SkipValidationEvaluator
+ */
+ public void setSkipValidationEvaluator(SkipValidationEvaluator skipValidationEvaluator)
+ {
+ setSkipValidationEvaluator(skipValidationEvaluator, true);
+ }
+
+ public void setSkipValidationEvaluator(SkipValidationEvaluator skipValidationEvaluator, boolean forceOverride)
+ {
+ if (this.skipValidationEvaluator == null || forceOverride)
+ {
+ if (this.logger.isInfoEnabled() && skipValidationEvaluator != null)
+ {
+ this.logger.info(skipValidationEvaluator.getClass() + " is used");
+ }
+ this.skipValidationEvaluator = skipValidationEvaluator;
+ }
+ }
+
+ public SkipValidationEvaluator getSkipValidationEvaluator()
+ {
+ if (this.skipValidationEvaluator == null)
+ {
+ return new SkipValidationEvaluator()
+ {
+ public boolean skipValidation(FacesContext facesContext, UIComponent uiComponent,
+ ValidationStrategy validationStrategy, MetaDataEntry entry)
+ {
+ return false;
+ }
+ };
+ }
+
+ return this.skipValidationEvaluator;
+ }
+
+ /*
+ * RendererInterceptors
+ */
+ public List<RendererInterceptor> getRendererInterceptors()
+ {
+ return new ArrayList<RendererInterceptor>(this.rendererInterceptors.values());
+ }
+
+ public boolean registerRendererInterceptor(RendererInterceptor rendererInterceptor)
+ {
+ synchronized (ExtValContext.class)
+ {
+ if (this.deniedInterceptors.contains(rendererInterceptor.getInterceptorId()))
+ {
+ return false;
+ }
+
+ this.rendererInterceptors.put(rendererInterceptor.getInterceptorId(), rendererInterceptor);
+ }
+ return true;
+ }
+
+ public void deregisterRendererInterceptor(Class<? extends RendererInterceptor> rendererInterceptorClass)
+ {
+ RendererInterceptor rendererInterceptor = ClassUtils.tryToInstantiateClass(rendererInterceptorClass);
+
+ synchronized (ExtValContext.class)
+ {
+ this.rendererInterceptors.remove(rendererInterceptor.getInterceptorId());
+ }
+ }
+
+ //if an interceptor hasn't been registered so far, it should be denied at future registrations
+ public void denyRendererInterceptor(Class<? extends RendererInterceptor> rendererInterceptorClass)
+ {
+ RendererInterceptor rendererInterceptor = ClassUtils.tryToInstantiateClass(rendererInterceptorClass);
+
+ synchronized (ExtValContext.class)
+ {
+ if (!this.deniedInterceptors.contains(rendererInterceptor.getInterceptorId()))
+ {
+ this.deniedInterceptors.add(rendererInterceptor.getInterceptorId());
+ }
+ }
+ deregisterRendererInterceptor(rendererInterceptorClass);
+ }
+
+ /*
+ * ComponentInitializers
+ */
+ public void addComponentInitializer(ComponentInitializer componentInitializer)
+ {
+ this.invocationOrderAwareContextHelper.lazyInitComponentInitializers();
+ this.invocationOrderAwareContextHelper.addComponentInitializer(componentInitializer);
+ }
+
+ public List<ComponentInitializer> getComponentInitializers()
+ {
+ this.invocationOrderAwareContextHelper.lazyInitComponentInitializers();
+ return this.invocationOrderAwareContextHelper.getComponentInitializers();
+ }
+
+ /*
+ * ValidationExceptionInterceptors
+ */
+ public void addValidationExceptionInterceptor(ValidationExceptionInterceptor validationExceptionInterceptor)
+ {
+ this.invocationOrderAwareContextHelper.lazyInitValidationExceptionInterceptors();
+ this.invocationOrderAwareContextHelper.addValidationExceptionInterceptor(validationExceptionInterceptor);
+ }
+
+ public List<ValidationExceptionInterceptor> getValidationExceptionInterceptors()
+ {
+ this.invocationOrderAwareContextHelper.lazyInitValidationExceptionInterceptors();
+ return this.invocationOrderAwareContextHelper.getValidationExceptionInterceptors();
+ }
+
+ /*
+ * PropertyValidationInterceptors
+ */
+ public void addPropertyValidationInterceptor(PropertyValidationInterceptor propertyValidationInterceptor)
+ {
+ this.invocationOrderAwareContextHelper.lazyInitPropertyValidationInterceptors();
+ this.invocationOrderAwareContextHelper.addPropertyValidationInterceptor(propertyValidationInterceptor);
+ }
+
+ /**
+ * @return all global validation interceptors
+ */
+ public List<PropertyValidationInterceptor> getPropertyValidationInterceptors()
+ {
+ this.invocationOrderAwareContextHelper.lazyInitPropertyValidationInterceptors();
+ return this.invocationOrderAwareContextHelper.getPropertyValidationInterceptors();
+ }
+
+ public List<PropertyValidationInterceptor> getPropertyValidationInterceptorsFor(Class moduleKey)
+ {
+ this.invocationOrderAwareContextHelper.lazyInitPropertyValidationInterceptors();
+ return this.invocationOrderAwareContextHelper.getPropertyValidationInterceptorsFor(moduleKey);
+ }
+
+ /*
+ * MetaDataExtractionInterceptors
+ */
+ public void addMetaDataExtractionInterceptor(MetaDataExtractionInterceptor metaDataExtractionInterceptor)
+ {
+ this.invocationOrderAwareContextHelper.lazyInitMetaDataExtractionInterceptors();
+ this.invocationOrderAwareContextHelper.addMetaDataExtractionInterceptor(metaDataExtractionInterceptor);
+ }
+
+ /**
+ * @return all global meta-data extraction interceptors
+ */
+ public List<MetaDataExtractionInterceptor> getMetaDataExtractionInterceptors()
+ {
+ this.invocationOrderAwareContextHelper.lazyInitMetaDataExtractionInterceptors();
+ return this.invocationOrderAwareContextHelper.getMetaDataExtractionInterceptors();
+ }
+
+ public List<MetaDataExtractionInterceptor> getMetaDataExtractionInterceptorsFor(Class moduleKey)
+ {
+ Map<String, Object> properties = new HashMap<String, Object>();
+
+ if(moduleKey != null)
+ {
+ properties.put(ValidationModuleKey.class.getName(), moduleKey);
+ }
+ return getMetaDataExtractionInterceptorsWith(properties);
+ }
+
+ public List<MetaDataExtractionInterceptor> getMetaDataExtractionInterceptorsWith(Map<String, Object> properties)
+ {
+ this.invocationOrderAwareContextHelper.lazyInitMetaDataExtractionInterceptors();
+ return this.invocationOrderAwareContextHelper.getMetaDataExtractionInterceptorsWith(properties);
+ }
+
+ /*
+ * ProcessedInformationRecorders
+ */
+ public List<ProcessedInformationRecorder> getProcessedInformationRecorders()
+ {
+ return this.processedInformationRecorders;
+ }
+
+ public void addProcessedInformationRecorder(ProcessedInformationRecorder processedInformationRecorder)
+ {
+ this.processedInformationRecorders.add(processedInformationRecorder);
+ }
+
+ /*
+ * InformationProviderBean
+ */
+ public InformationProviderBean getInformationProviderBean()
+ {
+ return this.contextHelper.getInformationProviderBean();
+ }
+
+ /*
+ * StaticConfiguration
+ */
+ public List<StaticConfiguration<String, String>> getStaticConfiguration(StaticConfigurationNames name)
+ {
+ if (!this.staticConfigMap.containsKey(name))
+ {
+ List<StaticConfiguration<String, String>> staticConfigList =
+ new ArrayList<StaticConfiguration<String, String>>();
+ this.staticConfigMap.put(name, staticConfigList);
+ }
+ return this.staticConfigMap.get(name);
+ }
+
+ public void addStaticConfiguration(StaticConfigurationNames name, StaticConfiguration<String, String> staticConfig)
+ {
+ synchronized (this)
+ {
+ List<StaticConfiguration<String, String>> staticConfigList;
+ if (!this.staticConfigMap.containsKey(name))
+ {
+ staticConfigList = new ArrayList<StaticConfiguration<String, String>>();
+ this.staticConfigMap.put(name, staticConfigList);
+ }
+ this.staticConfigMap.get(name).add(staticConfig);
+ }
+ }
+
+ /*
+ * Global properties
+ */
+ 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;
+ }
+
+ if (this.logger.isInfoEnabled())
+ {
+ logger.info("override global property '" + name + "'");
+ }
+ }
+
+ this.globalProperties.put(name, value);
+ return true;
+ }
+
+ public Object getGlobalProperty(String name)
+ {
+ return this.globalProperties.get(name);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInternals.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInternals.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInternals.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInternals.java Fri Nov 13 02:48:45 2009
@@ -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;
+
+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 javax.faces.context.FacesContext;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class ExtValContextInternals
+{
+ boolean isComponentInitializationActivated()
+ {
+ return !"true".equalsIgnoreCase(WebXmlParameter.DEACTIVATE_COMPONENT_INITIALIZATION);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ 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();
+ }
+
+ @SuppressWarnings({"unchecked"})
+ void tryToInitCustomConfiguredInformationProviderBeanClassName(Map applicationMap)
+ {
+ InformationProviderBean bean = (InformationProviderBean) ExtValUtils.getELHelper()
+ .getBean(InformationProviderBean.CUSTOM_BEAN.replace(".", "_"));
+
+ if (bean != null)
+ {
+ applicationMap.put(InformationProviderBean.BEAN_NAME, bean);
+ }
+ }
+
+ InformationProviderBean getInformationProviderBean()
+ {
+ Map applicationMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();
+ InformationProviderBean bean = (InformationProviderBean) applicationMap.get(InformationProviderBean.BEAN_NAME);
+
+ if (bean == null)
+ {
+ return initInformationProviderBean(applicationMap);
+ }
+ return bean;
+ }
+}
\ No newline at end of file