You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/12/01 14:24:04 UTC
svn commit: r600118 - in /myfaces/commons/trunk: ./ myfaces-commons-utils/
myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/utils/
myfaces-validators/
myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/
Author: bommel
Date: Sat Dec 1 05:24:03 2007
New Revision: 600118
URL: http://svn.apache.org/viewvc?rev=600118&view=rev
Log:
start prototyping common/XXX validators
Added:
myfaces/commons/trunk/myfaces-commons-utils/pom.xml (with props)
myfaces/commons/trunk/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/utils/MessageUtils.java
- copied, changed from r600114, myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java
myfaces/commons/trunk/myfaces-validators/pom.xml (with props)
myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedListStateWrapper.java
- copied, changed from r600112, myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/AttachedListStateWrapper.java
myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedStateWrapper.java
- copied, changed from r600112, myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/AttachedStateWrapper.java
myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/EmailValidator.java
- copied, changed from r600108, myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/emailvalidator/EmailValidator.java
myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/ValidatorBase.java
- copied, changed from r600108, myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/ValidatorBase.java
Modified:
myfaces/commons/trunk/pom.xml
Added: myfaces/commons/trunk/myfaces-commons-utils/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-utils/pom.xml?rev=600118&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-commons-utils/pom.xml (added)
+++ myfaces/commons/trunk/myfaces-commons-utils/pom.xml Sat Dec 1 05:24:03 2007
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<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>
+ <parent>
+ <groupId>org.apache.myfaces.commons</groupId>
+ <artifactId>commons</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>myfaces-commons-utils</artifactId>
+ <packaging>jar</packaging>
+ <name>MyFaces Commons Utils</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.1.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Propchange: myfaces/commons/trunk/myfaces-commons-utils/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/trunk/myfaces-commons-utils/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/commons/trunk/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/utils/MessageUtils.java (from r600114, myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java)
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/utils/MessageUtils.java?p2=myfaces/commons/trunk/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/utils/MessageUtils.java&p1=myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java&r1=600114&r2=600118&rev=600118&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java (original)
+++ myfaces/commons/trunk/myfaces-commons-utils/src/main/java/org/apache/myfaces/commons/utils/MessageUtils.java Sat Dec 1 05:24:03 2007
@@ -16,17 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.shared.util;
+package org.apache.myfaces.commons.utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.faces.application.FacesMessage;
-import javax.faces.application.ApplicationFactory;
+import javax.faces.FactoryFinder;
import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
-import javax.faces.FactoryFinder;
-
import java.text.MessageFormat;
import java.util.Locale;
import java.util.MissingResourceException;
@@ -194,7 +193,7 @@
{
try
{
- bundle = ResourceBundle.getBundle(bundleName, locale, org.apache.myfaces.shared.util.ClassUtils.getCurrentLoader(bundleName));
+ bundle = ResourceBundle.getBundle(bundleName, locale, getCurrentLoader(bundleName));
summary = bundle.getString(messageId);
}
catch (MissingResourceException e) {
@@ -206,7 +205,7 @@
{
try
{
- bundle = ResourceBundle.getBundle(DEFAULT_BUNDLE, locale, org.apache.myfaces.shared.util.ClassUtils.getCurrentLoader(DEFAULT_BUNDLE));
+ bundle = ResourceBundle.getBundle(DEFAULT_BUNDLE, locale, getCurrentLoader(DEFAULT_BUNDLE));
if(bundle == null)
{
throw new NullPointerException();
@@ -396,4 +395,14 @@
return afactory.getApplication();
}
}
+ private static ClassLoader getCurrentLoader(Object defaultObject)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ if(loader == null)
+ {
+ loader = defaultObject.getClass().getClassLoader();
+ }
+ return loader;
+ }
+
}
Added: myfaces/commons/trunk/myfaces-validators/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-validators/pom.xml?rev=600118&view=auto
==============================================================================
--- myfaces/commons/trunk/myfaces-validators/pom.xml (added)
+++ myfaces/commons/trunk/myfaces-validators/pom.xml Sat Dec 1 05:24:03 2007
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<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>
+ <parent>
+ <groupId>org.apache.myfaces.commons</groupId>
+ <artifactId>commons</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>myfaces-validators</artifactId>
+ <packaging>jar</packaging>
+ <name>MyFaces Validators</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>1.1.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-validator</groupId>
+ <artifactId>commons-validator</artifactId>
+ <version>1.3.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.commons</groupId>
+ <artifactId>myfaces-commons-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Propchange: myfaces/commons/trunk/myfaces-validators/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/commons/trunk/myfaces-validators/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Copied: myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedListStateWrapper.java (from r600112, myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/AttachedListStateWrapper.java)
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedListStateWrapper.java?p2=myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedListStateWrapper.java&p1=myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/AttachedListStateWrapper.java&r1=600112&r2=600118&rev=600118&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/AttachedListStateWrapper.java (original)
+++ myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedListStateWrapper.java Sat Dec 1 05:24:03 2007
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.validator;
+package org.apache.myfaces.commons.validator;
import java.io.Serializable;
import java.util.List;
Copied: myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedStateWrapper.java (from r600112, myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/AttachedStateWrapper.java)
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedStateWrapper.java?p2=myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedStateWrapper.java&p1=myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/AttachedStateWrapper.java&r1=600112&r2=600118&rev=600118&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/AttachedStateWrapper.java (original)
+++ myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/AttachedStateWrapper.java Sat Dec 1 05:24:03 2007
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.validator;
+package org.apache.myfaces.commons.validator;
import java.io.Serializable;
Copied: myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/EmailValidator.java (from r600108, myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/emailvalidator/EmailValidator.java)
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/EmailValidator.java?p2=myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/EmailValidator.java&p1=myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/emailvalidator/EmailValidator.java&r1=600108&r2=600118&rev=600118&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/emailvalidator/EmailValidator.java (original)
+++ myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/EmailValidator.java Sat Dec 1 05:24:03 2007
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.custom.emailvalidator;
+package org.apache.myfaces.commons.validator;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
@@ -24,7 +24,6 @@
import javax.faces.validator.ValidatorException;
import org.apache.commons.validator.GenericValidator;
-import org.apache.myfaces.validator.ValidatorBase;
/**
Copied: myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/ValidatorBase.java (from r600108, myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/ValidatorBase.java)
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/ValidatorBase.java?p2=myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/ValidatorBase.java&p1=myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/ValidatorBase.java&r1=600108&r2=600118&rev=600118&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/validator/ValidatorBase.java (original)
+++ myfaces/commons/trunk/myfaces-validators/src/main/java/org/apache/myfaces/commons/validator/ValidatorBase.java Sat Dec 1 05:24:03 2007
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.validator;
+package org.apache.myfaces.commons.validator;
import java.util.*;
import java.io.Serializable;
@@ -27,8 +27,8 @@
import javax.faces.validator.Validator;
import javax.faces.el.ValueBinding;
-import org.apache.myfaces.shared_tomahawk.util.MessageUtils;
-import org.apache.myfaces.shared_tomahawk.util._ComponentUtils;
+import org.apache.myfaces.commons.utils.MessageUtils;
+
/**
* Base validator implementation for Tomahawk validators.
@@ -48,7 +48,7 @@
{
if (_summaryMessage != null) return _summaryMessage;
ValueBinding vb = getValueBinding("summaryMessage");
- return vb != null ? _ComponentUtils.getStringValue(getFacesContext(), vb) : null;
+ return vb != null ? getStringValue(getFacesContext(), vb) : null;
}
/**
@@ -85,7 +85,7 @@
public String getDetailMessage() {
if (_detailMessage != null) return _detailMessage;
ValueBinding vb = getValueBinding("detailMessage");
- return vb != null ? _ComponentUtils.getStringValue(getFacesContext(), vb) : null;
+ return vb != null ? getStringValue(getFacesContext(), vb) : null;
}
/**
@@ -322,5 +322,14 @@
protected FacesContext getFacesContext()
{
return FacesContext.getCurrentInstance();
+ }
+ protected String getStringValue(FacesContext context, ValueBinding vb)
+ {
+ Object value = vb.getValue(context);
+ if (value != null)
+ {
+ return value.toString();
+ }
+ return null;
}
}
Modified: myfaces/commons/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/trunk/pom.xml?rev=600118&r1=600117&r2=600118&view=diff
==============================================================================
--- myfaces/commons/trunk/pom.xml (original)
+++ myfaces/commons/trunk/pom.xml Sat Dec 1 05:24:03 2007
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 2006 The Apache Software Foundation.
-
- Licensed 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.
+ * 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.
-->
<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">
@@ -74,6 +75,16 @@
</plugins>
</pluginManagement>
</build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/commons/trunk/</connection>
@@ -81,9 +92,10 @@
<url>http://svn.apache.org/viewvc/myfaces/commons/trunk</url>
</scm>
- <!--modules>
- <module>maven-faces-plugin</module>
- </modules-->
+ <modules>
+ <module>myfaces-validators</module>
+ <module>myfaces-commons-utils</module>
+ </modules>
<profiles>
<profile>