diff options
author | Brett Porter <brett@apache.org> | 2006-10-31 20:56:37 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2006-10-31 20:56:37 +0000 |
commit | cc7b9cb6a7e73fdf25d919b5caf015b487c6dd30 (patch) | |
tree | 5b228ec83b61a6e940bbb24717975e6c8d3390b4 /archiva-webapp | |
parent | 949ae6337a189db9d3fd343a11a7b4774b64400f (diff) | |
download | archiva-cc7b9cb6a7e73fdf25d919b5caf015b487c6dd30.tar.gz archiva-cc7b9cb6a7e73fdf25d919b5caf015b487c6dd30.zip |
set native property
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@469650 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-webapp')
3 files changed, 208 insertions, 208 deletions
diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/validator/IntervalValidator.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/validator/IntervalValidator.java index 16b6d8fce..c67e45667 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/validator/IntervalValidator.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/validator/IntervalValidator.java @@ -1,62 +1,62 @@ -package org.apache.maven.archiva.web.validator;
-
-/*
- * Copyright 2005-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.
- */
-
-import com.opensymphony.xwork.validator.ValidationException;
-import com.opensymphony.xwork.validator.ValidatorContext;
-import com.opensymphony.xwork.validator.validators.ValidatorSupport;
-
-/**
- *
- * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
- */
-public class IntervalValidator
- extends ValidatorSupport
-{
-
- public void validate( Object obj )
- throws ValidationException
- {
- String snapshotsPolicy = ( String ) getFieldValue( "snapshotsPolicy", obj );
- String releasesPolicy = ( String ) getFieldValue( "releasesPolicy", obj );
- Integer snapshotsInterval = ( Integer ) getFieldValue( "snapshotsInterval", obj );
- Integer releasesInterval = ( Integer ) getFieldValue( "releasesInterval", obj );
-
- ValidatorContext ctxt = getValidatorContext();
-
- if( !snapshotsPolicy.equals( "interval" ) )
- {
- if( snapshotsInterval.intValue() != 0 )
- {
- ctxt.addActionError( "Snapshots Interval must be set to zero." );
- }
- }
-
- if( !releasesPolicy.equals( "interval" ) )
- {
- if( releasesInterval.intValue() != 0 )
- {
- ctxt.addActionError( "Releases Interval must be set to zero." );
- }
- }
-
- if( ctxt.hasActionErrors() )
- {
- return;
- }
- }
-}
+package org.apache.maven.archiva.web.validator; + +/* + * Copyright 2005-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. + */ + +import com.opensymphony.xwork.validator.ValidationException; +import com.opensymphony.xwork.validator.ValidatorContext; +import com.opensymphony.xwork.validator.validators.ValidatorSupport; + +/** + * + * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a> + */ +public class IntervalValidator + extends ValidatorSupport +{ + + public void validate( Object obj ) + throws ValidationException + { + String snapshotsPolicy = ( String ) getFieldValue( "snapshotsPolicy", obj ); + String releasesPolicy = ( String ) getFieldValue( "releasesPolicy", obj ); + Integer snapshotsInterval = ( Integer ) getFieldValue( "snapshotsInterval", obj ); + Integer releasesInterval = ( Integer ) getFieldValue( "releasesInterval", obj ); + + ValidatorContext ctxt = getValidatorContext(); + + if( !snapshotsPolicy.equals( "interval" ) ) + { + if( snapshotsInterval.intValue() != 0 ) + { + ctxt.addActionError( "Snapshots Interval must be set to zero." ); + } + } + + if( !releasesPolicy.equals( "interval" ) ) + { + if( releasesInterval.intValue() != 0 ) + { + ctxt.addActionError( "Releases Interval must be set to zero." ); + } + } + + if( ctxt.hasActionErrors() ) + { + return; + } + } +} diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/validator/SyncedRepositoryValidator.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/validator/SyncedRepositoryValidator.java index c515acf46..68ab3b329 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/validator/SyncedRepositoryValidator.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/validator/SyncedRepositoryValidator.java @@ -1,111 +1,111 @@ -package org.apache.maven.archiva.web.validator;
-
-/*
- * Copyright 2005-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.
- */
-
-import com.opensymphony.xwork.validator.ValidationException;
-import com.opensymphony.xwork.validator.ValidatorContext;
-import com.opensymphony.xwork.validator.validators.ValidatorSupport;
-
-/**
- * Validator for synced repository form. The values to be validated depends on the
- * selected sync method to be used.
- *
- * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
- */
-public class SyncedRepositoryValidator
- extends ValidatorSupport
-{
-
- public void validate( Object obj )
- throws ValidationException
- {
-
- String method = ( String ) getFieldValue( "method", obj );
- ValidatorContext ctxt = getValidatorContext();
-
- if( method.equals( "rsync" ) )
- {
- String rsyncHost = ( String ) getFieldValue( "rsyncHost", obj );
- if( rsyncHost == null || rsyncHost.equals("") )
- {
- ctxt.addActionError( "Rsync host is required." );
- }
-
- String rsyncDirectory = ( String ) getFieldValue( "rsyncDirectory", obj );
- if( rsyncDirectory == null || rsyncDirectory.equals("") )
- {
- ctxt.addActionError( "Rsync directory is required." );
- }
-
- String rsyncMethod = ( String ) getFieldValue( "rsyncMethod", obj );
- if( rsyncMethod == null || rsyncMethod.equals("") )
- {
- ctxt.addActionError( "Rsync method is required." );
- }
- else
- {
- if( !rsyncMethod.equals( "anonymous" ) && !rsyncMethod.equals( "ssh" ) )
- {
- ctxt.addActionError( "Invalid rsync method" );
- }
- }
-
- String username = ( String ) getFieldValue( "username", obj );
- if( username == null || username.equals("") )
- {
- ctxt.addActionError( "Username is required." );
- }
-
- }
- else if ( method.equals( "svn" ) )
- {
- String svnUrl = ( String ) getFieldValue( "svnUrl", obj );
- if( svnUrl == null || svnUrl.equals("") )
- {
- ctxt.addActionError( "SVN url is required." );
- }
-
- String username = ( String ) getFieldValue( "username", obj );
- if( username == null || username.equals("") )
- {
- ctxt.addActionError( "Username is required." );
- }
- }
- else if ( method.equals( "cvs" ) )
- {
- String cvsRoot = ( String ) getFieldValue( "cvsRoot", obj );
- if( cvsRoot == null || cvsRoot.equals("") )
- {
- ctxt.addActionError( "CVS root is required." );
- }
- }
- else if ( method.equals( "file" ) )
- {
- String directory = ( String ) getFieldValue( "directory", obj );
- if( directory == null || directory.equals("") )
- {
- ctxt.addActionError( "Directory is required." );
- }
- }
-
- if( ctxt.hasActionErrors() )
- {
- return;
- }
- }
-
-}
+package org.apache.maven.archiva.web.validator; + +/* + * Copyright 2005-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. + */ + +import com.opensymphony.xwork.validator.ValidationException; +import com.opensymphony.xwork.validator.ValidatorContext; +import com.opensymphony.xwork.validator.validators.ValidatorSupport; + +/** + * Validator for synced repository form. The values to be validated depends on the + * selected sync method to be used. + * + * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a> + */ +public class SyncedRepositoryValidator + extends ValidatorSupport +{ + + public void validate( Object obj ) + throws ValidationException + { + + String method = ( String ) getFieldValue( "method", obj ); + ValidatorContext ctxt = getValidatorContext(); + + if( method.equals( "rsync" ) ) + { + String rsyncHost = ( String ) getFieldValue( "rsyncHost", obj ); + if( rsyncHost == null || rsyncHost.equals("") ) + { + ctxt.addActionError( "Rsync host is required." ); + } + + String rsyncDirectory = ( String ) getFieldValue( "rsyncDirectory", obj ); + if( rsyncDirectory == null || rsyncDirectory.equals("") ) + { + ctxt.addActionError( "Rsync directory is required." ); + } + + String rsyncMethod = ( String ) getFieldValue( "rsyncMethod", obj ); + if( rsyncMethod == null || rsyncMethod.equals("") ) + { + ctxt.addActionError( "Rsync method is required." ); + } + else + { + if( !rsyncMethod.equals( "anonymous" ) && !rsyncMethod.equals( "ssh" ) ) + { + ctxt.addActionError( "Invalid rsync method" ); + } + } + + String username = ( String ) getFieldValue( "username", obj ); + if( username == null || username.equals("") ) + { + ctxt.addActionError( "Username is required." ); + } + + } + else if ( method.equals( "svn" ) ) + { + String svnUrl = ( String ) getFieldValue( "svnUrl", obj ); + if( svnUrl == null || svnUrl.equals("") ) + { + ctxt.addActionError( "SVN url is required." ); + } + + String username = ( String ) getFieldValue( "username", obj ); + if( username == null || username.equals("") ) + { + ctxt.addActionError( "Username is required." ); + } + } + else if ( method.equals( "cvs" ) ) + { + String cvsRoot = ( String ) getFieldValue( "cvsRoot", obj ); + if( cvsRoot == null || cvsRoot.equals("") ) + { + ctxt.addActionError( "CVS root is required." ); + } + } + else if ( method.equals( "file" ) ) + { + String directory = ( String ) getFieldValue( "directory", obj ); + if( directory == null || directory.equals("") ) + { + ctxt.addActionError( "Directory is required." ); + } + } + + if( ctxt.hasActionErrors() ) + { + return; + } + } + +} diff --git a/archiva-webapp/src/main/resources/validators.xml b/archiva-webapp/src/main/resources/validators.xml index 8eb5c2429..bd65f65e2 100644 --- a/archiva-webapp/src/main/resources/validators.xml +++ b/archiva-webapp/src/main/resources/validators.xml @@ -1,35 +1,35 @@ -<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Copyright 2005-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.
- -->
-
-<validators>
- <validator name="required" class="com.opensymphony.xwork.validator.validators.RequiredFieldValidator"/>
- <validator name="requiredstring" class="com.opensymphony.xwork.validator.validators.RequiredStringValidator"/>
- <validator name="int" class="com.opensymphony.xwork.validator.validators.IntRangeFieldValidator"/>
- <validator name="double" class="com.opensymphony.xwork.validator.validators.DoubleRangeFieldValidator"/>
- <validator name="date" class="com.opensymphony.xwork.validator.validators.DateRangeFieldValidator"/>
- <validator name="expression" class="com.opensymphony.xwork.validator.validators.ExpressionValidator"/>
- <validator name="fieldexpression" class="com.opensymphony.xwork.validator.validators.FieldExpressionValidator"/>
- <validator name="email" class="com.opensymphony.xwork.validator.validators.EmailValidator"/>
- <validator name="url" class="com.opensymphony.xwork.validator.validators.URLValidator"/>
- <validator name="visitor" class="com.opensymphony.xwork.validator.validators.VisitorFieldValidator"/>
- <validator name="conversion" class="com.opensymphony.xwork.validator.validators.ConversionErrorFieldValidator"/>
- <validator name="stringlength" class="com.opensymphony.xwork.validator.validators.StringLengthFieldValidator"/>
- <validator name="regex" class="com.opensymphony.xwork.validator.validators.RegexFieldValidator"/>
- <validator name="interval" class="org.apache.maven.archiva.web.validator.IntervalValidator"/>
- <validator name="syncedrepo" class="org.apache.maven.archiva.web.validator.SyncedRepositoryValidator"/>
-</validators>
-
+<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + ~ Copyright 2005-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. + --> + +<validators> + <validator name="required" class="com.opensymphony.xwork.validator.validators.RequiredFieldValidator"/> + <validator name="requiredstring" class="com.opensymphony.xwork.validator.validators.RequiredStringValidator"/> + <validator name="int" class="com.opensymphony.xwork.validator.validators.IntRangeFieldValidator"/> + <validator name="double" class="com.opensymphony.xwork.validator.validators.DoubleRangeFieldValidator"/> + <validator name="date" class="com.opensymphony.xwork.validator.validators.DateRangeFieldValidator"/> + <validator name="expression" class="com.opensymphony.xwork.validator.validators.ExpressionValidator"/> + <validator name="fieldexpression" class="com.opensymphony.xwork.validator.validators.FieldExpressionValidator"/> + <validator name="email" class="com.opensymphony.xwork.validator.validators.EmailValidator"/> + <validator name="url" class="com.opensymphony.xwork.validator.validators.URLValidator"/> + <validator name="visitor" class="com.opensymphony.xwork.validator.validators.VisitorFieldValidator"/> + <validator name="conversion" class="com.opensymphony.xwork.validator.validators.ConversionErrorFieldValidator"/> + <validator name="stringlength" class="com.opensymphony.xwork.validator.validators.StringLengthFieldValidator"/> + <validator name="regex" class="com.opensymphony.xwork.validator.validators.RegexFieldValidator"/> + <validator name="interval" class="org.apache.maven.archiva.web.validator.IntervalValidator"/> + <validator name="syncedrepo" class="org.apache.maven.archiva.web.validator.SyncedRepositoryValidator"/> +</validators> + |