myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r831765 [1/2] - in /myfaces/extensions/validator/trunk: core/src/main/java/org/apache/myfaces/extensions/validator/core/ core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ core/src/main/java/org/apache/myfaces/exte...
Date Sun, 01 Nov 2009 21:47:33 GMT
Author: gpetracek
Date: Sun Nov  1 21:47:32 2009
New Revision: 831765

URL: http://svn.apache.org/viewvc?rev=831765&view=rev
Log:
EXTVAL-69 and small refactorings

Added:
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ValidationModuleKey.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/interceptor/
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/interceptor/ExtValBeanValidationMetaDataExtractionInterceptor.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationModuleMetaDataExtractionInterceptorTestCase.java
Modified:
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/ComponentMetaDataExtractorFactory.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractorFactory.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptorInternals.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationModuleKey.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/BeanValidation.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/ModelValidation.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/metadata/transformer/mapper/NotNullNameMapper.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/metadata/transformer/mapper/SizeNameMapper.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/startup/BeanValidationStartupListener.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/util/BeanValidationUtils.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleKey.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/extractor/DefaultPropertyScanningMetaDataExtractor.java

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java Sun Nov  1 21:47:32 2009
@@ -36,8 +36,6 @@
 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.internal.ToDo;
-import org.apache.myfaces.extensions.validator.internal.Priority;
 import org.apache.myfaces.extensions.validator.util.ClassUtils;
 import org.apache.myfaces.extensions.validator.util.ExtValUtils;
 
@@ -260,8 +258,9 @@
         this.invocationOrderAwareContextHelper.addPropertyValidationInterceptor(propertyValidationInterceptor);
     }
 
-    @Deprecated
-    @ToDo(value = Priority.HIGH, description = "not used")
+    /**
+     * @return all global validation interceptors
+     */
     public List<PropertyValidationInterceptor> getPropertyValidationInterceptors()
     {
         this.invocationOrderAwareContextHelper.lazyInitPropertyValidationInterceptors();
@@ -283,12 +282,32 @@
         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
      */

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContextInvocationOrderAwareInternals.java Sun Nov  1 21:47:32 2009
@@ -44,6 +44,7 @@
     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;
@@ -92,16 +93,14 @@
     {
         if (propertyValidationInterceptor instanceof ValidationModuleAware)
         {
-            addPropertyValidationInterceptorForModules(propertyValidationInterceptor,
-                    this.propertyValidationInterceptors, this.moduleSpecificPropertyValidationInterceptors);
+            addPropertyValidationInterceptorForModules(propertyValidationInterceptor);
+            sortModuleSpecificPropertyValidationInterceptors();
         }
         else
         {
-            addPropertyValidationInterceptorForModule(null, propertyValidationInterceptor,
-                    this.propertyValidationInterceptors, this.moduleSpecificPropertyValidationInterceptors);
+            addPropertyValidationInterceptorForModule(null, propertyValidationInterceptor);
+            sortPropertyValidationInterceptors();
         }
-
-        sortPropertyValidationInterceptors();
     }
 
     List<PropertyValidationInterceptor> getPropertyValidationInterceptors()
@@ -111,28 +110,18 @@
 
     List<PropertyValidationInterceptor> getPropertyValidationInterceptorsFor(Class moduleKey)
     {
-        List<PropertyValidationInterceptor> generalInterceptors = getPropertyValidationInterceptors();
+        List<PropertyValidationInterceptor> result = new ArrayList<PropertyValidationInterceptor>();
+
+        result.addAll(getPropertyValidationInterceptors());
 
-        if (moduleKey == null || !this.moduleSpecificPropertyValidationInterceptors.containsKey(moduleKey))
+        if (moduleKey != null && this.moduleSpecificPropertyValidationInterceptors.containsKey(moduleKey))
         {
-            return generalInterceptors;
+            result.addAll(this.moduleSpecificPropertyValidationInterceptors.get(moduleKey));
         }
-
-        List<PropertyValidationInterceptor> moduleSpecificInterceptors =
-                this.moduleSpecificPropertyValidationInterceptors.get(moduleKey);
-
-        List<PropertyValidationInterceptor> result = new ArrayList<PropertyValidationInterceptor>();
-        result.addAll(generalInterceptors);
-        result.addAll(moduleSpecificInterceptors);
-
-        sortPropertyValidationInterceptors(result);
-        return result;
+        return sortPropertyValidationInterceptorList(result);
     }
 
-    private void addPropertyValidationInterceptorForModules(PropertyValidationInterceptor propertyValidationInterceptor,
-                                                    List<PropertyValidationInterceptor> propertyValidationInterceptors,
-                                                    Map<Class, List<PropertyValidationInterceptor>>
-                                                            moduleSpecificPropertyValidationInterceptors)
+    private void addPropertyValidationInterceptorForModules(PropertyValidationInterceptor propertyValidationInterceptor)
     {
         Class moduleKey;
         for (String currentModuleKey : ((ValidationModuleAware) propertyValidationInterceptor).getModuleKeys())
@@ -144,44 +133,36 @@
                 continue;
             }
 
-            addPropertyValidationInterceptorForModule(moduleKey,
-                    propertyValidationInterceptor,
-                    propertyValidationInterceptors,
-                    moduleSpecificPropertyValidationInterceptors);
+            addPropertyValidationInterceptorForModule(moduleKey, propertyValidationInterceptor);
         }
     }
 
-    private void addPropertyValidationInterceptorForModule(Class moduleKey,
-                                                   PropertyValidationInterceptor propertyValidationInterceptor,
-                                                   List<PropertyValidationInterceptor> propertyValidationInterceptors,
-                                                   Map<Class, List<PropertyValidationInterceptor>>
-                                                           moduleSpecificPropertyValidationInterceptors)
+    private void addPropertyValidationInterceptorForModule(
+            Class moduleKey, PropertyValidationInterceptor propertyValidationInterceptor)
     {
         if (moduleKey == null)
         {
-            propertyValidationInterceptors.add(propertyValidationInterceptor);
+            this.propertyValidationInterceptors.add(propertyValidationInterceptor);
 
             if (logger.isTraceEnabled())
             {
-                logger.trace(propertyValidationInterceptor.getClass().getName() + " added");
+                logger.trace(propertyValidationInterceptor.getClass().getName() + " added as global interceptor");
             }
         }
         else
         {
             List<PropertyValidationInterceptor> propertyValidationInterceptorList;
-            if (moduleSpecificPropertyValidationInterceptors.containsKey(moduleKey))
+            if (this.moduleSpecificPropertyValidationInterceptors.containsKey(moduleKey))
             {
-                propertyValidationInterceptorList = moduleSpecificPropertyValidationInterceptors.get(moduleKey);
+                propertyValidationInterceptorList = this.moduleSpecificPropertyValidationInterceptors.get(moduleKey);
             }
             else
             {
                 propertyValidationInterceptorList = new ArrayList<PropertyValidationInterceptor>();
-                moduleSpecificPropertyValidationInterceptors.put(moduleKey, propertyValidationInterceptorList);
+                this.moduleSpecificPropertyValidationInterceptors.put(moduleKey, propertyValidationInterceptorList);
             }
             propertyValidationInterceptorList.add(propertyValidationInterceptor);
 
-            sortModuleSpecificPropertyValidationInterceptors(propertyValidationInterceptorList);
-
             if (logger.isTraceEnabled())
             {
                 logger.trace(propertyValidationInterceptor.getClass().getName() + " added for " + moduleKey.getName());
@@ -194,8 +175,65 @@
      */
     void addMetaDataExtractionInterceptor(MetaDataExtractionInterceptor metaDataExtractionInterceptor)
     {
-        this.metaDataExtractionInterceptors.add(metaDataExtractionInterceptor);
-        sortMetaDataExtractionInterceptors();
+        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()
@@ -203,6 +241,35 @@
         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
      */
@@ -250,6 +317,7 @@
         }
 
         metaDataExtractionInterceptors = new ArrayList<MetaDataExtractionInterceptor>();
+        moduleSpecificMetaDataExtractionInterceptors = new HashMap<Class, List<MetaDataExtractionInterceptor>>();
 
         List<String> metaDataExtractionInterceptorClassNames = new ArrayList<String>();
 
@@ -268,12 +336,7 @@
 
             if (metaDataExtractionInterceptor != null)
             {
-                metaDataExtractionInterceptors.add(metaDataExtractionInterceptor);
-
-                if (logger.isTraceEnabled())
-                {
-                    logger.trace(metaDataExtractionInterceptor.getClass().getName() + " added");
-                }
+                addMetaDataExtractionInterceptor(metaDataExtractionInterceptor);
             }
         }
     }
@@ -339,15 +402,11 @@
             {
                 if (propertyValidationInterceptor instanceof ValidationModuleAware)
                 {
-                    addPropertyValidationInterceptorForModules(propertyValidationInterceptor,
-                            propertyValidationInterceptors,
-                            moduleSpecificPropertyValidationInterceptors);
+                    addPropertyValidationInterceptorForModules(propertyValidationInterceptor);
                 }
                 else
                 {
-                    addPropertyValidationInterceptorForModule(null, propertyValidationInterceptor,
-                            propertyValidationInterceptors,
-                            moduleSpecificPropertyValidationInterceptors);
+                    addPropertyValidationInterceptorForModule(null, propertyValidationInterceptor);
                 }
             }
         }
@@ -361,35 +420,59 @@
         Collections.sort(this.componentInitializers, new InvocationOrderComparator<ComponentInitializer>());
     }
 
-    private void sortPropertyValidationInterceptors(List<PropertyValidationInterceptor> result)
-    {
-        Collections.sort(result, new InvocationOrderComparator<PropertyValidationInterceptor>());
-    }
-
     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 sortModuleSpecificPropertyValidationInterceptors(
-            List<PropertyValidationInterceptor> propertyValidationInterceptorList)
+    private void sortMetaDataExtractionInterceptors()
     {
-        if (propertyValidationInterceptorList != null)
+        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())
         {
-            Collections.sort(propertyValidationInterceptorList, new InvocationOrderComparator<Object>());
+            sortMetaDataExtractionInterceptorList(metaDataExtractionInterceptorList);
         }
     }
 
-    private void sortMetaDataExtractionInterceptors()
+    private List<MetaDataExtractionInterceptor> sortMetaDataExtractionInterceptorList(
+            List<MetaDataExtractionInterceptor> metaDataExtractionInterceptorList)
     {
-        Collections.sort(this.metaDataExtractionInterceptors,
-                new InvocationOrderComparator<MetaDataExtractionInterceptor>());
+        Collections.sort(metaDataExtractionInterceptorList,
+                    new InvocationOrderComparator<MetaDataExtractionInterceptor>());
+
+        return metaDataExtractionInterceptorList;
     }
 }
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ValidationModuleKey.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ValidationModuleKey.java?rev=831765&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ValidationModuleKey.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ValidationModuleKey.java Sun Nov  1 21:47:32 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

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java Sun Nov  1 21:47:32 2009
@@ -65,7 +65,8 @@
             logger.trace("start to init component " + uiComponent.getClass().getName());
         }
 
-        Map<String, Object> metaDataResult = ExtValUtils.getTransformedMetaData(facesContext, uiComponent);
+        Map<String, Object> metaDataResult = ExtValUtils
+                .getTransformedMetaDataFor(facesContext, uiComponent, getModuleKey());
 
         //get component initializer for the current component and configure it
         //also in case of skipped validation to reset e.g. the required attribute
@@ -82,7 +83,7 @@
 
     protected void processValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject)
     {
-        MetaDataExtractor metaDataExtractor = ExtValUtils.getComponentMetaDataExtractor();
+        MetaDataExtractor metaDataExtractor = ExtValUtils.getComponentMetaDataExtractorFor(getModuleKey());
 
         PropertyInformation propertyInformation = metaDataExtractor.extract(facesContext, uiComponent);
 

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/ComponentMetaDataExtractorFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/ComponentMetaDataExtractorFactory.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/ComponentMetaDataExtractorFactory.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/ComponentMetaDataExtractorFactory.java Sun Nov  1 21:47:32 2009
@@ -21,6 +21,8 @@
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 
+import java.util.Map;
+
 /**
  * The interface for all factories which create meta-data extractors
  * 
@@ -31,4 +33,6 @@
 public interface ComponentMetaDataExtractorFactory
 {
     MetaDataExtractor create();
+
+    MetaDataExtractor createWith(Map<String, Object> properties);
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractorFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractorFactory.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractorFactory.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractorFactory.java Sun Nov  1 21:47:32 2009
@@ -32,6 +32,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * This factory creates a meta-data extractor which extracts the meta-data
@@ -65,6 +66,11 @@
     @ToDo(value = Priority.MEDIUM, description = "logging")
     public MetaDataExtractor create()
     {
+        return createWith(null);
+    }
+
+    public MetaDataExtractor createWith(Map<String, Object> properties)
+    {
         if (metaDataExtractor == null)
         {
             List<String> metaDataExtractorClassNames = new ArrayList<String>();
@@ -91,6 +97,6 @@
             logger.trace(metaDataExtractor.getClass().getName() + " created");
         }
 
-        return ExtValUtils.createInterceptedMetaDataExtractor(metaDataExtractor);
+        return ExtValUtils.createInterceptedMetaDataExtractorWith(metaDataExtractor, properties);
     }
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java Sun Nov  1 21:47:32 2009
@@ -31,4 +31,5 @@
     static final String PROPERTY_DETAILS = "property_details";
     static final String SKIP_VALIDATION = "skip_validation";
     static final String LABEL = "label";
+    static final String CUSTOM_PROPERTIES = "custom_properties";
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java Sun Nov  1 21:47:32 2009
@@ -19,6 +19,8 @@
 package org.apache.myfaces.extensions.validator.core.storage;
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
 import static org.apache.myfaces.extensions.validator.internal.UsageCategory.INTERNAL;
 import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
 import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
@@ -185,6 +187,7 @@
         return targetClass.getName() + "#" + targetProperty;
     }
 
+    @ToDo(Priority.MEDIUM)
     private void copyMetaData(PropertyInformation source, PropertyInformation target)
     {
         MetaDataEntry newMetaDataEntry;

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java Sun Nov  1 21:47:32 2009
@@ -18,49 +18,50 @@
  */
 package org.apache.myfaces.extensions.validator.util;
 
-import org.apache.myfaces.extensions.validator.internal.UsageInformation;
-import org.apache.myfaces.extensions.validator.internal.UsageCategory;
-import org.apache.myfaces.extensions.validator.internal.ToDo;
-import org.apache.myfaces.extensions.validator.internal.Priority;
-import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
-import org.apache.myfaces.extensions.validator.core.validation.message.resolver.MessageResolver;
-import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameterExtractor;
-import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameterExtractorFactory;
-import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverityInterpreter;
-import org.apache.myfaces.extensions.validator.core.factory.ClassMappingFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.extensions.validator.core.ExtValContext;
 import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
-import org.apache.myfaces.extensions.validator.core.storage.StorageManager;
-import org.apache.myfaces.extensions.validator.core.storage.FacesMessageStorage;
-import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
-import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
-import org.apache.myfaces.extensions.validator.core.interceptor.MetaDataExtractionInterceptor;
-import org.apache.myfaces.extensions.validator.core.interceptor.PropertyValidationInterceptor;
-import org.apache.myfaces.extensions.validator.core.validation.SkipValidationEvaluator;
-import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
-import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
-import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
-import org.apache.myfaces.extensions.validator.core.el.ELHelper;
+import org.apache.myfaces.extensions.validator.core.ValidationModuleKey;
 import org.apache.myfaces.extensions.validator.core.el.AbstractELHelperFactory;
+import org.apache.myfaces.extensions.validator.core.el.ELHelper;
 import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
-import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
-import org.apache.myfaces.extensions.validator.core.metadata.extractor.ComponentMetaDataExtractorFactory;
+import org.apache.myfaces.extensions.validator.core.factory.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.factory.FacesMessageFactory;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.factory.NameMapperAwareFactory;
 import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
-import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
 import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfiguration;
 import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationEntry;
-import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.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.ValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
 import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
-import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
-import org.apache.myfaces.extensions.validator.core.factory.NameMapperAwareFactory;
-import org.apache.myfaces.extensions.validator.core.factory.FacesMessageFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.ComponentMetaDataExtractorFactory;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.storage.FacesMessageStorage;
+import org.apache.myfaces.extensions.validator.core.storage.StorageManager;
+import org.apache.myfaces.extensions.validator.core.validation.SkipValidationEvaluator;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.MessageResolver;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameterExtractor;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameterExtractorFactory;
+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.Priority;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 
+import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.validator.ValidatorException;
-import javax.faces.application.FacesMessage;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.MissingResourceException;
@@ -122,9 +123,9 @@
     public static MetaDataTransformer getMetaDataTransformerForValidationStrategy(ValidationStrategy validationStrategy)
     {
         return ((ClassMappingFactory<ValidationStrategy, MetaDataTransformer>) ExtValContext
-                    .getContext().getFactoryFinder()
-                    .getFactory(FactoryNames.META_DATA_TRANSFORMER_FACTORY, ClassMappingFactory.class))
-                    .create(validationStrategy);
+                .getContext().getFactoryFinder()
+                .getFactory(FactoryNames.META_DATA_TRANSFORMER_FACTORY, ClassMappingFactory.class))
+                .create(validationStrategy);
     }
 
     public static void registerValidationStrategyToMetaDataTransformerNameMapper(
@@ -156,39 +157,57 @@
 
     public static MetaDataExtractor getComponentMetaDataExtractor()
     {
-            return ExtValContext.getContext().getFactoryFinder()
+        return ExtValContext.getContext().getFactoryFinder()
                 .getFactory(FactoryNames.COMPONENT_META_DATA_EXTRACTOR_FACTORY, ComponentMetaDataExtractorFactory.class)
                 .create();
     }
 
+    public static MetaDataExtractor getComponentMetaDataExtractorFor(Class moduleKey)
+    {
+        Map<String, Object> properties = new HashMap<String, Object>();
+
+        if(moduleKey != null)
+        {
+            properties.put(ValidationModuleKey.class.getName(), moduleKey);
+        }
+        return getComponentMetaDataExtractorWith(properties);
+    }
+
+    public static MetaDataExtractor getComponentMetaDataExtractorWith(Map<String, Object> properties)
+    {
+        return ExtValContext.getContext().getFactoryFinder()
+                .getFactory(FactoryNames.COMPONENT_META_DATA_EXTRACTOR_FACTORY, ComponentMetaDataExtractorFactory.class)
+                .createWith(properties);
+    }
+
     public static void configureComponentWithMetaData(FacesContext facesContext,
                                                       UIComponent uiComponent,
                                                       Map<String, Object> metaData)
     {
-        for(ComponentInitializer componentInitializer : ExtValContext.getContext().getComponentInitializers())
+        for (ComponentInitializer componentInitializer : ExtValContext.getContext().getComponentInitializers())
         {
             componentInitializer.configureComponent(facesContext, uiComponent, metaData);
         }
     }
 
     public static boolean executeAfterThrowingInterceptors(UIComponent uiComponent,
-                                                        MetaDataEntry metaDataEntry,
-                                                        Object convertedObject,
-                                                        ValidatorException validatorException,
-                                                        ValidationStrategy validatorExceptionSource)
+                                                           MetaDataEntry metaDataEntry,
+                                                           Object convertedObject,
+                                                           ValidatorException validatorException,
+                                                           ValidationStrategy validatorExceptionSource)
     {
         boolean result = true;
 
-        if(metaDataEntry == null)
+        if (metaDataEntry == null)
         {
             metaDataEntry = new MetaDataEntry();
         }
-        
-        for(ValidationExceptionInterceptor validationExceptionInterceptor : ExtValContext.getContext()
+
+        for (ValidationExceptionInterceptor validationExceptionInterceptor : ExtValContext.getContext()
                 .getValidationExceptionInterceptors())
         {
-            if(!validationExceptionInterceptor.afterThrowing(
-                            uiComponent, metaDataEntry, convertedObject, validatorException, validatorExceptionSource))
+            if (!validationExceptionInterceptor.afterThrowing(
+                    uiComponent, metaDataEntry, convertedObject, validatorException, validatorExceptionSource))
             {
                 result = false;
             }
@@ -199,27 +218,73 @@
 
     public static MetaDataExtractor createInterceptedMetaDataExtractor(final MetaDataExtractor metaDataExtractor)
     {
+        return createInterceptedMetaDataExtractorWith(metaDataExtractor, null);
+    }
+
+    public static MetaDataExtractor createInterceptedMetaDataExtractorFor(
+            final MetaDataExtractor metaDataExtractor, Class moduleKey)
+    {
+        Map<String, Object> properties = new HashMap<String, Object>();
+
+        if(moduleKey != null)
+        {
+            properties.put(ValidationModuleKey.class.getName(), moduleKey);
+        }
+        return createInterceptedMetaDataExtractorWith(metaDataExtractor, properties);
+    }
+
+    public static MetaDataExtractor createInterceptedMetaDataExtractorWith(
+            final MetaDataExtractor metaDataExtractor, final Map<String, Object> properties)
+    {
         return new MetaDataExtractor()
         {
             public PropertyInformation extract(FacesContext facesContext, Object object)
             {
                 PropertyInformation result = metaDataExtractor.extract(facesContext, object);
-                for(MetaDataExtractionInterceptor metaDataExtractionInterceptor :
-                        ExtValContext.getContext().getMetaDataExtractionInterceptors())
-                {
-                    metaDataExtractionInterceptor.afterExtracting(result);
-                }
+
+                addProperties(result, properties);
+                invokeMetaDataExtractionInterceptors(result, properties);
+
                 return result;
             }
         };
     }
 
+    private static void addProperties(PropertyInformation result, Map<String, Object> properties)
+    {
+        if(properties != null)
+        {
+            Map<String, Object> customProperties = getCustomProperties(result);
+            customProperties.putAll(properties);
+        }
+    }
+
+    private static Map<String, Object> getCustomProperties(PropertyInformation propertyInformation)
+    {
+        if(!propertyInformation.containsInformation(PropertyInformationKeys.CUSTOM_PROPERTIES))
+        {
+            propertyInformation.setInformation(
+                    PropertyInformationKeys.CUSTOM_PROPERTIES, new HashMap<String, Object>());
+        }
+
+        return (Map<String, Object>) propertyInformation.getInformation(PropertyInformationKeys.CUSTOM_PROPERTIES);
+    }
+
+    private static void invokeMetaDataExtractionInterceptors(PropertyInformation result, Map<String, Object> properties)
+    {
+        for (MetaDataExtractionInterceptor metaDataExtractionInterceptor :
+                ExtValContext.getContext().getMetaDataExtractionInterceptorsWith(properties))
+        {
+            metaDataExtractionInterceptor.afterExtracting(result);
+        }
+    }
+
     public static MessageResolver getMessageResolverForValidationStrategy(ValidationStrategy validationStrategy)
     {
-        return ((ClassMappingFactory<ValidationStrategy, MessageResolver>)ExtValContext.getContext()
-            .getFactoryFinder()
-            .getFactory(FactoryNames.MESSAGE_RESOLVER_FACTORY, ClassMappingFactory.class))
-            .create(validationStrategy);
+        return ((ClassMappingFactory<ValidationStrategy, MessageResolver>) ExtValContext.getContext()
+                .getFactoryFinder()
+                .getFactory(FactoryNames.MESSAGE_RESOLVER_FACTORY, ClassMappingFactory.class))
+                .create(validationStrategy);
     }
 
     public static void registerValidationStrategyToMessageResolverNameMapper(
@@ -252,7 +317,7 @@
     public static ELHelper getELHelper()
     {
         return ExtValContext.getContext().getFactoryFinder()
-            .getFactory(FactoryNames.EL_HELPER_FACTORY, AbstractELHelperFactory.class).create();
+                .getFactory(FactoryNames.EL_HELPER_FACTORY, AbstractELHelperFactory.class).create();
     }
 
     public static FacesMessage createFacesMessage(String summary, String detail)
@@ -263,52 +328,52 @@
     public static FacesMessage createFacesMessage(FacesMessage.Severity severity, String summary, String detail)
     {
         return ExtValContext.getContext().getFactoryFinder()
-            .getFactory(FactoryNames.FACES_MESSAGE_FACTORY, FacesMessageFactory.class)
+                .getFactory(FactoryNames.FACES_MESSAGE_FACTORY, FacesMessageFactory.class)
                 .create(severity, summary, detail);
     }
 
     public static FacesMessage convertFacesMessage(FacesMessage facesMessage)
     {
         return ExtValContext.getContext().getFactoryFinder()
-            .getFactory(FactoryNames.FACES_MESSAGE_FACTORY, FacesMessageFactory.class)
+                .getFactory(FactoryNames.FACES_MESSAGE_FACTORY, FacesMessageFactory.class)
                 .convert(facesMessage);
     }
 
     public static PropertyDetails createPropertyDetailsForNewTarget(MetaDataEntry metaDataEntry,
-                                                                                  String targetExpression)
+                                                                    String targetExpression)
     {
         Object baseObject;
-        if(getELHelper().isELTermWellFormed(targetExpression))
+        if (getELHelper().isELTermWellFormed(targetExpression))
         {
             ValueBindingExpression vbe = new ValueBindingExpression(targetExpression);
 
             String expression = vbe.getExpressionString();
             baseObject = getELHelper().getValueOfExpression(FacesContext.getCurrentInstance(), vbe.getBaseExpression());
             return new PropertyDetails(
-                expression.substring(2, expression.length() - 1), baseObject, vbe.getProperty());
+                    expression.substring(2, expression.length() - 1), baseObject, vbe.getProperty());
         }
 
         PropertyDetails original = metaDataEntry.getProperty(
-            PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);
+                PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);
 
         String newBaseKey = original.getKey().substring(0, original.getKey().lastIndexOf(".") + 1);
         String newKey = newBaseKey + targetExpression;
 
         baseObject = ReflectionUtils.getBaseOfPropertyChain(original.getBaseObject(), targetExpression);
         return new PropertyDetails(
-            newKey, baseObject, targetExpression.substring(targetExpression.lastIndexOf(".") + 1,
-            targetExpression.length()));
+                newKey, baseObject, targetExpression.substring(targetExpression.lastIndexOf(".") + 1,
+                        targetExpression.length()));
     }
 
     @UsageInformation(UsageCategory.INTERNAL)
     public static void tryToPlaceLabel(FacesMessage facesMessage, String label, int index)
     {
-        if(facesMessage.getSummary() != null && facesMessage.getSummary().contains("{" + index + "}"))
+        if (facesMessage.getSummary() != null && facesMessage.getSummary().contains("{" + index + "}"))
         {
             facesMessage.setSummary(facesMessage.getSummary().replace("{" + index + "}", label));
         }
 
-        if(facesMessage.getDetail() != null && facesMessage.getDetail().contains("{" + index + "}"))
+        if (facesMessage.getDetail() != null && facesMessage.getDetail().contains("{" + index + "}"))
         {
             facesMessage.setDetail(facesMessage.getDetail().replace("{" + index + "}", label));
         }
@@ -323,7 +388,7 @@
         //use try/catch for easier sync between trunk/branch
         try
         {
-            if(JsfUtils.getDefaultFacesMessageBundle().getString(JAVAX_FACES_MAXIMUM_DETAIL) != null)
+            if (JsfUtils.getDefaultFacesMessageBundle().getString(JAVAX_FACES_MAXIMUM_DETAIL) != null)
             {
                 facesRequiredMessageDetail = JsfUtils
                         .getDefaultFacesMessageBundle().getString(JAVAX_FACES_MAXIMUM_DETAIL);
@@ -350,7 +415,7 @@
         //use try/catch for easier sync between trunk/branch
         try
         {
-            if(JsfUtils.getDefaultFacesMessageBundle().getString(JAVAX_FACES_REQUIRED_DETAIL) != null)
+            if (JsfUtils.getDefaultFacesMessageBundle().getString(JAVAX_FACES_REQUIRED_DETAIL) != null)
             {
                 facesRequiredMessageDetail = JsfUtils
                         .getDefaultFacesMessageBundle().getString(JAVAX_FACES_REQUIRED_DETAIL);
@@ -367,9 +432,9 @@
 
     public static boolean isSkipableValidationStrategy(Class<? extends ValidationStrategy> targetClass)
     {
-        for(Class currentClass : getSkipValidationSupportClassList())
+        for (Class currentClass : getSkipValidationSupportClassList())
         {
-            if(isSkipValidationSupported(currentClass, targetClass))
+            if (isSkipValidationSupported(currentClass, targetClass))
             {
                 return true;
             }
@@ -393,19 +458,19 @@
         List<Class> markerList = new ArrayList<Class>();
 
         Class currentClass;
-        for(StaticConfiguration<String, String> currentEntry : staticConfigurationList)
+        for (StaticConfiguration<String, String> currentEntry : staticConfigurationList)
         {
-            for(StaticConfigurationEntry<String, String> currentConfigurationEntry : currentEntry.getMapping())
+            for (StaticConfigurationEntry<String, String> currentConfigurationEntry : currentEntry.getMapping())
             {
                 currentClass = ClassUtils.tryToLoadClassForName(currentConfigurationEntry.getTarget());
 
-                if(currentClass != null)
+                if (currentClass != null)
                 {
                     markerList.add(currentClass);
                 }
                 else
                 {
-                    if(LOGGER.isWarnEnabled())
+                    if (LOGGER.isWarnEnabled())
                     {
                         LOGGER.warn("configuration entry provides an invalid entry: "
                                 + currentConfigurationEntry.getTarget());
@@ -420,16 +485,16 @@
     @SuppressWarnings({"unchecked"})
     public static boolean isSkipValidationSupported(Class currentClass, Class targetClass)
     {
-        if(currentClass.isAnnotation())
+        if (currentClass.isAnnotation())
         {
-            if(targetClass.isAnnotationPresent(currentClass))
+            if (targetClass.isAnnotationPresent(currentClass))
             {
                 return true;
             }
         }
         else
         {
-            if(currentClass.isAssignableFrom(targetClass))
+            if (currentClass.isAssignableFrom(targetClass))
             {
                 return true;
             }
@@ -440,9 +505,9 @@
 
     public static ValidationParameterExtractor getValidationParameterExtractor()
     {
-        return ExtValContext.getContext().getFactoryFinder()
-            .getFactory(FactoryNames.VALIDATION_PARAMETER_EXTRACTOR_FACTORY, ValidationParameterExtractorFactory.class)
-            .create();
+        return ExtValContext.getContext().getFactoryFinder().getFactory(
+                FactoryNames.VALIDATION_PARAMETER_EXTRACTOR_FACTORY, ValidationParameterExtractorFactory.class)
+                .create();
     }
 
     public static boolean executeLocalBeforeValidationInterceptors(FacesContext facesContext,
@@ -457,15 +522,16 @@
                 annotation, PropertyValidationInterceptor.class, PropertyValidationInterceptor.class);
         boolean result = true;
 
-        if(properties != null)
+        if (properties != null)
         {
             propertyMap.put(propertyKey, properties);
         }
         propertyMap.put(Annotation.class.getName(), annotation);
 
-        for(PropertyValidationInterceptor propertyValidationInterceptor : propertyValidationInterceptors)
+        for (PropertyValidationInterceptor propertyValidationInterceptor : propertyValidationInterceptors)
         {
-            if(!propertyValidationInterceptor.beforeValidation(facesContext, uiComponent, convertedObject, propertyMap))
+            if (!propertyValidationInterceptor
+                    .beforeValidation(facesContext, uiComponent, convertedObject, propertyMap))
             {
                 result = false;
             }
@@ -485,13 +551,13 @@
         List<PropertyValidationInterceptor> propertyValidationInterceptors = getValidationParameterExtractor().extract(
                 annotation, PropertyValidationInterceptor.class, PropertyValidationInterceptor.class);
 
-        if(properties != null)
+        if (properties != null)
         {
             propertyMap.put(propertyKey, properties);
             propertyMap.put(Annotation.class.getName(), annotation);
         }
 
-        for(PropertyValidationInterceptor propertyValidationInterceptor : propertyValidationInterceptors)
+        for (PropertyValidationInterceptor propertyValidationInterceptor : propertyValidationInterceptors)
         {
             propertyValidationInterceptor.afterValidation(facesContext, uiComponent, convertedObject, propertyMap);
         }
@@ -508,7 +574,7 @@
         Map<String, Object> propertyMap = new HashMap<String, Object>();
         boolean result = true;
 
-        if(properties != null)
+        if (properties != null)
         {
             propertyMap.put(propertyKey, properties);
         }
@@ -516,9 +582,10 @@
         List<PropertyValidationInterceptor> propertyValidationInterceptors =
                 ExtValContext.getContext().getPropertyValidationInterceptorsFor(moduleKey);
 
-        for(PropertyValidationInterceptor propertyValidationInterceptor : propertyValidationInterceptors)
+        for (PropertyValidationInterceptor propertyValidationInterceptor : propertyValidationInterceptors)
         {
-            if(!propertyValidationInterceptor.beforeValidation(facesContext, uiComponent, convertedObject, propertyMap))
+            if (!propertyValidationInterceptor
+                    .beforeValidation(facesContext, uiComponent, convertedObject, propertyMap))
             {
                 result = false;
             }
@@ -537,7 +604,7 @@
     {
         Map<String, Object> propertyMap = new HashMap<String, Object>();
 
-        if(properties != null)
+        if (properties != null)
         {
             propertyMap.put(propertyKey, properties);
         }
@@ -545,7 +612,7 @@
         List<PropertyValidationInterceptor> propertyValidationInterceptors =
                 ExtValContext.getContext().getPropertyValidationInterceptorsFor(moduleKey);
 
-        for(PropertyValidationInterceptor propertyValidationInterceptor : propertyValidationInterceptors)
+        for (PropertyValidationInterceptor propertyValidationInterceptor : propertyValidationInterceptors)
         {
             propertyValidationInterceptor.afterValidation(facesContext, uiComponent, convertedObject, propertyMap);
         }
@@ -553,7 +620,7 @@
 
     public static <T> T getStorage(Class<T> storageType, String storageName)
     {
-        return (T)getStorageManagerFactory().create(storageType).create(storageName);
+        return (T) getStorageManagerFactory().create(storageType).create(storageName);
     }
 
     public static void resetStorage(Class storageType, String storageName)
@@ -570,10 +637,29 @@
 
     public static Map<String, Object> getTransformedMetaData(FacesContext facesContext, UIComponent uiComponent)
     {
+        return getTransformedMetaDataFor(facesContext, uiComponent, null);
+    }
+
+    public static Map<String, Object> getTransformedMetaDataFor(
+            FacesContext facesContext, UIComponent uiComponent, Class moduleKey)
+    {
+        Map<String, Object> properties = new HashMap<String, Object>();
+
+        if(moduleKey != null)
+        {
+            properties.put(ValidationModuleKey.class.getName(), moduleKey);
+        }
+
+        return getTransformedMetaDataWith(facesContext, uiComponent, properties);
+    }
+
+    public static Map<String, Object> getTransformedMetaDataWith(
+            FacesContext facesContext, UIComponent uiComponent, Map<String, Object> properties)
+    {
         ValidationStrategy validationStrategy;
 
         SkipValidationEvaluator skipValidationEvaluator = ExtValContext.getContext().getSkipValidationEvaluator();
-        MetaDataExtractor metaDataExtractor = getComponentMetaDataExtractor();
+        MetaDataExtractor metaDataExtractor = getComponentMetaDataExtractorWith(properties);
 
         Map<String, Object> metaData;
         Map<String, Object> metaDataResult = new HashMap<String, Object>();
@@ -588,12 +674,12 @@
                 metaData = transformMetaData(
                         facesContext, uiComponent, validationStrategy, skipValidationEvaluator, metaData, entry);
 
-                if(!isComponentInitializationSkipped(metaData, entry, validationStrategy))
+                if (!isComponentInitializationSkipped(metaData, entry, validationStrategy))
                 {
                     //don't break maybe there are constraints which don't support the skip-mechanism
                     metaDataResult.putAll(metaData);
                 }
-           }
+            }
         }
 
         return metaDataResult;
@@ -605,13 +691,13 @@
                                                          SkipValidationEvaluator skipValidationEvaluator,
                                                          Map<String, Object> metaData, MetaDataEntry entry)
     {
-        if(!skipValidationEvaluator.skipValidation(facesContext, uiComponent, validationStrategy, entry))
+        if (!skipValidationEvaluator.skipValidation(facesContext, uiComponent, validationStrategy, entry))
         {
             MetaDataTransformer metaDataTransformer = getMetaDataTransformerForValidationStrategy(validationStrategy);
 
-            if(metaDataTransformer != null)
+            if (metaDataTransformer != null)
             {
-                if(LOGGER.isDebugEnabled())
+                if (LOGGER.isDebugEnabled())
                 {
                     LOGGER.debug(metaDataTransformer.getClass().getName() + " instantiated");
                 }
@@ -623,7 +709,7 @@
                 metaData = null;
             }
 
-            if(metaData == null)
+            if (metaData == null)
             {
                 return new HashMap<String, Object>();
             }
@@ -635,8 +721,8 @@
                                                             ValidationStrategy validationStrategy)
     {
         return metaData.isEmpty() ||
-              (Boolean.TRUE.equals(entry.getProperty(PropertyInformationKeys.SKIP_VALIDATION, Boolean.class)) &&
-                isSkipableValidationStrategy(validationStrategy.getClass()));
+                (Boolean.TRUE.equals(entry.getProperty(PropertyInformationKeys.SKIP_VALIDATION, Boolean.class)) &&
+                        isSkipableValidationStrategy(validationStrategy.getClass()));
     }
 
     public static boolean interpretEmptyStringValuesAsNull()
@@ -671,9 +757,9 @@
 
         FacesContext facesContext = FacesContext.getCurrentInstance();
 
-        if(interpreter.severityCausesValidatorException(facesContext, uiComponent, facesMessage.getSeverity()))
+        if (interpreter.severityCausesValidatorException(facesContext, uiComponent, facesMessage.getSeverity()))
         {
-            if(throwable == null)
+            if (throwable == null)
             {
                 throw new ValidatorException(facesMessage);
             }
@@ -692,7 +778,7 @@
     {
         UIComponent targetComponent = findComponent(clientId);
 
-        if(targetComponent == null && clientId != null)
+        if (targetComponent == null && clientId != null)
         {
             tryToAddViolationMessageForTestClientId(clientId, facesMessage);
             return;
@@ -708,7 +794,7 @@
 
         FacesContext facesContext = FacesContext.getCurrentInstance();
 
-        if(interpreter.severityCausesViolationMessage(facesContext, null, facesMessage.getSeverity()))
+        if (interpreter.severityCausesViolationMessage(facesContext, null, facesMessage.getSeverity()))
         {
             addFacesMessage(clientId, facesMessage);
         }
@@ -722,9 +808,9 @@
 
         FacesContext facesContext = FacesContext.getCurrentInstance();
 
-        if(interpreter.severityCausesViolationMessage(facesContext, uiComponent, facesMessage.getSeverity()))
+        if (interpreter.severityCausesViolationMessage(facesContext, uiComponent, facesMessage.getSeverity()))
         {
-            if(uiComponent != null)
+            if (uiComponent != null)
             {
                 addFacesMessage(uiComponent.getClientId(facesContext), facesMessage);
             }
@@ -745,7 +831,7 @@
     {
         FacesMessageStorage storage = getStorage(FacesMessageStorage.class, FacesMessageStorage.class.getName());
 
-        if(storage != null)
+        if (storage != null)
         {
             storage.addFacesMessage(clientId, facesMessage);
         }
@@ -769,7 +855,7 @@
 
         FacesContext facesContext = FacesContext.getCurrentInstance();
 
-        if(interpreter.severityBlocksNavigation(facesContext, uiComponent, facesMessage.getSeverity()))
+        if (interpreter.severityBlocksNavigation(facesContext, uiComponent, facesMessage.getSeverity()))
         {
             FacesContext.getCurrentInstance().renderResponse();
         }
@@ -802,7 +888,7 @@
     {
         UIComponent targetComponent = null;
 
-        if(clientId != null)
+        if (clientId != null)
         {
             targetComponent = FacesContext.getCurrentInstance().getViewRoot().findComponent(clientId);
         }

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java Sun Nov  1 21:47:32 2009
@@ -67,7 +67,6 @@
 
         if (propertyDetails != null)
         {
-            BeanValidationUtils.addMetaDataToContext(uiComponent, propertyDetails);
             bviUtils.initComponentWithPropertyDetails(facesContext, uiComponent, propertyDetails);
         }
 
@@ -79,7 +78,7 @@
 
     protected void processValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject)
     {
-        MetaDataExtractor metaDataExtractor = ExtValUtils.getComponentMetaDataExtractor();
+        MetaDataExtractor metaDataExtractor = bviUtils.getComponentMetaDataExtractor(uiComponent);
 
         PropertyInformation propertyInformation = metaDataExtractor.extract(facesContext, uiComponent);
 
@@ -93,9 +92,6 @@
                     logger.trace("jsr303 start validation");
                 }
 
-                BeanValidationUtils.addMetaDataToContext(
-                        uiComponent, ExtValUtils.getPropertyDetails(propertyInformation));
-
                 if (!executeGlobalBeforeValidationInterceptors(
                         facesContext, uiComponent, convertedObject, propertyInformation))
                 {

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptorInternals.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptorInternals.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptorInternals.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptorInternals.java Sun Nov  1 21:47:32 2009
@@ -22,10 +22,12 @@
 import org.apache.myfaces.extensions.validator.beanval.validation.strategy.BeanValidationVirtualValidationStrategy;
 import org.apache.myfaces.extensions.validator.beanval.util.BeanValidationUtils;
 import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
 import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
 import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
 import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
 import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.ValidationModuleKey;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.ToDo;
@@ -59,7 +61,8 @@
 
     PropertyDetails extractPropertyDetails(FacesContext facesContext, UIComponent uiComponent)
     {
-        PropertyDetails result = ExtValUtils.getComponentMetaDataExtractor().extract(facesContext, uiComponent)
+        PropertyDetails result = getComponentMetaDataExtractor(uiComponent)
+                .extract(facesContext, uiComponent)
                 .getInformation(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);
 
         if (result.getBaseObject() == null && this.logger.isWarnEnabled())
@@ -71,6 +74,19 @@
         return result.getBaseObject() != null ? result : null;
     }
 
+    /*
+     * also invokes meta-data extraction interceptors
+     * (see e.g. ExtValBeanValidationMetaDataExtractionInterceptor)
+     */
+    MetaDataExtractor getComponentMetaDataExtractor(UIComponent uiComponent)
+    {
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.put(ValidationModuleKey.class.getName(), BeanValidationModuleKey.class);
+        properties.put(UIComponent.class.getName(), uiComponent);
+
+        return ExtValUtils.getComponentMetaDataExtractorWith(properties);
+    }
+
     void initComponentWithPropertyDetails(
             FacesContext facesContext, UIComponent uiComponent, PropertyDetails propertyDetails)
     {

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationModuleKey.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationModuleKey.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationModuleKey.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationModuleKey.java Sun Nov  1 21:47:32 2009
@@ -20,11 +20,13 @@
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.ValidationModuleKey;
 
 /**
  * @author Gerhard Petracek
  * @since x.x.3
  */
+@ValidationModuleKey
 @UsageInformation(UsageCategory.API)
 public interface BeanValidationModuleKey
 {

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/BeanValidation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/BeanValidation.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/BeanValidation.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/BeanValidation.java Sun Nov  1 21:47:32 2009
@@ -20,8 +20,6 @@
 
 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 javax.validation.groups.Default;
 import java.lang.annotation.Target;
@@ -49,7 +47,6 @@
 
     Class[] restrictGroups() default {};
 
-    @ToDo(value = Priority.HIGH, description = "support property chain syntax")
     String[] conditions() default "#{true}";
 
     ModelValidation modelValidation() default @ModelValidation;

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/ModelValidation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/ModelValidation.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/ModelValidation.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/ModelValidation.java Sun Nov  1 21:47:32 2009
@@ -20,6 +20,8 @@
 
 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 java.lang.annotation.Target;
 import java.lang.annotation.Retention;
@@ -47,6 +49,7 @@
 
     boolean displayInline() default false;
 
+    @ToDo(value = Priority.HIGH, description = "support property chain syntax")
     String[] validationTargets() default DEFAULT_TARGET;
 
     String message() default DEFAULT_MESSAGE;

Added: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/interceptor/ExtValBeanValidationMetaDataExtractionInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/interceptor/ExtValBeanValidationMetaDataExtractionInterceptor.java?rev=831765&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/interceptor/ExtValBeanValidationMetaDataExtractionInterceptor.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/interceptor/ExtValBeanValidationMetaDataExtractionInterceptor.java Sun Nov  1 21:47:32 2009
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.beanval.interceptor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.interceptor.MetaDataExtractionInterceptor;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.ValidationModuleAware;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.beanval.BeanValidationModuleKey;
+import org.apache.myfaces.extensions.validator.beanval.util.BeanValidationUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import javax.faces.component.UIComponent;
+import java.util.Map;
+
+/**
+ * extracts and adds the extval bv meta-data (e.g. validation groups) to the ExtValBeanValidationContext
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@InvocationOrder(200)
+@UsageInformation(UsageCategory.INTERNAL)
+public class ExtValBeanValidationMetaDataExtractionInterceptor
+        implements MetaDataExtractionInterceptor, ValidationModuleAware
+{
+    public void afterExtracting(PropertyInformation propertyInformation)
+    {
+        if(propertyInformation.containsInformation(PropertyInformationKeys.CUSTOM_PROPERTIES))
+        {
+            Map properties = propertyInformation.getInformation(PropertyInformationKeys.CUSTOM_PROPERTIES, Map.class);
+
+            if(properties != null && properties.containsKey(UIComponent.class.getName()))
+            {
+                UIComponent uiComponent = (UIComponent)properties.get(UIComponent.class.getName());
+                PropertyDetails propertyDetails = ExtValUtils.getPropertyDetails(propertyInformation);
+
+                processExtValBeanValidationMetaData(uiComponent, propertyDetails);
+            }
+        }
+    }
+
+    /**
+     * adds the extval bv meta-data to the ExtValBeanValidationContext
+     *
+     * @param uiComponent current component
+     * @param propertyDetails property details of the value-binding
+     */
+    private void processExtValBeanValidationMetaData(UIComponent uiComponent, PropertyDetails propertyDetails)
+    {
+        BeanValidationUtils.addMetaDataToContext(uiComponent, propertyDetails);
+    }
+
+    public String[] getModuleKeys()
+    {
+        return new String[] {BeanValidationModuleKey.class.getName()};
+    }
+}

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/metadata/transformer/mapper/NotNullNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/metadata/transformer/mapper/NotNullNameMapper.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/metadata/transformer/mapper/NotNullNameMapper.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/metadata/transformer/mapper/NotNullNameMapper.java Sun Nov  1 21:47:32 2009
@@ -32,7 +32,7 @@
  * @since x.x.3
  */
 @Nested
-@InvocationOrder(100)
+@InvocationOrder(200)
 @UsageInformation({UsageCategory.INTERNAL})
 public class NotNullNameMapper extends AbstractBeanValidationVirtualValidationStrategyToMetaDataTransformerNameMapper
 {

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/metadata/transformer/mapper/SizeNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/metadata/transformer/mapper/SizeNameMapper.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/metadata/transformer/mapper/SizeNameMapper.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/metadata/transformer/mapper/SizeNameMapper.java Sun Nov  1 21:47:32 2009
@@ -32,7 +32,7 @@
  * @since x.x.3
  */
 @Nested
-@InvocationOrder(101)
+@InvocationOrder(201)
 @UsageInformation({UsageCategory.INTERNAL})
 public class SizeNameMapper extends AbstractBeanValidationVirtualValidationStrategyToMetaDataTransformerNameMapper
 {

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/startup/BeanValidationStartupListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/startup/BeanValidationStartupListener.java?rev=831765&r1=831764&r2=831765&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/startup/BeanValidationStartupListener.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/startup/BeanValidationStartupListener.java Sun Nov  1 21:47:32 2009
@@ -20,6 +20,7 @@
 
 import org.apache.myfaces.extensions.validator.beanval.BeanValidationInterceptor;
 import org.apache.myfaces.extensions.validator.beanval.HtmlCoreComponentsComponentInitializer;
+import org.apache.myfaces.extensions.validator.beanval.interceptor.ExtValBeanValidationMetaDataExtractionInterceptor;
 import org.apache.myfaces.extensions.validator.beanval.validation.ModelValidationPhaseListener;
 import org.apache.myfaces.extensions.validator.beanval.metadata.transformer.mapper.SizeNameMapper;
 import org.apache.myfaces.extensions.validator.beanval.metadata.transformer.mapper.NotNullNameMapper;
@@ -59,6 +60,7 @@
         registerGroupStorageNameMapper();
         registerModelValidationStorageNameMapper();
         registerComponentInitializers();
+        registerMetaDataExtractionInterceptors();
         registerPhaseListeners();
     }
 
@@ -119,6 +121,12 @@
                 .getFactory(FactoryNames.STORAGE_MANAGER_FACTORY, StorageManagerHolder.class));
     }
 
+    protected void registerMetaDataExtractionInterceptors()
+    {
+        ExtValContext.getContext()
+                .addMetaDataExtractionInterceptor(new ExtValBeanValidationMetaDataExtractionInterceptor());
+    }
+
     protected void registerPhaseListeners()
     {
         JsfUtils.registerPhaseListener(new ModelValidationPhaseListener());



Mime
View raw message