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/09/07 03:06:54 UTC

svn commit: r811962 - in /myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core: metadata/extractor/ storage/ storage/mapper/

Author: gpetracek
Date: Mon Sep  7 01:06:53 2009
New Revision: 811962

URL: http://svn.apache.org/viewvc?rev=811962&view=rev
Log:
EXTVAL-57 caching and minor refactoring

Added:
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractApplicationScopeAwareStorageManager.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorageManager.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MetaDataStorage.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultMetaDataStorageNameMapper.java
Modified:
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractor.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractor.java?rev=811962&r1=811961&r2=811962&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractor.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/metadata/extractor/DefaultComponentMetaDataExtractor.java Mon Sep  7 01:06:53 2009
@@ -23,6 +23,7 @@
 import org.apache.myfaces.extensions.validator.core.property.DefaultPropertyInformation;
 import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
 import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.storage.MetaDataStorage;
 import org.apache.myfaces.extensions.validator.internal.ToDo;
 import org.apache.myfaces.extensions.validator.internal.Priority;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
@@ -97,19 +98,17 @@
         //create
         propertyInformation.setInformation(PropertyInformationKeys.PROPERTY_DETAILS, propertyDetails);
 
-        /*
-         * find and add annotations
-         */
-        Class currentClass = entityClass;
-
-        while (!Object.class.getName().equals(currentClass.getName()))
+        if(isCached(entityClass, propertyDetails.getProperty()))
         {
-            addPropertyAccessAnnotations(currentClass, propertyDetails.getProperty(), propertyInformation);
-            addFieldAccessAnnotations(currentClass, propertyDetails.getProperty(), propertyInformation);
-
-            processInterfaces(currentClass, propertyDetails, propertyInformation);
-
-            currentClass = currentClass.getSuperclass();
+            for(MetaDataEntry metaDataEntry : getCachedMetaData(entityClass, propertyDetails.getProperty()))
+            {
+                propertyInformation.addMetaDataEntry(metaDataEntry);
+            }
+        }
+        else
+        {
+            extractAnnotations(propertyInformation, propertyDetails, entityClass);
+            cacheMetaData(propertyInformation);
         }
 
         if(logger.isTraceEnabled())
@@ -120,6 +119,40 @@
         return propertyInformation;
     }
 
+    private boolean isCached(Class entityClass, String property)
+    {
+        return getMetaDataStorage().containsMetaDataFor(entityClass, property);
+    }
+
+    private void cacheMetaData(PropertyInformation propertyInformation)
+    {
+        getMetaDataStorage().storeMetaDataOf(propertyInformation);
+    }
+
+    private MetaDataEntry[] getCachedMetaData(Class entityClass, String property)
+    {
+        return getMetaDataStorage().getMetaData(entityClass, property);
+    }
+
+    private MetaDataStorage getMetaDataStorage()
+    {
+        return ExtValUtils.getStorage(MetaDataStorage.class, MetaDataStorage.class.getName());
+    }
+
+    private void extractAnnotations(
+            PropertyInformation propertyInformation, PropertyDetails propertyDetails, Class entityClass)
+    {
+        while (!Object.class.getName().equals(entityClass.getName()))
+        {
+            addPropertyAccessAnnotations(entityClass, propertyDetails.getProperty(), propertyInformation);
+            addFieldAccessAnnotations(entityClass, propertyDetails.getProperty(), propertyInformation);
+
+            processInterfaces(entityClass, propertyDetails, propertyInformation);
+
+            entityClass = entityClass.getSuperclass();
+        }
+    }
+
     private void processInterfaces(
             Class currentClass, PropertyDetails propertyDetails, PropertyInformation propertyInformation)
     {
@@ -176,7 +209,22 @@
         {
             try
             {
-                field = entity.getDeclaredField("_" + property);
+                try
+                {
+                    if(property.length() > 1 &&
+                            Character.isUpperCase(property.charAt(0)) && Character.isUpperCase(property.charAt(1)))
+                    {
+                        field = entity.getDeclaredField(property.substring(0, 1).toLowerCase() + property.substring(1));
+                    }
+                    else
+                    {
+                        field = entity.getDeclaredField("_" + property);
+                    }
+                }
+                catch (Exception e1)
+                {
+                    field = entity.getDeclaredField("_" + property);
+                }
             }
             catch (NoSuchFieldException e1)
             {

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractApplicationScopeAwareStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractApplicationScopeAwareStorageManager.java?rev=811962&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractApplicationScopeAwareStorageManager.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractApplicationScopeAwareStorageManager.java Mon Sep  7 01:06:53 2009
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.storage;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import static org.apache.myfaces.extensions.validator.internal.UsageCategory.REUSE;
+
+import javax.faces.context.FacesContext;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * generic storage manager implementation which stores the storage implementations in the application scope
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(REUSE)
+public abstract class AbstractApplicationScopeAwareStorageManager<T> extends AbstractStorageManager<T>
+{
+    protected Map<String, T> resolveStorageMap()
+    {
+        Map applicationMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();
+        Map<String, T> storageMap;
+
+        if(!applicationMap.containsKey(getStorageManagerKey()))
+        {
+            storageMap = new HashMap<String, T>();
+            applicationMap.put(getStorageManagerKey(), storageMap);
+        }
+
+        return (Map<String, T>)applicationMap.get(getStorageManagerKey());
+    }
+}

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java?rev=811962&r1=811961&r2=811962&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractRequestScopeAwareStorageManager.java Mon Sep  7 01:06:53 2009
@@ -18,17 +18,10 @@
  */
 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.myfaces.extensions.validator.internal.UsageInformation;
 import static org.apache.myfaces.extensions.validator.internal.UsageCategory.REUSE;
-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;
 
@@ -39,57 +32,9 @@
  * @since x.x.3
  */
 @UsageInformation(REUSE)
-public abstract class AbstractRequestScopeAwareStorageManager<T> extends AbstractNameMapperAwareFactory<String>
-        implements StorageManager<T>
+public abstract class AbstractRequestScopeAwareStorageManager<T> extends AbstractStorageManager<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()
+    protected Map<String, T> resolveStorageMap()
     {
         Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
         Map<String, T> storageMap;
@@ -102,22 +47,4 @@
 
         return (Map<String, T>)requestMap.get(getStorageManagerKey());
     }
-
-    public void reset(String storageKey)
-    {
-        Map<String, T> storageMap = resolveStorageMap();
-
-        if(storageMap != null && storageMap.containsKey(storageKey))
-        {
-            Class storageClass = storageMap.get(storageKey).getClass();
-            storageMap.put(storageKey, (T)ClassUtils.tryToInstantiateClass(storageClass));
-        }
-    }
-
-    protected List<NameMapper<String>> getNameMapperList()
-    {
-        return this.nameMapperList;
-    }
-
-    public abstract String getStorageManagerKey();
 }
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java?rev=811962&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/AbstractStorageManager.java Mon Sep  7 01:06:53 2009
@@ -0,0 +1,109 @@
+/*
+ * 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.myfaces.extensions.validator.internal.UsageInformation;
+import static org.apache.myfaces.extensions.validator.internal.UsageCategory.REUSE;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+
+/**
+ * generic storage manager implementation
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(REUSE)
+public abstract class AbstractStorageManager<T> extends AbstractNameMapperAwareFactory<String>
+        implements StorageManager<T>
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    private List<NameMapper<String>> nameMapperList = new ArrayList<NameMapper<String>>();
+
+    public AbstractStorageManager()
+    {
+        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;
+    }
+
+    protected 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);
+    }
+
+    protected abstract Map<String, T> resolveStorageMap();
+
+    public void reset(String storageKey)
+    {
+        Map<String, T> storageMap = resolveStorageMap();
+
+        if(storageMap != null && storageMap.containsKey(storageKey))
+        {
+            Class storageClass = storageMap.get(storageKey).getClass();
+            storageMap.put(storageKey, (T)ClassUtils.tryToInstantiateClass(storageClass));
+        }
+    }
+
+    protected List<NameMapper<String>> getNameMapperList()
+    {
+        return this.nameMapperList;
+    }
+
+    public abstract String getStorageManagerKey();
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java?rev=811962&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorage.java Mon Sep  7 01:06:53 2009
@@ -0,0 +1,88 @@
+/*
+ * 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.internal.UsageInformation;
+import static org.apache.myfaces.extensions.validator.internal.UsageCategory.INTERNAL;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.core.property.DefaultPropertyInformation;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(INTERNAL)
+public class DefaultMetaDataStorage implements MetaDataStorage
+{
+    private Map<String, PropertyInformation> cachedPropertyInformation = new HashMap<String, PropertyInformation>();
+
+    public void storeMetaDataOf(PropertyInformation propertyInformation)
+    {
+        PropertyInformation propertyInformationToStore = new DefaultPropertyInformation();
+
+        PropertyDetails propertyDetails = propertyInformation
+                .getInformation(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);
+
+        copyMetaData(propertyInformation, propertyInformationToStore);
+
+        this.cachedPropertyInformation.put(
+                createKey(propertyDetails.getBaseObject().getClass(), propertyDetails.getProperty()),
+                propertyInformationToStore);
+    }
+
+    public MetaDataEntry[] getMetaData(Class targetClass, String targetProperty)
+    {
+        PropertyInformation propertyInformation = this.cachedPropertyInformation
+                .get(createKey(targetClass, targetProperty));
+
+        PropertyInformation clonedPropertyInformation = new DefaultPropertyInformation();
+        copyMetaData(propertyInformation, clonedPropertyInformation);
+
+        return clonedPropertyInformation.getMetaDataEntries();
+    }
+
+    public boolean containsMetaDataFor(Class targetClass, String targetProperty)
+    {
+        return this.cachedPropertyInformation.containsKey(createKey(targetClass, targetProperty));
+    }
+
+    private String createKey(Class targetClass, String targetProperty)
+    {
+        return targetClass.getName() + "#" + targetProperty;
+    }
+
+    private void copyMetaData(PropertyInformation source, PropertyInformation target)
+    {
+        MetaDataEntry newMetaDataEntry;
+        for(MetaDataEntry metaDataEntry : source.getMetaDataEntries())
+        {
+            newMetaDataEntry = new MetaDataEntry();
+            newMetaDataEntry.setKey(metaDataEntry.getKey());
+            newMetaDataEntry.setValue(metaDataEntry.getValue());
+
+            target.addMetaDataEntry(newMetaDataEntry);
+        }
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorageManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorageManager.java?rev=811962&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorageManager.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMetaDataStorageManager.java Mon Sep  7 01:06:53 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.storage;
+
+import org.apache.myfaces.extensions.validator.core.storage.mapper.DefaultMetaDataStorageNameMapper;
+
+/**
+ * default storage-manager for property information entries
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+class DefaultMetaDataStorageManager extends AbstractApplicationScopeAwareStorageManager<MetaDataStorage>
+{
+    DefaultMetaDataStorageManager()
+    {
+        register(new DefaultMetaDataStorageNameMapper());
+    }
+
+    public String getStorageManagerKey()
+    {
+        return StorageManager.class.getName() + "_FOR_META_DATA_CACHE:KEY";
+    }
+}

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java?rev=811962&r1=811961&r2=811962&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java Mon Sep  7 01:06:53 2009
@@ -61,6 +61,7 @@
 
         setStorageManager(RendererProxyStorage.class, new DefaultRendererProxyStorageManager(), false);
         setStorageManager(GroupStorage.class, new DefaultGroupStorageManager(), false);
+        setStorageManager(MetaDataStorage.class, new DefaultMetaDataStorageManager(), false);
     }
 
     public StorageManager create(Class storageType)
@@ -90,7 +91,7 @@
                 return storageManager;
             }
         }
-        return this.storageTypeToStorageManagerMap.get(storageType);
+        return getStorageManager(storageType);
     }
 
     private synchronized void addMapping(Class storageType, StorageManager storageManager)

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MetaDataStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MetaDataStorage.java?rev=811962&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MetaDataStorage.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MetaDataStorage.java Mon Sep  7 01:06:53 2009
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.storage;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.API)
+public interface MetaDataStorage
+{
+    void storeMetaDataOf(PropertyInformation propertyInformation);
+
+    MetaDataEntry[] getMetaData(Class targetClass, String targetProperty);
+
+    boolean containsMetaDataFor(Class targetClass, String targetProperty);
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultMetaDataStorageNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultMetaDataStorageNameMapper.java?rev=811962&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultMetaDataStorageNameMapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultMetaDataStorageNameMapper.java Mon Sep  7 01:06:53 2009
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.storage.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.storage.MetaDataStorage;
+import org.apache.myfaces.extensions.validator.core.storage.DefaultMetaDataStorage;
+
+/**
+ * use a public class to allow optional deregistration
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+public class DefaultMetaDataStorageNameMapper implements NameMapper<String>
+{
+    public String createName(String source)
+    {
+        return (MetaDataStorage.class.getName().equals(source)) ?
+                DefaultMetaDataStorage.class.getName() : null;
+    }
+}