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 [3/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/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.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/ExtValContextInvocationOrderAwareInternals.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,478 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, 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.initializer.component.ComponentInitializer;
+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.ValidationExceptionInterceptor;
+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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Collections;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+class ExtValContextInvocationOrderAwareInternals
+{
+    private final Log logger = LogFactory.getLog(getClass());
+
+    private List<MetaDataExtractionInterceptor> metaDataExtractionInterceptors = null;
+    private Map<Class, List<MetaDataExtractionInterceptor>> moduleSpecificMetaDataExtractionInterceptors = null;
+    private List<ValidationExceptionInterceptor> validationExceptionInterceptors = null;
+    private List<PropertyValidationInterceptor> propertyValidationInterceptors = null;
+    private Map<Class, List<PropertyValidationInterceptor>> moduleSpecificPropertyValidationInterceptors = null;
+    private List<ComponentInitializer> componentInitializers = null;
+
+    private ExtValContextInternals contextHelper;
+
+    ExtValContextInvocationOrderAwareInternals(ExtValContextInternals contextHelper)
+    {
+        this.contextHelper = contextHelper;
+    }
+
+    /*
+     * ComponentInitializers
+     */
+    void addComponentInitializer(ComponentInitializer componentInitializer)
+    {
+        this.componentInitializers.add(componentInitializer);
+        sortComponentInitializers();
+    }
+
+    List<ComponentInitializer> getComponentInitializers()
+    {
+        return this.contextHelper.isComponentInitializationActivated() ?
+                this.componentInitializers : new ArrayList<ComponentInitializer>();
+    }
+
+    /*
+     * ValidationExceptionInterceptors
+     */
+    void addValidationExceptionInterceptor(ValidationExceptionInterceptor validationExceptionInterceptor)
+    {
+        this.validationExceptionInterceptors.add(validationExceptionInterceptor);
+        sortValidationExceptionInterceptors();
+    }
+
+    List<ValidationExceptionInterceptor> getValidationExceptionInterceptors()
+    {
+        return this.validationExceptionInterceptors;
+    }
+
+    /*
+     * PropertyValidationInterceptors
+     */
+    void addPropertyValidationInterceptor(PropertyValidationInterceptor propertyValidationInterceptor)
+    {
+        if (propertyValidationInterceptor instanceof ValidationModuleAware)
+        {
+            addPropertyValidationInterceptorForModules(propertyValidationInterceptor);
+            sortModuleSpecificPropertyValidationInterceptors();
+        }
+        else
+        {
+            addPropertyValidationInterceptorForModule(null, propertyValidationInterceptor);
+            sortPropertyValidationInterceptors();
+        }
+    }
+
+    List<PropertyValidationInterceptor> getPropertyValidationInterceptors()
+    {
+        return this.propertyValidationInterceptors;
+    }
+
+    List<PropertyValidationInterceptor> getPropertyValidationInterceptorsFor(Class moduleKey)
+    {
+        List<PropertyValidationInterceptor> result = new ArrayList<PropertyValidationInterceptor>();
+
+        result.addAll(getPropertyValidationInterceptors());
+
+        if (moduleKey != null && this.moduleSpecificPropertyValidationInterceptors.containsKey(moduleKey))
+        {
+            result.addAll(this.moduleSpecificPropertyValidationInterceptors.get(moduleKey));
+        }
+        return sortPropertyValidationInterceptorList(result);
+    }
+
+    private void addPropertyValidationInterceptorForModules(PropertyValidationInterceptor propertyValidationInterceptor)
+    {
+        Class moduleKey;
+        for (String currentModuleKey : ((ValidationModuleAware) propertyValidationInterceptor).getModuleKeys())
+        {
+            moduleKey = ClassUtils.tryToLoadClassForName(currentModuleKey);
+
+            if (moduleKey == null)
+            {
+                continue;
+            }
+
+            addPropertyValidationInterceptorForModule(moduleKey, propertyValidationInterceptor);
+        }
+    }
+
+    private void addPropertyValidationInterceptorForModule(
+            Class moduleKey, PropertyValidationInterceptor propertyValidationInterceptor)
+    {
+        if (moduleKey == null)
+        {
+            this.propertyValidationInterceptors.add(propertyValidationInterceptor);
+
+            if (logger.isTraceEnabled())
+            {
+                logger.trace(propertyValidationInterceptor.getClass().getName() + " added as global interceptor");
+            }
+        }
+        else
+        {
+            List<PropertyValidationInterceptor> propertyValidationInterceptorList;
+            if (this.moduleSpecificPropertyValidationInterceptors.containsKey(moduleKey))
+            {
+                propertyValidationInterceptorList = this.moduleSpecificPropertyValidationInterceptors.get(moduleKey);
+            }
+            else
+            {
+                propertyValidationInterceptorList = new ArrayList<PropertyValidationInterceptor>();
+                this.moduleSpecificPropertyValidationInterceptors.put(moduleKey, propertyValidationInterceptorList);
+            }
+            propertyValidationInterceptorList.add(propertyValidationInterceptor);
+
+            if (logger.isTraceEnabled())
+            {
+                logger.trace(propertyValidationInterceptor.getClass().getName() + " added for " + moduleKey.getName());
+            }
+        }
+    }
+
+    /*
+     * MetaDataExtractionInterceptors
+     */
+    void addMetaDataExtractionInterceptor(MetaDataExtractionInterceptor metaDataExtractionInterceptor)
+    {
+        if(metaDataExtractionInterceptor instanceof ValidationModuleAware)
+        {
+            addMetaDataExtractionInterceptorForModules(metaDataExtractionInterceptor);
+            sortModuleSpecificMetaDataExtractionInterceptors();
+        }
+        else
+        {
+            addMetaDataExtractionInterceptorForModule(null, metaDataExtractionInterceptor);
+            sortMetaDataExtractionInterceptors();
+        }
+    }
+
+    private void addMetaDataExtractionInterceptorForModules(MetaDataExtractionInterceptor metaDataExtractionInterceptor)
+    {
+        Class moduleKey;
+        for (String currentModuleKey : ((ValidationModuleAware) metaDataExtractionInterceptor).getModuleKeys())
+        {
+            moduleKey = ClassUtils.tryToLoadClassForName(currentModuleKey);
+
+            if (moduleKey == null)
+            {
+                continue;
+            }
+
+            addMetaDataExtractionInterceptorForModule(moduleKey, metaDataExtractionInterceptor);
+        }
+    }
+
+    private void addMetaDataExtractionInterceptorForModule(
+            Class moduleKey, MetaDataExtractionInterceptor metaDataExtractionInterceptor)
+    {
+        if (moduleKey == null)
+        {
+            this.metaDataExtractionInterceptors.add(metaDataExtractionInterceptor);
+
+            if (logger.isTraceEnabled())
+            {
+                logger.trace(metaDataExtractionInterceptor.getClass().getName() + " added as global interceptor");
+            }
+        }
+        else
+        {
+            List<MetaDataExtractionInterceptor> metaDataExtractionInterceptorList;
+            if (this.moduleSpecificMetaDataExtractionInterceptors.containsKey(moduleKey))
+            {
+                metaDataExtractionInterceptorList = this.moduleSpecificMetaDataExtractionInterceptors.get(moduleKey);
+            }
+            else
+            {
+                metaDataExtractionInterceptorList = new ArrayList<MetaDataExtractionInterceptor>();
+                this.moduleSpecificMetaDataExtractionInterceptors.put(moduleKey, metaDataExtractionInterceptorList);
+            }
+            metaDataExtractionInterceptorList.add(metaDataExtractionInterceptor);
+
+            if (logger.isTraceEnabled())
+            {
+                logger.trace(metaDataExtractionInterceptor.getClass().getName() + " added for " + moduleKey.getName());
+            }
+        }
+    }
+
+    List<MetaDataExtractionInterceptor> getMetaDataExtractionInterceptors()
+    {
+        return this.metaDataExtractionInterceptors;
+    }
+
+    List<MetaDataExtractionInterceptor> getMetaDataExtractionInterceptorsWith(Map<String, Object> properties)
+    {
+        List<MetaDataExtractionInterceptor> result = new ArrayList<MetaDataExtractionInterceptor>();
+
+        result.addAll(getMetaDataExtractionInterceptors());
+
+        Class moduleKey = tryToResolveModuleKey(properties);
+        if(moduleKey != null && this.moduleSpecificMetaDataExtractionInterceptors.containsKey(moduleKey))
+        {
+            result.addAll(this.moduleSpecificMetaDataExtractionInterceptors.get(moduleKey));
+        }
+
+        return sortMetaDataExtractionInterceptorList(result);
+    }
+
+    private Class tryToResolveModuleKey(Map<String, Object> properties)
+    {
+        Class moduleKey = null;
+        if(properties != null && properties.containsKey(ValidationModuleKey.class.getName()))
+        {
+            Object foundValue = properties.get(ValidationModuleKey.class.getName());
+            if(foundValue instanceof Class)
+            {
+                moduleKey = (Class)foundValue;
+            }
+        }
+        return moduleKey;
+    }
+
+    /*
+     * init
+     */
+
+    void lazyInitValidationExceptionInterceptors()
+    {
+        if (validationExceptionInterceptors != null)
+        {
+            return;
+        }
+
+        validationExceptionInterceptors = new ArrayList<ValidationExceptionInterceptor>();
+        List<String> validationExceptionInterceptorClassNames = new ArrayList<String>();
+
+        validationExceptionInterceptorClassNames
+                .add(WebXmlParameter.CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR);
+        validationExceptionInterceptorClassNames
+                .add(this.contextHelper.getInformationProviderBean().get(
+                        CustomInformation.VALIDATION_EXCEPTION_INTERCEPTOR));
+
+        ValidationExceptionInterceptor validationExceptionInterceptor;
+        for (String validationExceptionInterceptorName : validationExceptionInterceptorClassNames)
+        {
+            validationExceptionInterceptor =
+                    (ValidationExceptionInterceptor)
+                            ClassUtils.tryToInstantiateClassForName(validationExceptionInterceptorName);
+
+            if (validationExceptionInterceptor != null)
+            {
+                validationExceptionInterceptors.add(validationExceptionInterceptor);
+
+                if (logger.isTraceEnabled())
+                {
+                    logger.trace(validationExceptionInterceptor.getClass().getName() + " added");
+                }
+            }
+        }
+    }
+
+    void lazyInitMetaDataExtractionInterceptors()
+    {
+        if (metaDataExtractionInterceptors != null)
+        {
+            return;
+        }
+
+        metaDataExtractionInterceptors = new ArrayList<MetaDataExtractionInterceptor>();
+        moduleSpecificMetaDataExtractionInterceptors = new HashMap<Class, List<MetaDataExtractionInterceptor>>();
+
+        List<String> metaDataExtractionInterceptorClassNames = new ArrayList<String>();
+
+        metaDataExtractionInterceptorClassNames
+                .add(WebXmlParameter.CUSTOM_META_DATA_EXTRACTION_INTERCEPTOR);
+        metaDataExtractionInterceptorClassNames
+                .add(this.contextHelper.getInformationProviderBean().get(
+                        CustomInformation.META_DATA_EXTRACTION_INTERCEPTOR));
+
+        MetaDataExtractionInterceptor metaDataExtractionInterceptor;
+        for (String validationExceptionInterceptorName : metaDataExtractionInterceptorClassNames)
+        {
+            metaDataExtractionInterceptor =
+                    (MetaDataExtractionInterceptor)
+                            ClassUtils.tryToInstantiateClassForName(validationExceptionInterceptorName);
+
+            if (metaDataExtractionInterceptor != null)
+            {
+                addMetaDataExtractionInterceptor(metaDataExtractionInterceptor);
+            }
+        }
+    }
+
+    void lazyInitComponentInitializers()
+    {
+        if (componentInitializers != null)
+        {
+            return;
+        }
+
+        componentInitializers = new ArrayList<ComponentInitializer>();
+        List<String> componentInitializerClassNames = new ArrayList<String>();
+        componentInitializerClassNames
+                .add(WebXmlParameter.CUSTOM_COMPONENT_INITIALIZER);
+        componentInitializerClassNames
+                .add(this.contextHelper.getInformationProviderBean().get(CustomInformation.COMPONENT_INITIALIZER));
+
+        ComponentInitializer componentInitializer;
+        for (String componentInitializerName : componentInitializerClassNames)
+        {
+            componentInitializer =
+                    (ComponentInitializer) ClassUtils.tryToInstantiateClassForName(componentInitializerName);
+
+            if (componentInitializer != null)
+            {
+                componentInitializers.add(componentInitializer);
+
+                if (logger.isTraceEnabled())
+                {
+                    logger.trace(componentInitializer.getClass().getName() + " added");
+                }
+            }
+        }
+    }
+
+    void lazyInitPropertyValidationInterceptors()
+    {
+        if (propertyValidationInterceptors != null)
+        {
+            return;
+        }
+
+        propertyValidationInterceptors = new ArrayList<PropertyValidationInterceptor>();
+        moduleSpecificPropertyValidationInterceptors = new HashMap<Class, List<PropertyValidationInterceptor>>();
+
+        List<String> validationInterceptorClassNames = new ArrayList<String>();
+
+        validationInterceptorClassNames
+                .add(WebXmlParameter.CUSTOM_PROPERTY_VALIDATION_INTERCEPTOR);
+        validationInterceptorClassNames
+                .add(this.contextHelper.getInformationProviderBean().get(
+                        CustomInformation.PROPERTY_VALIDATION_INTERCEPTOR));
+
+        PropertyValidationInterceptor propertyValidationInterceptor;
+        for (String validationInterceptorName : validationInterceptorClassNames)
+        {
+            propertyValidationInterceptor =
+                    (PropertyValidationInterceptor)
+                            ClassUtils.tryToInstantiateClassForName(validationInterceptorName);
+
+            if (propertyValidationInterceptor != null)
+            {
+                if (propertyValidationInterceptor instanceof ValidationModuleAware)
+                {
+                    addPropertyValidationInterceptorForModules(propertyValidationInterceptor);
+                }
+                else
+                {
+                    addPropertyValidationInterceptorForModule(null, propertyValidationInterceptor);
+                }
+            }
+        }
+    }
+
+    /*
+     * sort
+     */
+    private void sortComponentInitializers()
+    {
+        Collections.sort(this.componentInitializers, new InvocationOrderComparator<ComponentInitializer>());
+    }
+
+    private void sortPropertyValidationInterceptors()
+    {
+        Collections.sort(this.propertyValidationInterceptors,
+                new InvocationOrderComparator<PropertyValidationInterceptor>());
+    }
+
+    //sort all - it isn't a huge overhead since it's just done during the init-phase
+    private void sortModuleSpecificPropertyValidationInterceptors()
+    {
+        for(List<PropertyValidationInterceptor> propertyValidationInterceptorList :
+                this.moduleSpecificPropertyValidationInterceptors.values())
+        {
+            sortPropertyValidationInterceptorList(propertyValidationInterceptorList);
+        }
+    }
+
+    private List<PropertyValidationInterceptor> sortPropertyValidationInterceptorList(
+            List<PropertyValidationInterceptor> propertyValidationInterceptorList)
+    {
+        Collections.sort(propertyValidationInterceptorList,
+                    new InvocationOrderComparator<PropertyValidationInterceptor>());
+
+        return propertyValidationInterceptorList;
+    }
+
+    private void sortValidationExceptionInterceptors()
+    {
+        Collections.sort(this.validationExceptionInterceptors,
+                new InvocationOrderComparator<ValidationExceptionInterceptor>());
+    }
+
+    private void sortMetaDataExtractionInterceptors()
+    {
+        Collections.sort(this.metaDataExtractionInterceptors,
+                new InvocationOrderComparator<MetaDataExtractionInterceptor>());
+    }
+
+    //sort all - it isn't a huge overhead since it's just done during the init-phase
+    private void sortModuleSpecificMetaDataExtractionInterceptors()
+    {
+        for(List<MetaDataExtractionInterceptor> metaDataExtractionInterceptorList :
+                this.moduleSpecificMetaDataExtractionInterceptors.values())
+        {
+            sortMetaDataExtractionInterceptorList(metaDataExtractionInterceptorList);
+        }
+    }
+
+    private List<MetaDataExtractionInterceptor> sortMetaDataExtractionInterceptorList(
+            List<MetaDataExtractionInterceptor> metaDataExtractionInterceptorList)
+    {
+        Collections.sort(metaDataExtractionInterceptorList,
+                    new InvocationOrderComparator<MetaDataExtractionInterceptor>());
+
+        return metaDataExtractionInterceptorList;
+    }
+}
\ 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/core/InformationProviderBean.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/InformationProviderBean.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java Fri Nov 13 02:48:45 2009
@@ -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;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * centralized in order that these information aren't spread over the complete code base
+ * + some of them can be customized within a custom impl. of the bean
+ * (extend this class and provide it via convention or web.xml)
+ * <p/>
+ * the static api should only be used
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.API, UsageCategory.CUSTOMIZABLE})
+public class InformationProviderBean
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    public static final String BEAN_NAME = ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME
+        + "." + InformationProviderBean.class.getSimpleName();
+    //custom class which is an optional replacement for this class (has to extend this class)
+    public static final String CUSTOM_BEAN = (ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME
+        + ".custom." + InformationProviderBean.class.getSimpleName());
+
+    public InformationProviderBean()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+
+        setupCustomizableInformation();
+        applyCustomValues(this.customizableInfos);
+    }
+
+    private Map<CustomInformation, String> customizableInfos = new HashMap<CustomInformation, String>();
+
+    private void setupCustomizableInformation()
+    {
+        String basePackage = WebXmlParameter.CUSTOM_BASE_PACKAGE;
+
+        if (basePackage == null)
+        {
+            basePackage = ExtValInformation.EXTENSIONS_VALIDATOR_BASE_PACKAGE_NAME + ".custom.";
+        }
+        if (!basePackage.endsWith("."))
+        {
+            basePackage = basePackage + ".";
+        }
+
+        customizableInfos.put(CustomInformation.BASE_PACKAGE, basePackage);
+        customizableInfos.put(CustomInformation.EXTVAL_CONTEXT, "customExtValContext");
+        
+        customizableInfos.put(CustomInformation.COMPONENT_META_DATA_EXTRACTOR,
+                "ComponentMetaDataExtractor");
+        customizableInfos.put(CustomInformation.VALIDATION_PARAMETER_EXTRACTOR,
+                "ValidationParameterExtractor");
+
+        customizableInfos.put(CustomInformation.VALIDATION_STRATEGY_POSTFIX,
+                "ValidationStrategy");
+        customizableInfos.put(CustomInformation.META_DATA_TRANSFORMER_POSTFIX,
+                "MetaDataTransformer");
+        customizableInfos.put(CustomInformation.VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX,
+                "ValidationErrorMessageResolver");
+
+        customizableInfos.put(CustomInformation.COMPONENT_INITIALIZER,
+                "ComponentInitializer");
+        customizableInfos.put(CustomInformation.VALIDATION_EXCEPTION_INTERCEPTOR,
+                "ValidationExceptionInterceptor");
+        customizableInfos.put(CustomInformation.PROPERTY_VALIDATION_INTERCEPTOR,
+                "PropertyValidationInterceptor");
+        customizableInfos.put(CustomInformation.META_DATA_EXTRACTION_INTERCEPTOR,
+                "MetaDataExtractionInterceptor");
+
+        customizableInfos.put(CustomInformation.VALIDATION_STRATEGY_TO_MSG_RESOLVER_NAME_MAPPER,
+                "ValidationStrategyToMsgResolverNameMapper");
+        customizableInfos.put(CustomInformation.META_DATA_TO_VALIDATION_STRATEGY_NAME_MAPPER,
+                "MetaDataToValidationStrategyNameMapper");
+        customizableInfos.put(CustomInformation.VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER,
+                "ValidationStrategyToMetaDataTransformerNameMapper");
+
+        customizableInfos.put(CustomInformation.STARTUP_LISTENER,
+                "StartupListener");
+
+        customizableInfos.put(CustomInformation.MESSAGE_RESOLVER_FACTORY,
+                "MessageResolverFactory");
+        customizableInfos.put(CustomInformation.VALIDATION_STRATEGY_FACTORY,
+                "ValidationStrategyFactory");
+        customizableInfos.put(CustomInformation.COMPONENT_META_DATA_EXTRACTOR_FACTORY,
+                "ComponentMetaDataExtractorFactory");
+        customizableInfos.put(CustomInformation.VALIDATION_PARAMETER_EXTRACTOR_FACTORY,
+                "ValidationParameterExtractorFactory");
+        customizableInfos.put(CustomInformation.META_DATA_TRANSFORMER_FACTORY,
+                "MetaDataTransformerFactory");
+        customizableInfos.put(CustomInformation.FACES_MESSAGE_FACTORY,
+                "FacesMessageFactory");
+        customizableInfos.put(CustomInformation.STORAGE_MANAGER_FACTORY,
+                "StorageManagerFactory");
+
+        //conventions (the rest of the conventions are built with the help of name mappers,...
+        customizableInfos.put(CustomInformation.MESSAGE_BUNDLE_NAME,
+                "validation_messages");
+        //static strategy mappings (name of property files)
+        customizableInfos.put(CustomInformation.STATIC_STRATEGY_MAPPING_SOURCE,
+                "strategy_mappings");
+
+        customizableInfos.put(CustomInformation.META_DATA_STORAGE_FILTER,
+                "MetaDataStorageFilter");
+    }
+
+    @SuppressWarnings({"UnusedDeclaration"})
+    protected void applyCustomValues(Map<CustomInformation, String> map)
+    {
+        //override to customize information
+    }
+
+    public final String get(CustomInformation customInformation)
+    {
+        String value = customizableInfos.get(customInformation);
+
+        switch (customInformation)
+        {
+            case BASE_PACKAGE:
+                return value;
+
+            case EXTVAL_CONTEXT:
+                return value;
+
+            /*
+             * postfix used by the SimpleAnnotationToValidationStrategyNameMapper
+             * the SimpleAnnotationToValidationStrategyNameMapper is for custom strategies only
+             * (not for public validation modules)
+             * so it's fine to customize it
+             */
+            case VALIDATION_STRATEGY_POSTFIX:
+                return value;
+
+            case VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX:
+                return value;
+
+            case META_DATA_TRANSFORMER_POSTFIX:
+                return value;
+
+            default:
+                return customizableInfos.get(CustomInformation.BASE_PACKAGE) + value;
+        }
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InternalConventionProvider.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/InternalConventionProvider.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InternalConventionProvider.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InternalConventionProvider.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class InternalConventionProvider
+{
+    public static String getModuleMessageBundleName(String packageName)
+    {
+        String newPackageName;
+        if (packageName.endsWith(".resolver"))
+        {
+            newPackageName = packageName.replace(".resolver", ".bundle");
+        }
+        else
+        {
+            newPackageName = packageName.replace(".resolver.", ".bundle.");
+        }
+
+        return newPackageName + ".validation_messages";
+    }
+
+    /**
+     * use a custom name mapper to implement custom conventions
+     */
+    @ToDo(value = Priority.MEDIUM, description = "logging")
+    public static String getMessageResolverClassName(
+        Class<? extends ValidationStrategy> validationStrategyClass, String targetClassName)
+    {
+        return getValidationStrategyBasedName(validationStrategyClass, ".message.resolver.", targetClassName);
+    }
+
+    public static String getMetaDataTransformerClassName(
+        Class<? extends ValidationStrategy> validationStrategyClass, String targetClassName)
+    {
+        return getValidationStrategyBasedName(validationStrategyClass, ".metadata.transformer.", targetClassName);
+    }
+
+    private static String getValidationStrategyBasedName(Class<? extends ValidationStrategy> validationStrategyClass,
+                                                  String targetPackageName, String targetClassName)
+    {
+        String validationStrategyClassName = validationStrategyClass.getName();
+
+        validationStrategyClassName = validationStrategyClassName.replace(".strategy.", targetPackageName);
+
+        if (targetClassName == null || validationStrategyClassName.lastIndexOf(".") == -1)
+        {
+            return null;
+        }
+        return validationStrategyClassName
+                .substring(0, validationStrategyClassName.lastIndexOf(".")) + "." + targetClassName;
+    }
+
+    /**
+     * use a custom name mapper to implement custom conventions
+     */
+    public static String getMessageResolverClassName(String validationStrategyName)
+    {
+        return getValidationStrategyBasedName(validationStrategyName, "ValidationErrorMessageResolver");
+    }
+
+    /**
+     * use a custom name mapper to implement custom conventions
+     */
+    public static String getValidationStrategyClassName(String metaDataKey)
+    {
+        return metaDataKey.replace(".annotation.", ".strategy.") + "Strategy";
+    }
+
+    public static String getMetaDataTransformerClassName(String validationStrategyName)
+    {
+        return getValidationStrategyBasedName(validationStrategyName, "MetaDataTransformer");
+    }
+
+    public static String getValidationStrategyBasedName(String validationStrategyName, String targetPostfix)
+    {
+        if (validationStrategyName.endsWith("ValidationStrategy"))
+        {
+            return validationStrategyName.substring(0, validationStrategyName.length() - 18) + targetPostfix;
+        }
+        else if (validationStrategyName.endsWith("Strategy"))
+        {
+            return validationStrategyName.substring(0, validationStrategyName.length() - 8) + targetPostfix;
+        }
+        return validationStrategyName + targetPostfix;
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InvocationOrder.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/InvocationOrder.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InvocationOrder.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InvocationOrder.java Fri Nov 13 02:48:45 2009
@@ -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.core;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+
+@Target(TYPE)
+@Retention(RUNTIME)
+@Documented
+/**
+ * allowed to use for classes which implement interfaces which have the marker @InvocationOrderSupport
+ *
+ * suggested ranges (mainly for name-mappers):
+ * negative values for "extreme" cases
+ *
+ * 0-49 for custom artifacts which should have the highest priority
+ * 50-99 for add-ons which provide artifacts which should have a higher priority than the default artifacts
+ * 100-999 internal artifacts
+ * 1000+ for custom artifacts
+ *
+ * suggested ranges for artifacts like interceptors,...
+ * 1xx ... artifacts of the core
+ * 2xx ... artifacts of validation modules
+ * 3xx ... artifacts of component support modules
+ *
+ * a priority should be unique within one artifact-type - that means
+ * if a name-mapper has priority 100, it's ok that an exception-interceptor also has priority 100.
+ * but a 2nd name-mapper shouldn't have priority 100
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+public @interface InvocationOrder
+{
+    /**
+     * default priority for custom artifacts (if they should get added after the internal versions
+     * @return the priority of an artifact annotated with this annotation
+     */
+    int value() default 1000;
+}
\ 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/core/InvocationOrderComparator.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/InvocationOrderComparator.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InvocationOrderComparator.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InvocationOrderComparator.java Fri Nov 13 02:48:45 2009
@@ -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.core;
+
+import java.util.Comparator;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+public class InvocationOrderComparator<T> implements Comparator<T>
+{
+    public int compare(T nm1, T nm2)
+    {
+        if (hasPriority(nm1) && hasPriority(nm2))
+        {
+            return isPriorityHigher(nm1.getClass().getAnnotation(InvocationOrder.class),
+                    nm2.getClass().getAnnotation(InvocationOrder.class));
+        }
+        if (!hasPriority(nm1) && !hasPriority(nm2))
+        {
+            return 0;
+        }
+        return hasPriority(nm1) ? -1 : 1;
+    }
+
+    private int isPriorityHigher(InvocationOrder priority1, InvocationOrder priority2)
+    {
+        if (priority1.value() == priority2.value())
+        {
+            return 0;
+        }
+
+        return priority1.value() < priority2.value() ? -1 : 1;
+    }
+
+    private boolean hasPriority(Object nm)
+    {
+        return nm.getClass().isAnnotationPresent(InvocationOrder.class);
+    }
+}
\ 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/core/InvocationOrderSupport.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/InvocationOrderSupport.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InvocationOrderSupport.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/InvocationOrderSupport.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.core;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.TYPE;
+
+@Target(TYPE)
+@Documented
+/**
+ * marker annotation for easier usage
+ * it marks interfaces - instances of classes implementing these interfaces will be sorted
+ * @see InvocationOrderComparator
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+public @interface InvocationOrderSupport
+{
+}
\ 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/core/Nested.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/Nested.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/Nested.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/Nested.java Fri Nov 13 02:48:45 2009
@@ -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;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+
+/**
+ * marker annotation e.g. to mark sub-name-mappers
+ * 
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+@Documented
+@UsageInformation(UsageCategory.API)
+public @interface Nested
+{
+}
\ 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/core/PhaseIdRecordingPhaseListener.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/PhaseIdRecordingPhaseListener.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/PhaseIdRecordingPhaseListener.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/PhaseIdRecordingPhaseListener.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core;
+
+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.myfaces.extensions.validator.core.storage.FacesInformationStorage;
+
+import javax.faces.event.PhaseListener;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+
+/**
+ * e.g. to allow in metadata extraction interceptors to know if they are invoked during validation or
+ * component initialization (if needed)
+ * example: client-side validation - some functionality shouldn't be processed during rendering
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class PhaseIdRecordingPhaseListener implements PhaseListener
+{
+    private static final long serialVersionUID = 2791240514014867457L;
+
+    public void afterPhase(PhaseEvent phaseEvent)
+    {
+    }
+
+    public void beforePhase(PhaseEvent phaseEvent)
+    {
+        FacesInformationStorage facesInformationStorage = ExtValUtils
+                .getStorage(FacesInformationStorage.class, FacesInformationStorage.class.getName());
+
+        facesInformationStorage.setCurrentPhaseId(phaseEvent.getPhaseId());
+    }
+
+    public PhaseId getPhaseId()
+    {
+        return PhaseId.ANY_PHASE;
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ValidationModuleAware.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/ValidationModuleAware.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ValidationModuleAware.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ValidationModuleAware.java Fri Nov 13 02:48:45 2009
@@ -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;
+
+/**
+ * if an artifact (which supports this concept) should be used just for a/some specific module(s),
+ * the artifact has to implement this interface
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+public interface ValidationModuleAware
+{
+    /**
+     * during the registration process the information gets evaluated<br/>
+     * instead of a class array a string array is used so that it's possible to implement
+     * an artifact for different modules. if an add-on restricts an artifact to specific modules,
+     * not all modules have to be used by the webapp. if a module key is unknown, the artifact won't get registered
+     * for this module. if an artifact doesn't implement this interface, it gets registered for all modules
+     *
+     * @return an array of fully qualified class names of the module keys
+     */
+    String[] getModuleKeys();
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ValidationModuleKey.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/ValidationModuleKey.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ValidationModuleKey.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/ValidationModuleKey.java Fri Nov 13 02:48:45 2009
@@ -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;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+
+@Target(TYPE)
+@Retention(RUNTIME)
+@Documented
+/**
+ * marker annotation for module keys
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+public @interface ValidationModuleKey
+{
+}
\ 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/core/WebXmlParameter.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/WebXmlParameter.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.WebXmlUtils;
+
+/**
+ * centralized in order that these information aren't spread over the complete code base
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface WebXmlParameter
+{
+    /*
+     * misc
+     */
+    static final String CUSTOM_MESSAGE_BUNDLE = WebXmlUtils
+        .getInitParameter("CUSTOM_MESSAGE_BUNDLE");
+
+    static final String CUSTOM_BASE_PACKAGE = WebXmlUtils
+        .getInitParameter("CUSTOM_BASE_PACKAGE");
+
+    static final String CUSTOM_INFORMATION_PROVIDER_BEAN = WebXmlUtils
+        .getInitParameter("CUSTOM_INFORMATION_PROVIDER_BEAN");
+
+    static final String CUSTOM_COMPONENT_META_DATA_EXTRACTOR = WebXmlUtils
+        .getInitParameter("CUSTOM_COMPONENT_META_DATA_EXTRACTOR");
+
+    static final String CUSTOM_VALIDATION_PARAMETER_EXTRACTOR = WebXmlUtils
+        .getInitParameter("CUSTOM_VALIDATION_PARAMETER_EXTRACTOR");
+
+    static final String CUSTOM_STATIC_VALIDATION_STRATEGY_MAPPING = WebXmlUtils
+        .getInitParameter("CUSTOM_STATIC_VALIDATION_STRATEGY_MAPPING");
+
+    static final String CUSTOM_COMPONENT_INITIALIZER = WebXmlUtils
+        .getInitParameter("CUSTOM_COMPONENT_INITIALIZER");
+
+    static final String CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR = WebXmlUtils
+        .getInitParameter("CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR");
+
+    static final String CUSTOM_PROPERTY_VALIDATION_INTERCEPTOR = WebXmlUtils
+        .getInitParameter("CUSTOM_PROPERTY_VALIDATION_INTERCEPTOR");
+
+    static final String CUSTOM_META_DATA_EXTRACTION_INTERCEPTOR = WebXmlUtils
+        .getInitParameter("CUSTOM_META_DATA_EXTRACTION_INTERCEPTOR");
+
+    /*
+     * name mapper
+     */
+    static final String CUSTOM_VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_NAME_MAPPER = WebXmlUtils
+        .getInitParameter("CUSTOM_VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_NAME_MAPPER");
+
+    static final String CUSTOM_META_DATA_TO_VALIDATION_STRATEGY_NAME_MAPPER = WebXmlUtils
+        .getInitParameter("CUSTOM_META_DATA_TO_VALIDATION_STRATEGY_NAME_MAPPER");
+
+    static final String CUSTOM_VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER = WebXmlUtils
+        .getInitParameter("CUSTOM_VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER");
+
+    /*
+     * filter
+     */
+    static final String CUSTOM_META_DATA_STORAGE_FILTER = WebXmlUtils
+        .getInitParameter("CUSTOM_META_DATA_STORAGE_FILTER");
+    
+    /*
+     * factories
+     */
+    static final String CUSTOM_VALIDATION_STRATEGY_FACTORY = WebXmlUtils
+        .getInitParameter("CUSTOM_VALIDATION_STRATEGY_FACTORY");
+
+    static final String CUSTOM_MESSAGE_RESOLVER_FACTORY = WebXmlUtils
+        .getInitParameter("CUSTOM_MESSAGE_RESOLVER_FACTORY");
+
+    static final String CUSTOM_COMPONENT_META_DATA_EXTRACTOR_FACTORY = WebXmlUtils
+        .getInitParameter("CUSTOM_COMPONENT_META_DATA_EXTRACTOR_FACTORY");
+
+    static final String CUSTOM_VALIDATION_PARAMETER_EXTRACTOR_FACTORY = WebXmlUtils
+        .getInitParameter("CUSTOM_VALIDATION_PARAMETER_EXTRACTOR_FACTORY");
+
+    static final String CUSTOM_META_DATA_TRANSFORMER_FACTORY = WebXmlUtils
+        .getInitParameter("CUSTOM_META_DATA_TRANSFORMER_FACTORY");
+
+    static final String CUSTOM_STORAGE_MANAGER_FACTORY = WebXmlUtils
+        .getInitParameter("CUSTOM_STORAGE_MANAGER_FACTORY");
+
+    static final String CUSTOM_FACES_MESSAGE_FACTORY = WebXmlUtils
+        .getInitParameter("CUSTOM_FACES_MESSAGE_FACTORY");
+
+    /*
+     * deactivate
+     */
+    @Deprecated
+    static final String DEACTIVATE_RENDERKIT = WebXmlUtils
+        .getInitParameter("DEACTIVATE_RENDERKIT");
+
+    //currently just used by AbstractValidationErrorMessageResolver
+    static final String DEACTIVATE_DEFAULT_CONVENTION = WebXmlUtils
+        .getInitParameter("DEACTIVATE_DEFAULT_CONVENTION");
+
+    static final String DEACTIVATE_DEFAULT_NAME_MAPPERS = WebXmlUtils
+        .getInitParameter("DEACTIVATE_DEFAULT_NAME_MAPPERS");
+    
+    static final String DEACTIVATE_EL_RESOLVER = WebXmlUtils
+        .getInitParameter("DEACTIVATE_EL_RESOLVER");
+
+    static final String DEACTIVATE_COMPONENT_INITIALIZATION = WebXmlUtils
+        .getInitParameter("DEACTIVATE_COMPONENT_INITIALIZATION");
+
+    //there is nothing like DEACTIVATE_DEFAULT_VALIDATION_INTERCEPTOR
+    //use ExtValContext.getContext().denyRendererInterceptor(...) within an extval-StartupListener
+
+    /*
+     * spec parameters
+     */
+    static final String INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL = WebXmlUtils
+        .getInitParameter("javax.faces", "INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL");
+
+    static final String VALIDATE_EMPTY_FIELDS = WebXmlUtils
+        .getInitParameter("javax.faces", "VALIDATE_EMPTY_FIELDS");
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/AbstractELHelperFactory.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/el/AbstractELHelperFactory.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/AbstractELHelperFactory.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/AbstractELHelperFactory.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.el;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * details
+ * @see DefaultELHelper
+ * 
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public abstract class AbstractELHelperFactory
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+    protected AbstractELHelperFactory customELHelperFactory;
+
+    protected AbstractELHelperFactory()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+
+    public void setCustomELHelperFactory(AbstractELHelperFactory elHelperFactory)
+    {
+        this.customELHelperFactory = elHelperFactory;
+    }
+
+    public final ELHelper create()
+    {
+        ELHelper result = null;
+
+        if(this.customELHelperFactory != null)
+        {
+            result = this.customELHelperFactory.createELHelper();
+        }
+
+        if(result == null)
+        {
+            return createELHelper();
+        }
+
+        return result;
+    }
+
+    protected abstract ELHelper createELHelper();
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelper.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/el/DefaultELHelper.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelper.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,341 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.el;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.el.ValueExpression;
+import javax.el.ELContext;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import java.io.Externalizable;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+/**
+ * in order to centralize the jsf version dependency within the core
+ *
+ * this el-helper supports jsp and facelets (tested with 1.1.14)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+/*
+ * there is a special facelets workaround for el-expressions of custom components
+ * it's pluggable in order to support special mechanisms of different technologies (than jsp and facelets)
+ * so you can plug in your own impl. which implements a custom workaround (like the facelets workaround of this impl.)
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultELHelper implements ELHelper
+{
+    private static final String DEACTIVATE_EL_RESOLVER = WebXmlParameter.DEACTIVATE_EL_RESOLVER;
+
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    public DefaultELHelper()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+
+    public Class getTypeOfExpression(FacesContext facesContext, ValueBindingExpression valueBindingExpression)
+    {
+        //due to a restriction with the ri
+        Object bean = getValueOfExpression(facesContext, valueBindingExpression);
+        return (bean != null) ? bean.getClass() : null;
+    }
+
+    public Object getBean(String beanName)
+    {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        return facesContext.getApplication().getELResolver().getValue(facesContext.getELContext(), null, beanName);
+    }
+
+    public Object getValueOfExpression(FacesContext facesContext,
+                                                   ValueBindingExpression valueBindingExpression)
+    {
+        return (valueBindingExpression != null) ? facesContext.getApplication().evaluateExpressionGet(
+            facesContext, valueBindingExpression.getExpressionString(), Object.class) : null;
+    }
+
+    public boolean isELTermValid(FacesContext facesContext, String valueBindingExpression)
+    {
+        try
+        {
+            facesContext.getApplication().evaluateExpressionGet(facesContext, valueBindingExpression, Object.class);
+        }
+        catch (Throwable t)
+        {
+            return false;
+        }
+        return true;
+    }
+
+    private ValueBindingExpression getValueBindingExpression(UIComponent uiComponent, boolean allowBlankCharacters)
+    {
+        String valueBindingExpression = getOriginalValueBindingExpression(uiComponent);
+
+        //for input components without value-binding
+        //(e.g. for special component libs -> issue with ExtValRendererWrapper#encodeBegin)
+        if(valueBindingExpression == null)
+        {
+            if(this.logger.isTraceEnabled())
+            {
+                this.logger.trace(
+                        uiComponent.getClass() + " has no value binding - component id: " + uiComponent.getId());
+            }
+            return null;
+        }
+
+        if(!allowBlankCharacters)
+        {
+            valueBindingExpression = valueBindingExpression.replace(" ", "");
+        }
+
+        if (getTypeOfExpression(FacesContext.getCurrentInstance(),
+            new ValueBindingExpression(valueBindingExpression).getBaseExpression()) == null)
+        {
+            ValueBindingExpression result = FaceletsTaglibExpressionHelper.
+                tryToCreateValueBindingForFaceletsBinding(uiComponent);
+
+            if(result == null)
+            {
+                if(logger.isWarnEnabled())
+                {
+                    logger.warn("couldn't resolve expression: " + valueBindingExpression);
+                }
+                return null;
+            }
+
+            Class entityClass = ExtValUtils.getELHelper()
+                .getTypeOfExpression(FacesContext.getCurrentInstance(), result.getBaseExpression());
+
+            if(entityClass == null)
+            {
+                if(logger.isWarnEnabled())
+                {
+                    logger.warn("couldn't resolve expression: " + result.getExpressionString());
+                }
+
+                return null;
+            }
+            return result;
+        }
+        return new ValueBindingExpression(valueBindingExpression);
+    }
+
+    @ToDo(value = Priority.HIGH, description = "check if it works with nested composite components")
+    public PropertyDetails getPropertyDetailsOfValueBinding(UIComponent uiComponent)
+    {
+        if("true".equalsIgnoreCase(DEACTIVATE_EL_RESOLVER))
+        {
+            return getPropertyDetailsViaReflectionFallback(uiComponent);
+        }
+
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+
+        ValueExpression valueExpression = uiComponent.getValueExpression("value");
+
+        if(valueExpression == null)
+        {
+            return null;
+        }
+
+        ExtValELResolver elResolver = createWrappedELContext(facesContext);
+        inspectTarget(valueExpression,
+                ExtValELResolver.createContextWrapper(facesContext.getELContext(), elResolver), false);
+
+        ExtValELResolver compositeComponentELResolver = null;
+
+        //re-check to get full key for cross-validation
+        if (elResolver.getCompositeComponentExpression() != null)
+        {
+            ValueExpression compositeExpression = elResolver.getCompositeComponentExpression();
+            
+            compositeComponentELResolver = createWrappedELContext(facesContext);
+            inspectTarget(compositeExpression,
+                    ExtValELResolver.createContextWrapper(
+                            facesContext.getELContext(), compositeComponentELResolver), true);
+        }
+
+        if(elResolver.getPath() == null || elResolver.getBaseObject() == null || elResolver.getProperty() == null)
+        {
+            return null;
+        }
+
+        String key;
+        if(compositeComponentELResolver != null)
+        {
+            key = compositeComponentELResolver.getPath() +
+                    elResolver.getPath().substring(elResolver.getPath().indexOf("."));
+        }
+        else
+        {
+            key = elResolver.getPath();
+        }
+
+        return new PropertyDetails(key, elResolver.getBaseObject(), elResolver.getProperty());
+    }
+
+    private void inspectTarget(ValueExpression valueExpression, ELContext elContext, boolean inspectCompositeComponent)
+    {
+        try
+        {
+            valueExpression.setValue(elContext, null);
+        }
+        catch (Throwable t)
+        {
+            if(inspectCompositeComponent)
+            {
+                throw new IllegalStateException(
+                        "error at binding: " + valueExpression.getExpressionString() +
+                                " -- an el-resolver error occurred! maybe you used an invalid binding.", t);
+            }
+        }
+    }
+
+    private ExtValELResolver createWrappedELContext(FacesContext facesContext)
+    {
+        return new ExtValELResolver(facesContext.getApplication().getELResolver());
+    }
+
+    //keep in sync with DefaultELHelper#getPropertyDetailsOfValueBinding of branch!!!
+    private PropertyDetails getPropertyDetailsViaReflectionFallback(UIComponent uiComponent)
+    {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        ValueBindingExpression valueBindingExpression = getValueBindingExpression(uiComponent, false);
+        ValueBindingExpression currentValueBindingExpression =
+            new ValueBindingExpression(valueBindingExpression.getExpressionString());
+
+        String path = null;
+
+        while(currentValueBindingExpression.getBaseExpression() != null)
+        {
+            if(path == null)
+            {
+                path = getPropertyName(currentValueBindingExpression);
+            }
+            else
+            {
+                path = getPropertyName(currentValueBindingExpression) + "." + path;
+            }
+
+            currentValueBindingExpression = currentValueBindingExpression.getBaseExpression();
+        }
+
+        path = currentValueBindingExpression.getProperty() + "." + path;
+
+        Object baseObject = getValueOfExpression(facesContext, valueBindingExpression.getBaseExpression());
+
+        //in case of e.g.: #{bean[bean.passwordRepeatedPropertyName]}
+        //-> bean.passwordRepeatedPropertyName is not the final property name
+        return new PropertyDetails(path, baseObject, getPropertyName(valueBindingExpression));
+    }
+
+    private String getPropertyName(ValueBindingExpression valueBindingExpression)
+    {
+        String propertyName = valueBindingExpression.getProperty();
+
+        if(propertyName.contains("."))
+        {
+            propertyName = extractPropertyNameOfPropertyPath(propertyName);
+        }
+
+        return propertyName;
+    }
+
+    @ToDo(value = Priority.MEDIUM, description = "support for more dynamic bindings - details see inline")
+    private String extractPropertyNameOfPropertyPath(String propertyChain)
+    {
+        String[] properties = propertyChain.split("\\.");
+
+        Object currentPropertyValue = ExtValUtils.getELHelper().getBean(properties[0]);
+
+        Method currentMethod;
+        String currentPropertyName;
+        for(int i = 1; i < properties.length; i++)
+        {
+            currentPropertyName = properties[i];
+            currentMethod = ReflectionUtils.tryToGetMethod(currentPropertyValue.getClass(),
+                "get" + currentPropertyName.substring(0, 1).toUpperCase() + currentPropertyName.substring(1));
+
+            if(currentMethod == null && currentPropertyValue instanceof Map)
+            {
+                //it's ok for the simple map case - but not for e.g.:
+                //#{bean1[bean2.propertyNameProvider[ bean3.index]]}
+                //or every other complex replacement for bean3.index
+                //it might also require an adjustment at FaceletsTaglibExpressionHelper#tryToTransformToRealBinding
+                ((Map)currentPropertyValue).get(currentPropertyName);
+            }
+            else
+            {
+                currentPropertyValue = ReflectionUtils.tryToInvokeMethod(currentPropertyValue, currentMethod);
+            }
+        }
+
+        if(currentPropertyValue instanceof String)
+        {
+            return (String)currentPropertyValue;
+        }
+        else
+        {
+            if(this.logger.isErrorEnabled())
+            {
+                this.logger.error("unexpected value within map syntax: " + propertyChain +
+                        " last property name: " + currentPropertyValue);
+            }
+            return null;
+        }
+    }
+
+    static String getOriginalValueBindingExpression(UIComponent uiComponent)
+    {
+        ValueExpression valueExpression = uiComponent.getValueExpression("value");
+
+        return (valueExpression != null) ? valueExpression.getExpressionString() : null;
+    }
+
+    public boolean isELTermWellFormed(Object o)
+    {
+        if (o instanceof ValueBinding || o instanceof Externalizable)
+        {
+            return false;
+        }
+
+        String s = o.toString();
+        return ((s.contains("#") || s.contains("$")) && s.contains("{") && s.contains("}"));
+    }
+
+    public Object getBindingOfComponent(UIComponent uiComponent, String name)
+    {
+        return uiComponent.getValueExpression(name);
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelperFactory.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/el/DefaultELHelperFactory.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelperFactory.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/DefaultELHelperFactory.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.core.el;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultELHelperFactory extends AbstractELHelperFactory
+{
+    private ELHelper elHelper = new DefaultELHelper();
+    
+    protected ELHelper createELHelper()
+    {
+        return this.elHelper;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.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/el/ELHelper.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/el/ELHelper.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.el;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * in order to centralize the jsf version dependency within the core
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface ELHelper
+{
+    Object getBean(String beanName);
+
+    Object getValueOfExpression(FacesContext facesContext, ValueBindingExpression valueBindingExpression);
+
+    Class getTypeOfExpression(FacesContext facesContext, ValueBindingExpression valueBindingExpression);
+
+    PropertyDetails getPropertyDetailsOfValueBinding(UIComponent uiComponent);
+
+    boolean isELTermValid(FacesContext facesContext, String valueBindingExpression);
+
+    boolean isELTermWellFormed(Object o);
+
+    Object getBindingOfComponent(UIComponent uiComponent, String name);
+}