You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2009/11/13 03:48:58 UTC

svn commit: r835712 [9/19] - in /myfaces/extensions/validator/branches/branch_for_jsf_2_0: ./ assembly/ assembly/src/ assembly/src/main/ assembly/src/main/assembly/ assembly/src/main/resources/ component-support/ component-support/generic-support/ comp...

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.message.resolver;
+
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * MessageResolver which uses property files.
+ * Subclasses just have to provide the package to look at.
+ * An implementation can also provide a custom name which is e.g. configured via web.xml.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public abstract class AbstractValidationErrorMessageResolver implements MessageResolver
+{
+    public static final String MISSING_RESOURCE_MARKER = "???";
+
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    private static String deactivateDefaultConvention = WebXmlParameter.DEACTIVATE_DEFAULT_CONVENTION;
+    private static ResourceBundle defaultBundle = null;
+    private String messageBundleBaseName;
+    //with jsf 1.1 only available if there is a custom bean
+    private String messageBundleVarName;
+
+    protected AbstractValidationErrorMessageResolver()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+
+    public String getMessage(String key, Locale locale)
+    {
+        if (key == null || key.equals(""))
+        {
+            return null;
+        }
+
+        if(key.contains(" "))
+        {
+            if(key.endsWith("_detail"))
+            {
+                key = key.substring(0, key.length() - 7);
+            }
+            return key;
+        }
+
+        ResourceBundle resourceBundle = null;
+        String customMessage = null;
+
+        //only in case of a ValidationErrorMessageResolver which is configured as bean
+        if (this.messageBundleBaseName != null)
+        {
+            resourceBundle = ResourceBundle.getBundle(this.messageBundleBaseName, locale);
+            if (resourceBundle != null)
+            {
+                customMessage = resourceBundle.getString(key);
+            }
+            else
+            {
+                if(logger.isWarnEnabled())
+                {
+                    logger.warn("message bundle " + this.messageBundleBaseName + " not found");
+                }
+            }
+        }
+
+        //only in case of a ValidationErrorMessageResolver which is configured as bean
+        if (this.messageBundleVarName != null && customMessage == null)
+        {
+            resourceBundle = (ResourceBundle) ExtValUtils.getELHelper().getBean(messageBundleVarName);
+
+            if (resourceBundle != null)
+            {
+                customMessage = resourceBundle.getString(key);
+            }
+            else
+            {
+                if(logger.isWarnEnabled())
+                {
+                    logger.warn("message bundle var name " + this.messageBundleVarName + " not found");
+                }
+            }
+        }
+
+        if (customMessage != null)
+        {
+            return customMessage;
+        }
+
+        /*
+         * try to use the convention for the message bundle
+         */
+        customMessage = tryToUseMessageBundleConvention(key, locale);
+
+        if (customMessage != null)
+        {
+            return customMessage;
+        }
+
+        /*
+         * no message bundle or message found (with the convention)?
+         */
+
+        //try to load custom messages
+        try
+        {
+            resourceBundle = ResourceBundle.getBundle(getCustomBaseName(), locale);
+        }
+        catch (Throwable t)
+        {
+            //do nothing - it was just a try
+        }
+
+        if (resourceBundle != null)
+        {
+            try
+            {
+                customMessage = resourceBundle.getString(key);
+            }
+            catch (MissingResourceException e)
+            {
+                if(logger.isTraceEnabled())
+                {
+                    logger.trace("no custom message for " + key + " within " + getCustomBaseName(), e);
+                }
+            }
+        }
+
+        //use custom name (if possible) otherwise: fallback to default message (if possible)
+        try
+        {
+            return (customMessage != null) ? customMessage
+                : (getBaseName() != null) ? ResourceBundle.getBundle(getBaseName(), locale).getString(key) : null;
+        }
+        catch (MissingResourceException e)
+        {
+            return MISSING_RESOURCE_MARKER + key + MISSING_RESOURCE_MARKER;
+        }
+    }
+
+    private String tryToUseMessageBundleConvention(String key, Locale locale)
+    {
+        String customMessage = null;
+
+        if ((deactivateDefaultConvention == null || !deactivateDefaultConvention.equalsIgnoreCase("true"))
+            && isDefaultMessageBundleConventionActive())
+        {
+            if (defaultBundle == null)
+            {
+                try
+                {
+                    defaultBundle = ResourceBundle.getBundle(ExtValContext.getContext().getInformationProviderBean()
+                        .get(CustomInformation.MESSAGE_BUNDLE_NAME), locale);
+                }
+                catch (Throwable t)
+                {
+                    //do nothing
+                    deactivateDefaultConvention = "true";
+                }
+            }
+
+            if (defaultBundle != null)
+            {
+                try
+                {
+                    customMessage = defaultBundle.getString(key);
+                }
+                catch (MissingResourceException e)
+                {
+                    //do nothing
+                }
+            }
+        }
+
+        return customMessage;
+    }
+
+    protected boolean isDefaultMessageBundleConventionActive()
+    {
+        return true;
+    }
+
+    protected abstract String getBaseName();
+
+    protected String getCustomBaseName()
+    {
+        return null;
+    }
+
+    public void setMessageBundleBaseName(String messageBundleBaseName)
+    {
+        this.messageBundleBaseName = messageBundleBaseName;
+    }
+
+    public void setMessageBundleVarName(String messageBundleVarName)
+    {
+        this.messageBundleVarName = messageBundleVarName;
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultMessageResolverFactory.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.message.resolver;
+
+import org.apache.myfaces.extensions.validator.core.factory.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.factory.AbstractNameMapperAwareFactory;
+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.core.initializer.configuration.StaticConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationEntry;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Factory which creates a MessageResolver for a given ValidationStrategy
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@ToDo(value = Priority.MEDIUM, description = "add generic java api (de-/register mapping)")
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultMessageResolverFactory extends AbstractNameMapperAwareFactory<ValidationStrategy>
+        implements ClassMappingFactory<ValidationStrategy, MessageResolver>
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    private Map<String, String> strategyMessageResolverMapping;
+    private List<NameMapper<ValidationStrategy>> nameMapperList = new ArrayList<NameMapper<ValidationStrategy>>();
+
+    public DefaultMessageResolverFactory()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+
+    public MessageResolver create(ValidationStrategy validationStrategy)
+    {
+        String strategyName = validationStrategy.getClass().getName();
+
+        if (strategyMessageResolverMapping == null)
+        {
+            initStaticMappings();
+        }
+
+        if (strategyMessageResolverMapping.containsKey(strategyName))
+        {
+            return (MessageResolver) ClassUtils
+                .tryToInstantiateClassForName(strategyMessageResolverMapping.get(strategyName));
+        }
+
+        MessageResolver messageResolver;
+        String resolverName;
+        for (NameMapper<ValidationStrategy> nameMapper : nameMapperList)
+        {
+            //build convention (ValidationErrorMessageResolver)
+            resolverName = nameMapper.createName(validationStrategy);
+
+            //name wasn't mapped
+            if (resolverName == null || validationStrategy.getClass().getName().equals(resolverName))
+            {
+                continue;
+            }
+
+            messageResolver = (MessageResolver) ClassUtils.tryToInstantiateClassForName(resolverName);
+
+            if (messageResolver != null)
+            {
+                addMapping(strategyName, resolverName);
+
+                if(logger.isTraceEnabled())
+                {
+                    logger.trace(resolverName + " used for " + strategyName);
+                }
+
+                return messageResolver;
+            }
+        }
+
+        addMapping(strategyName, DefaultValidationErrorMessageResolver.class.getName());
+        return new DefaultValidationErrorMessageResolver();
+    }
+
+    private synchronized void initStaticMappings()
+    {
+        strategyMessageResolverMapping = new HashMap<String, String>();
+
+        //setup internal static mappings
+        for (StaticConfiguration<String, String> staticConfig :
+            ExtValContext.getContext().getStaticConfiguration(
+                StaticConfigurationNames.VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_CONFIG))
+        {
+            setupStrategyMappings(staticConfig.getMapping());
+        }
+    }
+
+    private void setupStrategyMappings(List<StaticConfigurationEntry<String,String>> mappings)
+    {
+        for(StaticConfigurationEntry<String, String> mapping : mappings)
+        {
+            addMapping(mapping.getSource(), mapping.getTarget());
+        }
+    }
+
+    @ToDo(value = Priority.MEDIUM, description = "logging")
+    private synchronized void addMapping(String validationStrategyName, String messageResolverName)
+    {
+        if(logger.isTraceEnabled())
+        {
+            logger.trace("adding static validation strategy to message resolver mapping: "
+                + validationStrategyName + " -> " + messageResolverName);
+        }
+
+        strategyMessageResolverMapping.put(validationStrategyName, messageResolverName);
+    }
+
+    protected List<NameMapper<ValidationStrategy>> getNameMapperList()
+    {
+        return nameMapperList;
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultValidationErrorMessageResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultValidationErrorMessageResolver.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultValidationErrorMessageResolver.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/DefaultValidationErrorMessageResolver.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.message.resolver;
+
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.InternalConventionProvider;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * Default MessageResolver which uses the default convention for the message bundle.
+ * It's possible to provide a custom message bundle via web.xml
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultValidationErrorMessageResolver extends AbstractValidationErrorMessageResolver
+{
+    private static final String CUSTOM_BUNDLE = WebXmlParameter.CUSTOM_MESSAGE_BUNDLE;
+
+    //not used at the moment - just for a convention
+    protected String getBaseName()
+    {
+        return InternalConventionProvider.getModuleMessageBundleName(getClass().getPackage().getName());
+    }
+
+    protected String getCustomBaseName()
+    {
+        return CUSTOM_BUNDLE;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/MessageResolver.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.message.resolver;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.Locale;
+
+/**
+ * Interface for MessageResolvers independent of the message source.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface MessageResolver
+{
+    String getMessage(String key, Locale locale);
+}
\ No newline at end of file

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

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

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

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultModuleValidationStrategyToMsgResolverNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultModuleValidationStrategyToMsgResolverNameMapper.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultModuleValidationStrategyToMsgResolverNameMapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultModuleValidationStrategyToMsgResolverNameMapper.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.message.resolver.mapper;
+
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.DefaultValidationErrorMessageResolver;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * In order to provide a NameMapper per validation module.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@InvocationOrder(310)
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultModuleValidationStrategyToMsgResolverNameMapper extends
+    DefaultValidationStrategyToMsgResolverNameMapper
+{
+    @Override
+    protected String getClassName(String strategyClassName)
+    {
+        return DefaultValidationErrorMessageResolver.class.getSimpleName();
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.message.resolver.mapper;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.InternalConventionProvider;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * Default implementation which maps ExtVal ValidationStrategies to ExtVal MessageResolvers.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@InvocationOrder(300)
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultValidationStrategyToMsgResolverNameMapper extends
+    AbstractValidationStrategyToMsgResolverNameMapper
+{
+    public String createName(ValidationStrategy validationStrategy)
+    {
+        return InternalConventionProvider.getMessageResolverClassName(validationStrategy.getClass(),
+                                                     getClassName(validationStrategy.getClass().getSimpleName()));
+    }
+
+    protected String getClassName(String strategyClassName)
+    {
+        return InternalConventionProvider.getMessageResolverClassName(strategyClassName);
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.message.resolver.mapper;
+
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.core.InternalConventionProvider;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * It's an alternative Mapper to place ValidationStrategies and MessageResolvers in the same package.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@InvocationOrder(400)
+@UsageInformation({UsageCategory.INTERNAL})
+public class SimpleValidationStrategyToMsgResolverNameMapper extends
+    DefaultValidationStrategyToMsgResolverNameMapper
+{
+    protected String getClassName(String strategyClassName)
+    {
+        String customPostfix = ExtValContext.getContext().getInformationProviderBean()
+            .get(CustomInformation.VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX);
+        return InternalConventionProvider.getValidationStrategyBasedName(strategyClassName, customPostfix);
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,400 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Map;
+import java.util.List;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.WildcardType;
+import java.lang.reflect.Modifier;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultValidationParameterExtractor implements ValidationParameterExtractor
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    public Map<Object, List<Object>> extract(Annotation annotation)
+    {
+        return extractById(annotation, null);
+    }
+
+    public List<Object> extract(Annotation annotation, Object key)
+    {
+        return extractById(annotation, key, null);
+    }
+
+    public <T> List<T> extract(Annotation annotation, Object key, Class<T> valueType)
+    {
+        return extractById(annotation, key, valueType, null);
+    }
+
+    public <T> T extract(Annotation annotation, Object key, Class<T> valueType, Class valueId)
+    {
+        List<T> results = extractById(annotation, key, valueType, valueId);
+
+        if(results.iterator().hasNext())
+        {
+            return results.iterator().next();
+        }
+
+        return null;
+    }
+
+    @SuppressWarnings({"unchecked"})
+    public <T> List<T> extractById(Annotation annotation, Object key, Class<T> valueType, Class valueId)
+    {
+        List<Object> result = new ArrayList<Object>();
+
+        for(Object entry : extractById(annotation, key, valueId))
+        {
+            if(valueType.isAssignableFrom(entry.getClass()))
+            {
+                result.add(entry);
+            }
+        }
+
+        return (List<T>)result;
+    }
+
+    public List<Object> extractById(Annotation annotation, Object key, Class valueId)
+    {
+        Map<Object, List<Object>> fullResult = extractById(annotation, valueId);
+
+        if(fullResult.containsKey(key))
+        {
+            return fullResult.get(key);
+        }
+
+        return new ArrayList<Object>();
+    }
+
+    @ToDo(value = Priority.MEDIUM, description = "add web.xml parameter for performance tuning to deactivate the scan")
+    public Map<Object, List<Object>> extractById(Annotation annotation, Class valueId)
+    {
+        Map<Object, List<Object>> result = new HashMap<Object, List<Object>>();
+
+        for(Method currentAnnotationAttribute : annotation.annotationType().getDeclaredMethods())
+        {
+            try
+            {
+                if(!isValidationParameter(currentAnnotationAttribute.getGenericReturnType()))
+                {
+                    continue;
+                }
+
+                Object parameterValue = currentAnnotationAttribute.invoke(annotation);
+
+                if(parameterValue instanceof Class[])
+                {
+                    for(Class currentParameterValue : (Class[])parameterValue)
+                    {
+                        //keep check so that following is true:
+                        //if at least one parameter is found which tells that it isn't a blocking error, let it pass
+                        processParameterValue(annotation, currentParameterValue, result, valueId);
+                    }
+                }
+                else if(parameterValue instanceof Class)
+                {
+                    //keep check so that following is true:
+                    //if at least one parameter is found which tells that it isn't a blocking error, let it pass
+                    processParameterValue(annotation, (Class)parameterValue, result, valueId);
+                }
+            }
+            catch (Throwable e)
+            {
+                if(this.logger.isWarnEnabled())
+                {
+                    this.logger.warn(e);
+                }
+            }
+        }
+
+        return result;
+    }
+
+    /*
+     * don't use the Introspector in this case
+     * if you have a better solution which supports all supported parameter styles (see extval wiki),
+     * you can impl. it and use it (exchange the impls. via the ExtValContext).
+     * furthermore, you can provide the fix for the community
+     */
+    private void processParameterValue(
+            Annotation annotation, Class paramClass, Map<Object, List<Object>> result, Class valueId) throws Exception
+    {
+        Object key = null;
+        List<Object> parameterValues = new ArrayList<Object>();
+
+        if(ValidationParameter.class.isAssignableFrom(paramClass))
+        {
+            List<Field> processedFields = new ArrayList<Field>();
+            List<Method> processedMethods = new ArrayList<Method>();
+
+            Class currentParamClass = paramClass;
+            while (currentParamClass != null && !Object.class.getName().equals(currentParamClass.getName()))
+            {
+                /*
+                 * process class
+                 */
+                //support pure interface approach e.g. ViolationSeverity.Warn.class
+                for(Field currentField : currentParamClass.getDeclaredFields())
+                {
+                    if(!processedFields.contains(currentField))
+                    {
+                        key = processFoundField(annotation, currentField, parameterValues, key, valueId);
+                        processedFields.add(currentField);
+                    }
+                }
+
+                //inspect the other methods of the implementing class
+                for(Method currentMethod : currentParamClass.getDeclaredMethods())
+                {
+                    if(!processedMethods.contains(currentMethod))
+                    {
+                        key = processFoundMethod(currentParamClass, currentMethod, parameterValues, key, valueId);
+                        processedMethods.add(currentMethod);
+                    }
+                }
+
+                /*
+                 * process interfaces
+                 */
+                for(Class currentInterface : currentParamClass.getInterfaces())
+                {
+                    if(!ValidationParameter.class.isAssignableFrom(currentInterface))
+                    {
+                        continue;
+                    }
+
+                    //support interface + impl. approach e.g. MyParamImpl.class
+                    //(MyParamImpl implements MyParam
+                    //MyParam extends ValidationParameter
+                    //methods in the interface have to be marked with @ParameterValue and @ParameterKey
+                    for(Method currentMethod : currentInterface.getDeclaredMethods())
+                    {
+                        if(!processedMethods.contains(currentMethod))
+                        {
+                            key = processFoundMethod(currentParamClass, currentMethod, parameterValues, key, valueId);
+                            processedMethods.add(currentMethod);
+                        }
+                    }
+
+                    for(Field currentField : currentInterface.getDeclaredFields())
+                    {
+                        if(!processedFields.contains(currentField))
+                        {
+                            key = processFoundField(annotation, currentField, parameterValues, key, valueId);
+                            processedFields.add(currentField);
+                        }
+                    }
+                }
+
+                currentParamClass = currentParamClass.getSuperclass();
+            }
+        }
+
+        key = createDefaultKey(key, paramClass);
+
+        if(parameterValues.isEmpty())
+        {
+            //@ParameterValue is optional as well
+            parameterValues.add(key);
+        }
+
+        if(result.containsKey(key))
+        {
+            result.get(key).addAll(parameterValues);
+        }
+        else
+        {
+            result.put(key, parameterValues);
+        }
+    }
+
+    private Object createDefaultKey(Object key, Class currentClass)
+    {
+        if(key == null)
+        {
+            //check for super-interface (exclude ValidationParameter itself)
+            for(Class interfaceClass : currentClass.getInterfaces())
+            {
+                if(ValidationParameter.class.isAssignableFrom(interfaceClass) &&
+                        (!interfaceClass.getName().equals(ValidationParameter.class.getName())))
+                {
+                    key = interfaceClass;
+                    break;
+                }
+            }
+        }
+
+        if(key == null)
+        {
+            key = currentClass;
+        }
+
+        return key;
+    }
+
+    private Object processFoundField(
+            Object instance, Field currentField, List<Object> paramValues, Object key, Class valueId)
+    {
+        Object newKey = null;
+        if(key == null && currentField.isAnnotationPresent(ParameterKey.class))
+        {
+            try
+            {
+                newKey = currentField.get(instance);
+            }
+            catch (Throwable e)
+            {
+                if(this.logger.isWarnEnabled())
+                {
+                    this.logger.warn(e);
+                }
+            }
+        }
+        //no "else if" to allow both at one field
+        if(currentField.isAnnotationPresent(ParameterValue.class))
+        {
+            if(valueId == null || valueId.equals(currentField.getAnnotation(ParameterValue.class).id()))
+            {
+                currentField.setAccessible(true);
+                try
+                {
+                    paramValues.add(currentField.get(instance));
+                }
+                catch (Throwable e)
+                {
+                    if(this.logger.isWarnEnabled())
+                    {
+                        this.logger.warn(e);
+                    }
+                }
+            }
+        }
+
+        return newKey != null ? newKey : key;
+    }
+
+    private Object processFoundMethod(
+            Class paramClass, Method currentMethod, List<Object> parameterValues, Object key, Class valueId)
+    {
+        Object newKey = null;
+        if(key == null && currentMethod.isAnnotationPresent(ParameterKey.class))
+        {
+            try
+            {
+                if(!(Modifier.isAbstract(paramClass.getModifiers()) || Modifier.isInterface(paramClass.getModifiers())))
+                {
+                    newKey = currentMethod.invoke(paramClass.newInstance());
+                }
+            }
+            catch (Throwable e)
+            {
+                if(this.logger.isWarnEnabled())
+                {
+                    this.logger.warn(e);
+                }
+            }
+        }
+        //no "else if" to allow both at one field
+        if(currentMethod.isAnnotationPresent(ParameterValue.class))
+        {
+            if(valueId == null || valueId.equals(currentMethod.getAnnotation(ParameterValue.class).id()))
+            {
+                currentMethod.setAccessible(true);
+                try
+                {
+                    parameterValues.add(currentMethod.invoke(paramClass.newInstance()));
+                }
+                catch (Throwable e)
+                {
+                    //check if it's a none-static inner class -> return this class
+                    if(paramClass.getEnclosingClass() != null)
+                    {
+                        parameterValues.add(paramClass);
+                    }
+                    else if(this.logger.isWarnEnabled())
+                    {
+                        this.logger.warn(e);
+                    }
+                }
+            }
+        }
+
+        return newKey != null ? newKey : key;
+    }
+
+    private boolean isValidationParameter(Type genericReturnType)
+    {
+        if(genericReturnType instanceof GenericArrayType)
+        {
+            if(((GenericArrayType)genericReturnType).getGenericComponentType() instanceof ParameterizedType)
+            {
+                return analyzeParameterizedType(
+                        (ParameterizedType)((GenericArrayType)genericReturnType).getGenericComponentType());
+            }
+        }
+        else if(genericReturnType instanceof ParameterizedType)
+        {
+            return analyzeParameterizedType(
+                    (ParameterizedType)genericReturnType);
+        }
+
+        return false;
+    }
+
+    private boolean analyzeParameterizedType(ParameterizedType parameterizedType)
+    {
+        for(Type type : parameterizedType.getActualTypeArguments())
+        {
+            if(type instanceof WildcardType)
+            {
+                for(Type upperBounds : ((WildcardType)type).getUpperBounds())
+                {
+                    if(upperBounds instanceof Class &&
+                            //for attributes like: Class<? extends InheritedFromValidationParameter> value();
+                            ValidationParameter.class.isAssignableFrom((Class)upperBounds))
+                    {
+                        return true;
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractorFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractorFactory.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractorFactory.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractorFactory.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultValidationParameterExtractorFactory implements ValidationParameterExtractorFactory
+{
+    private final Log logger = LogFactory.getLog(getClass());
+
+    private static ValidationParameterExtractor validationParameterExtractor = null;
+
+    public DefaultValidationParameterExtractorFactory()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+
+    public ValidationParameterExtractor create()
+    {
+        if (validationParameterExtractor == null)
+        {
+            List<String> validationParameterExtractorClassNames = new ArrayList<String>();
+
+            validationParameterExtractorClassNames.add(WebXmlParameter.CUSTOM_VALIDATION_PARAMETER_EXTRACTOR);
+            validationParameterExtractorClassNames
+                .add(ExtValContext.getContext().getInformationProviderBean()
+                    .get(CustomInformation.VALIDATION_PARAMETER_EXTRACTOR));
+            validationParameterExtractorClassNames.add(DefaultValidationParameterExtractor.class.getName());
+
+            for (String className : validationParameterExtractorClassNames)
+            {
+                validationParameterExtractor = (ValidationParameterExtractor)
+                        ClassUtils.tryToInstantiateClassForName(className);
+
+                if (validationParameterExtractor != null)
+                {
+                    break;
+                }
+            }
+        }
+
+        if(logger.isTraceEnabled())
+        {
+            logger.trace(validationParameterExtractor.getClass().getName() + " created");
+        }
+
+        return validationParameterExtractor;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultViolationSeverityInterpreter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultViolationSeverityInterpreter.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultViolationSeverityInterpreter.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultViolationSeverityInterpreter.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.application.FacesMessage;
+
+/**
+ * mechanism to change the default behavior of extval
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultViolationSeverityInterpreter implements ViolationSeverityInterpreter
+{
+    public boolean severityBlocksNavigation(
+            FacesContext facesContext, UIComponent uiComponent, FacesMessage.Severity severity)
+    {
+        return FacesMessage.SEVERITY_ERROR.equals(severity) || FacesMessage.SEVERITY_FATAL.equals(severity);
+    }
+
+    public boolean severityCausesValidatorException(
+            FacesContext facesContext, UIComponent uiComponent, FacesMessage.Severity severity)
+    {
+        return FacesMessage.SEVERITY_ERROR.equals(severity) || FacesMessage.SEVERITY_FATAL.equals(severity);
+    }
+
+    public boolean severityCausesViolationMessage(
+            FacesContext facesContext, UIComponent uiComponent, FacesMessage.Severity severity)
+    {
+        return true;
+    }
+
+    public boolean severityBlocksSubmit(
+            FacesContext facesContext, UIComponent uiComponent, FacesMessage.Severity severity)
+    {
+        return FacesMessage.SEVERITY_ERROR.equals(severity) || FacesMessage.SEVERITY_FATAL.equals(severity);
+    }
+
+    public boolean severityShowsIndication(
+            FacesContext facesContext, UIComponent uiComponent, FacesMessage.Severity severity)
+    {
+        return FacesMessage.SEVERITY_ERROR.equals(severity) || FacesMessage.SEVERITY_FATAL.equals(severity);
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientSideValidation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientSideValidation.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientSideValidation.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientSideValidation.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.API)
+public interface DisableClientSideValidation extends ValidationParameter
+{
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterKey.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface ParameterKey
+{
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ParameterValue.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@UsageInformation(UsageCategory.API)
+public @interface ParameterValue
+{
+    Class id() default ParameterValue.class;
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameter.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.API)
+public interface ValidationParameter
+{
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractor.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractor.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractor.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import java.util.Map;
+import java.util.List;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.API)
+public interface ValidationParameterExtractor
+{
+    Map<Object, List<Object>> extract(Annotation annotation);
+    List<Object> extract(Annotation annotation, Object key);
+    <T> List<T> extract(Annotation annotation, Object key, Class<T> valueType);
+    <T> T extract(Annotation annotation, Object key, Class<T> valueType, Class valueId);
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractorFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractorFactory.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractorFactory.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ValidationParameterExtractorFactory.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.API)
+public interface ValidationParameterExtractorFactory
+{
+    ValidationParameterExtractor create();
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverity.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.API)
+public interface ViolationSeverity
+{
+    interface Info extends ValidationParameter
+    {
+        @ParameterKey
+        public Class KEY = ViolationSeverity.class;
+                
+        @ParameterValue
+        public FacesMessage.Severity SEVERITY = FacesMessage.SEVERITY_INFO;
+
+        //@ParameterValue
+        //MessageType postfix = MessageType.INFO;
+    }
+
+    interface Warn extends ValidationParameter
+    {
+        @ParameterKey
+        public Class KEY = ViolationSeverity.class;
+
+        @ParameterValue
+        FacesMessage.Severity SEVERITY = FacesMessage.SEVERITY_WARN;
+
+        //@ParameterValue
+        //MessageType postfix = MessageType.WARN;
+    }
+
+    interface Error extends ValidationParameter
+    {
+        @ParameterKey
+        public Class KEY = ViolationSeverity.class;
+
+        @ParameterValue
+        FacesMessage.Severity SEVERITY = FacesMessage.SEVERITY_ERROR;
+
+        //@ParameterValue
+        //MessageType postfix = MessageType.ERROR;
+    }
+
+    interface Fatal extends ValidationParameter
+    {
+        @ParameterKey
+        public Class KEY = ViolationSeverity.class;
+
+        @ParameterValue
+        FacesMessage.Severity SEVERITY = FacesMessage.SEVERITY_FATAL;
+
+        //@ParameterValue
+        //MessageType postfix = MessageType.FATAL;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverityInterpreter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverityInterpreter.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverityInterpreter.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ViolationSeverityInterpreter.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.parameter;
+
+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.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.application.FacesMessage;
+
+/**
+ * mechanism to change the default behavior of extval
+ * 
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.API)
+public interface ViolationSeverityInterpreter
+{
+    /**
+     * @param facesContext current faces context
+     * @param uiComponent current component
+     * @param severity jsf severity for faces messages
+     * @return true if the given severity should block the navigation
+     * if #severityCausesValidatorException returns falls validation will be continued for the current property
+     * all messages which don't lead to an exception should be stored in an storage and
+     * added after the first message which gets thrown as exception
+     * a global PropertyValidationInterceptor add the messages of the storage as faces message
+     */
+    boolean severityBlocksNavigation(
+            FacesContext facesContext, UIComponent uiComponent, FacesMessage.Severity severity);
+
+    /**
+     * @param facesContext current faces context
+     * @param uiComponent current component
+     * @param severity jsf severity for faces messages
+     * @return true if the given severity should cause a validator exception
+     */
+    boolean severityCausesValidatorException(
+            FacesContext facesContext, UIComponent uiComponent, FacesMessage.Severity severity);
+
+    /**
+     *
+     * @param facesContext current faces context
+     * @param uiComponent current component
+     * @param severity jsf severity for faces messages
+     * @return true if a violation message leads to a faces message
+     */
+    boolean severityCausesViolationMessage(
+            FacesContext facesContext, UIComponent uiComponent, FacesMessage.Severity severity);
+
+    /**
+     * @param facesContext current faces context
+     * @param uiComponent current component
+     * @param severity jsf severity for faces messages
+     * @return true if the constraint with the given severity should be validated on the client side (if supported)
+     */
+    boolean severityBlocksSubmit(
+            FacesContext facesContext, UIComponent uiComponent, FacesMessage.Severity severity);
+
+    /**
+     * available for add-ons not used internally due to performance reasons
+     *
+     * @param facesContext current faces context
+     * @param uiComponent current component
+     * @param severity jsf severity for faces messages
+     * @return true if the constraint with the given severity
+     * should cause e.g. a required marker independent of client-side validation (if supported)
+     */
+    @ToDo(Priority.HIGH)
+    boolean severityShowsIndication(
+            FacesContext facesContext, UIComponent uiComponent, FacesMessage.Severity severity);
+}