myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r698417 - 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/metadata/ core/src/main/java/org/apache/myfaces/extensions/va...
Date Wed, 24 Sep 2008 02:25:39 GMT
Author: gpetracek
Date: Tue Sep 23 19:25:38 2008
New Revision: 698417

URL: http://svn.apache.org/viewvc?rev=698417&view=rev
Log:
refactoring: meta-data extractor as a stand-alone mechanism to support customized extractors and get clean artifacts

Added:
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultMetaDataExtractorFactory.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/MetaDataExtractor.java
      - copied, changed from r697737, myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/MetaDataExtractor.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/CustomConfiguredValidationStrategyToMetaDataExtractorNameMapper.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/CustomConventionValidationStrategyToMetaDataExtractorNameMapper.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/DefaultValidationStrategyToMetaDataExtractorNameMapper.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/SimpleValidationStrategyToMetaDataExtractorNameMapper.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/MetaDataKeys.java
      - copied, changed from r698062, myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/MetaDataKeys.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/JoinMetaDataExtractor.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/JpaMetaDataExtractor.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/LengthMetaDataExtractor.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/RequiredMetaDataExtractor.java
Removed:
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/MetaDataExtractor.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/MetaDataKeys.java
Modified:
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValRendererWrapper.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsComponentInitializer.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/TrinidadComponentInitializer.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JoinValidationStrategy.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LengthStrategy.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.java

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValRendererWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValRendererWrapper.java?rev=698417&r1=698416&r2=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValRendererWrapper.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValRendererWrapper.java Tue Sep 23 19:25:38 2008
@@ -21,6 +21,7 @@
 import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
 import org.apache.myfaces.extensions.validator.core.annotation.extractor.AnnotationExtractor;
 import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.util.ClassUtils;
@@ -82,6 +83,7 @@
         }
 
         ValidationStrategy validationStrategy;
+        MetaDataExtractor metaDataExtractor;
 
         AnnotationExtractor annotationExtractor = FactoryUtils.getComponentAnnotationExtractorFactory().create();
 
@@ -92,9 +94,11 @@
 
             if (validationStrategy != null)
             {
-                if(validationStrategy instanceof MetaDataExtractor)
+                metaDataExtractor = FactoryUtils.getMetaDataExtractorFactory().create(validationStrategy);
+
+                if(metaDataExtractor != null)
                 {
-                    metaData = ((MetaDataExtractor)validationStrategy).extractMetaData(entry.getAnnotation());
+                    metaData = metaDataExtractor.extractMetaData(entry.getAnnotation());
                 }
                 else
                 {

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java?rev=698417&r1=698416&r2=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java Tue Sep 23 19:25:38 2008
@@ -68,11 +68,6 @@
         return basePackage;
     }
 
-    public String getCustomComponentAnnotationExtractorFactory()
-    {
-        return this.basePackage + "AnnotationExtractorFactory";
-    }
-
     public String getCustomComponentAnnotationExtractor()
     {
         return this.basePackage + "AnnotationExtractor";
@@ -89,6 +84,11 @@
         return "ValidationStrategy";
     }
 
+    public String getMetaDataExtractorPostfix()
+    {
+        return "MetaDataExtractor";
+    }
+
     /*
      * name mapper
      */
@@ -102,6 +102,11 @@
         return this.basePackage + "AnnotationToValidationStrategyNameMapper";
     }
 
+    public String getCustomValidationStrategyToMetaDataExtractorNameMapper()
+    {
+        return this.basePackage + "ValidationStrategyToMetaDataExtractorNameMapper";
+    }
+
     /*
      * initializer
      */
@@ -138,6 +143,16 @@
         return this.basePackage + "ComponentInitializerFactory";
     }
 
+    public String getCustomComponentAnnotationExtractorFactory()
+    {
+        return this.basePackage + "AnnotationExtractorFactory";
+    }
+
+    public String getCustomMetaDataExtractorFactory()
+    {
+        return this.basePackage + "MetaDataExtractorFactory";
+    }
+
     /*
      * conventions (the rest of the conventions are built with the help of name mappers,...
      */
@@ -201,51 +216,63 @@
      * use a custom name mapper to implement custom conventions
      */
     @ToDo(value = Priority.MEDIUM, description = "logging")
-    public final String getConventionNameForMessageResolverPackage(
-        Class<? extends ValidationStrategy> validationStrategyClass,
-        String targetClassName)
+    public final String getConventionNameForMessageResolverName(
+        Class<? extends ValidationStrategy> validationStrategyClass, String targetClassName)
     {
-        String resolverName = validationStrategyClass.getName();
+        return getValidationStrategyBasedName(validationStrategyClass, ".message.resolver.", targetClassName);
+    }
 
-        resolverName = resolverName.replace(".strategy.", ".message.resolver.");
+    public final String getConventionNameForMetaDataExtractorName(
+        Class<? extends ValidationStrategy> validationStrategyClass, String targetClassName)
+    {
+        return getValidationStrategyBasedName(validationStrategyClass, ".metadata.extractor.", targetClassName);
+    }
+
+    private String getValidationStrategyBasedName(Class<? extends ValidationStrategy> validationStrategyClass,
+                                                  String targetPackageName, String targetClassName)
+    {
+        String extractorName = validationStrategyClass.getName();
+
+        extractorName = extractorName.replace(".strategy.", targetPackageName);
 
         if (targetClassName == null)
         {
             return null;
         }
-        return resolverName.substring(0, resolverName.lastIndexOf(".")) + "."
-            + targetClassName;
+        return extractorName.substring(0, extractorName.lastIndexOf(".")) + "." + targetClassName;
     }
 
     /**
      * use a custom name mapper to implement custom conventions
      */
-    public final String getConventionNameForMessageResolverClass(
-        String strategyClassName)
+    public final String getConventionNameForMessageResolverClass(String validationStrategyName)
     {
-        if (strategyClassName.endsWith("ValidationStrategy"))
-        {
-            return strategyClassName.substring(0,
-                strategyClassName.length() - 18)
-                + "ValidationErrorMessageResolver";
-        }
-        else if (strategyClassName.endsWith("Strategy"))
-        {
-            return strategyClassName.substring(0,
-                strategyClassName.length() - 8)
-                + "ValidationErrorMessageResolver";
-        }
-        return strategyClassName;
+        return getValidationStrategyBasedName(validationStrategyName, "ValidationErrorMessageResolver");
     }
 
     /**
      * use a custom name mapper to implement custom conventions
      */
-    public final String getConventionNameForValidationStrategy(
-        Annotation annotation)
+    public final String getConventionNameForValidationStrategy(Annotation annotation)
     {
-        return annotation.annotationType().getName().replace(".annotation.",
-            ".strategy.")
-            + "Strategy";
+        return annotation.annotationType().getName().replace(".annotation.", ".strategy.") + "Strategy";
+    }
+
+    public final String getConventionNameForMetaDataExtractorClass(String validationStrategyName)
+    {
+        return getValidationStrategyBasedName(validationStrategyName, "MetaDataExtractor");
+    }
+
+    private 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 null;
     }
 }
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java?rev=698417&r1=698416&r2=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java Tue Sep 23 19:25:38 2008
@@ -74,6 +74,12 @@
     static final String CUSTOM_COMPONENT_INITIALIZER = WebXmlUtils
         .getInitParameter("CUSTOM_COMPONENT_INITIALIZER");
 
+    static final String CUSTOM_META_DATA_EXTRACTOR_FACTORY = WebXmlUtils
+        .getInitParameter("CUSTOM_META_DATA_EXTRACTOR_FACTORY");
+
+    static final String CUSTOM_VALIDATION_STRATEGY_TO_META_DATA_EXTRACTOR_NAME_MAPPER = WebXmlUtils
+        .getInitParameter("CUSTOM_VALIDATION_STRATEGY_TO_META_DATA_EXTRACTOR_NAME_MAPPER");
+
     /*
      * deactivate
      */

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultMetaDataExtractorFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultMetaDataExtractorFactory.java?rev=698417&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultMetaDataExtractorFactory.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultMetaDataExtractorFactory.java Tue Sep 23 19:25:38 2008
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.metadata.extractor;
+
+import org.apache.myfaces.extensions.validator.core.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.mapper
+    .CustomConfiguredValidationStrategyToMetaDataExtractorNameMapper;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.mapper
+    .CustomConventionValidationStrategyToMetaDataExtractorNameMapper;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.mapper
+    .DefaultValidationStrategyToMetaDataExtractorNameMapper;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.mapper
+    .SimpleValidationStrategyToMetaDataExtractorNameMapper;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * Factory which creates the MetaDataExtractor for a given ValidationStrategy
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+/*
+ * ValidationStrategy -> MetaDataExtractor instead of Annotation -> MetaDataExtractor
+ * to avoid a second static mapping e.g. for jpa annotations
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultMetaDataExtractorFactory implements
+    ClassMappingFactory<ValidationStrategy, MetaDataExtractor>
+{
+    private static Map<String, String> validationStrategyToMetaDataExtractorMapping = new HashMap<String, String>();
+    private static List<NameMapper<ValidationStrategy>> nameMapperList
+        = new ArrayList<NameMapper<ValidationStrategy>>();
+
+    static
+    {
+        nameMapperList
+            .add(new CustomConfiguredValidationStrategyToMetaDataExtractorNameMapper());
+        nameMapperList
+            .add(new CustomConventionValidationStrategyToMetaDataExtractorNameMapper());
+        nameMapperList
+            .add(new DefaultValidationStrategyToMetaDataExtractorNameMapper());
+        nameMapperList
+            .add(new SimpleValidationStrategyToMetaDataExtractorNameMapper());
+    }
+
+    public MetaDataExtractor create(ValidationStrategy validationStrategy)
+    {
+        String validationStrategyName = validationStrategy.getClass().getName();
+
+        if (validationStrategyToMetaDataExtractorMapping.containsKey(validationStrategyName))
+        {
+            return (MetaDataExtractor)ClassUtils.tryToInstantiateClassForName(
+                validationStrategyToMetaDataExtractorMapping.get(validationStrategyName));
+        }
+
+        MetaDataExtractor metaDataExtractor;
+        String extractorName;
+        //null -> use name mappers
+        for (NameMapper<ValidationStrategy> nameMapper : nameMapperList)
+        {
+            extractorName = nameMapper.createName(validationStrategy);
+
+            if (extractorName == null)
+            {
+                continue;
+            }
+
+            metaDataExtractor = (MetaDataExtractor)ClassUtils.tryToInstantiateClassForName(extractorName);
+
+            if (metaDataExtractor != null)
+            {
+                validationStrategyToMetaDataExtractorMapping.put(validationStrategyName, extractorName);
+                return metaDataExtractor;
+            }
+        }
+
+        return null;
+    }
+}
\ No newline at end of file

Copied: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/MetaDataExtractor.java (from r697737, myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/MetaDataExtractor.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/MetaDataExtractor.java?p2=myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/MetaDataExtractor.java&p1=myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/MetaDataExtractor.java&r1=697737&r2=698417&rev=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/MetaDataExtractor.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/MetaDataExtractor.java Tue Sep 23 19:25:38 2008
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.extensions.validator.core;
+package org.apache.myfaces.extensions.validator.core.metadata.extractor;
 
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/CustomConfiguredValidationStrategyToMetaDataExtractorNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/CustomConfiguredValidationStrategyToMetaDataExtractorNameMapper.java?rev=698417&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/CustomConfiguredValidationStrategyToMetaDataExtractorNameMapper.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/CustomConfiguredValidationStrategyToMetaDataExtractorNameMapper.java Tue Sep 23 19:25:38 2008
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.metadata.extractor.mapper;
+
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.mapper.AbstractCustomNameMapper;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * To provide a custom NameMapper to map ValidationStrategies to MetaDataExtractors.
+ * (configured via web.xml)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class CustomConfiguredValidationStrategyToMetaDataExtractorNameMapper extends
+    AbstractCustomNameMapper<ValidationStrategy>
+{
+    protected String getCustomNameMapperClassName()
+    {
+        return WebXmlParameter.CUSTOM_VALIDATION_STRATEGY_TO_META_DATA_EXTRACTOR_NAME_MAPPER;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/CustomConventionValidationStrategyToMetaDataExtractorNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/CustomConventionValidationStrategyToMetaDataExtractorNameMapper.java?rev=698417&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/CustomConventionValidationStrategyToMetaDataExtractorNameMapper.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/CustomConventionValidationStrategyToMetaDataExtractorNameMapper.java Tue Sep 23 19:25:38 2008
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.metadata.extractor.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.AbstractCustomNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * To provide a custom NameMapper to map ValidationStrategies to MetaDataExtractors.
+ * (configured via information provider bean)
+ * The bean provides the default name (convention).
+ * It's possible to provide a custom full qualified name. (= customizable convention)
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class CustomConventionValidationStrategyToMetaDataExtractorNameMapper extends
+    AbstractCustomNameMapper<ValidationStrategy>
+{
+    protected String getCustomNameMapperClassName()
+    {
+        return ExtValUtils.getInformationProviderBean()
+            .getCustomValidationStrategyToMetaDataExtractorNameMapper();
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/DefaultValidationStrategyToMetaDataExtractorNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/DefaultValidationStrategyToMetaDataExtractorNameMapper.java?rev=698417&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/DefaultValidationStrategyToMetaDataExtractorNameMapper.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/DefaultValidationStrategyToMetaDataExtractorNameMapper.java Tue Sep 23 19:25:38 2008
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.metadata.extractor.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * Default implementation which maps ExtVal ValidationStrategies to MetaDataExtractors.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultValidationStrategyToMetaDataExtractorNameMapper implements
+    NameMapper<ValidationStrategy>
+{
+    public String createName(ValidationStrategy validationStrategy)
+    {
+        return ExtValUtils.getInformationProviderBean()
+            .getConventionNameForMetaDataExtractorName(
+                validationStrategy.getClass(), getClassName(validationStrategy.getClass().getSimpleName()));
+    }
+
+    protected String getClassName(String validationStrategyClassName)
+    {
+        return ExtValUtils.getInformationProviderBean()
+            .getConventionNameForMetaDataExtractorClass(validationStrategyClassName);
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/SimpleValidationStrategyToMetaDataExtractorNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/SimpleValidationStrategyToMetaDataExtractorNameMapper.java?rev=698417&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/SimpleValidationStrategyToMetaDataExtractorNameMapper.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/mapper/SimpleValidationStrategyToMetaDataExtractorNameMapper.java Tue Sep 23 19:25:38 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.metadata.extractor.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * It's a alternative Mapper to place ValidationStrategies and MetaDataExtractors in the same package.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.ALTERNATIVE})
+public class SimpleValidationStrategyToMetaDataExtractorNameMapper implements
+    NameMapper<ValidationStrategy>
+{
+    public String createName(ValidationStrategy validationStrategy)
+    {
+        return getSimpleMetaDataExtractorName(validationStrategy.getClass().getPackage().getName() + ".",
+                                                validationStrategy.getClass().getSimpleName());
+    }
+
+    public String getSimpleMetaDataExtractorName(String validationStrategyPackageName,
+                                                 String validationStrategyClassName)
+    {
+        String postfix = ExtValUtils.getInformationProviderBean().getMetaDataExtractorPostfix();
+
+        return validationStrategyPackageName + validationStrategyClassName
+                .replace(ExtValUtils.getInformationProviderBean().getValidationStrategyPostfix(), postfix)
+                .replace("ValidationStrategy", postfix)
+                .replace("Strategy", postfix);
+    }
+
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java?rev=698417&r1=698416&r2=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java Tue Sep 23 19:25:38 2008
@@ -37,10 +37,8 @@
     public String createName(ValidationStrategy validationStrategy)
     {
         return ExtValUtils.getInformationProviderBean()
-            .getConventionNameForMessageResolverPackage(
-                validationStrategy.getClass(),
-                getClassName(validationStrategy.getClass()
-                    .getSimpleName()));
+            .getConventionNameForMessageResolverName(validationStrategy.getClass(),
+                                                     getClassName(validationStrategy.getClass().getSimpleName()));
     }
 
     protected String getClassName(String strategyClassName)

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=698417&r1=698416&r2=698417&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 Tue Sep 23 19:25:38 2008
@@ -49,8 +49,7 @@
 public class ExtValUtils
 {
     @ToDo(value = Priority.MEDIUM, description = "test")
-    public static void createValueBindingConvertedValueMapping(
-        UIComponent uiComponent, Object convertedObject)
+    public static void createValueBindingConvertedValueMapping(UIComponent uiComponent, Object convertedObject)
     {
         if (!(uiComponent instanceof EditableValueHolder))
         {
@@ -64,8 +63,7 @@
         String valueBindingExpression;
         ProcessedInformationEntry entry;
 
-        valueBindingExpression = ELUtils
-            .getReliableValueBindingExpression(uiComponent);
+        valueBindingExpression = ELUtils.getReliableValueBindingExpression(uiComponent);
 
         if (valueBindingExpression == null)
         {

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java?rev=698417&r1=698416&r2=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java Tue Sep 23 19:25:38 2008
@@ -20,6 +20,8 @@
 
 import org.apache.myfaces.extensions.validator.core.ClassMappingFactory;
 import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.DefaultMetaDataExtractorFactory;
 import org.apache.myfaces.extensions.validator.core.annotation.extractor.AnnotationExtractorFactory;
 import org.apache.myfaces.extensions.validator.core.annotation.extractor.DefaultComponentAnnotationExtractorFactory;
 import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
@@ -141,6 +143,34 @@
         return messageResolverFactory;
     }
 
+    private static ClassMappingFactory<ValidationStrategy, MetaDataExtractor> metaDataExtractorFactory;
+
+    public static ClassMappingFactory<ValidationStrategy, MetaDataExtractor> getMetaDataExtractorFactory()
+    {
+        if (metaDataExtractorFactory == null)
+        {
+            List<String> metaDataExtractorFactoryClassNames = new ArrayList<String>();
+
+            metaDataExtractorFactoryClassNames.add(WebXmlParameter.CUSTOM_META_DATA_EXTRACTOR_FACTORY);
+            metaDataExtractorFactoryClassNames.add(ExtValUtils
+                .getInformationProviderBean().getCustomMetaDataExtractorFactory());
+            metaDataExtractorFactoryClassNames.add(DefaultMetaDataExtractorFactory.class.getName());
+
+            for (String className : metaDataExtractorFactoryClassNames)
+            {
+                metaDataExtractorFactory = (ClassMappingFactory<ValidationStrategy, MetaDataExtractor>) ClassUtils
+                    .tryToInstantiateClassForName(className);
+
+                if (metaDataExtractorFactory != null)
+                {
+                    break;
+                }
+            }
+        }
+
+        return metaDataExtractorFactory;
+    }
+
     private static ClassMappingFactory<RenderKit, RenderingContextInitializer> renderingContextInitializerFactory;
 
     public static ClassMappingFactory<RenderKit, RenderingContextInitializer> getRenderingContextInitializerFactory()

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsComponentInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsComponentInitializer.java?rev=698417&r1=698416&r2=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsComponentInitializer.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsComponentInitializer.java Tue Sep 23 19:25:38 2008
@@ -19,6 +19,7 @@
 package org.apache.myfaces.extensions.validator;
 
 import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
+import org.apache.myfaces.extensions.validator.baseval.metadata.MetaDataKeys;
 
 import javax.faces.component.EditableValueHolder;
 import javax.faces.component.UIComponent;

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/TrinidadComponentInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/TrinidadComponentInitializer.java?rev=698417&r1=698416&r2=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/TrinidadComponentInitializer.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/TrinidadComponentInitializer.java Tue Sep 23 19:25:38 2008
@@ -19,6 +19,7 @@
 package org.apache.myfaces.extensions.validator;
 
 import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+import org.apache.myfaces.extensions.validator.baseval.metadata.MetaDataKeys;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;

Copied: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/MetaDataKeys.java (from r698062, myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/MetaDataKeys.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/MetaDataKeys.java?p2=myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/MetaDataKeys.java&p1=myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/MetaDataKeys.java&r1=698062&r2=698417&rev=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/MetaDataKeys.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/MetaDataKeys.java Tue Sep 23 19:25:38 2008
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.extensions.validator;
+package org.apache.myfaces.extensions.validator.baseval.metadata;
 
 /**
  * @author Gerhard Petracek

Added: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/JoinMetaDataExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/JoinMetaDataExtractor.java?rev=698417&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/JoinMetaDataExtractor.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/JoinMetaDataExtractor.java Tue Sep 23 19:25:38 2008
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.baseval.metadata.extractor;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.JoinValidation;
+import org.apache.myfaces.extensions.validator.baseval.annotation.extractor.DefaultPropertyScanningAnnotationExtractor;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+import org.apache.myfaces.extensions.validator.core.annotation.extractor.AnnotationExtractor;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.util.FactoryUtils;
+
+import javax.faces.context.FacesContext;
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class JoinMetaDataExtractor implements MetaDataExtractor
+{
+    public Map<String, Object> extractMetaData(Annotation annotation)
+    {
+        AnnotationExtractor extractor = new DefaultPropertyScanningAnnotationExtractor();
+
+        String[] targetExpressions = ((JoinValidation)annotation).value();
+
+        ValidationStrategy validationStrategy;
+        MetaDataExtractor metaDataExtractor;
+
+        Map<String, Object> results = new HashMap<String, Object>();
+
+        for (String targetExpression : targetExpressions)
+        {
+            for (AnnotationEntry entry : extractor
+                                            .extractAnnotations(FacesContext.getCurrentInstance(), targetExpression))
+            {
+                validationStrategy = FactoryUtils .getValidationStrategyFactory().create(entry.getAnnotation());
+
+                metaDataExtractor = FactoryUtils.getMetaDataExtractorFactory().create(validationStrategy);
+
+                if (metaDataExtractor != null)
+                {
+                    results.putAll(metaDataExtractor.extractMetaData(entry.getAnnotation()));
+                }
+            }
+        }
+        return results;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/JpaMetaDataExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/JpaMetaDataExtractor.java?rev=698417&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/JpaMetaDataExtractor.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/JpaMetaDataExtractor.java Tue Sep 23 19:25:38 2008
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.baseval.metadata.extractor;
+
+import org.apache.myfaces.extensions.validator.baseval.metadata.MetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class JpaMetaDataExtractor implements MetaDataExtractor
+{
+    @ToDo(value = Priority.HIGH, description = "impl. the rest")
+    public Map<String, Object> extractMetaData(Annotation annotation)
+    {
+        Map<String, Object> results = new HashMap<String, Object>();
+
+        if(annotation instanceof Column)
+        {
+            if(!((Column) annotation).nullable())
+            {
+                results.put(MetaDataKeys.REQUIRED, true);
+            }
+
+            results.put(MetaDataKeys.MAX_LENGTH, ((Column) annotation).length());
+        }
+        else if(annotation instanceof Basic)
+        {
+            if(!((Basic)annotation).optional())
+            {
+                results.put(MetaDataKeys.REQUIRED, true);
+            }
+        }
+        //TODO impl. the rest!!!
+        return results;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/LengthMetaDataExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/LengthMetaDataExtractor.java?rev=698417&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/LengthMetaDataExtractor.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/LengthMetaDataExtractor.java Tue Sep 23 19:25:38 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.baseval.metadata.extractor;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Length;
+import org.apache.myfaces.extensions.validator.baseval.metadata.MetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class LengthMetaDataExtractor implements MetaDataExtractor
+{
+    public Map<String, Object> extractMetaData(Annotation annotation)
+    {
+        Map<String, Object> results = new HashMap<String, Object>();
+        int minimum = ((Length)annotation).minimum();
+
+        results.put(MetaDataKeys.MIM_LENGTH, minimum);
+        results.put(MetaDataKeys.MAX_LENGTH, ((Length)annotation).maximum());
+
+        if(minimum > 0)
+        {
+            results.put(MetaDataKeys.REQUIRED, true);
+        }
+
+        return results;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/RequiredMetaDataExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/RequiredMetaDataExtractor.java?rev=698417&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/RequiredMetaDataExtractor.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/metadata/extractor/RequiredMetaDataExtractor.java Tue Sep 23 19:25:38 2008
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.baseval.metadata.extractor;
+
+import org.apache.myfaces.extensions.validator.baseval.metadata.MetaDataKeys;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public class RequiredMetaDataExtractor implements MetaDataExtractor
+{
+    public Map<String, Object> extractMetaData(Annotation annotation)
+    {
+        Map<String, Object> results = new HashMap<String, Object>();
+        results.put(MetaDataKeys.REQUIRED, true);
+        return results;
+    }
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JoinValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JoinValidationStrategy.java?rev=698417&r1=698416&r2=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JoinValidationStrategy.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JoinValidationStrategy.java Tue Sep 23 19:25:38 2008
@@ -24,20 +24,16 @@
 import org.apache.myfaces.extensions.validator.core.annotation.extractor.AnnotationExtractor;
 import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidatorAdapter;
 import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
-import org.apache.myfaces.extensions.validator.core.MetaDataExtractor;
 import org.apache.myfaces.extensions.validator.util.FactoryUtils;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.validator.ValidatorException;
-import java.lang.annotation.Annotation;
-import java.util.Map;
-import java.util.HashMap;
 
 /**
  * @author Gerhard Petracek
  */
-public class JoinValidationStrategy extends AbstractValidatorAdapter implements MetaDataExtractor
+public class JoinValidationStrategy extends AbstractValidatorAdapter
 {
     public void processValidation(FacesContext facesContext,
             UIComponent uiComponent, AnnotationEntry annotationEntry,
@@ -72,32 +68,4 @@
             }
         }
     }
-
-    public Map<String, Object> extractMetaData(Annotation annotation)
-    {
-        AnnotationExtractor extractor = new DefaultPropertyScanningAnnotationExtractor();
-
-        String[] targetExpressions = ((JoinValidation)annotation).value();
-
-        ValidationStrategy validationStrategy;
-
-        Map<String, Object> results = new HashMap<String, Object>();
-
-        for (String targetExpression : targetExpressions)
-        {
-            for (AnnotationEntry entry : extractor.extractAnnotations(
-                FacesContext.getCurrentInstance(), targetExpression))
-            {
-                validationStrategy = FactoryUtils
-                        .getValidationStrategyFactory().create(
-                                entry.getAnnotation());
-
-                if (validationStrategy != null && validationStrategy instanceof MetaDataExtractor)
-                {
-                    results.putAll(((MetaDataExtractor)validationStrategy).extractMetaData(entry.getAnnotation()));
-                }
-            }
-        }
-        return results;
-    }
 }

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java?rev=698417&r1=698416&r2=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java Tue Sep 23 19:25:38 2008
@@ -18,12 +18,11 @@
  */
 package org.apache.myfaces.extensions.validator.baseval.strategy;
 
+import org.apache.myfaces.extensions.validator.baseval.metadata.MetaDataKeys;
 import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
 import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
-import org.apache.myfaces.extensions.validator.core.MetaDataExtractor;
-import org.apache.myfaces.extensions.validator.internal.ToDo;
 import org.apache.myfaces.extensions.validator.internal.Priority;
-import org.apache.myfaces.extensions.validator.MetaDataKeys;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -33,13 +32,11 @@
 import javax.persistence.ManyToOne;
 import javax.persistence.OneToOne;
 import java.lang.annotation.Annotation;
-import java.util.Map;
-import java.util.HashMap;
 
 /**
  * @author Gerhard Petracek
  */
-public class JpaValidationStrategy extends AbstractValidationStrategy implements MetaDataExtractor
+public class JpaValidationStrategy extends AbstractValidationStrategy
 {
 
     private static final String VALIDATE_LENGTH = "length";
@@ -70,31 +67,6 @@
         }
     }
 
-    @ToDo(value = Priority.HIGH, description = "impl. the rest")
-    public Map<String, Object> extractMetaData(Annotation annotation)
-    {
-        Map<String, Object> results = new HashMap<String, Object>();
-
-        if(annotation instanceof Column)
-        {
-            if(!((Column) annotation).nullable())
-            {
-                results.put(MetaDataKeys.REQUIRED, true);
-            }
-
-            results.put(MetaDataKeys.MAX_LENGTH, ((Column) annotation).length());
-        }
-        else if(annotation instanceof Basic)
-        {
-            if(!((Basic)annotation).optional())
-            {
-                results.put(MetaDataKeys.REQUIRED, true);
-            }
-        }
-        //TODO impl. the rest!!!
-        return results;
-    }
-
     private void validateColumnAnnotation(Column column, Object convertedObject)
             throws ValidatorException
     {

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LengthStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LengthStrategy.java?rev=698417&r1=698416&r2=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LengthStrategy.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/LengthStrategy.java Tue Sep 23 19:25:38 2008
@@ -21,21 +21,16 @@
 import org.apache.myfaces.extensions.validator.baseval.annotation.Length;
 import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
 import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidatorAdapter;
-import org.apache.myfaces.extensions.validator.core.MetaDataExtractor;
-import org.apache.myfaces.extensions.validator.MetaDataKeys;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.validator.LengthValidator;
 import javax.faces.validator.ValidatorException;
-import java.lang.annotation.Annotation;
-import java.util.Map;
-import java.util.HashMap;
 
 /**
  * @author Gerhard Petracek
  */
-public class LengthStrategy extends AbstractValidatorAdapter implements MetaDataExtractor
+public class LengthStrategy extends AbstractValidatorAdapter
 {
     protected void processValidation(FacesContext facesContext,
             UIComponent uiComponent, AnnotationEntry annotationEntry,
@@ -50,20 +45,4 @@
 
         lengthValidator.validate(facesContext, uiComponent, convertedObject);
     }
-
-    public Map<String, Object> extractMetaData(Annotation annotation)
-    {
-        Map<String, Object> results = new HashMap<String, Object>();
-        int minimum = ((Length)annotation).minimum();
-
-        results.put(MetaDataKeys.MIM_LENGTH, minimum);
-        results.put(MetaDataKeys.MAX_LENGTH, ((Length)annotation).maximum());
-
-        if(minimum > 0)
-        {
-            results.put(MetaDataKeys.REQUIRED, true);
-        }
-
-        return results;
-    }
 }
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.java?rev=698417&r1=698416&r2=698417&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.java Tue Sep 23 19:25:38 2008
@@ -21,20 +21,16 @@
 import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
 import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
 import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractValidationStrategy;
-import org.apache.myfaces.extensions.validator.core.MetaDataExtractor;
-import org.apache.myfaces.extensions.validator.MetaDataKeys;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.validator.ValidatorException;
 import java.lang.annotation.Annotation;
-import java.util.Map;
-import java.util.HashMap;
 
 /**
  * @author Gerhard Petracek
  */
-public class RequiredStrategy extends AbstractValidationStrategy implements MetaDataExtractor
+public class RequiredStrategy extends AbstractValidationStrategy
 {
     public void processValidation(FacesContext facesContext,
             UIComponent uiComponent, AnnotationEntry annotationEntry,
@@ -48,13 +44,6 @@
         }
     }
 
-    public Map<String, Object> extractMetaData(Annotation annotation)
-    {
-        Map<String, Object> results = new HashMap<String, Object>();
-        results.put(MetaDataKeys.REQUIRED, true);
-        return results;
-    }
-
     protected String getValidationErrorMsgKey(Annotation annotation)
     {
         return ((Required) annotation).validationErrorMsgKey();



Mime
View raw message