continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r320960 - in /maven/continuum/trunk: ./ continuum-core/ continuum-web/ continuum-web/src/main/java/org/apache/maven/continuum/web/validation/ continuum-web/src/main/resources/META-INF/plexus/ continuum-web/src/main/resources/forms/ continuu...
Date Fri, 14 Oct 2005 01:11:30 GMT
Author: evenisse
Date: Thu Oct 13 18:11:28 2005
New Revision: 320960

URL: http://svn.apache.org/viewcvs?rev=320960&view=rev
Log:
[CONTINUUM-304] Add a basic cron expression validator

Added:
    maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/validation/CronExpressionValidator.java
  (with props)
Modified:
    maven/continuum/trunk/continuum-core/pom.xml
    maven/continuum/trunk/continuum-web/pom.xml
    maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml
    maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
    maven/continuum/trunk/pom.xml

Modified: maven/continuum/trunk/continuum-core/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/pom.xml?rev=320960&r1=320959&r2=320960&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/pom.xml (original)
+++ maven/continuum/trunk/continuum-core/pom.xml Thu Oct 13 18:11:28 2005
@@ -132,7 +132,6 @@
     <dependency>
       <groupId>quartz</groupId>
       <artifactId>quartz</artifactId>
-      <version>1.4.5</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>

Modified: maven/continuum/trunk/continuum-web/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/pom.xml?rev=320960&r1=320959&r2=320960&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/pom.xml (original)
+++ maven/continuum/trunk/continuum-web/pom.xml Thu Oct 13 18:11:28 2005
@@ -66,6 +66,10 @@
       <artifactId>ognl</artifactId>
       <version>2.6.7</version>
     </dependency>
+    <dependency>
+      <groupId>quartz</groupId>
+      <artifactId>quartz</artifactId>
+    </dependency>
   </dependencies>
   <build>
     <resources>

Added: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/validation/CronExpressionValidator.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/validation/CronExpressionValidator.java?rev=320960&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/validation/CronExpressionValidator.java
(added)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/validation/CronExpressionValidator.java
Thu Oct 13 18:11:28 2005
@@ -0,0 +1,48 @@
+package org.apache.maven.continuum.web.validation;
+
+/*
+ * Copyright 2004-2005 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 org.codehaus.plexus.formica.FormicaException;
+import org.codehaus.plexus.formica.validation.AbstractValidator;
+import org.quartz.CronTrigger;
+
+import java.text.ParseException;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class CronExpressionValidator
+    extends AbstractValidator
+{
+    public boolean validate( String cronExpression )
+        throws FormicaException
+    {
+        try
+        {
+            CronTrigger cronTrigger = new CronTrigger();
+
+            cronTrigger.setCronExpression( cronExpression );
+
+            return true;
+        }
+        catch ( ParseException e )
+        {
+            return false;
+        }
+    }
+}

Propchange: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/validation/CronExpressionValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/validation/CronExpressionValidator.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml?rev=320960&r1=320959&r2=320960&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
Thu Oct 13 18:11:28 2005
@@ -591,6 +591,12 @@
       <implementation>org.apache.maven.continuum.web.validation.SafePathValidator</implementation>
     </component>
 
+    <component>
+      <role>org.codehaus.plexus.formica.validation.Validator</role>
+      <role-hint>cron</role-hint>
+      <implementation>org.apache.maven.continuum.web.validation.CronExpressionValidator</implementation>
+    </component>
+
     <!--
      |
      | Content Generators

Modified: maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml?rev=320960&r1=320959&r2=320960&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/forms/schedules.xml Thu Oct 13
18:11:28 2005
@@ -39,6 +39,10 @@
           <id>required</id>
           <error-message-key>schedule.cronExpression.error</error-message-key>
         </validator>
+        <validator>
+          <id>cron</id>
+          <error-message-key>schedule.cronExpression.error</error-message-key>
+        </validator>
       </validators>
       <type>text</type>
       <label-key>schedule.cronExpression.label</label-key>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties?rev=320960&r1=320959&r2=320960&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/localization/Continuum.properties
Thu Oct 13 18:11:28 2005
@@ -232,7 +232,7 @@
 
 schedule.cronExpression.label = Cron Expression
 schedule.cronExpression.message = Enter the cron expression
-schedule.cronExpression.error = You must enter a cron expression
+schedule.cronExpression.error = You must enter a valid cron expression (<a href="http://www.opensymphony.com/quartz/api/org/quartz/CronTrigger.html"
target="_blank">Syntax<a>)
 
 schedule.quietPeriod.label = Quiet Period (seconds)
 schedule.quietPeriod.message = Enter a description of the schedule

Modified: maven/continuum/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/pom.xml?rev=320960&r1=320959&r2=320960&view=diff
==============================================================================
--- maven/continuum/trunk/pom.xml (original)
+++ maven/continuum/trunk/pom.xml Thu Oct 13 18:11:28 2005
@@ -364,6 +364,11 @@
         <artifactId>hsqldb</artifactId>
         <version>1.7.3.3</version>
       </dependency>
+      <dependency>
+        <groupId>quartz</groupId>
+        <artifactId>quartz</artifactId>
+        <version>1.4.5</version>
+      </dependency>
     </dependencies>
   </dependencyManagement>
   <distributionManagement>



Mime
View raw message