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 2008/07/14 19:58:22 UTC
svn commit: r676664 [3/12] - in /myfaces/extensions/validator: branches/
branches/jsf_1.1/ branches/jsf_1.1/core/ branches/jsf_1.1/core/src/
branches/jsf_1.1/core/src/main/ branches/jsf_1.1/core/src/main/config/
branches/jsf_1.1/core/src/main/java/ bra...
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/DefaultValidationStrategyToMsgResolverNameMapper.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.message.resolver.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class DefaultValidationStrategyToMsgResolverNameMapper implements NameMapper<ValidationStrategy> {
+ public String createName(ValidationStrategy validationStrategy) {
+ return ExtValUtils.getInformationProviderBean().getConventionNameForMessageResolverPackage(validationStrategy.getClass(), getClassName(validationStrategy.getClass().getSimpleName()));
+ }
+
+ protected String getClassName(String strategyClassName) {
+ return ExtValUtils.getInformationProviderBean().getConventionNameForMessageResolverClass(strategyClassName);
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/mapper/SimpleValidationStrategyToMsgResolverNameMapper.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.message.resolver.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class SimpleValidationStrategyToMsgResolverNameMapper implements NameMapper<ValidationStrategy> {
+ public String createName(ValidationStrategy validationStrategy) {
+ String resolverName = validationStrategy.getClass().getName();
+
+ return resolverName.substring(0, resolverName.lastIndexOf(".")) + ".DefaultValidationErrorMessageResolver";
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidationStrategy.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.strategy;
+
+import org.apache.myfaces.extensions.validator.util.FactoryUtils;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import java.lang.annotation.Annotation;
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+/**
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractValidationStrategy extends AbstractValidatorAdapter {
+ protected static final String DETAIL_MESSAGE_KEY_POSTFIX = "_details";
+
+ protected String resolveMessage(String key) {
+ Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
+
+ return FactoryUtils.getMessageResolverFactory().create(this).getMessage(key, locale);
+ }
+
+ protected String getErrorMessageSummary(Annotation annotation) {
+ return resolveMessage(getValidationErrorMsgKey(annotation));
+ }
+
+ protected String getErrorMessageDetails(Annotation annotation) {
+ try {
+ String key = getValidationErrorMsgKey(annotation);
+ return (key != null) ? resolveMessage(key + DETAIL_MESSAGE_KEY_POSTFIX) : null;
+ } catch (MissingResourceException e) {
+ logger.warn("couldn't find key " + getValidationErrorMsgKey(annotation) + DETAIL_MESSAGE_KEY_POSTFIX, e);
+ }
+ return null;
+ }
+
+ protected FacesMessage getValidationErrorFacesMassage(Annotation annotation) {
+ return new FacesMessage(FacesMessage.SEVERITY_ERROR, getErrorMessageSummary(annotation), getErrorMessageDetails(annotation));
+ }
+
+ protected abstract String getValidationErrorMsgKey(Annotation annotation);
+}
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java Mon Jul 14 10:58:09 2008
@@ -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.validation.strategy;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.ConverterException;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractValidatorAdapter implements ValidationStrategy {
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ public void validate(FacesContext facesContext, UIComponent uiComponent, AnnotationEntry annotationEntry, Object convertedObject) {
+ initValidation(facesContext, uiComponent, annotationEntry, convertedObject);
+
+ try {
+ processValidation(facesContext, uiComponent, annotationEntry, convertedObject);
+ }
+ catch (ValidatorException e) {
+ if (processAfterValidatorException(facesContext, uiComponent, annotationEntry, convertedObject, e)) {
+ throw new ConverterException(e.getFacesMessage(), e);
+ }
+ }
+ }
+
+ protected void initValidation(FacesContext facesContext, UIComponent uiComponent, AnnotationEntry annotationEntry, Object convertedObject) {
+ //override if needed
+ }
+
+ //override if needed
+ protected boolean processAfterValidatorException(FacesContext facesContext, UIComponent uiComponent, AnnotationEntry annotationEntry, Object convertedObject, ValidatorException e) {
+ return true;
+ }
+
+ protected abstract void processValidation(FacesContext facesContext, UIComponent uiComponent, AnnotationEntry annotationEntry, Object convertedObject) throws ValidatorException;
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/DefaultValidationStrategyFactory.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.strategy;
+
+import org.apache.myfaces.extensions.validator.core.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper.CustomConfiguredAnnotationToValidationStrategyNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper.CustomConventionAnnotationToValidationStrategyNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper.DefaultAnnotationToValidationStrategyNameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper.SimpleAnnotationToValidationStrategyNameMapper;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import java.lang.annotation.Annotation;
+import java.util.*;
+
+/**
+ * @author Gerhard Petracek
+ */
+//TODO add generic java api (de-/register mapping)
+public class DefaultValidationStrategyFactory implements ClassMappingFactory<Annotation, ValidationStrategy> {
+ private static Map<String, String> annotationStrategyMapping = null;
+ private static List<NameMapper<Annotation>> nameMapperList = new ArrayList<NameMapper<Annotation>>();
+
+ static {
+ nameMapperList.add(new CustomConfiguredAnnotationToValidationStrategyNameMapper());
+ nameMapperList.add(new CustomConventionAnnotationToValidationStrategyNameMapper());
+ nameMapperList.add(new DefaultAnnotationToValidationStrategyNameMapper());
+ nameMapperList.add(new SimpleAnnotationToValidationStrategyNameMapper());
+ //TODO if jsr 303 doesn't change:
+ //nameMapperList.add(new BeanValidationAnnotationStrategyNameMapper());
+ }
+
+ public ValidationStrategy create(Annotation annotation) {
+ if (annotationStrategyMapping == null) {
+ initStaticStrategyMappings();
+ }
+
+ String annotationName = annotation.annotationType().getName();
+
+ if (annotationStrategyMapping.containsKey(annotationName)) {
+ return (ValidationStrategy) ClassUtils.tryToInstantiateClassForName(annotationStrategyMapping.get(annotationName));
+ }
+
+ ValidationStrategy validationStrategy;
+ String strategyName;
+ //null -> use name mappers
+ for (NameMapper<Annotation> nameMapper : nameMapperList) {
+ strategyName = nameMapper.createName(annotation);
+ //build convention (ValidationStrategy)
+ validationStrategy = (ValidationStrategy) ClassUtils.tryToInstantiateClassForName(strategyName);
+
+ if (validationStrategy != null) {
+ addMapping(annotationName, strategyName);
+ return validationStrategy;
+ }
+ }
+
+ return null;
+ }
+
+ private void addMapping(String annotationName, String strategyName) {
+ synchronized (DefaultValidationStrategyFactory.class) {
+ annotationStrategyMapping.put(annotationName, strategyName);
+ }
+ //TODO logging
+ }
+
+ private void initStaticStrategyMappings() {
+ synchronized (DefaultValidationStrategyFactory.class) {
+ annotationStrategyMapping = new HashMap<String, String>();
+
+ //setup internal static mappings
+ for (String internalMappingSource : ExtValUtils.getInformationProviderBean().getStaticStrategyMappingSources()) {
+ setupStrategyMappings(internalMappingSource);
+ }
+
+ //try to setup mapping with base name by convention - overrides default mapping
+ try {
+ //build convention (strategy mapping)
+ setupStrategyMappings(ExtValUtils.getInformationProviderBean().getCustomStaticStrategyMappingSource());
+ }
+ catch (Throwable t) {
+ //do nothing - it was just a try
+ }
+
+ //setup custom mapping - overrides all other mappings
+ String customMappingBaseName = WebXmlParameter.CUSTOM_VALIDATIONSTRATEGY_MAPPING;
+ if (customMappingBaseName != null) {
+ try {
+ setupStrategyMappings(customMappingBaseName);
+ }
+ catch (MissingResourceException e) {
+ //TODO logging
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private void setupStrategyMappings(String bundle) {
+ ResourceBundle strategyMapping = ResourceBundle.getBundle(bundle);
+
+ if (strategyMapping == null) {
+ return;
+ }
+
+ Enumeration keys = strategyMapping.getKeys();
+
+ String annotationClassName;
+ String validationStrategyClassName;
+
+ while (keys.hasMoreElements()) {
+ annotationClassName = (String) keys.nextElement();
+ validationStrategyClassName = strategyMapping.getString(annotationClassName);
+
+ addMapping(annotationClassName, validationStrategyClassName);
+ }
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/ValidationStrategy.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.strategy;
+
+import org.apache.myfaces.extensions.validator.core.annotation.AnnotationEntry;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Gerhard Petracek
+ */
+public interface ValidationStrategy {
+ void validate(FacesContext facesContext, UIComponent uiComponent, AnnotationEntry annotationEntry, Object convertedObject);
+}
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConfiguredAnnotationToValidationStrategyNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConfiguredAnnotationToValidationStrategyNameMapper.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConfiguredAnnotationToValidationStrategyNameMapper.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConfiguredAnnotationToValidationStrategyNameMapper.java Mon Jul 14 10:58:09 2008
@@ -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.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.mapper.AbstractCustomNameMapper;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Deprecated
+public class CustomConfiguredAnnotationToValidationStrategyNameMapper extends AbstractCustomNameMapper<Annotation> {
+
+ protected String getCustomNameMapperClassName() {
+ return WebXmlParameter.CUSTOM_ANNOTATION_TO_VALIDATION_STRATEGY_NAME_MAPPER;
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/CustomConventionAnnotationToValidationStrategyNameMapper.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.AbstractCustomNameMapper;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * NameMappers are stateless
+ *
+ * @author Gerhard Petracek
+ */
+public class CustomConventionAnnotationToValidationStrategyNameMapper extends AbstractCustomNameMapper<Annotation> {
+
+ protected String getCustomNameMapperClassName() {
+ return ExtValUtils.getInformationProviderBean().getCustomAnnotationToValidationStrategyNameMapper();
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/DefaultAnnotationToValidationStrategyNameMapper.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class DefaultAnnotationToValidationStrategyNameMapper implements NameMapper<Annotation> {
+ public String createName(Annotation annotation) {
+ return ExtValUtils.getInformationProviderBean().getConventionNameForValidationStrategy(annotation);
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/mapper/SimpleAnnotationToValidationStrategyNameMapper.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation.strategy.mapper;
+
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class SimpleAnnotationToValidationStrategyNameMapper implements NameMapper<Annotation> {
+ public String createName(Annotation annotation) {
+ return annotation.annotationType().getName() + "Strategy";
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ClassUtils.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,61 @@
+/*
+ * 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;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ClassUtils {
+ public static Class loadClassForName(String name) throws ClassNotFoundException {
+ try {
+ // Try WebApp ClassLoader first
+ return Class.forName(name,
+ false, // do not initialize for faster startup
+ Thread.currentThread().getContextClassLoader());
+ }
+ catch (ClassNotFoundException ignore) {
+ // fallback: Try ClassLoader for ClassUtils (i.e. the myfaces.jar lib)
+ return Class.forName(name,
+ false, // do not initialize for faster startup
+ ClassUtils.class.getClassLoader());
+ }
+ }
+
+ public static Object tryToInstantiateClass(Class targetClass) {
+ try {
+ return targetClass.newInstance();
+ } catch (Throwable t) {
+ //do nothing - it was just a try
+ }
+ return null;
+ }
+
+ public static Object tryToInstantiateClassForName(String className) {
+ try {
+ return instantiateClassForName(className);
+ } catch (Throwable t) {
+ //do nothing - it was just a try
+ }
+ return null;
+ }
+
+ public static Object instantiateClassForName(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+ return loadClassForName(className).newInstance();
+ }
+}
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ELUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ELUtils.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ELUtils.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ELUtils.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,87 @@
+/*
+ * 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 javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+/**
+ * in order to centralize the jsf version dependency within the core
+ *
+ * @author Gerhard Petracek
+ */
+public class ELUtils {
+ public static Class getTypeOfValueBindingForExpression(FacesContext facesContext, String valueBindingExpression) {
+ //due to a restriction with the ri
+ Object bean = ELUtils.getValueOfExpression(facesContext, valueBindingExpression);
+ return (bean != null) ? bean.getClass() : null;
+ }
+
+ public static Object getBean(String beanName) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ return facesContext.getApplication().getVariableResolver().resolveVariable(facesContext, beanName);
+ }
+
+ //TODO refactor - problem - static values - jsf 1.2 e.g.: ${value}
+ public static Object getBeanObject(String valueBindingExpression, UIComponent uiComponent) {
+ return getBeanObject(valueBindingExpression);
+ }
+
+ public static Object getBeanObject(String valueBindingExpression) {
+ String newExpression = valueBindingExpression.substring(0, valueBindingExpression.lastIndexOf(".")) + "}";
+
+ return getValueOfExpression(FacesContext.getCurrentInstance(), newExpression);
+ }
+
+ public static Object getValueOfExpression(FacesContext facesContext, String valueBindingExpression) {
+ return (valueBindingExpression != null) ? facesContext.getApplication().createValueBinding(valueBindingExpression).getValue(facesContext) : null;
+ }
+
+ public static boolean isExpressionValid(FacesContext facesContext, String valueBindingExpression) {
+ return facesContext.getApplication().createValueBinding(valueBindingExpression) != null;
+ }
+
+
+ public static String getReliableValueBindingExpression(UIComponent uiComponent) {
+ String valueBindingExpression = getValueBindingExpression(uiComponent);
+
+ String baseExpression = valueBindingExpression;
+ if(baseExpression.contains(".")) {
+ baseExpression = baseExpression.substring(0, valueBindingExpression.lastIndexOf(".")) + "}";
+ }
+
+ if(getTypeOfValueBindingForExpression(FacesContext.getCurrentInstance(), baseExpression) == null) {
+ valueBindingExpression = FaceletsTaglibExpressionUtils.tryToCreateValueBindingForFaceletsBinding(uiComponent);
+ }
+ return valueBindingExpression;
+ }
+
+ public static String getValueBindingExpression(UIComponent uiComponent) {
+ ValueBinding valueExpression = uiComponent.getValueBinding("value");
+
+ return (valueExpression != null) ? valueExpression.getExpressionString() : null;
+ }
+
+ public static Class getTypeOfValueBindingForComponent(FacesContext facesContext, UIComponent uiComponent) {
+ ValueBinding valueBinding = uiComponent.getValueBinding("value");
+
+ return (valueBinding != null) ? valueBinding.getType(facesContext) : null;
+ }
+}
Added: myfaces/extensions/validator/branches/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/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,298 @@
+/*
+ * 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.core.InformationProviderBean;
+import org.apache.myfaces.extensions.validator.core.ProcessedInformationEntry;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+
+import javax.faces.FactoryFinder;
+import javax.faces.application.Application;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.event.PhaseListener;
+import javax.faces.lifecycle.Lifecycle;
+import javax.faces.lifecycle.LifecycleFactory;
+import java.util.*;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ExtValUtils {
+
+ public static String getBasePackage() {
+ return getInformationProviderBean().getBasePackage();
+ }
+
+ public static InformationProviderBean getInformationProviderBean() {
+ Map applicationMap = FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();
+ InformationProviderBean bean = (InformationProviderBean) applicationMap.get(InformationProviderBean.BEAN_NAME);
+
+ if (bean == null) {
+ return initInformationProviderBean(applicationMap);
+ }
+ return bean;
+ }
+
+ private static InformationProviderBean initInformationProviderBean(Map applicationMap) {
+
+ List<String> informationProviderBeanClassNames = new ArrayList<String>();
+
+ informationProviderBeanClassNames.add(WebXmlParameter.CUSTOM_CONVENTION_INFO_PROVIDER_BEAN);
+ informationProviderBeanClassNames.add(ExtValUtils.getCustomInformationProviderBeanClassName());
+ informationProviderBeanClassNames.add(InformationProviderBean.class.getName());
+
+ InformationProviderBean informationProviderBean;
+ for (String className : informationProviderBeanClassNames) {
+ informationProviderBean = (InformationProviderBean) ClassUtils.tryToInstantiateClassForName(className);
+
+ if (informationProviderBean != null) {
+ applicationMap.put(InformationProviderBean.BEAN_NAME, informationProviderBean);
+ return informationProviderBean;
+ }
+ }
+ throw new IllegalStateException(InformationProviderBean.class.getName() + " not found");
+ }
+
+ public static String getCustomInformationProviderBeanClassName() {
+ InformationProviderBean bean = (InformationProviderBean) ELUtils.getBean(InformationProviderBean.CUSTOM_BEAN);
+
+ return (bean != null) ? bean.getClass().getName() : null;
+ }
+
+ public static void deregisterPhaseListener(PhaseListener phaseListener) {
+ LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+
+ String currentId;
+ Lifecycle currentLifecycle;
+ Iterator lifecycleIds = lifecycleFactory.getLifecycleIds();
+ while (lifecycleIds.hasNext()) {
+ currentId = (String) lifecycleIds.next();
+ currentLifecycle = lifecycleFactory.getLifecycle(currentId);
+ currentLifecycle.removePhaseListener(phaseListener);
+ }
+ }
+
+ public static final String VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY = ExtValUtils.class.getName();
+
+ public static Map<String, ProcessedInformationEntry> getOrInitValueBindingConvertedValueMapping() {
+ Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+
+ if (!requestMap.containsKey(VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY)) {
+ resetCrossValidationStorage();
+ }
+
+ return (Map<String, ProcessedInformationEntry>) requestMap.get(VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY);
+ }
+
+ public static void resetCrossValidationStorage() {
+ FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY, new HashMap<String, ProcessedInformationEntry>());
+ }
+
+ /*
+ * workaround: mapping clientId -> proxy -> after restore view: find component + set converter of the mapping
+ * TODO: find a better solution
+ */
+ public static final String PROXY_MAPPING_KEY = VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY + ":proxyMapping";
+
+ public static Map<String, Object> getOrInitProxyMapping() {
+ //session scope is just the worst case - cleanup after restore view
+ Map sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
+
+ if (!sessionMap.containsKey(PROXY_MAPPING_KEY)) {
+ resetProxyMapping();
+ }
+
+ return (Map<String, Object>) sessionMap.get(PROXY_MAPPING_KEY);
+ }
+
+ public static void resetProxyMapping() {
+ FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(PROXY_MAPPING_KEY, new HashMap<String, Object>());
+ }
+
+ public static final String PROCESSED_CONVERTER_COUNT_KEY = VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY + ":processedConverterCount";
+
+ public static Integer getProcessedConverterCount() {
+ Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+
+ if (!requestMap.containsKey(PROCESSED_CONVERTER_COUNT_KEY)) {
+ resetProcessedConverterMapping();
+ }
+
+ return (Integer) requestMap.get(PROCESSED_CONVERTER_COUNT_KEY);
+ }
+
+ public static void setProcessedConverterCount(Integer count) {
+ Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+
+ if (!requestMap.containsKey(PROCESSED_CONVERTER_COUNT_KEY)) {
+ resetProcessedConverterMapping();
+ }
+
+ requestMap.put(PROCESSED_CONVERTER_COUNT_KEY, count);
+ }
+
+ public static void resetProcessedConverterMapping() {
+ FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(PROCESSED_CONVERTER_COUNT_KEY, 0);
+ }
+
+ public static void increaseProcessedConverterCount() {
+ setProcessedConverterCount(getProcessedConverterCount() + 1);
+ }
+
+ public static void decreaseProcessedConverterCount() {
+ setProcessedConverterCount(getProcessedConverterCount() - 1);
+ }
+
+ public static boolean useProxyMapping() {
+
+ String initParam = WebXmlParameter.DEACTIVATE_PROXY_MAPPING;
+ boolean disableProxyMapping = (initParam != null && initParam.trim().equalsIgnoreCase("true"));
+
+ return !(useFallbackAdapters() || disableProxyMapping);
+ }
+
+ @Deprecated
+ public static boolean useFallbackAdapters() {
+ String initParam = WebXmlParameter.USE_ADAPTERS;
+ return (initParam != null && initParam.trim().equalsIgnoreCase("true"));
+ }
+
+ public static void restoreProxies() {
+ UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
+
+ if (viewRoot != null && ExtValUtils.useProxyMapping()) {
+ Map componentConverterMapping = ExtValUtils.getOrInitProxyMapping();
+
+ Iterator current = componentConverterMapping.keySet().iterator();
+ String key;
+ Converter converter;
+ Converter converterOfComponent;
+ UIComponent component;
+ while (current.hasNext()) {
+ key = (String) current.next();
+ converter = (Converter) componentConverterMapping.get(key);
+ component = viewRoot.findComponent(key);
+
+ if (component == null) {
+ component = resolveComponentInComplexComponent(viewRoot, component, key);
+
+ if (component == null) {
+ continue;
+ }
+ }
+
+ if (!(component instanceof ValueHolder)) {
+ continue;
+ }
+
+ converterOfComponent = ((ValueHolder) component).getConverter();
+
+ //converterOfComponent lost callback during state-saving -> set converter of same type
+ if (converterOfComponent != null && converterOfComponent.getClass().getSuperclass().equals(converter.getClass().getSuperclass())) {
+ ((ValueHolder) component).setConverter(converter);
+ }
+ }
+ }
+
+ if (ExtValUtils.useProxyMapping()) {
+ ExtValUtils.resetProxyMapping();
+ }
+ }
+
+ //TODO
+ private static UIComponent resolveComponentInComplexComponent(UIComponent viewRoot, UIComponent component, String key) {
+ int index = key.lastIndexOf(":");
+
+ if(index == -1) {
+ return null;
+ }
+
+ String newKey = key.substring(0, index);
+ if (viewRoot.findComponent(newKey) == null) {
+ int newIndex = newKey.lastIndexOf(":");
+ if (newIndex < 1) {
+ return null;
+ }
+ newKey = newKey.substring(0, newIndex);
+
+ component = viewRoot.findComponent(newKey);
+
+ if (component == null) {
+ return null;
+ } else {
+ return tryToResolveChildComponent(component, key.substring(key.lastIndexOf(":")));
+ }
+ }
+ return null;
+ }
+
+ //TODO
+ private static UIComponent tryToResolveChildComponent(UIComponent component, String endOfKey) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ String clientId = component.getClientId(facesContext);
+
+ if (clientId.substring(clientId.lastIndexOf(":")).endsWith(endOfKey)) {
+ return component;
+ }
+
+ UIComponent foundComponent;
+ for (UIComponent child : (List<UIComponent>) component.getChildren()) {
+ foundComponent = tryToResolveChildComponent(child, endOfKey);
+
+ if (foundComponent != null) {
+ return foundComponent;
+ }
+ }
+
+ return null;
+ }
+
+ public static final String ORIGINAL_APPLICATION_KEY = VALUE_BINDING_CONVERTED_VALUE_MAPPING_KEY + ":wrapped_application";
+
+ //in order to access the wrapped application and support other Application wrappers
+ public static void setOriginalApplication(Application application) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ Map applicationMap = facesContext.getExternalContext().getApplicationMap();
+
+ if (!applicationMap.containsKey(ORIGINAL_APPLICATION_KEY)) {
+ synchronized (ExtValUtils.class) {
+ applicationMap.put(ORIGINAL_APPLICATION_KEY, application);
+ }
+ }
+ }
+
+ public static Application getOriginalApplication() {
+ return (Application) FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().get(ORIGINAL_APPLICATION_KEY);
+ }
+
+ public static Converter tryToCreateOriginalConverter(FacesContext facesContext, UIComponent uiComponent) {
+ //for backward compatibility: cross-validation workaround with hidden field and static value
+ Class valueBindingType = ELUtils.getTypeOfValueBindingForComponent(facesContext, uiComponent);
+
+ if (valueBindingType == null) {
+ return null;
+ }
+
+ return getOriginalApplication().createConverter(valueBindingType);
+ }
+}
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/FaceletsTaglibExpressionUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/FaceletsTaglibExpressionUtils.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/FaceletsTaglibExpressionUtils.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/FaceletsTaglibExpressionUtils.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,210 @@
+/*
+ * 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 javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import java.io.Externalizable;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class FaceletsTaglibExpressionUtils {
+ public static String tryToCreateValueBindingForFaceletsBinding(UIComponent uiComponent) {
+ String faceletsValueBindingExpression = ELUtils.getValueBindingExpression(uiComponent);
+
+ try {
+ List<String> foundBindings = extractELTerms(uiComponent.getValueBinding("value"));
+
+ return faceletsValueBindingExpression.substring(0, 1) + "{" + createBinding(foundBindings) + "}";
+ } catch (Throwable t) {
+ return faceletsValueBindingExpression;
+ }
+ }
+
+ private static String createBinding(List<String> expressions) {
+ String result = "";
+
+ String prevFaceletsAttributeName = null;
+ String currentBinding;
+ String partOfBinding;
+
+ int indexOfBindingDetails;
+ String[] foundBindingDetails;
+ String[] bindingDetails;
+
+ for (String entry : expressions) {
+ if (entry.startsWith("ValueExpression[")) {
+ continue;
+ }
+ //TODO log entry
+
+ foundBindingDetails = entry.split(" ");
+ indexOfBindingDetails = findIndexOfBindingDetails(foundBindingDetails);
+ if (indexOfBindingDetails == -1) {
+ return null;
+ }
+
+ bindingDetails = foundBindingDetails[indexOfBindingDetails].split("=");
+
+ if (bindingDetails.length < 2) {
+ return null;
+ }
+
+ currentBinding = bindingDetails[1];
+ if (prevFaceletsAttributeName != null) {
+ partOfBinding = currentBinding.substring(currentBinding.indexOf(prevFaceletsAttributeName) + prevFaceletsAttributeName.length(), currentBinding.indexOf("}"));
+ result = result + partOfBinding;
+ } else {
+ result = currentBinding.substring(currentBinding.indexOf("{") + 1, currentBinding.indexOf("}"));
+ }
+
+ prevFaceletsAttributeName = bindingDetails[0];
+ }
+ return result;
+ }
+
+ private static int findIndexOfBindingDetails(String[] bindingDetails) {
+ int count = 0;
+ for (String entry : bindingDetails) {
+ if (entry.contains("=")) {
+ return count;
+ }
+ count++;
+ }
+ return -1;
+ }
+
+ private static List<String> extractELTerms(Object o) {
+ List<String> foundELTerms = new ArrayList<String>();
+ try {
+ if (resolveELTerms(o, new HashMap<Object, Object>(), foundELTerms, 0) > 0) {
+ return foundELTerms;
+ }
+ }
+ catch (Exception ex) {
+ return null;
+ }
+ return null;
+ }
+
+ private static int resolveELTerms(Object o, Map<Object, Object> visited, List<String> foundELTerms, int count) throws Exception {
+ if (o == null || visited.containsKey(o) || count > 50) {
+ return 0;
+ }
+
+ visited.put(o, null);
+
+ int elCount = 0;
+ Class c = o.getClass();
+
+ //inspect maps
+ if (o instanceof Map) {
+
+ for (Object entry : ((Map) o).values()) {
+ elCount += resolveELTerms(entry, visited, foundELTerms, count + 1);
+ }
+ return elCount;
+ }
+
+ if (isELTerm(o)) {
+ if (foundELTerms != null) {
+ foundELTerms.add(o.toString());
+ }
+ return ++elCount;
+ }
+
+ //analyze arrays
+ if (c.isArray()) {
+ int length = Array.getLength(o);
+ //check array [L -> no array of primitive types
+ if (o.toString().startsWith("[L")) {
+ for (int i = 0; i < length; i++) {
+ if (o.toString().startsWith("[Ljava.lang.String")) {
+ if (isELTerm(Array.get(o, i))) {
+ if (foundELTerms != null) {
+ foundELTerms.add(o.toString());
+ }
+ elCount++;
+ }
+ } else {
+ elCount += resolveELTerms(Array.get(o, i), visited, foundELTerms, count + 1);
+ }
+ }
+ }
+ return elCount;
+ }
+
+ List<Field> attributes = findAllAttributes(c, new ArrayList<Field>());
+ Field[] fields = (Field[]) attributes.toArray(new Field[attributes.size()]);
+
+ AccessibleObject.setAccessible(fields, true);
+ for (Field currentField : fields) {
+ if (currentField.get(o) == null) {
+ continue;
+ }
+
+ if (currentField.getType().equals(String.class)) {
+ if (currentField.get(o) != null && isELTerm(currentField.get(o))) {
+ if (foundELTerms != null) {
+ foundELTerms.add(o.toString());
+ }
+ elCount++;
+ }
+ } else if (!currentField.getType().isPrimitive()) {
+ elCount += resolveELTerms(currentField.get(o), visited, foundELTerms, count + 1);
+ }
+ }
+ return elCount;
+ }
+
+ private static boolean isELTerm(Object o) {
+ if (o instanceof ValueBinding || o instanceof Externalizable) {
+ return false;
+ }
+
+ String s = o.toString();
+ return ((s.contains("#") || s.contains("$")) && s.contains("{") && s.contains("}"));
+ }
+
+ private static List<Field> findAllAttributes(Class c, List<Field> attributes) {
+ if (c == null) {
+ return attributes;
+ }
+ findAllAttributes(c.getSuperclass(), attributes);
+
+ Field[] fields = c.getDeclaredFields();
+ for (Field currentField : fields) {
+ if (!Modifier.isStatic(currentField.getModifiers())) {
+ attributes.add(currentField);
+ }
+ }
+
+ return attributes;
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/FactoryUtils.java Mon Jul 14 10:58:09 2008
@@ -0,0 +1,132 @@
+/*
+ * 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.core.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.adapter.DefaultConverterAdapterFactory;
+import org.apache.myfaces.extensions.validator.core.annotation.extractor.AnnotationExtractorFactory;
+import org.apache.myfaces.extensions.validator.core.annotation.extractor.DefaultAnnotationExtractorFactory;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.DefaultMessageResolverFactory;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.MessageResolver;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.DefaultValidationStrategyFactory;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+
+import javax.faces.convert.Converter;
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ */
+//TODO
+public class FactoryUtils {
+ private static AnnotationExtractorFactory annotationExtractorFactory;
+
+ public static AnnotationExtractorFactory getAnnotationExtractorFactory() {
+ if (annotationExtractorFactory == null) {
+ List<String> annotationExtractorFactoryClassNames = new ArrayList<String>();
+
+ annotationExtractorFactoryClassNames.add(WebXmlParameter.CUSTOM_ANNOTATION_EXTRACTOR_FACTORY);
+ annotationExtractorFactoryClassNames.add(ExtValUtils.getInformationProviderBean().getCustomAnnotationExtractorFactory());
+ annotationExtractorFactoryClassNames.add(DefaultAnnotationExtractorFactory.class.getName());
+
+ for (String className : annotationExtractorFactoryClassNames) {
+ annotationExtractorFactory = (AnnotationExtractorFactory) ClassUtils.tryToInstantiateClassForName(className);
+
+ if (annotationExtractorFactory != null) {
+ //TODO logging
+ break;
+ }
+ }
+ }
+
+ return annotationExtractorFactory;
+ }
+
+ private static ClassMappingFactory<Annotation, ValidationStrategy> validationStrategyFactory;
+
+ public static ClassMappingFactory<Annotation, ValidationStrategy> getValidationStrategyFactory() {
+ if (validationStrategyFactory == null) {
+ List<String> validationStrategyFactoryClassNames = new ArrayList<String>();
+
+ validationStrategyFactoryClassNames.add(WebXmlParameter.CUSTOM_VALIDATION_STRATEGY_FACTORY);
+ validationStrategyFactoryClassNames.add(ExtValUtils.getInformationProviderBean().getCustomValidationStrategyFactory());
+ validationStrategyFactoryClassNames.add(DefaultValidationStrategyFactory.class.getName());
+
+ for (String className : validationStrategyFactoryClassNames) {
+ validationStrategyFactory = (ClassMappingFactory<Annotation, ValidationStrategy>) ClassUtils.tryToInstantiateClassForName(className);
+
+ if (validationStrategyFactory != null) {
+ //TODO logging
+ break;
+ }
+ }
+ }
+
+ return validationStrategyFactory;
+ }
+
+ private static ClassMappingFactory<ValidationStrategy, MessageResolver> messageResolverFactory;
+
+ public static ClassMappingFactory<ValidationStrategy, MessageResolver> getMessageResolverFactory() {
+ if (messageResolverFactory == null) {
+ List<String> messageResolverFactoryClassNames = new ArrayList<String>();
+
+ messageResolverFactoryClassNames.add(WebXmlParameter.CUSTOM_MESSAGE_RESOLVER_FACTORY);
+ messageResolverFactoryClassNames.add(ExtValUtils.getInformationProviderBean().getCustomMessageResolverFactory());
+ messageResolverFactoryClassNames.add(DefaultMessageResolverFactory.class.getName());
+
+ for (String className : messageResolverFactoryClassNames) {
+ messageResolverFactory = (ClassMappingFactory<ValidationStrategy, MessageResolver>) ClassUtils.tryToInstantiateClassForName(className);
+
+ if (messageResolverFactory != null) {
+ //TODO logging
+ break;
+ }
+ }
+ }
+
+ return messageResolverFactory;
+ }
+
+ private static ClassMappingFactory<Converter, Converter> converterAdapterFactory;
+
+ @Deprecated
+ public static ClassMappingFactory<Converter, Converter> getConverterAdapterFactory() {
+ if (converterAdapterFactory == null) {
+ List<String> converterAdapterFactoryClassNames = new ArrayList<String>();
+
+ converterAdapterFactoryClassNames.add(WebXmlParameter.CUSTOM_CONVERTER_ADAPTER_FACTORY);
+ converterAdapterFactoryClassNames.add(ExtValUtils.getInformationProviderBean().getCustomConverterAdapterFactory());
+ converterAdapterFactoryClassNames.add(DefaultConverterAdapterFactory.class.getName());
+
+ for (String className : converterAdapterFactoryClassNames) {
+ converterAdapterFactory = (ClassMappingFactory<Converter, Converter>) ClassUtils.tryToInstantiateClassForName(className);
+
+ if (converterAdapterFactory != null) {
+ //TODO logging
+ break;
+ }
+ }
+ }
+ return converterAdapterFactory;
+ }
+}
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/WebXmlUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/WebXmlUtils.java?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/WebXmlUtils.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/WebXmlUtils.java Mon Jul 14 10:58:09 2008
@@ -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.ExtValInformation;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class WebXmlUtils {
+
+ public static String getInitParameter(String key) {
+ String value = FacesContext.getCurrentInstance().getExternalContext().getInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + "." + key);
+ //TODO
+ return (value != null) ? value.replace(" ", "").trim() : null;
+ }
+}
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/resources/LICENSE.txt
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/resources/LICENSE.txt?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/resources/LICENSE.txt (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/resources/LICENSE.txt Mon Jul 14 10:58:09 2008
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/resources/NOTICE.txt
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/resources/NOTICE.txt?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/resources/NOTICE.txt (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/resources/NOTICE.txt Mon Jul 14 10:58:09 2008
@@ -0,0 +1,9 @@
+Apache MyFaces Extensions Validator
+Copyright 2007-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+------------------------------------------------------------------------
+See the file LICENSE.txt
+------------------------------------------------------------------------
\ No newline at end of file
Added: myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/pom.xml?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/pom.xml (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/pom.xml Mon Jul 14 10:58:09 2008
@@ -0,0 +1,110 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>war</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-feature-set_01</artifactId>
+
+ <name>MyFaces Extensions-Validator examples feature-set 01</name>
+ <version>${build.version}</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.examples</groupId>
+ <artifactId>examples-project</artifactId>
+ <version>${build.version}</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>${build.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>myfaces-extval-cross-validation</artifactId>
+ <version>${build.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.14</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${jsf.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.trinidad</groupId>
+ <artifactId>trinidad-api</artifactId>
+ <version>${trinidad.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.trinidad</groupId>
+ <artifactId>trinidad-impl</artifactId>
+ <version>${trinidad.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>el-impl</groupId>
+ <artifactId>el-impl</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.tomahawk</groupId>
+ <artifactId>tomahawk</artifactId>
+ <version>1.1.6</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties?rev=676664&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties Mon Jul 14 10:58:09 2008
@@ -0,0 +1,2 @@
+repeated_password_requried=please retype the password
+repeated_password_requried_details=please retype the password
\ No newline at end of file