continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r278785 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/build/settings/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/build/settings/ con...
Date Mon, 05 Sep 2005 16:07:22 GMT
Author: evenisse
Date: Mon Sep  5 09:07:03 2005
New Revision: 278785

URL: http://svn.apache.org/viewcvs?rev=278785&view=rev
Log:
o [CONTINUUM-43] Add schedule selection in build definition
o Activate schedule when it is added and enabled

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/build/settings/SchedulesActivator.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java
    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/continuum-web/src/main/resources/templates/screens/AddBuildDefinition.vm
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/BuildDefinition.vm
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/build/settings/SchedulesActivator.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/build/settings/SchedulesActivator.java?rev=278785&r1=278784&r2=278785&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/build/settings/SchedulesActivator.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/build/settings/SchedulesActivator.java
Mon Sep  5 09:07:03 2005
@@ -17,6 +17,7 @@
  */
 
 import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.model.project.Schedule;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -34,5 +35,14 @@
      * @throws SchedulesActivationException
      */
     void activateSchedules( Continuum continuum )
+        throws SchedulesActivationException;
+
+    /**
+     * Activate schedule by looking at the scheduling information contained within and submitting
a
+     * Job to the scheduler.
+     *
+     * @throws SchedulesActivationException
+     */
+    void activateSchedule( Schedule schedule, Continuum continuum )
         throws SchedulesActivationException;
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=278785&r1=278784&r2=278785&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Mon Sep  5 09:07:03 2005
@@ -687,6 +687,10 @@
 
         buildDefinition.setArguments( (String) configuration.get( "arguments" ) );
 
+        Schedule schedule = getSchedule( new Integer( (String) configuration.get( "schedule"
) ).intValue() );
+
+        buildDefinition.setSchedule( schedule );
+
         storeBuildDefinition( buildDefinition );
     }
 
@@ -714,6 +718,10 @@
 
         buildDefinition.setArguments( (String) configuration.get( "arguments" ) );
 
+        Schedule schedule = getSchedule( new Integer( (String) configuration.get( "schedule"
) ).intValue() );
+
+        buildDefinition.setSchedule( schedule );
+
         Project project = getProjectWithAllDetails( projectId );
 
         project.addBuildDefinition( buildDefinition );
@@ -756,6 +764,7 @@
     public Schedule getSchedule( int scheduleId )
         throws ContinuumException
     {
+        //TODO: Add a store.getScheduleById() method
         List schedules = store.getAllSchedulesByName();
 
         for ( Iterator i = schedules.iterator(); i.hasNext(); )
@@ -792,7 +801,16 @@
 
         if ( s == null )
         {
-            store.addSchedule( schedule );
+            s = store.addSchedule( schedule );
+
+            try
+            {
+                schedulesActivator.activateSchedules( s, this );
+            }
+            catch ( SchedulesActivationException e )
+            {
+                throw new ContinuumException( "Error activating schedule " + s.getName()
+ ".", e );
+            }
         }
         else
         {
@@ -913,7 +931,7 @@
         }
         catch ( SchedulesActivationException e )
         {
-            throw new StartingException( "Error activating build settings.", e );
+            throw new StartingException( "Error activating schedules.", e );
         }
         catch ( ConfigurationLoadingException e )
         {

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java?rev=278785&r1=278784&r2=278785&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/build/settings/DefaultSchedulesActivator.java
Mon Sep  5 09:07:03 2005
@@ -59,7 +59,7 @@
     public void activateSchedules( Continuum continuum )
         throws SchedulesActivationException
     {
-        getLogger().info( "Activating build settings ..." );
+        getLogger().info( "Activating schedules ..." );
 
         Collection schedules = store.getAllSchedulesByName();
 
@@ -80,9 +80,24 @@
         }
     }
 
+    public void activateSchedule( Schedule schedule, Continuum continuum )
+        throws SchedulesActivationException
+    {
+        getLogger().info( "Activating schedule " + schedule.getName() );
+
+        schedule( schedule, continuum );
+    }
+
     protected void schedule( Schedule schedule, Continuum continuum )
         throws SchedulesActivationException
     {
+        if ( !schedule.isActive() )
+        {
+            getLogger().info( "Schedule \"" + schedule.getName() + "\" is disabled." );
+
+            return;
+        }
+
         JobDataMap dataMap = new JobDataMap();
 
         dataMap.put( "continuum", continuum );

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=278785&r1=278784&r2=278785&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 Mon Sep  5
09:07:03 2005
@@ -47,6 +47,12 @@
     </element>
     <element>
       <id>schedule.quietPeriod</id>
+      <validators>
+        <validator>
+          <id>required</id>
+          <error-message-key>schedule.quietPeriod.error</error-message-key>
+        </validator>
+      </validators>
       <type>text</type>
       <label-key>schedule.quietPeriod.label</label-key>
       <message-key>schedule.quietPeriod.message</message-key>
@@ -60,7 +66,7 @@
       <type>checkbox</type>
       <label-key>schedule.active.label</label-key>
       <message-key>schedule.active.message</message-key>
-      <default-value>true</default-value>
+      <default-value>false</default-value>
       <expression>active</expression>
     </element>
   </elements>

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=278785&r1=278784&r2=278785&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
Mon Sep  5 09:07:03 2005
@@ -154,6 +154,7 @@
 buildDefinition.goals.message =  Enter one or more goals - leave empty to use the default
 buildDefinition.arguments.label = Arguments
 buildDefinition.arguments.message =  Enter one or more command line arguments
+buildDefinition.schedule.label = Schedule
 
 // ----------------------------------------------------------------------
 // Notification
@@ -235,7 +236,7 @@
 
 schedule.quietPeriod.label = Quiet Period (seconds)
 schedule.quietPeriod.message = Enter a description of the schedule
-schedule.quietPeriod.error = You must enter a description for the schedule
+schedule.quietPeriod.error = You must enter a quiet period for the schedule
 
 schedule.active.label = Enabled
 schedule.active.message = Enabled/Disabled the schedule

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/AddBuildDefinition.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/AddBuildDefinition.vm?rev=278785&r1=278784&r2=278785&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/AddBuildDefinition.vm
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/AddBuildDefinition.vm
Mon Sep  5 09:07:03 2005
@@ -1,4 +1,4 @@
-$page.setTitle( $form.add.titleKey )
+$page.setTitle( $i18n.getString( $form.add.titleKey ) )
 
 <div class="app">
   <div id="axial" class="h3">
@@ -11,16 +11,26 @@
       <div class="axial">
         <table border="1" cellspacing="2" cellpadding="3" width="100%">
           #foreach ( $element in $form.elements )
-          #if ( !$element.immutable )
-          <tr>
-            #field( $i18n $data $element $item $formtool )
-          </tr>
-          #else
-            #if ( $element.defaultValue )
-              #hidden ( $element.id $element.defaultValue )
+            #if ( !$element.immutable )
+            <tr>
+              #field( $i18n $data $element $item $formtool )
+            </tr>
+            #else
+              #if ( $element.defaultValue )
+                #hidden ( $element.id $element.defaultValue )
+              #end
             #end
           #end
-          #end
+          <tr>
+            <th>$i18n.getString( "buildDefinition.schedule.label" )</th>
+            <td>
+              <select name="schedule">
+                #foreach ( $schedule in $continuum.getSchedules() )
+                  <option value="$schedule.id" #if ( $schedule.name == "DEFAULT_SCHEDULE"
) selected="selected" #end>$schedule.name</option>
+                #end
+              </select>
+            </td>
+          </tr>
         </table>
         #submitBar( "Submit" )
       </div>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/BuildDefinition.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/BuildDefinition.vm?rev=278785&r1=278784&r2=278785&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/BuildDefinition.vm
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/BuildDefinition.vm
Mon Sep  5 09:07:03 2005
@@ -13,11 +13,11 @@
       <div class="axial">
         <table border="1" cellspacing="2" cellpadding="3" width="100%">
           <tr>
-            <th>$i18n.getString( "buildDefinition.pomFilename.label" )</th>
+            <th>$i18n.getString( "buildDefinition.buildFile.label" )</th>
             <td>
               <input type="text" name="buildFile" value="$buildDefinition.buildFile" size="40"/>
                   <p>
-                    $i18n.getString( "buildDefinition.pomFilename.message" ) <font color="red"><b></b></font>
+                    $i18n.getString( "buildDefinition.buildFile.message" ) <font color="red"><b></b></font>
                   </p>
             </td>
           </tr>
@@ -37,6 +37,16 @@
                   <p>
                     $i18n.getString( "buildDefinition.arguments.message" ) <font color="red"><b></b></font>
                   </p>
+            </td>
+          </tr>
+          <tr>
+            <th>$i18n.getString( "buildDefinition.schedule.label" )</th>
+            <td>
+              <select name="schedule">
+                #foreach ( $schedule in $continuum.getSchedules() )
+                  <option value="$schedule.id" #if ( $schedule.id == $buildDefinition.schedule.id
) selected="selected" #end>$schedule.name</option>
+                #end
+              </select>
             </td>
           </tr>
         </table>

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm?rev=278785&r1=278784&r2=278785&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm
(original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Schedules.vm
Mon Sep  5 09:07:03 2005
@@ -23,8 +23,10 @@
           <td>$schedule.cronExpression</td>
           <td>$schedule.delay</td>
           <td width="10%">
-            <a href="$link.setPage('Edit.vm').addPathInfo( 'fid', 'schedules').addPathInfo('id',
$schedule.id)">Edit</a>
-            | <a href="$link.setPage('Delete.vm').addPathInfo('fid', "schedules").addPathInfo('id',
$schedule.id)">Delete</a></td>
+            #if ( $schedule.name != "DEFAULT_SCHEDULE" )
+              <a href="$link.setPage('Edit.vm').addPathInfo( 'fid', 'schedules').addPathInfo('id',
$schedule.id)">Edit</a>
+              | <a href="$link.setPage('Delete.vm').addPathInfo('fid', "schedules").addPathInfo('id',
$schedule.id)">Delete</a></td>
+            #end
         </tr>
       #end
     </table>



Mime
View raw message