myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r889452 - in /myfaces/extensions/validator/branches/branch_for_jsf_1_1: core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/ core/src/main/java...
Date Thu, 10 Dec 2009 22:56:44 GMT
Author: gpetracek
Date: Thu Dec 10 22:56:43 2009
New Revision: 889452

URL: http://svn.apache.org/viewvc?rev=889452&view=rev
Log:
internal refactorings

Added:
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultRendererInterceptorPropertyStorage.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultRendererInterceptorPropertyStorageManager.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/RendererInterceptorPropertyStorage.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultRendererInterceptorPropertyStorageNameMapper.java
Modified:
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractValidationInterceptor.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptorInternals.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/ModelValidation.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationEntry.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/util/ExtValBeanValidationMetaDataInternals.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationPhaseListener.java

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractValidationInterceptor.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/interceptor/AbstractValidationInterceptor.java?rev=889452&r1=889451&r2=889452&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractValidationInterceptor.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/AbstractValidationInterceptor.java
Thu Dec 10 22:56:43 2009
@@ -22,6 +22,10 @@
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.core.ExtValContext;
 import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ValidationModuleKey;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.core.storage.RendererInterceptorPropertyStorage;
 import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipBeforeInterceptorsException;
 import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipRendererDelegationException;
 import org.apache.myfaces.extensions.validator.core.recorder.ProcessedInformationRecorder;
@@ -35,6 +39,8 @@
 import javax.faces.validator.ValidatorException;
 import javax.el.PropertyNotFoundException;
 import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
 
 /**
  * @author Gerhard Petracek
@@ -76,6 +82,8 @@
             throw r;
         }
 
+        setRendererInterceptorProperties(uiComponent);
+        
         if(recordProcessedInformation())
         {
             //recorde user input e.g. for cross-component validation
@@ -96,7 +104,8 @@
             {
                 convertedObject = transformValueForValidation(convertedObject);
 
-                if(validateValue(convertedObject))
+                if(validateValue(convertedObject) &&
+                        processBeforeValidation(facesContext, uiComponent, convertedObject))
                 {
                     processValidation(facesContext, uiComponent, convertedObject);
                 }
@@ -114,8 +123,48 @@
                 throw new ConverterException(e.getFacesMessage(), e);
             }
         }
+        finally
+        {
+            processAfterValidation(facesContext, uiComponent, convertedObject);
+            resetRendererInterceptorProperties(uiComponent);
+        }
+    }
+
+    protected boolean processBeforeValidation(FacesContext facesContext, UIComponent uiComponent,
Object value)
+    {
+        return ExtValUtils.executeGlobalBeforeValidationInterceptors(facesContext, uiComponent,
value,
+                PropertyInformation.class.getName(), getPropertyInformation(facesContext,
uiComponent), getModuleKey());
+    }
+
+    protected void processAfterValidation(FacesContext facesContext, UIComponent uiComponent,
Object value)
+    {
+        ExtValUtils.executeGlobalAfterValidationInterceptors(facesContext, uiComponent, value,
+                PropertyInformation.class.getName(), getPropertyInformation(facesContext,
uiComponent), getModuleKey());
     }
 
+    protected PropertyInformation getPropertyInformation(FacesContext facesContext, UIComponent
uiComponent)
+    {
+        Map<String, Object> properties = getPropertiesForComponentMetaDataExtractor(uiComponent);
+
+        MetaDataExtractor metaDataExtractor = getComponentMetaDataExtractor(properties);
+
+        return metaDataExtractor.extract(facesContext, uiComponent);
+    }
+
+    protected Map<String, Object> getPropertiesForComponentMetaDataExtractor(UIComponent
uiComponent)
+    {
+        Map<String, Object> properties = new HashMap<String, Object>();
+
+        if(getModuleKey() != null)
+        {
+            properties.put(ValidationModuleKey.class.getName(), getModuleKey());
+        }
+        properties.put(UIComponent.class.getName(), uiComponent);
+        return properties;
+    }
+
+    protected abstract MetaDataExtractor getComponentMetaDataExtractor(Map<String, Object>
properties);
+
     protected Object transformValueForValidation(Object convertedObject)
     {
         if ("".equals(convertedObject) && interpretEmptyStringValuesAsNull())
@@ -187,4 +236,50 @@
         //override if needed
         return false;
     }
+
+    protected Class getModuleKey()
+    {
+        //override if needed
+        return null;
+    }
+
+    protected Map<String, Object> getInterceptorProperties(UIComponent uiComponent)
+    {
+        Map<String, Object> result = new HashMap<String, Object>();
+
+        if(getModuleKey() != null)
+        {
+            result.put(ValidationModuleKey.class.getName(), getModuleKey());
+        }
+        result.put(UIComponent.class.getName(), uiComponent);
+
+        return result;
+    }
+
+    private void setRendererInterceptorProperties(UIComponent uiComponent)
+    {
+        RendererInterceptorPropertyStorage interceptorPropertyStorage = getRendererInterceptorPropertyStorage();
+
+        Map<String, Object> properties = getInterceptorProperties(uiComponent);
+        for(String key : properties.keySet())
+        {
+            interceptorPropertyStorage.setProperty(key, properties.get(key));
+        }
+    }
+
+    private void resetRendererInterceptorProperties(UIComponent uiComponent)
+    {
+        RendererInterceptorPropertyStorage interceptorPropertyStorage = getRendererInterceptorPropertyStorage();
+
+        for(String key : getInterceptorProperties(uiComponent).keySet())
+        {
+            interceptorPropertyStorage.removeProperty(key);
+        }
+    }
+
+    private RendererInterceptorPropertyStorage getRendererInterceptorPropertyStorage()
+    {
+        return ExtValUtils.getStorage(RendererInterceptorPropertyStorage.class,
+                RendererInterceptorPropertyStorage.class.getName());
+    }
 }

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.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/interceptor/ValidationInterceptor.java?rev=889452&r1=889451&r2=889452&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationInterceptor.java
Thu Dec 10 22:56:43 2009
@@ -85,16 +85,11 @@
 
     protected void processValidation(FacesContext facesContext, UIComponent uiComponent,
Object convertedObject)
     {
-        MetaDataExtractor metaDataExtractor = ExtValUtils.getComponentMetaDataExtractorFor(getModuleKey());
+        MetaDataExtractor metaDataExtractor = ExtValUtils
+                .getComponentMetaDataExtractorWith(getPropertiesForComponentMetaDataExtractor(uiComponent));
 
         PropertyInformation propertyInformation = metaDataExtractor.extract(facesContext,
uiComponent);
 
-        if(!ExtValUtils.executeGlobalBeforeValidationInterceptors(facesContext, uiComponent,
convertedObject,
-                PropertyInformation.class.getName() ,propertyInformation, getModuleKey()))
-        {
-            return;
-        }
-
         try
         {
             if(logger.isTraceEnabled())
@@ -110,12 +105,14 @@
             {
                 logger.trace("validation finished");
             }
-
-            ExtValUtils.executeGlobalAfterValidationInterceptors(facesContext, uiComponent,
convertedObject,
-                    PropertyInformation.class.getName(), propertyInformation, getModuleKey());
         }
     }
 
+    protected MetaDataExtractor getComponentMetaDataExtractor(Map<String, Object> properties)
+    {
+        return ExtValUtils.getComponentMetaDataExtractorWith(properties);
+    }
+
     protected void processFieldValidation(FacesContext facesContext,
                                           UIComponent uiComponent,
                                           Object convertedObject,
@@ -207,10 +204,4 @@
     {
         return true;
     }
-
-    protected Class getModuleKey()
-    {
-        //override if needed
-        return null;
-    }
 }

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultRendererInterceptorPropertyStorage.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/DefaultRendererInterceptorPropertyStorage.java?rev=889452&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultRendererInterceptorPropertyStorage.java
(added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultRendererInterceptorPropertyStorage.java
Thu Dec 10 22:56:43 2009
@@ -0,0 +1,59 @@
+/*
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(INTERNAL)
+public class DefaultRendererInterceptorPropertyStorage implements RendererInterceptorPropertyStorage
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    private Map<String, Object> properties = new HashMap<String, Object>();
+
+    public void setProperty(String key, Object value)
+    {
+        this.properties.put(key, value);
+    }
+
+    public Object getProperty(String key)
+    {
+        return this.properties.get(key);
+    }
+
+    public <T> T getProperty(String key, Class<T> targetClass)
+    {
+        return (T)this.properties.get(key);
+    }
+
+    public void removeProperty(String key)
+    {
+        this.properties.remove(key);
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultRendererInterceptorPropertyStorageManager.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/DefaultRendererInterceptorPropertyStorageManager.java?rev=889452&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultRendererInterceptorPropertyStorageManager.java
(added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultRendererInterceptorPropertyStorageManager.java
Thu Dec 10 22:56:43 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.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.storage.mapper.DefaultRendererInterceptorPropertyStorageNameMapper;
+
+/**
+ * default storage-manager for renderer interceptor properties
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(INTERNAL)
+class DefaultRendererInterceptorPropertyStorageManager
+        extends AbstractRequestScopeAwareStorageManager<RendererInterceptorPropertyStorage>
+{
+    DefaultRendererInterceptorPropertyStorageManager()
+    {
+        register(new DefaultRendererInterceptorPropertyStorageNameMapper());
+    }
+
+    public String getStorageManagerKey()
+    {
+        return StorageManager.class.getName() + "_FOR_RENDERER_INTERCEPTOR_PROPERTY: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=889452&r1=889451&r2=889452&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
Thu Dec 10 22:56:43 2009
@@ -59,11 +59,18 @@
             logger.debug(getClass().getName() + " instantiated");
         }
 
-        setStorageManager(RendererProxyStorage.class, new DefaultRendererProxyStorageManager(),
false);
-        setStorageManager(GroupStorage.class, new DefaultGroupStorageManager(), false);
-        setStorageManager(MetaDataStorage.class, new DefaultMetaDataStorageManager(), false);
-        setStorageManager(FacesMessageStorage.class, new DefaultFacesMessageStorageManager(),
false);
-        setStorageManager(PropertyStorage.class, new DefaultPropertyStorageManager(), false);
+        setStorageManager(RendererProxyStorage.class,
+                new DefaultRendererProxyStorageManager(), false);
+        setStorageManager(GroupStorage.class,
+                new DefaultGroupStorageManager(), false);
+        setStorageManager(MetaDataStorage.class,
+                new DefaultMetaDataStorageManager(), false);
+        setStorageManager(FacesMessageStorage.class,
+                new DefaultFacesMessageStorageManager(), false);
+        setStorageManager(PropertyStorage.class,
+                new DefaultPropertyStorageManager(), false);
+        setStorageManager(RendererInterceptorPropertyStorage.class,
+                new DefaultRendererInterceptorPropertyStorageManager(), false);
 
         setStorageManager(
                 FacesInformationStorage.class, new DefaultFacesInformationStorageManager(),
false);

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/RendererInterceptorPropertyStorage.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/RendererInterceptorPropertyStorage.java?rev=889452&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/RendererInterceptorPropertyStorage.java
(added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/RendererInterceptorPropertyStorage.java
Thu Dec 10 22:56:43 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.storage;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * a storage which isn't used internally. it's for add-ons to easily store properties of
interceptors.
+ * without braking backward compatibility, it's possible to use these properties in custom
artifacts.
+ * rendering interception is an internal concept. so properties,... of it won't get into
the api.
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@UsageInformation(UsageCategory.API)
+public interface RendererInterceptorPropertyStorage
+{
+    void setProperty(String key, Object value);
+
+    Object getProperty(String key);
+
+    <T> T getProperty(String key, Class<T> targetClass);
+
+    void removeProperty(String key);
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultRendererInterceptorPropertyStorageNameMapper.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/DefaultRendererInterceptorPropertyStorageNameMapper.java?rev=889452&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultRendererInterceptorPropertyStorageNameMapper.java
(added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultRendererInterceptorPropertyStorageNameMapper.java
Thu Dec 10 22:56:43 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.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.storage.RendererInterceptorPropertyStorage;
+import org.apache.myfaces.extensions.validator.core.storage.DefaultRendererInterceptorPropertyStorage;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+
+/**
+ * use a public class to allow optional deregistration
+ *
+ * @author Gerhard Petracek
+ * @since x.x.3
+ */
+@InvocationOrder(100)
+public class DefaultRendererInterceptorPropertyStorageNameMapper implements NameMapper<String>
+{
+    public String createName(String source)
+    {
+        return (RendererInterceptorPropertyStorage.class.getName().equals(source)) ?
+                DefaultRendererInterceptorPropertyStorage.class.getName() : null;
+    }
+}

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.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/util/ExtValUtils.java?rev=889452&r1=889451&r2=889452&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
Thu Dec 10 22:56:43 2009
@@ -162,17 +162,6 @@
                 .create();
     }
 
-    public static MetaDataExtractor getComponentMetaDataExtractorFor(Class moduleKey)
-    {
-        Map<String, Object> properties = new HashMap<String, Object>();
-
-        if(moduleKey != null)
-        {
-            properties.put(ValidationModuleKey.class.getName(), moduleKey);
-        }
-        return getComponentMetaDataExtractorWith(properties);
-    }
-
     public static MetaDataExtractor getComponentMetaDataExtractorWith(Map<String, Object>
properties)
     {
         return ExtValContext.getContext().getFactoryFinder()

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java?rev=889452&r1=889451&r2=889452&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptor.java
Thu Dec 10 22:56:43 2009
@@ -22,19 +22,15 @@
 import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
 import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
 import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
-import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipBeforeInterceptorsException;
-import org.apache.myfaces.extensions.validator.core.renderkit.exception.SkipRendererDelegationException;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
-import org.apache.myfaces.extensions.validator.util.ExtValUtils;
 import org.apache.myfaces.extensions.validator.beanval.util.BeanValidationUtils;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
-import javax.faces.render.Renderer;
 import javax.validation.ConstraintViolation;
-import java.io.IOException;
 import java.util.Set;
+import java.util.Map;
 
 /**
  * @author Gerhard Petracek
@@ -45,16 +41,6 @@
 {
     private BeanValidationInterceptorInternals bviUtils = new BeanValidationInterceptorInternals(this.logger);
 
-    @Override
-    public void beforeEncodeBegin(FacesContext facesContext, UIComponent uiComponent, Renderer
wrapped)
-            throws IOException, SkipBeforeInterceptorsException, SkipRendererDelegationException
-    {
-        if (processComponent(uiComponent))
-        {
-            initComponent(facesContext, uiComponent);
-        }
-    }
-
     protected void initComponent(FacesContext facesContext, UIComponent uiComponent)
     {
         if (logger.isTraceEnabled())
@@ -62,7 +48,8 @@
             logger.trace("start to init component " + uiComponent.getClass().getName());
         }
 
-        PropertyDetails propertyDetails = bviUtils.extractPropertyDetails(facesContext, uiComponent);
+        PropertyDetails propertyDetails = bviUtils.extractPropertyDetails(
+                facesContext, uiComponent, getPropertiesForComponentMetaDataExtractor(uiComponent));
 
         if (propertyDetails != null)
         {
@@ -89,12 +76,6 @@
                     logger.trace("jsr303 start validation");
                 }
 
-                if (!executeGlobalBeforeValidationInterceptors(
-                        facesContext, uiComponent, convertedObject, propertyInformation))
-                {
-                    return;
-                }
-
                 processFieldValidation(facesContext, uiComponent, convertedObject, propertyInformation);
             }
         }
@@ -106,18 +87,13 @@
                 {
                     logger.trace("jsr303 validation finished");
                 }
-
-                executeGlobalAfterValidationInterceptors(
-                        facesContext, uiComponent, convertedObject, propertyInformation);
             }
         }
     }
 
-    protected PropertyInformation getPropertyInformation(FacesContext facesContext, UIComponent
uiComponent)
+    protected MetaDataExtractor getComponentMetaDataExtractor(Map<String, Object> properties)
     {
-        MetaDataExtractor metaDataExtractor = bviUtils.getComponentMetaDataExtractor(uiComponent);
-
-        return metaDataExtractor.extract(facesContext, uiComponent);
+        return bviUtils.getComponentMetaDataExtractor(properties);
     }
 
     protected boolean hasBeanValidationConstraints(PropertyInformation propertyInformation)
@@ -140,24 +116,9 @@
         }
     }
 
-    /*
-     * e.g. extract groups for validation
-     */
-    private boolean executeGlobalBeforeValidationInterceptors(FacesContext facesContext,
-                                                              UIComponent uiComponent,
-                                                              Object convertedObject,
-                                                              PropertyInformation propertyInformation)
-    {
-        return ExtValUtils.executeGlobalBeforeValidationInterceptors(facesContext, uiComponent,
convertedObject,
-                PropertyInformation.class.getName(), propertyInformation, BeanValidationModuleKey.class);
-    }
-
-    private void executeGlobalAfterValidationInterceptors(FacesContext facesContext,
-                                                          UIComponent uiComponent,
-                                                          Object convertedObject,
-                                                          PropertyInformation propertyInformation)
+    @Override
+    protected Class getModuleKey()
     {
-        ExtValUtils.executeGlobalAfterValidationInterceptors(facesContext, uiComponent, convertedObject,
-                PropertyInformation.class.getName(), propertyInformation, BeanValidationModuleKey.class);
+        return BeanValidationModuleKey.class;
     }
 }

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptorInternals.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptorInternals.java?rev=889452&r1=889451&r2=889452&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptorInternals.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/BeanValidationInterceptorInternals.java
Thu Dec 10 22:56:43 2009
@@ -26,7 +26,6 @@
 import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
 import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
 import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
-import org.apache.myfaces.extensions.validator.core.ValidationModuleKey;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.ToDo;
@@ -59,9 +58,10 @@
         this.logger = logger;
     }
 
-    PropertyDetails extractPropertyDetails(FacesContext facesContext, UIComponent uiComponent)
+    PropertyDetails extractPropertyDetails(
+            FacesContext facesContext, UIComponent uiComponent, Map<String, Object>
propertiesForExtraction)
     {
-        PropertyDetails result = getComponentMetaDataExtractor(uiComponent)
+        PropertyDetails result = getComponentMetaDataExtractor(propertiesForExtraction)
                 .extract(facesContext, uiComponent)
                 .getInformation(PropertyInformationKeys.PROPERTY_DETAILS, PropertyDetails.class);
 
@@ -78,12 +78,8 @@
      * also invokes meta-data extraction interceptors
      * (see e.g. ExtValBeanValidationMetaDataExtractionInterceptor)
      */
-    MetaDataExtractor getComponentMetaDataExtractor(UIComponent uiComponent)
+    MetaDataExtractor getComponentMetaDataExtractor(Map<String, Object> properties)
     {
-        Map<String, Object> properties = new HashMap<String, Object>();
-        properties.put(ValidationModuleKey.class.getName(), BeanValidationModuleKey.class);
-        properties.put(UIComponent.class.getName(), uiComponent);
-
         return ExtValUtils.getComponentMetaDataExtractorWith(properties);
     }
 

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/ModelValidation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/ModelValidation.java?rev=889452&r1=889451&r2=889452&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/ModelValidation.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/annotation/ModelValidation.java
Thu Dec 10 22:56:43 2009
@@ -42,15 +42,14 @@
 @Documented
 public @interface ModelValidation
 {
-    public static final String DEFAULT_TARGET = "base";
-    public static final String DEFAULT_MESSAGE = "org.apache.myfaces.extensions.validator.bv_message";
+    public static final String DEFAULT = "";
 
     boolean isActive() default false;
 
     boolean displayInline() default false;
 
     @ToDo(value = Priority.MEDIUM, description = "support property chain syntax")
-    String[] validationTargets() default DEFAULT_TARGET;
+    String[] validationTargets() default DEFAULT;
 
-    String message() default DEFAULT_MESSAGE;
-}
+    String message() default DEFAULT;
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationEntry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationEntry.java?rev=889452&r1=889451&r2=889452&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationEntry.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/storage/ModelValidationEntry.java
Thu Dec 10 22:56:43 2009
@@ -38,7 +38,7 @@
     private List<Class> groups = new ArrayList<Class>();
     private List<Object> validationTargets = new ArrayList<Object>();
     private boolean displayMessageInline = false;
-    private String customMessage = ModelValidation.DEFAULT_MESSAGE;
+    private String customMessage = ModelValidation.DEFAULT;
     
     //the original source where the extval-bv meta-data has been found
     private Object metaDataSourceObject;

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/util/ExtValBeanValidationMetaDataInternals.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/util/ExtValBeanValidationMetaDataInternals.java?rev=889452&r1=889451&r2=889452&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/util/ExtValBeanValidationMetaDataInternals.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/util/ExtValBeanValidationMetaDataInternals.java
Thu Dec 10 22:56:43 2009
@@ -510,7 +510,7 @@
         Object validationTarget;
         for (String validationTargetExpression : beanValidation.modelValidation().validationTargets())
         {
-            if (ModelValidation.DEFAULT_TARGET.equals(validationTargetExpression))
+            if (ModelValidation.DEFAULT.equals(validationTargetExpression))
             {
                 continue;
             }

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationPhaseListener.java?rev=889452&r1=889451&r2=889452&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationPhaseListener.java
(original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/validation/ModelValidationPhaseListener.java
Thu Dec 10 22:56:43 2009
@@ -385,7 +385,7 @@
 
     private boolean isDefaultMessage(ModelValidationEntry modelValidationEntry)
     {
-        return ModelValidation.DEFAULT_MESSAGE.equals(modelValidationEntry.getCustomMessage());
+        return ModelValidation.DEFAULT.equals(modelValidationEntry.getCustomMessage());
     }
 
     private String interpolateValidationErrorMessage(String extValInlineMessage,



Mime
View raw message