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/07/13 20:36:38 UTC

svn commit: r793654 - in /myfaces/extensions/validator/trunk: core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/ core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/ core/src/main/java/org/apa...

Author: gpetracek
Date: Mon Jul 13 18:36:37 2009
New Revision: 793654

URL: http://svn.apache.org/viewvc?rev=793654&view=rev
Log:
EXTVAL-49 basic implementation

Added:
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultGroupStorage.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultGroupStorageManager.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/GroupStorage.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManager.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManagerHolder.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/GroupUtils.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultBeanValidationGroupStorage.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultModelValidationStorage.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultModelValidationStorageManager.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationEntry.java
      - copied, changed from r793226, myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationEntry.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationStorage.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/mapper/
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/mapper/BeanValidationGroupStorageNameMapper.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/mapper/ModelValidationStorageNameMapper.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationGroupStorageNameMapper.java
Removed:
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationEntry.java
Modified:
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java
    myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/ExtValBeanValidationContext.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/interceptor/PropertyValidationGroupProvider.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/startup/BeanValidationStartupListener.java
    myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationPhaseListener.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java?rev=793654&r1=793653&r2=793654&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java Mon Jul 13 18:36:37 2009
@@ -26,6 +26,7 @@
 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.storage.DefaultStorageManagerFactory;
 import org.apache.myfaces.extensions.validator.core.el.DefaultELHelperFactory;
 import org.apache.myfaces.extensions.validator.core.renderkit.DefaultRenderKitWrapperFactory;
 import org.apache.myfaces.extensions.validator.core.metadata.transformer.DefaultMetaDataTransformerFactory;
@@ -115,6 +116,10 @@
             case VALIDATION_PARAMETER_EXTRACTOR_FACTORY:
                 factory = createValidationParameterExtractorFactory();
                 break;
+
+            case STORAGE_MANAGER_FACTORY:
+                factory = createStorageManagerFactory();
+                break;
              
             default: //required by checkstyle
         }
@@ -296,4 +301,9 @@
         }
         return factory;
     }
+
+    private Object createStorageManagerFactory()
+    {
+        return new DefaultStorageManagerFactory();
+    }
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java?rev=793654&r1=793653&r2=793654&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java Mon Jul 13 18:36:37 2009
@@ -37,5 +37,7 @@
     FACES_MESSAGE_FACTORY,
 
     RENDERKIT_WRAPPER_FACTORY,
-    EL_HELPER_FACTORY
+    EL_HELPER_FACTORY,
+
+    STORAGE_MANAGER_FACTORY
 }

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.java?rev=793654&r1=793653&r2=793654&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/initializer/configuration/StaticConfigurationNames.java Mon Jul 13 18:36:37 2009
@@ -31,6 +31,7 @@
     META_DATA_TO_VALIDATION_STRATEGY_CONFIG,
     VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_CONFIG,
     VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_CONFIG,
+    STORAGE_TYPE_TO_STORAGE_MANAGER_CONFIG,
 
     SKIP_VALIDATION_SUPPORT_CONFIG
 }
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java?rev=793654&r1=793653&r2=793654&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java Mon Jul 13 18:36:37 2009
@@ -66,6 +66,8 @@
 @UsageInformation(UsageCategory.INTERNAL)
 public class ExtValStartupListener extends AbstractStartupListener
 {
+    private static final long serialVersionUID = -2504826421086572012L;
+
     protected void init()
     {
         if(logger.isInfoEnabled())

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java Mon Jul 13 18:36:37 2009
@@ -0,0 +1,117 @@
+/*
+ * 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.storage;
+
+import org.apache.myfaces.extensions.validator.core.factory.AbstractNameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.context.FacesContext;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+public abstract class AbstractRequestScopeAwareStorageManager<T> extends AbstractNameMapperAwareFactory<String>
+        implements StorageManager<T>
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    private List<NameMapper<String>> nameMapperList = new ArrayList<NameMapper<String>>();
+
+    public AbstractRequestScopeAwareStorageManager()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+
+    public T create(String storageName)
+    {
+        T storageManager;
+        String storageClassName;
+        //null -> use name mappers
+        for (NameMapper<String> nameMapper : this.nameMapperList)
+        {
+            storageClassName = nameMapper.createName(storageName);
+
+            if (storageClassName == null)
+            {
+                continue;
+            }
+
+            storageManager = resolveStorage(storageName, storageClassName);
+
+            if (storageManager != null)
+            {
+                return storageManager;
+            }
+        }
+        return null;
+    }
+
+    private T resolveStorage(String storageKey, String storageClassName)
+    {
+        Map<String, T> storageMap = resolveStorageMap();
+
+        if(!storageMap.containsKey(storageKey))
+        {
+            storageMap.put(storageKey, (T)ClassUtils.tryToInstantiateClassForName(storageClassName));
+        }
+        return storageMap.get(storageKey);
+    }
+
+    private Map<String, T> resolveStorageMap()
+    {
+        Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+        Map<String, T> storageMap;
+
+        if(!requestMap.containsKey(getStorageManagerKey()))
+        {
+            storageMap = new HashMap<String, T>();
+            requestMap.put(getStorageManagerKey(), storageMap);
+        }
+
+        return (Map<String, T>)requestMap.get(getStorageManagerKey());
+    }
+
+    public void reset(String storageKey)
+    {
+        Map<String, T> storageMap = resolveStorageMap();
+
+        if(storageMap != null && storageMap.containsKey(storageKey))
+        {
+            storageMap.put(storageKey, null);
+        }
+    }
+
+    protected List<NameMapper<String>> getNameMapperList()
+    {
+        return this.nameMapperList;
+    }
+
+    public abstract String getStorageManagerKey();
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultGroupStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultGroupStorage.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultGroupStorage.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultGroupStorage.java Mon Jul 13 18:36:37 2009
@@ -0,0 +1,141 @@
+/*
+ * 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.storage;
+
+import org.apache.myfaces.extensions.validator.util.GroupUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+public class DefaultGroupStorage implements GroupStorage
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    private Map<String, List<Class>> addedGroups = new HashMap<String, List<Class>>();
+
+    private Map<String, List<Class>> restrictedGroups = new HashMap<String, List<Class>>();
+
+    public void addGroup(Class groupClass, String viewId, String componentId)
+    {
+        addGroupToGroupStorage(groupClass, viewId, componentId, this.addedGroups);
+    }
+
+    public void restrictGroup(Class groupClass, String viewId, String componentId)
+    {
+        addGroupToGroupStorage(groupClass, viewId, componentId, this.restrictedGroups);
+    }
+
+    public Class[] getGroups(String viewId, String componentId)
+    {
+        if(this.addedGroups.size() < 1)
+        {
+            return null;
+        }
+
+        //add found groups
+        String key = GroupUtils.getGroupKey(viewId, null);
+        List<Class> resultListForPage = buildGroupList(key, this.addedGroups);
+
+        key = GroupUtils.getGroupKey(viewId, componentId);
+        List<Class> resultListForComponent = buildGroupList(key, this.addedGroups);
+
+        //remove restricted groups
+        Class[] resultsForPage =
+                filterGroupList(GroupUtils.getGroupKey(viewId, null), resultListForPage);
+        Class[] resultsForComponent =
+                filterGroupList(GroupUtils.getGroupKey(viewId, componentId), resultListForComponent);
+
+        if(resultsForPage.length == 0)
+        {
+            if(resultsForComponent.length == 0)
+            {
+                if(this.logger.isDebugEnabled())
+                {
+                    this.logger.debug("no groups for group-validation available." +
+                            "maybe you restricted all groups or you aren't using groups." +
+                            "bean validation will use the default group for validation");
+                }
+            }
+            return resultsForComponent;
+        }
+        else if(resultsForComponent.length == 0)
+        {
+            return resultsForPage;
+        }
+
+        return mergeResults(resultsForPage, resultsForComponent);
+    }
+
+    private void addGroupToGroupStorage(Class groupClass, String viewId, String componentId,
+                                        Map<String, List<Class>> groupStorage)
+    {
+        List<Class> groupList = groupStorage.get(GroupUtils.getGroupKey(viewId, componentId));
+
+        if(groupList == null)
+        {
+            groupList = new ArrayList<Class>();
+            groupStorage.put(GroupUtils.getGroupKey(viewId, componentId), groupList);
+        }
+
+        if(!groupList.contains(groupClass))
+        {
+            groupList.add(groupClass);
+        }
+    }
+
+    private List<Class> buildGroupList(String key, Map<String, List<Class>> groupStorage)
+    {
+        List<Class> list = groupStorage.get(key);
+        return (list != null) ? list : new ArrayList<Class>();
+    }
+
+    private Class[] filterGroupList(String key, List<Class> addedGroups)
+    {
+        List<Class> restrictedGroups = buildGroupList(key, this.restrictedGroups);
+        List<Class> results = new ArrayList<Class>();
+
+        for(Class currentGroup : addedGroups)
+        {
+            if(!restrictedGroups.contains(currentGroup))
+            {
+                results.add(currentGroup);
+            }
+        }
+
+        return results.toArray(new Class[results.size()]);
+    }
+
+    private Class[] mergeResults(Class[] resultsForPage, Class[] resultsForComponent)
+    {
+        Class[] mergedResult = new Class[resultsForPage.length + resultsForComponent.length];
+
+        System.arraycopy(resultsForPage, 0, mergedResult, 0, resultsForPage.length);
+        System.arraycopy(resultsForComponent, 0, mergedResult, resultsForPage.length, resultsForComponent.length);
+
+        return mergedResult;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultGroupStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultGroupStorageManager.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultGroupStorageManager.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultGroupStorageManager.java Mon Jul 13 18:36:37 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.storage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+class DefaultGroupStorageManager extends AbstractRequestScopeAwareStorageManager<GroupStorage>
+{
+    public String getStorageManagerKey()
+    {
+        return StorageManager.class.getName() + "_FOR_GROUPS:KEY";
+    }
+}

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java Mon Jul 13 18:36:37 2009
@@ -0,0 +1,169 @@
+/*
+ * 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.storage;
+
+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.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationEntry;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import static org.apache.myfaces.extensions.validator.internal.UsageCategory.INTERNAL;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+@UsageInformation(INTERNAL)
+public class DefaultStorageManagerFactory extends AbstractNameMapperAwareFactory<Class>
+        implements ClassMappingFactory<Class, StorageManager>, StorageManagerHolder
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    private boolean lazyStaticMappingApplied = false;
+    private List<NameMapper<Class>> nameMapperList = new ArrayList<NameMapper<Class>>();
+    private Map<Class, StorageManager> storageTypeToStorageManagerMap = new HashMap<Class, StorageManager>();
+
+    public DefaultStorageManagerFactory()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+
+        setStorageManager(GroupStorage.class, new DefaultGroupStorageManager(), false);
+    }
+
+    public StorageManager create(Class storageType)
+    {
+        if (!this.lazyStaticMappingApplied)
+        {
+            initStaticMappings();
+        }
+
+        StorageManager storageManager;
+        String storageManagerName;
+        //null -> use name mappers
+        for (NameMapper<Class> nameMapper : this.nameMapperList)
+        {
+            storageManagerName = nameMapper.createName(storageType);
+
+            if (storageManagerName == null)
+            {
+                continue;
+            }
+
+            storageManager = (StorageManager)ClassUtils.tryToInstantiateClassForName(storageManagerName);
+
+            if (storageManager != null)
+            {
+                addMapping(storageType, storageManager);
+                return storageManager;
+            }
+        }
+        return this.storageTypeToStorageManagerMap.get(storageType);
+    }
+
+    private synchronized void addMapping(Class storageType, StorageManager storageManager)
+    {
+        boolean isValidEntry = true;
+        if(storageType == null)
+        {
+            isValidEntry = false;
+            if(this.logger.isErrorEnabled())
+            {
+                this.logger.error("you tried to add an invalid storage type");
+            }
+        }
+
+        if(storageManager == null)
+        {
+            isValidEntry = false;
+            if(this.logger.isErrorEnabled())
+            {
+                this.logger.error("you tried to add an invalid storage manager");
+            }
+        }
+
+        if(!isValidEntry)
+        {
+            return;
+        }
+
+        setStorageManager(storageType, storageManager, true);
+    }
+
+    private void initStaticMappings()
+    {
+        this.lazyStaticMappingApplied = true;
+
+        //setup internal static mappings
+        for (StaticConfiguration<String, String> staticConfig :
+            ExtValContext.getContext().getStaticConfiguration(
+                StaticConfigurationNames.STORAGE_TYPE_TO_STORAGE_MANAGER_CONFIG))
+        {
+            setupStrategyMappings(staticConfig.getMapping());
+        }
+    }
+
+    private void setupStrategyMappings(List<StaticConfigurationEntry<String, String>> mappings)
+    {
+        for(StaticConfigurationEntry<String, String> mapping : mappings)
+        {
+            addMapping(ClassUtils.tryToLoadClassForName(mapping.getSource()),
+                    (StorageManager)ClassUtils.tryToInstantiateClassForName(mapping.getTarget()));
+        }
+    }
+
+    protected List<NameMapper<Class>> getNameMapperList()
+    {
+        return this.nameMapperList;
+    }
+
+    public void setStorageManager(Class storageType, StorageManager storageManager, boolean override)
+    {
+        if(!this.storageTypeToStorageManagerMap.containsKey(storageType) ||
+                (this.storageTypeToStorageManagerMap.containsKey(storageType) && override))
+        {
+
+            if(logger.isTraceEnabled())
+            {
+                logger.trace("adding type to storage-manager mapping: "
+                    + storageType.getName() + " -> " + storageManager.getClass().getName());
+            }
+
+            this.storageTypeToStorageManagerMap.put(storageType, storageManager);
+        }
+    }
+
+    public StorageManager getStorageManager(Class type)
+    {
+        return this.storageTypeToStorageManagerMap.get(type);
+    }
+}

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/GroupStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/GroupStorage.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/GroupStorage.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/GroupStorage.java Mon Jul 13 18:36:37 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.storage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+public interface GroupStorage
+{
+    void addGroup(Class groupClass, String viewId, String componentId);
+
+    void restrictGroup(Class groupClass, String viewId, String componentId);
+
+    Class[] getGroups(String viewId, String componentId);
+}

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManager.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManager.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManager.java Mon Jul 13 18:36:37 2009
@@ -0,0 +1,29 @@
+/*
+ * 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.storage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+public interface StorageManager<T>
+{
+    T create(String key);
+    void reset(String key);
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManagerHolder.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManagerHolder.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManagerHolder.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/StorageManagerHolder.java Mon Jul 13 18:36:37 2009
@@ -0,0 +1,29 @@
+/*
+ * 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.storage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+public interface StorageManagerHolder
+{
+    void setStorageManager(Class type, StorageManager storageManager, boolean override);
+    StorageManager getStorageManager(Class type);
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java?rev=793654&r1=793653&r2=793654&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java (original)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java Mon Jul 13 18:36:37 2009
@@ -26,6 +26,7 @@
 import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameterExtractorFactory;
 import org.apache.myfaces.extensions.validator.core.factory.ClassMappingFactory;
 import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.storage.StorageManager;
 import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
 import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
 import org.apache.myfaces.extensions.validator.core.interceptor.MetaDataExtractionInterceptor;
@@ -65,6 +66,7 @@
  * @author Gerhard Petracek
  * @since 1.x.1
  */
+@SuppressWarnings({"unchecked"})
 @UsageInformation(UsageCategory.INTERNAL)
 public class ExtValUtils
 {
@@ -534,4 +536,21 @@
             propertyValidationInterceptor.afterValidation(facesContext, uiComponent, convertedObject, propertyMap);
         }
     }
+
+    public static <T> T getOrInitStorage(Class<T> storageType, String storageName)
+    {
+        return (T)getStorageManagerFactory().create(storageType).create(storageName);
+    }
+
+    public static void resetStorage(Class storageType, String storageName)
+    {
+        getStorageManagerFactory().create(storageType).reset(storageName);
+    }
+
+    private static ClassMappingFactory<Class, StorageManager> getStorageManagerFactory()
+    {
+        return (ExtValContext.getContext()
+                .getFactoryFinder()
+                .getFactory(FactoryNames.STORAGE_MANAGER_FACTORY, ClassMappingFactory.class));
+    }
 }

Added: myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/GroupUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/GroupUtils.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/GroupUtils.java (added)
+++ myfaces/extensions/validator/trunk/core/src/main/java/org/apache/myfaces/extensions/validator/util/GroupUtils.java Mon Jul 13 18:36:37 2009
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class GroupUtils
+{
+    public static String getGroupKey(String viewId, String componentId)
+    {
+        return componentId == null ? viewId : viewId + "@" + componentId;
+    }
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/ExtValBeanValidationContext.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/ExtValBeanValidationContext.java?rev=793654&r1=793653&r2=793654&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/ExtValBeanValidationContext.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/ExtValBeanValidationContext.java Mon Jul 13 18:36:37 2009
@@ -20,28 +20,31 @@
 
 import org.apache.myfaces.extensions.validator.beanval.validation.message.interpolator.DefaultMessageInterpolator;
 import org.apache.myfaces.extensions.validator.beanval.validation.message.interpolator.ExtValMessageInterpolatorAdapter;
-import org.apache.myfaces.extensions.validator.beanval.validation.ModelValidationEntry;
 import org.apache.myfaces.extensions.validator.beanval.validation.strategy.BeanValidationStrategyAdapter;
+import org.apache.myfaces.extensions.validator.beanval.storage.ModelValidationEntry;
+import org.apache.myfaces.extensions.validator.beanval.storage.ModelValidationStorage;
+import org.apache.myfaces.extensions.validator.beanval.annotation.BeanValidation;
+import org.apache.myfaces.extensions.validator.beanval.annotation.ModelValidation;
 import org.apache.myfaces.extensions.validator.core.validation.message.resolver.MessageResolver;
+import org.apache.myfaces.extensions.validator.core.storage.GroupStorage;
 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.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import javax.faces.context.FacesContext;
 import javax.faces.component.UIComponent;
-import javax.validation.groups.Default;
 import javax.validation.MessageInterpolator;
 import javax.validation.Validation;
 import java.util.Map;
 import java.util.List;
-import java.util.ArrayList;
-import java.util.HashMap;
 
 /**
  * @author Gerhard Petracek
  * @since 1.x.3
  */
-public class ExtValBeanValidationContext
+public class ExtValBeanValidationContext implements GroupStorage, ModelValidationStorage
 {
     protected final Log logger = LogFactory.getLog(getClass());
 
@@ -51,15 +54,11 @@
 
     private MessageResolver messageResolver;
 
-    private Map<String, List<Class>> addedGroups = new HashMap<String, List<Class>>();
+    private GroupStorage groupStorage;
 
-    private Map<String, List<Class>> restrictedGroups = new HashMap<String, List<Class>>();
-
-    private Map<String, List<ModelValidationEntry>> modelValidationEntries =
-            new HashMap<String, List<ModelValidationEntry>>();
-
-    private List<String> componentsOfRequest = new ArrayList<String>();
+    private ModelValidationStorage modelValidationStorage;
 
+    @ToDo(Priority.HIGH)
     private ExtValBeanValidationContext()
     {
         this.messageResolver = ExtValUtils
@@ -76,6 +75,12 @@
             this.defaultMessageInterpolator = new DefaultMessageInterpolator(
                 Validation.buildDefaultValidatorFactory().getMessageInterpolator());
         }
+
+        this.groupStorage = ExtValUtils
+                .getOrInitStorage(GroupStorage.class, BeanValidation.class.getName());
+
+        this.modelValidationStorage = ExtValUtils.
+                getOrInitStorage(ModelValidationStorage.class, ModelValidation.class.getName());
     }
 
     @SuppressWarnings({"unchecked"})
@@ -96,104 +101,6 @@
         return currentContext;
     }
 
-    public void addGroup(Class groupClass, String viewId, String componentId)
-    {
-        addGroupToGroupStorage(groupClass, viewId, componentId, this.addedGroups);
-    }
-
-    public void addModelValidationEntry(
-            ModelValidationEntry modelValidationEntry, String viewId, UIComponent component)
-    {
-        modelValidationEntry.setComponent(component);
-
-        String componentId = null;
-
-        if(component != null)
-        {
-            componentId = component.getClientId(FacesContext.getCurrentInstance());
-            this.componentsOfRequest.add(componentId);
-        }
-
-        List<ModelValidationEntry> modelValidationEntryList =
-                this.modelValidationEntries.get(getGroupKey(viewId, componentId));
-
-        if(modelValidationEntryList == null)
-        {
-            modelValidationEntryList = new ArrayList<ModelValidationEntry>();
-            this.modelValidationEntries.put(getGroupKey(viewId, componentId), modelValidationEntryList);
-        }
-
-        if(!modelValidationEntryList.contains(modelValidationEntry))
-        {
-            modelValidationEntryList.add(modelValidationEntry);
-        }
-    }
-
-    public void restrictGroup(Class groupClass, String viewId, String componentId)
-    {
-        addGroupToGroupStorage(groupClass, viewId, componentId, this.restrictedGroups);
-    }
-
-    public Class[] getGroups(String viewId, String componentId)
-    {
-        if(this.addedGroups.size() < 1)
-        {
-            if(!"true".equalsIgnoreCase(WebXmlParameter.DEACTIVATE_IMPLICIT_DEFAULT_GROUP_VALIDATION))
-            {
-                return new Class[] {Default.class};
-            }
-            return null;
-        }
-
-        //add found groups
-        String key = getGroupKey(viewId, null);
-        List<Class> resultListForPage = buildGroupList(key, this.addedGroups);
-
-        key = getGroupKey(viewId, componentId);
-        List<Class> resultListForComponent = buildGroupList(key, this.addedGroups);
-
-        //remove restricted groups
-        Class[] resultsForPage = filterGroupList(getGroupKey(viewId, null), resultListForPage);
-        Class[] resultsForComponent = filterGroupList(getGroupKey(viewId, componentId), resultListForComponent);
-
-        if(resultsForPage.length == 0)
-        {
-            if(resultsForComponent.length == 0)
-            {
-                if(this.logger.isDebugEnabled())
-                {
-                    this.logger.debug("no groups for group-validation available." +
-                            "maybe you restricted all groups or you aren't using groups." +
-                            "bean validation will use the default group for validation");
-                }
-            }
-            return resultsForComponent;
-        }
-        else if(resultsForComponent.length == 0)
-        {
-            return resultsForPage;
-        }
-
-        return mergeResults(resultsForPage, resultsForComponent);
-    }
-
-    public List<ModelValidationEntry> getModelValidationEntriesToValidate()
-    {
-        String viewId = FacesContext.getCurrentInstance().getViewRoot().getViewId();
-        List<ModelValidationEntry> result = new ArrayList<ModelValidationEntry>();
-
-        //add entries for specific components
-        for(String currentClientId : this.componentsOfRequest)
-        {
-            result.addAll(getModelValidationEntries(viewId, currentClientId));
-        }
-
-        //add entries for the whole page
-        result.addAll(getModelValidationEntries(viewId));
-
-        return result;
-    }
-
     public MessageInterpolator getMessageInterpolator()
     {
         if(this.messageResolver != null)
@@ -204,126 +111,28 @@
         return this.defaultMessageInterpolator;
     }
 
-    /*
-     * private methods
-     */
-    private String getGroupKey(String viewId, String componentId)
-    {
-        return componentId == null ? viewId : viewId + "@" + componentId;
-    }
-
-    private void addGroupToGroupStorage(Class groupClass, String viewId, String componentId,
-                                        Map<String, List<Class>> groupStorage)
-    {
-        List<Class> groupList = groupStorage.get(getGroupKey(viewId, componentId));
-
-        if(groupList == null)
-        {
-            groupList = new ArrayList<Class>();
-            groupStorage.put(getGroupKey(viewId, componentId), groupList);
-        }
-
-        if(!groupList.contains(groupClass))
-        {
-            groupList.add(groupClass);
-        }
-    }
-
-    private List<Class> buildGroupList(String key, Map<String, List<Class>> groupStorage)
-    {
-        List<Class> list = groupStorage.get(key);
-        return (list != null) ? list : new ArrayList<Class>();
-    }
-
-    private List<ModelValidationEntry> buildModelValidationEntryList(
-            String key, Map<String, List<ModelValidationEntry>> groupStorage)
+    public void addGroup(Class groupClass, String viewId, String componentId)
     {
-        List<ModelValidationEntry> list;
-
-        if(key != null && key.endsWith("*"))
-        {
-            list = new ArrayList<ModelValidationEntry>();
-            for(Map.Entry<String,List<ModelValidationEntry>> entry : groupStorage.entrySet())
-            {
-                if(entry.getKey().substring(0, entry.getKey().indexOf("@"))
-                        .equals(key.substring(0, key.indexOf("@"))))
-                {
-                    list.addAll(entry.getValue());
-                }
-            }
-            return list;
-        }
-
-        list = groupStorage.get(key);
-        return (list != null) ? list : new ArrayList<ModelValidationEntry>();
+        this.groupStorage.addGroup(groupClass, viewId, componentId);
     }
 
-    private Class[] filterGroupList(String key, List<Class> addedGroups)
+    public void restrictGroup(Class groupClass, String viewId, String componentId)
     {
-        List<Class> restrictedGroups = buildGroupList(key, this.restrictedGroups);
-        List<Class> results = new ArrayList<Class>();
-
-        for(Class currentGroup : addedGroups)
-        {
-            if(!restrictedGroups.contains(currentGroup))
-            {
-                results.add(currentGroup);
-            }
-        }
-
-        return results.toArray(new Class[results.size()]);
+        this.groupStorage.restrictGroup(groupClass, viewId, componentId);
     }
 
-    private Class[] mergeResults(Class[] resultsForPage, Class[] resultsForComponent)
+    public Class[] getGroups(String viewId, String componentId)
     {
-        Class[] mergedResult = new Class[resultsForPage.length + resultsForComponent.length];
-
-        System.arraycopy(resultsForPage, 0, mergedResult, 0, resultsForPage.length);
-        System.arraycopy(resultsForComponent, 0, mergedResult, resultsForPage.length, resultsForComponent.length);
-
-        return mergedResult;
+        return this.groupStorage.getGroups(viewId, componentId);
     }
 
-    private List<ModelValidationEntry> getModelValidationEntries(String viewId)
+    public void addModelValidationEntry(ModelValidationEntry modelValidationEntry, String viewId, UIComponent component)
     {
-        return getModelValidationEntries(viewId, null);
+        this.modelValidationStorage.addModelValidationEntry(modelValidationEntry, viewId, component);
     }
 
-    private List<ModelValidationEntry> getModelValidationEntries(String viewId, String componentId)
+    public List<ModelValidationEntry> getModelValidationEntriesToValidate()
     {
-        if(this.modelValidationEntries.size() < 1)
-        {
-            return new ArrayList<ModelValidationEntry>();
-        }
-
-        //add found groups
-        String key;
-        List<ModelValidationEntry> resultListForPage = null;
-
-        if(!"*".equals(componentId))
-        {
-            key = getGroupKey(viewId, null);
-            resultListForPage =
-                    buildModelValidationEntryList(key, this.modelValidationEntries);
-        }
-
-        key = getGroupKey(viewId, componentId);
-        List<ModelValidationEntry> resultListForComponent =
-                buildModelValidationEntryList(key, this.modelValidationEntries);
-
-        if(resultListForPage == null || resultListForPage.isEmpty())
-        {
-            return resultListForComponent;
-        }
-        else if(resultListForComponent.isEmpty())
-        {
-            return resultListForPage;
-        }
-
-        //merge results
-        List<ModelValidationEntry> mergedResult = new ArrayList<ModelValidationEntry>();
-        mergedResult.addAll(resultListForPage);
-        mergedResult.addAll(resultListForComponent);
-        return mergedResult;
+        return this.modelValidationStorage.getModelValidationEntriesToValidate();
     }
 }

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/interceptor/PropertyValidationGroupProvider.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/interceptor/PropertyValidationGroupProvider.java?rev=793654&r1=793653&r2=793654&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/interceptor/PropertyValidationGroupProvider.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/interceptor/PropertyValidationGroupProvider.java Mon Jul 13 18:36:37 2009
@@ -27,7 +27,7 @@
 import org.apache.myfaces.extensions.validator.core.el.ValueBindingExpression;
 import org.apache.myfaces.extensions.validator.util.ExtValUtils;
 import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
-import org.apache.myfaces.extensions.validator.beanval.validation.ModelValidationEntry;
+import org.apache.myfaces.extensions.validator.beanval.storage.ModelValidationEntry;
 import org.apache.myfaces.extensions.validator.beanval.ExtValBeanValidationContext;
 import org.apache.myfaces.extensions.validator.beanval.annotation.extractor.DefaultGroupControllerScanningExtractor;
 import org.apache.myfaces.extensions.validator.beanval.annotation.BeanValidation;

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/startup/BeanValidationStartupListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/startup/BeanValidationStartupListener.java?rev=793654&r1=793653&r2=793654&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/startup/BeanValidationStartupListener.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/startup/BeanValidationStartupListener.java Mon Jul 13 18:36:37 2009
@@ -20,7 +20,16 @@
 
 import org.apache.myfaces.extensions.validator.core.startup.AbstractStartupListener;
 import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.factory.AbstractNameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.storage.GroupStorage;
+import org.apache.myfaces.extensions.validator.core.storage.StorageManagerHolder;
+import org.apache.myfaces.extensions.validator.core.storage.StorageManager;
 import org.apache.myfaces.extensions.validator.beanval.BeanValidationInterceptor;
+import org.apache.myfaces.extensions.validator.beanval.storage.mapper.BeanValidationGroupStorageNameMapper;
+import org.apache.myfaces.extensions.validator.beanval.storage.mapper.ModelValidationStorageNameMapper;
+import org.apache.myfaces.extensions.validator.beanval.storage.ModelValidationStorage;
+import org.apache.myfaces.extensions.validator.beanval.storage.DefaultModelValidationStorageManager;
 import org.apache.myfaces.extensions.validator.beanval.interceptor.PropertyValidationGroupProvider;
 import org.apache.myfaces.extensions.validator.beanval.metadata.transformer.mapper
         .DefaultBeanValidationStrategyToMetaDataTransformerNameMapper;
@@ -49,5 +58,31 @@
 
         ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
                 new DefaultBeanValidationStrategyToMetaDataTransformerNameMapper());
+
+        StorageManagerHolder storageManagerHolder =
+                (ExtValContext.getContext()
+                .getFactoryFinder()
+                .getFactory(FactoryNames.STORAGE_MANAGER_FACTORY, StorageManagerHolder.class));
+
+        StorageManager storageManager = storageManagerHolder.getStorageManager(GroupStorage.class);
+
+        if(storageManager instanceof AbstractNameMapperAwareFactory)
+        {
+            ((AbstractNameMapperAwareFactory<String>)storageManager)
+                    .register(new BeanValidationGroupStorageNameMapper());
+        }
+        else
+        {
+            if(this.logger.isWarnEnabled())
+            {
+                this.logger.warn(storageManager.getClass().getName() +
+                        " has to implement AbstractNameMapperAwareFactory " + getClass().getName() +
+                        " couldn't register " + BeanValidationGroupStorageNameMapper.class.getName());
+            }
+        }
+
+        DefaultModelValidationStorageManager modelValidationStorageManager = new DefaultModelValidationStorageManager();
+        modelValidationStorageManager.register(new ModelValidationStorageNameMapper());
+        storageManagerHolder.setStorageManager(ModelValidationStorage.class, modelValidationStorageManager, false);
     }
 }

Added: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultBeanValidationGroupStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultBeanValidationGroupStorage.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultBeanValidationGroupStorage.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultBeanValidationGroupStorage.java Mon Jul 13 18:36:37 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.beanval.storage;
+
+import org.apache.myfaces.extensions.validator.core.storage.DefaultGroupStorage;
+import org.apache.myfaces.extensions.validator.beanval.WebXmlParameter;
+
+import javax.validation.groups.Default;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+public class DefaultBeanValidationGroupStorage extends DefaultGroupStorage
+{
+    @Override
+    public Class[] getGroups(String viewId, String componentId)
+    {
+        Class[] result = super.getGroups(viewId, componentId);
+
+        if(result == null)
+        {
+            if(!"true".equalsIgnoreCase(WebXmlParameter.DEACTIVATE_IMPLICIT_DEFAULT_GROUP_VALIDATION))
+            {
+                return new Class[] {Default.class};
+            }
+            return null;
+        }
+
+        return result;
+    }
+}

Added: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultModelValidationStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultModelValidationStorage.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultModelValidationStorage.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultModelValidationStorage.java Mon Jul 13 18:36:37 2009
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.beanval.storage;
+
+import org.apache.myfaces.extensions.validator.util.GroupUtils;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+public class DefaultModelValidationStorage implements ModelValidationStorage
+{
+    private Map<String, List<ModelValidationEntry>> modelValidationEntries =
+            new HashMap<String, List<ModelValidationEntry>>();
+
+    private List<String> componentsOfRequest = new ArrayList<String>();
+
+    public void addModelValidationEntry(
+            ModelValidationEntry modelValidationEntry, String viewId, UIComponent component)
+    {
+        modelValidationEntry.setComponent(component);
+
+        String componentId = null;
+
+        if(component != null)
+        {
+            componentId = component.getClientId(FacesContext.getCurrentInstance());
+            this.componentsOfRequest.add(componentId);
+        }
+
+        List<ModelValidationEntry> modelValidationEntryList =
+                this.modelValidationEntries.get(GroupUtils.getGroupKey(viewId, componentId));
+
+        if(modelValidationEntryList == null)
+        {
+            modelValidationEntryList = new ArrayList<ModelValidationEntry>();
+            this.modelValidationEntries.put(GroupUtils.getGroupKey(viewId, componentId), modelValidationEntryList);
+        }
+
+        if(!modelValidationEntryList.contains(modelValidationEntry))
+        {
+            modelValidationEntryList.add(modelValidationEntry);
+        }
+    }
+
+    public List<ModelValidationEntry> getModelValidationEntriesToValidate()
+    {
+        String viewId = FacesContext.getCurrentInstance().getViewRoot().getViewId();
+        List<ModelValidationEntry> result = new ArrayList<ModelValidationEntry>();
+
+        //add entries for specific components
+        for(String currentClientId : this.componentsOfRequest)
+        {
+            result.addAll(getModelValidationEntries(viewId, currentClientId));
+        }
+
+        //add entries for the whole page
+        result.addAll(getModelValidationEntries(viewId));
+
+        return result;
+    }
+
+    private List<ModelValidationEntry> buildModelValidationEntryList(
+            String key, Map<String, List<ModelValidationEntry>> groupStorage)
+    {
+        List<ModelValidationEntry> list;
+
+        if(key != null && key.endsWith("*"))
+        {
+            list = new ArrayList<ModelValidationEntry>();
+            for(Map.Entry<String,List<ModelValidationEntry>> entry : groupStorage.entrySet())
+            {
+                if(entry.getKey().substring(0, entry.getKey().indexOf("@"))
+                        .equals(key.substring(0, key.indexOf("@"))))
+                {
+                    list.addAll(entry.getValue());
+                }
+            }
+            return list;
+        }
+
+        list = groupStorage.get(key);
+        return (list != null) ? list : new ArrayList<ModelValidationEntry>();
+    }
+
+    private List<ModelValidationEntry> getModelValidationEntries(String viewId)
+    {
+        return getModelValidationEntries(viewId, null);
+    }
+
+    private List<ModelValidationEntry> getModelValidationEntries(String viewId, String componentId)
+    {
+        if(this.modelValidationEntries.size() < 1)
+        {
+            return new ArrayList<ModelValidationEntry>();
+        }
+
+        //add found groups
+        String key;
+        List<ModelValidationEntry> resultListForPage = null;
+
+        if(!"*".equals(componentId))
+        {
+            key = GroupUtils.getGroupKey(viewId, null);
+            resultListForPage =
+                    buildModelValidationEntryList(key, this.modelValidationEntries);
+        }
+
+        key = GroupUtils.getGroupKey(viewId, componentId);
+        List<ModelValidationEntry> resultListForComponent =
+                buildModelValidationEntryList(key, this.modelValidationEntries);
+
+        if(resultListForPage == null || resultListForPage.isEmpty())
+        {
+            return resultListForComponent;
+        }
+        else if(resultListForComponent.isEmpty())
+        {
+            return resultListForPage;
+        }
+
+        //merge results
+        List<ModelValidationEntry> mergedResult = new ArrayList<ModelValidationEntry>();
+        mergedResult.addAll(resultListForPage);
+        mergedResult.addAll(resultListForComponent);
+        return mergedResult;
+    }
+}

Added: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultModelValidationStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultModelValidationStorageManager.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultModelValidationStorageManager.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/DefaultModelValidationStorageManager.java Mon Jul 13 18:36:37 2009
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.beanval.storage;
+
+import org.apache.myfaces.extensions.validator.core.storage.StorageManager;
+import org.apache.myfaces.extensions.validator.core.storage.AbstractRequestScopeAwareStorageManager;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import static org.apache.myfaces.extensions.validator.internal.UsageCategory.INTERNAL;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+@UsageInformation(INTERNAL)
+public class DefaultModelValidationStorageManager
+        extends AbstractRequestScopeAwareStorageManager<ModelValidationStorage>
+{
+    public String getStorageManagerKey()
+    {
+        return StorageManager.class.getName() + "_FOR_MODEL_VALIDATION:KEY";
+    }
+}
\ No newline at end of file

Copied: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationEntry.java (from r793226, myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationEntry.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationEntry.java?p2=myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationEntry.java&p1=myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationEntry.java&r1=793226&r2=793654&rev=793654&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationEntry.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationEntry.java Mon Jul 13 18:36:37 2009
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.extensions.validator.beanval.validation;
+package org.apache.myfaces.extensions.validator.beanval.storage;
 
 import org.apache.myfaces.extensions.validator.beanval.annotation.ModelValidation;
 

Added: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationStorage.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationStorage.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationStorage.java Mon Jul 13 18:36:37 2009
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.beanval.storage;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+public interface ModelValidationStorage
+{
+    void addModelValidationEntry(
+            ModelValidationEntry modelValidationEntry, String viewId, UIComponent component);
+
+    List<ModelValidationEntry> getModelValidationEntriesToValidate();
+}

Added: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/mapper/BeanValidationGroupStorageNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/mapper/BeanValidationGroupStorageNameMapper.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/mapper/BeanValidationGroupStorageNameMapper.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/mapper/BeanValidationGroupStorageNameMapper.java Mon Jul 13 18:36:37 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.beanval.storage.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.beanval.annotation.BeanValidation;
+import org.apache.myfaces.extensions.validator.beanval.storage.DefaultBeanValidationGroupStorage;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+public class BeanValidationGroupStorageNameMapper implements NameMapper<String>
+{
+    public String createName(String key)
+    {
+        return (BeanValidation.class.getName().equals(key)) ?
+                DefaultBeanValidationGroupStorage.class.getName() : null;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/mapper/ModelValidationStorageNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/mapper/ModelValidationStorageNameMapper.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/mapper/ModelValidationStorageNameMapper.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/mapper/ModelValidationStorageNameMapper.java Mon Jul 13 18:36:37 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.beanval.storage.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.beanval.annotation.ModelValidation;
+import org.apache.myfaces.extensions.validator.beanval.storage.DefaultModelValidationStorage;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+public class ModelValidationStorageNameMapper implements NameMapper<String>
+{
+    public String createName(String key)
+    {
+        return (ModelValidation.class.getName().equals(key)) ?
+                DefaultModelValidationStorage.class.getName() : null;
+    }
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationPhaseListener.java?rev=793654&r1=793653&r2=793654&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationPhaseListener.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationPhaseListener.java Mon Jul 13 18:36:37 2009
@@ -21,6 +21,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.extensions.validator.beanval.ExtValBeanValidationContext;
+import org.apache.myfaces.extensions.validator.beanval.storage.ModelValidationEntry;
 import org.apache.myfaces.extensions.validator.beanval.annotation.ModelValidation;
 import org.apache.myfaces.extensions.validator.internal.Priority;
 import org.apache.myfaces.extensions.validator.internal.ToDo;

Added: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationGroupStorageNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationGroupStorageNameMapper.java?rev=793654&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationGroupStorageNameMapper.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationGroupStorageNameMapper.java Mon Jul 13 18:36:37 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;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.storage.DefaultGroupStorage;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+public class PropertyValidationGroupStorageNameMapper implements NameMapper<String>
+{
+    public String createName(String source)
+    {
+        return (ValidationParameter.class.getName().equals(source)) ?
+                DefaultGroupStorage.class.getName() : null;
+    }
+}

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java?rev=793654&r1=793653&r2=793654&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java Mon Jul 13 18:36:37 2009
@@ -22,6 +22,11 @@
 import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
 import org.apache.myfaces.extensions.validator.core.startup.AbstractStartupListener;
 import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.factory.AbstractNameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.storage.StorageManagerHolder;
+import org.apache.myfaces.extensions.validator.core.storage.StorageManager;
+import org.apache.myfaces.extensions.validator.core.storage.GroupStorage;
 import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
 import org.apache.myfaces.extensions.validator.core.interceptor.ValidationInterceptor;
 import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticResourceBundleConfiguration;
@@ -41,6 +46,8 @@
 @UsageInformation(UsageCategory.INTERNAL)
 public class PropertyValidationModuleStartupListener extends AbstractStartupListener
 {
+    private static final long serialVersionUID = -2474361612857222283L;
+
     protected void init()
     {
         ExtValContext.getContext().addProcessedInformationRecorder(new CrossValidationUserInputRecorder());
@@ -49,6 +56,7 @@
         initDefaultComponentInitializer();
         initDefaultValidationExceptionInterceptor();
         addSkipValidationSupport();
+        initNameMappers();
     }
 
     private void initStaticStrategyMappings()
@@ -98,4 +106,21 @@
 
         //config.addMapping(CommonMetaDataKeys.SKIP_VALIDATION, RequiredStrategy.class.getName());
     }
+
+    @SuppressWarnings({"unchecked"})
+    private void initNameMappers()
+    {
+        StorageManagerHolder storageManagerHolder =
+                (ExtValContext.getContext()
+                .getFactoryFinder()
+                .getFactory(FactoryNames.STORAGE_MANAGER_FACTORY, StorageManagerHolder.class));
+
+        StorageManager storageManager = storageManagerHolder.getStorageManager(GroupStorage.class);
+
+        if(storageManager instanceof AbstractNameMapperAwareFactory)
+        {
+            ((AbstractNameMapperAwareFactory<String>)storageManager)
+                    .register(new PropertyValidationGroupStorageNameMapper());
+        }
+    }
 }