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 [10/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/ com...

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.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/strategy/AbstractAnnotationValidationStrategy.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/strategy/AbstractAnnotationValidationStrategy.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,110 @@
+/*
+ * 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.strategy;
+
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.MessageResolver;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+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 javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.validator.ValidatorException;
+import java.lang.annotation.Annotation;
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+/**
+ * Provides the ability of message resolving to ValidationStrategies
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.REUSE})
+public abstract class AbstractAnnotationValidationStrategy<A extends Annotation> extends AbstractValidationStrategy
+{
+    protected static final String DETAIL_MESSAGE_KEY_POSTFIX = "_detail";
+    //e.g. for injecting a message resolver via spring
+    private MessageResolver messageResolver;
+
+    protected String resolveMessage(String key)
+    {
+        Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
+
+        return this.messageResolver != null ? this.messageResolver.getMessage(key, locale) :
+            ExtValUtils.getMessageResolverForValidationStrategy(this).getMessage(key, locale);
+    }
+
+    protected String getErrorMessageSummary(A annotation)
+    {
+        return resolveMessage(getValidationErrorMsgKey(annotation));
+    }
+
+    protected String getErrorMessageDetail(A annotation)
+    {
+        try
+        {
+            String key = getValidationErrorMsgKey(annotation);
+            return (key != null) ? resolveMessage(key + DETAIL_MESSAGE_KEY_POSTFIX) : null;
+        }
+        catch (MissingResourceException e)
+        {
+            if(logger.isWarnEnabled())
+            {
+                logger.warn("couldn't find key " + getValidationErrorMsgKey(annotation) + DETAIL_MESSAGE_KEY_POSTFIX,
+                        e);
+            }
+        }
+        return null;
+    }
+
+    protected FacesMessage getValidationErrorFacesMessage(A annotation)
+    {
+        return ExtValUtils.createFacesMessage(getErrorMessageSummary(annotation), getErrorMessageDetail(annotation));
+    }
+
+    protected abstract String getValidationErrorMsgKey(A annotation);
+
+    public void setMessageResolver(MessageResolver messageResolver)
+    {
+        this.messageResolver = messageResolver;
+    }
+
+    @Override
+    protected boolean processAfterValidatorException(FacesContext facesContext,
+                                                     UIComponent uiComponent,
+                                                     MetaDataEntry metaDataEntry,
+                                                     Object convertedObject,
+                                                     ValidatorException validatorException)
+    {
+        metaDataEntry.setProperty(PropertyInformationKeys.LABEL, getLabel(facesContext, uiComponent, metaDataEntry));
+
+        return super.processAfterValidatorException(
+                facesContext, uiComponent, metaDataEntry, convertedObject, validatorException);
+    }
+
+    //for custom annotations - override if needed
+    protected String getLabel(FacesContext facesContext, UIComponent uiComponent, MetaDataEntry metaDataEntry)
+    {
+        return null;
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.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/strategy/AbstractValidationStrategy.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/strategy/AbstractValidationStrategy.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,147 @@
+/*
+ * 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.strategy;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.validation.exception.RequiredValidatorException;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * Provides the ability to use ValidatorException (as expected by the user) instead of ConverterException.
+ * Furthermore it provides:<br/>
+ * initValidation<br/>
+ * processAfterValidatorException
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.REUSE})
+public abstract class AbstractValidationStrategy implements ValidationStrategy
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    protected AbstractValidationStrategy()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+
+    public void validate(FacesContext facesContext, UIComponent uiComponent,
+                         MetaDataEntry metaDataEntry, Object convertedObject)
+    {
+        if(logger.isTraceEnabled())
+        {
+            logger.trace("start initValidation of " + getClass().getName());
+        }
+
+        initValidation(facesContext, uiComponent, metaDataEntry, convertedObject);
+
+        if(logger.isTraceEnabled())
+        {
+            logger.trace("initValidation of " + getClass().getName() + " finished");
+        }
+
+        try
+        {
+            if(logger.isTraceEnabled())
+            {
+                logger.trace("start processValidation of " + getClass().getName());
+            }
+
+            processValidation(facesContext, uiComponent, metaDataEntry, convertedObject);
+
+            if(logger.isTraceEnabled())
+            {
+                logger.trace("processValidation of " + getClass().getName() + " finished");
+            }
+        }
+        catch (ValidatorException e)
+        {
+            if(logger.isTraceEnabled())
+            {
+                logger.trace("start processAfterValidatorException of " + getClass().getName());
+            }
+
+            ValidatorException validatorException;
+
+            if(e instanceof RequiredValidatorException)
+            {
+                validatorException = new RequiredValidatorException(
+                        ExtValUtils.convertFacesMessage(e.getFacesMessage()), e.getCause());
+            }
+            else
+            {
+                validatorException = new ValidatorException(
+                        ExtValUtils.convertFacesMessage(e.getFacesMessage()), e.getCause());
+            }
+            
+            if (processAfterValidatorException(
+                    facesContext, uiComponent, metaDataEntry, convertedObject, validatorException))
+            {
+                if(logger.isTraceEnabled())
+                {
+                    logger.trace(getClass().getName() +
+                        ": throw original exception after processAfterValidatorException");
+                }
+
+                ExtValUtils.tryToThrowValidatorExceptionForComponent(
+                        uiComponent, validatorException.getFacesMessage(), validatorException);
+            }
+
+            if(logger.isTraceEnabled())
+            {
+                logger.trace(getClass().getName() +
+                    ": original exception after processAfterValidatorException not thrown");
+            }
+        }
+    }
+
+    protected void initValidation(FacesContext facesContext,
+                                  UIComponent uiComponent,
+                                  MetaDataEntry metaDataEntry,
+                                  Object convertedObject)
+    {
+        //override if needed
+    }
+
+    //override if needed
+    protected boolean processAfterValidatorException(FacesContext facesContext,
+                                                     UIComponent uiComponent,
+                                                     MetaDataEntry metaDataEntry,
+                                                     Object convertedObject,
+                                                     ValidatorException validatorException)
+    {
+        return ExtValUtils.executeAfterThrowingInterceptors(
+                uiComponent, metaDataEntry, convertedObject, validatorException, this);
+    }
+
+    protected abstract void processValidation(FacesContext facesContext,
+                                              UIComponent uiComponent, MetaDataEntry metaDataEntry,
+                                              Object convertedObject) throws ValidatorException;
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractVirtualValidationStrategy.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/strategy/AbstractVirtualValidationStrategy.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/strategy/AbstractVirtualValidationStrategy.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractVirtualValidationStrategy.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.strategy;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+
+/**
+ * to map constraints directly to a meta-data transformer if there is no validation strategy (required by jsr 303)
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.REUSE)
+public abstract class AbstractVirtualValidationStrategy implements IdentifiableValidationStrategy
+{
+    public final void validate(
+            FacesContext facesContext, UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject)
+    {
+        throw new UnsupportedOperationException("this is just an adapter e.g. for component initialization");
+    }
+}
\ 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/strategy/BeanValidationStrategyAdapter.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/strategy/BeanValidationStrategyAdapter.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/strategy/BeanValidationStrategyAdapter.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapter.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,41 @@
+/*
+ * 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.strategy;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * it's just a helper for proxies - you just need it, if you define the validation strategy as bean and
+ * e.g. spring creates a proxy for it.
+
+ * adapter to connect validation strategies with meta-data transformers,
+ * if the validation strategy is defined as bean and e.g. spring creates a proxy
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.REUSE})
+public interface BeanValidationStrategyAdapter extends ValidationStrategy
+{
+    //to get back the internal cashing
+    String getValidationStrategyClassName();
+
+    String getMetaDataTransformerClassName();
+}
\ 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/strategy/BeanValidationStrategyAdapterImpl.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/strategy/BeanValidationStrategyAdapterImpl.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/strategy/BeanValidationStrategyAdapterImpl.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/BeanValidationStrategyAdapterImpl.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,123 @@
+/*
+ * 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.strategy;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.MetaDataTransformer;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.BeanMetaDataTransformerAdapter;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * it's just a helper for proxies - you just need it, if you define the validation strategy as bean and
+ * e.g. spring creates a proxy for it.
+
+ * adapter to connect validation strategies with meta-data transformers,
+ * if the validation strategy is defined as bean and e.g. spring creates a proxy
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.REUSE})
+public class BeanValidationStrategyAdapterImpl implements BeanValidationStrategyAdapter
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    private MetaDataTransformer metaDataTransformer;
+    private ValidationStrategy validationStrategy;
+    //optional fallback for internal cashing
+    private String validationStrategyClassName;
+
+    public BeanValidationStrategyAdapterImpl()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+
+    public void validate(FacesContext facesContext,
+                         UIComponent uiComponent,
+                         MetaDataEntry metaDataEntry,
+                         Object convertedObject)
+    {
+        this.validationStrategy.validate(facesContext, uiComponent, metaDataEntry, convertedObject);
+    }
+
+    public String getValidationStrategyClassName()
+    {
+        if(validationStrategy.getClass().getPackage() != null)
+        {
+            return validationStrategy.getClass().getName();
+        }
+        return validationStrategyClassName;
+    }
+
+    public String getMetaDataTransformerClassName()
+    {
+        if(metaDataTransformer != null)
+        {
+            if(metaDataTransformer.getClass().getPackage() != null)
+            {
+                return metaDataTransformer.getClass().getName();
+            }
+            else
+            {
+                if(metaDataTransformer instanceof BeanMetaDataTransformerAdapter)
+                {
+                    return ((BeanMetaDataTransformerAdapter) metaDataTransformer ).getMetaDataTransformerClassName();
+                }
+            }
+        }
+        return null;
+    }
+
+    /*
+     * generated
+     */
+    public MetaDataTransformer getMetaDataTransformer()
+    {
+        return metaDataTransformer;
+    }
+
+    public void setMetaDataTransformer(MetaDataTransformer metaDataTransformer)
+    {
+        this.metaDataTransformer = metaDataTransformer;
+    }
+
+    public ValidationStrategy getValidationStrategy()
+    {
+        return validationStrategy;
+    }
+
+    public void setValidationStrategy(ValidationStrategy validationStrategy)
+    {
+        this.validationStrategy = validationStrategy;
+    }
+
+    public void setValidationStrategyClassName(String validationStrategyClassName)
+    {
+        this.validationStrategyClassName = validationStrategyClassName;
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.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/strategy/DefaultValidationStrategyFactory.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/strategy/DefaultValidationStrategyFactory.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,189 @@
+/*
+ * 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.strategy;
+
+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.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInformation;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+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.initializer.configuration.StaticResourceBundleConfiguration;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper
+    .AnnotationToValidationStrategyBeanNameMapper;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+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;
+import java.util.MissingResourceException;
+
+
+/**
+ * Factory which creates the ValidationStrategy for a given Meta-Data Key
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultValidationStrategyFactory extends AbstractNameMapperAwareFactory<String>
+        implements ClassMappingFactory<String, ValidationStrategy>
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    private Map<String, String> metaDataKeyToValidationStrategyMapping = null;
+    private List<NameMapper<String>> nameMapperList = new ArrayList<NameMapper<String>>();
+
+    public DefaultValidationStrategyFactory()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+
+    public ValidationStrategy create(String metaDataKey)
+    {
+        if (metaDataKeyToValidationStrategyMapping == null)
+        {
+            initStaticMappings();
+        }
+
+        if (metaDataKeyToValidationStrategyMapping.containsKey(metaDataKey))
+        {
+            return getValidationStrategyInstance(metaDataKeyToValidationStrategyMapping.get(metaDataKey));
+        }
+
+        ValidationStrategy validationStrategy;
+        String strategyName;
+        //null -> use name mappers
+        for (NameMapper<String> nameMapper : nameMapperList)
+        {
+            strategyName = nameMapper.createName(metaDataKey);
+
+            if (strategyName == null)
+            {
+                continue;
+            }
+
+            validationStrategy = getValidationStrategyInstance(strategyName);
+
+            if (validationStrategy != null)
+            {
+                addMapping(metaDataKey, strategyName);
+                return validationStrategy;
+            }
+        }
+        return null;
+    }
+
+    private ValidationStrategy getValidationStrategyInstance(String validationStrategyName)
+    {
+        if (validationStrategyName
+            .startsWith(AnnotationToValidationStrategyBeanNameMapper.PREFIX_FOR_BEAN_MAPPING))
+        {
+            return (ValidationStrategy) ExtValUtils.getELHelper().getBean(validationStrategyName
+                    .substring(AnnotationToValidationStrategyBeanNameMapper.PREFIX_FOR_BEAN_MAPPING.length()));
+        }
+        else
+        {
+            return (ValidationStrategy) ClassUtils.tryToInstantiateClassForName(validationStrategyName);
+        }
+    }
+
+    private synchronized void addMapping(String metaDataKey, String validationStrategyName)
+    {
+        if(logger.isTraceEnabled())
+        {
+            logger.trace("adding meta-data key to validation strategy mapping: "
+                + metaDataKey + " -> " + validationStrategyName);
+        }
+
+        metaDataKeyToValidationStrategyMapping.put(metaDataKey, validationStrategyName);
+    }
+
+    @ToDo(value = Priority.MEDIUM, description = "logging")
+    private synchronized void initStaticMappings()
+    {
+        metaDataKeyToValidationStrategyMapping = new HashMap<String, String>();
+
+        //setup internal static mappings
+        for (StaticConfiguration<String, String> staticConfig :
+            ExtValContext.getContext().getStaticConfiguration(
+                StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG))
+        {
+            setupStrategyMappings(staticConfig.getMapping());
+        }
+
+        StaticConfiguration<String, String> staticConfig = new StaticResourceBundleConfiguration();
+        //try to setup mapping with base name by convention - overrides default mapping
+        try
+        {
+            //build convention (strategy mapping)
+            staticConfig.setSourceOfMapping(ExtValContext.getContext().getInformationProviderBean()
+                .get(CustomInformation.STATIC_STRATEGY_MAPPING_SOURCE));
+
+            setupStrategyMappings(staticConfig.getMapping());
+        }
+        catch (Throwable t)
+        {
+            //do nothing - it was just a try
+        }
+
+        //setup custom mapping - overrides all other mappings
+        String customMappingBaseName = WebXmlParameter.CUSTOM_STATIC_VALIDATION_STRATEGY_MAPPING;
+        if (customMappingBaseName != null)
+        {
+            try
+            {
+                staticConfig = new StaticResourceBundleConfiguration();
+                staticConfig.setSourceOfMapping(customMappingBaseName);
+                setupStrategyMappings(staticConfig.getMapping());
+            }
+            catch (MissingResourceException e)
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private void setupStrategyMappings(List<StaticConfigurationEntry<String,String>> mappings)
+    {
+        for(StaticConfigurationEntry<String, String> mapping : mappings)
+        {
+            addMapping(mapping.getSource(), mapping.getTarget());
+        }
+    }
+
+    protected List<NameMapper<String>> getNameMapperList()
+    {
+        return this.nameMapperList;
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/IdentifiableValidationStrategy.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/strategy/IdentifiableValidationStrategy.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/strategy/IdentifiableValidationStrategy.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/IdentifiableValidationStrategy.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.strategy;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * if an adapter is used for several constraints, this interface allows to identify instances
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.REUSE)
+public interface IdentifiableValidationStrategy extends ValidationStrategy
+{
+    String ID_PREFIX = ":";
+
+    String getId();
+}
\ 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/strategy/ValidationStrategy.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/strategy/ValidationStrategy.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/strategy/ValidationStrategy.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.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.strategy;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * Base interface for ValidationStrategies
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+//*ValidationStrategy instead of *Validator to avoid naming confusion 
+public interface ValidationStrategy
+{
+    void validate(FacesContext facesContext, UIComponent uiComponent,
+                  MetaDataEntry metaDataEntry, Object convertedObject);
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AbstractMetaDataToValidationStrategyNameMapper.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/strategy/mapper/AbstractMetaDataToValidationStrategyNameMapper.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/strategy/mapper/AbstractMetaDataToValidationStrategyNameMapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AbstractMetaDataToValidationStrategyNameMapper.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+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 AbstractMetaDataToValidationStrategyNameMapper implements NameMapper<String>
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    public AbstractMetaDataToValidationStrategyNameMapper()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AnnotationToValidationStrategyBeanNameMapper.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/strategy/mapper/AnnotationToValidationStrategyBeanNameMapper.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/strategy/mapper/AnnotationToValidationStrategyBeanNameMapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/AnnotationToValidationStrategyBeanNameMapper.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * Name Mapper which delegates the name mapping, extract the name and convert it to a bean name + prefix
+ * target: configure a validation strategy via a managed bean facility -> allows to inject other beans
+ * instead of api calls + hardcoded bean names
+ * <p/>
+ * allowed bean scopes:
+ * the validation strategy is stateless: application/singleton
+ * the validation strategy is stateful: none/prototype
+ * don't use the session or a conversation scope
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@InvocationOrder(500)
+@UsageInformation(UsageCategory.INTERNAL)
+public class AnnotationToValidationStrategyBeanNameMapper extends AbstractMetaDataToValidationStrategyNameMapper
+{
+    public static final String PREFIX_FOR_BEAN_MAPPING = "bean:";
+    private NameMapper<String> wrapped;
+
+    public AnnotationToValidationStrategyBeanNameMapper(NameMapper<String> nameMapper)
+    {
+        this.wrapped = nameMapper;
+    }
+
+    public String createName(String source)
+    {
+        String name = wrapped.createName(source);
+
+        if (name == null)
+        {
+            return null;
+        }
+
+        name = name.substring(name.lastIndexOf(".") + 1);
+        return PREFIX_FOR_BEAN_MAPPING + name.substring(0, 1).toLowerCase() + name.substring(1);
+    }
+}

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

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.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/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.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/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,47 @@
+/*
+ * 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.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.AbstractCustomNameMapper;
+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 Annotations to ValidationStrategies.
+ * (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 CustomConventionAnnotationToValidationStrategyNameMapper extends
+    AbstractCustomNameMapper<String>
+{
+    protected String getCustomNameMapperClassName()
+    {
+        return ExtValContext.getContext().getInformationProviderBean()
+            .get(CustomInformation.META_DATA_TO_VALIDATION_STRATEGY_NAME_MAPPER);
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.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/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.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/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.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.strategy.mapper;
+
+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 Annotations to ExtVal ValidationStrategies.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@InvocationOrder(300)
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultAnnotationToValidationStrategyNameMapper extends AbstractMetaDataToValidationStrategyNameMapper
+{
+    public String createName(String metaDataKey)
+    {
+        return InternalConventionProvider.getValidationStrategyClassName(metaDataKey);
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.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/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.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/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.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.strategy.mapper;
+
+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;
+
+/**
+ * It's an alternative Mapper to place Annotations and ValidationStrategies in the same package.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@InvocationOrder(400)
+@UsageInformation({UsageCategory.INTERNAL})
+public class SimpleAnnotationToValidationStrategyNameMapper extends AbstractMetaDataToValidationStrategyNameMapper
+{
+    public String createName(String metaDataKey)
+    {
+        return metaDataKey +
+            ExtValContext.getContext().getInformationProviderBean().get(CustomInformation.VALIDATION_STRATEGY_POSTFIX);
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/internal/Priority.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/internal/Priority.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/internal/Priority.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/internal/Priority.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.internal;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public enum Priority
+{
+    BLOCKING,
+    HIGH,
+    MEDIUM,
+    LOW
+}
\ 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/internal/ToDo.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/internal/ToDo.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/internal/ToDo.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/internal/ToDo.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.internal;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import java.lang.annotation.Target;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@Target({TYPE, METHOD, FIELD, CONSTRUCTOR})
+public @interface ToDo
+{
+    Priority value();
+    String description() default "";
+
+    @Target({TYPE, METHOD, FIELD})
+    @interface List
+    {
+        ToDo[] value();
+    }
+}
\ 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/internal/UsageCategory.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/internal/UsageCategory.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageCategory.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageCategory.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.internal;
+
+/**
+ * API:<br/>
+ * parts you might need for custom implementations and which are quite stable in view of changes
+ * <p/>
+ * INTERNAL:<br/>
+ * if you think about referencing an artifact which is marked as internal, ask for support.
+ * there should be a better solution
+ * <p/>
+ * CUSTOMIZABLE:<br/>
+ * a planned extension point which contains logic to customize the framework.
+ * if it isn't also marked as API it might change in future releases.
+ * however, we try to keep it as stable as possible and reasonable.
+ * <p/>
+ * REUSE:<br/>
+ * an artifact which you can reuse for a custom implementation.
+ * if it isn't marked as API it might change in future releases.
+ * however, we try to keep it as stable as possible and reasonable.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+public enum UsageCategory
+{
+    API,
+    INTERNAL,
+    CUSTOMIZABLE,
+    REUSE
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageInformation.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/internal/UsageInformation.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageInformation.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/internal/UsageInformation.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.internal;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Target;
+
+/**
+ * it's an internal annotation to provide some information concerning usage-categories
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ * @see org.apache.myfaces.extensions.validator.internal.UsageCategory
+ */
+@Target({TYPE, METHOD, FIELD})
+public @interface UsageInformation
+{
+    UsageCategory[] value();
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.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/util/ClassUtils.java?rev=835712&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java Fri Nov 13 02:48:45 2009
@@ -0,0 +1,123 @@
+/*
+ * 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.util;
+
+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.jar.Manifest;
+import java.util.jar.Attributes;
+import java.net.URL;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class ClassUtils
+{
+    private static final Log LOG = LogFactory.getLog(ClassUtils.class);
+
+    public static Class tryToLoadClassForName(String name)
+    {
+        try
+        {
+            return loadClassForName(name);
+        }
+        catch (ClassNotFoundException e)
+        {
+            //do nothing - it's just a try
+            return null;
+        }
+    }
+    
+    public static Class loadClassForName(String name) throws ClassNotFoundException
+    {
+        try
+        {
+            // Try WebApp ClassLoader first
+            return Class.forName(name, false, // do not initialize for faster startup
+                Thread.currentThread().getContextClassLoader());
+        }
+        catch (ClassNotFoundException ignore)
+        {
+            // fallback: Try ClassLoader for ClassUtils (i.e. the myfaces.jar lib)
+            return Class.forName(name, false, // do not initialize for faster startup
+                ClassUtils.class.getClassLoader());
+        }
+    }
+
+    public static <T> T tryToInstantiateClass(Class<T> targetClass)
+    {
+        try
+        {
+            return targetClass.newInstance();
+        }
+        catch (Throwable t)
+        {
+            //do nothing - it was just a try
+        }
+        return null;
+    }
+
+    public static Object tryToInstantiateClassForName(String className)
+    {
+        try
+        {
+            return instantiateClassForName(className);
+        }
+        catch (Throwable t)
+        {
+            //do nothing - it was just a try
+        }
+        return null;
+    }
+
+    public static Object instantiateClassForName(String className)
+        throws ClassNotFoundException, IllegalAccessException, InstantiationException
+    {
+        return loadClassForName(className).newInstance();
+    }
+
+    public static String getJarVersion(Class targetClass)
+    {
+        String classFilePath = targetClass.getCanonicalName().replace('.', '/') + ".class";
+        String manifestFilePath = "/META-INF/MANIFEST.MF";
+
+        String classLocation = targetClass.getResource(targetClass.getSimpleName() + ".class").toString();
+        String manifestFileLocation = classLocation
+                .substring(0, classLocation.indexOf(classFilePath) - 1) + manifestFilePath;
+
+        try
+        {
+            return new Manifest(new URL(manifestFileLocation).openStream())
+                    .getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION);
+        }
+        catch (Throwable t)
+        {
+            if (LOG.isTraceEnabled())
+            {
+                LOG.trace("couldn't load version of jar file which contains " + targetClass.getName(), t);
+            }
+            return null;
+        }
+    }
+}