Updated ConfigurationAction. Removed cron expression validation in execute(). Created method for getting the cron expression.

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@443212 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maria Odea B. Ching 2006-09-14 03:39:47 +00:00
parent e89a397189
commit 3ca919b9f3
1 changed files with 9 additions and 19 deletions

View File

@ -67,17 +67,12 @@ public class ConfigureAction
private String year;
private String cronEx = "";
public void validate()
{
cronEx = ( second + " " + minute + " " + hour + " " + dayOfMonth + " " + month +
" " + dayOfWeek + " " + year ).trim();
//validate cron expression
cronValidator = new CronExpressionValidator();
if( !cronValidator.validate( cronEx ) )
if( !cronValidator.validate( getCronExpression() ) )
{
addActionError( "Invalid Cron Expression" );
}
@ -89,19 +84,7 @@ public class ConfigureAction
{
// TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded
// TODO: if this is changed, do we move the index or recreate it?
String cronEx = ( second + " " + minute + " " + hour + " " + dayOfMonth + " " + month +
" " + dayOfWeek + " " + year ).trim();
//validate cron expression
cronValidator = new CronExpressionValidator();
if( !cronValidator.validate( cronEx ) )
{
addActionError( "Invalid Cron Expression" );
return ERROR;
}
configuration.setIndexerCronExpression( cronEx );
configuration.setIndexerCronExpression( getCronExpression() );
// Normalize the path
File file = new File( configuration.getIndexPath() );
@ -227,4 +210,11 @@ public class ConfigureAction
{
this.dayOfWeek = dayOfWeek;
}
private String getCronExpression()
{
return ( second + " " + minute + " " + hour + " " + dayOfMonth + " " + month +
" " + dayOfWeek + " " + year ).trim();
}
}