You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ev...@apache.org on 2007/01/12 10:36:49 UTC
svn commit: r495530 - in /maven/continuum/trunk/continuum-webapp/src/main:
java/org/apache/maven/continuum/web/validator/ resources/
resources/org/apache/maven/continuum/web/action/notifier/
Author: evenisse
Date: Fri Jan 12 01:36:48 2007
New Revision: 495530
URL: http://svn.apache.org/viewvc?view=rev&rev=495530
Log:
[CONTINUUM-1133] Add validator for Project Site URL in wagon notifier
Submitted by: Henri S. Isidro
Added:
maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/WagonUrlValidator.java (with props)
maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction-wagonProjectGroupNotifierSave-validation.xml (with props)
maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.properties (with props)
maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction-wagonProjectNotifierSave-validation.xml (with props)
maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.properties (with props)
Modified:
maven/continuum/trunk/continuum-webapp/src/main/resources/validators.xml
Added: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/WagonUrlValidator.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/WagonUrlValidator.java?view=auto&rev=495530
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/WagonUrlValidator.java (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/WagonUrlValidator.java Fri Jan 12 01:36:48 2007
@@ -0,0 +1,68 @@
+package org.apache.maven.continuum.web.validator;
+
+/*
+ * 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.
+ */
+
+import com.opensymphony.xwork.validator.validators.ValidatorSupport;
+import com.opensymphony.xwork.validator.ValidationException;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+ *
+ * Validator class for Wagon URLs
+ *
+ * @author <a href="mailto:hisidro@exist.com">Henry Isidro</a>
+ */
+public class WagonUrlValidator
+ extends ValidatorSupport
+{
+
+ public void validate( Object object )
+ throws ValidationException
+ {
+ String url = ( String ) getFieldValue( "url", object);
+
+ if ( ( url == null ) || ( url.length() == 0 ) )
+ {
+ return;
+ }
+
+ if ( url.startsWith( "dav:" ) )
+ {
+ url = url.substring( 4 );
+ }
+
+ if ( ( url.startsWith( "scp://" ) ) || ( url.startsWith( "sftp://" ) ) )
+ {
+ // URL doesn't understand these protocols, hack it
+ url = "http://" + url.substring( url.indexOf( "://" ) + 3 ) ;
+ }
+
+ try
+ {
+ new URL( url );
+ }
+ catch ( MalformedURLException m )
+ {
+ addFieldError( "url", object );
+ }
+ }
+}
Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/WagonUrlValidator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/validator/WagonUrlValidator.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction-wagonProjectGroupNotifierSave-validation.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction-wagonProjectGroupNotifierSave-validation.xml?view=auto&rev=495530
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction-wagonProjectGroupNotifierSave-validation.xml (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction-wagonProjectGroupNotifierSave-validation.xml Fri Jan 12 01:36:48 2007
@@ -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.
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="url">
+ <field-validator type="requiredstring">
+ <message key="wagonNotifier.url.required"/>
+ </field-validator>
+ <field-validator type="wagon-url">
+ <message key="wagonNotifier.url.invalid"/>
+ </field-validator>
+ </field>
+</validators>
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction-wagonProjectGroupNotifierSave-validation.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction-wagonProjectGroupNotifierSave-validation.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.properties?view=auto&rev=495530
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.properties (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.properties Fri Jan 12 01:36:48 2007
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+
+wagonNotifier.url.required = Destination URL is required
+wagonNotifier.url.invalid = Destination URL is invalid
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonGroupNotifierEditAction.properties
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction-wagonProjectNotifierSave-validation.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction-wagonProjectNotifierSave-validation.xml?view=auto&rev=495530
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction-wagonProjectNotifierSave-validation.xml (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction-wagonProjectNotifierSave-validation.xml Fri Jan 12 01:36:48 2007
@@ -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.
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
+ "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
+
+<validators>
+ <field name="url">
+ <field-validator type="requiredstring">
+ <message key="wagonNotifier.url.required"/>
+ </field-validator>
+ <field-validator type="wagon-url">
+ <message key="wagonNotifier.url.invalid"/>
+ </field-validator>
+ </field>
+</validators>
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction-wagonProjectNotifierSave-validation.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction-wagonProjectNotifierSave-validation.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.properties?view=auto&rev=495530
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.properties (added)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.properties Fri Jan 12 01:36:48 2007
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+
+wagonNotifier.url.required = Destination URL is required
+wagonNotifier.url.invalid = Destination URL is invalid
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/notifier/WagonProjectNotifierEditAction.properties
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/validators.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/validators.xml?view=diff&rev=495530&r1=495529&r2=495530
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/validators.xml (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/validators.xml Fri Jan 12 01:36:48 2007
@@ -32,5 +32,7 @@
<validator name="stringlength" class="com.opensymphony.xwork.validator.validators.StringLengthFieldValidator"/>
<validator name="regex" class="com.opensymphony.xwork.validator.validators.RegexFieldValidator"/>
<validator name="cronexpression" class="org.apache.maven.continuum.web.validator.CronExpressionValidator"/>
+ <validator name="wagon-url" class="org.apache.maven.continuum.web.validator.WagonUrlValidator"/>
</validators>
+