continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r372494 - in /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum: DefaultContinuum.java build/settings/DefaultSchedulesActivator.java scheduler/DefaultContinuumScheduler.java
Date Thu, 26 Jan 2006 10:04:56 GMT
Author: evenisse
Date: Thu Jan 26 02:04:50 2006
New Revision: 372494

URL: http://svn.apache.org/viewcvs?rev=372494&view=rev
Log:
[CONTINUUM-569] Disable invalid schedule when continuum start instead of throw an exception
so users will can fix cron expression in web interface

Modified:
    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-core/src/main/java/org/apache/maven/continuum/scheduler/DefaultContinuumScheduler.java

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=372494&r1=372493&r2=372494&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
Thu Jan 26 02:04:50 2006
@@ -1,7 +1,7 @@
 package org.apache.maven.continuum;
 
 /*
- * Copyright 2004-2005 The Apache Software Foundation.
+ * Copyright 2001-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.
@@ -1807,16 +1807,6 @@
             initializer.initialize();
 
             configurationService.load();
-
-            // ----------------------------------------------------------------------
-            // Activate all the Build settings in the system
-            // ----------------------------------------------------------------------
-
-            schedulesActivator.activateSchedules( this );
-        }
-        catch ( SchedulesActivationException e )
-        {
-            throw new StartingException( "Error activating schedules.", e );
         }
         catch ( ConfigurationLoadingException e )
         {
@@ -1826,6 +1816,19 @@
         {
             throw new StartingException( "Cannot initializing Continuum for the first time.",
e );
         }
+
+        try
+        {
+            // ----------------------------------------------------------------------
+            // Activate all the schedules in the system
+            // ----------------------------------------------------------------------
+            schedulesActivator.activateSchedules( this );
+        }
+        catch ( SchedulesActivationException e )
+        {
+            // We don't throw an exception here, so users will can modify schedules in interface
instead of database
+            getLogger().error( "Error activating schedules.", e );
+        }
     }
 
     public void stop()
@@ -2049,14 +2052,7 @@
 
     private boolean convertBoolean( String value )
     {
-        if ( "true".equalsIgnoreCase( value ) || "on".equalsIgnoreCase( value ) || "yes".equalsIgnoreCase(
value ) )
-        {
-            return true;
-        }
-        else
-        {
-            return false;
-        }
+        return "true".equalsIgnoreCase( value ) || "on".equalsIgnoreCase( value ) || "yes".equalsIgnoreCase(
value );
     }
 
     private void startMessage()

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=372494&r1=372493&r2=372494&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
Thu Jan 26 02:04:50 2006
@@ -1,7 +1,7 @@
 package org.apache.maven.continuum.build.settings;
 
 /*
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2001-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.
@@ -23,6 +23,7 @@
 import org.apache.maven.continuum.scheduler.ContinuumSchedulerConstants;
 import org.apache.maven.continuum.scheduler.ContinuumSchedulerException;
 import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.StringUtils;
 import org.quartz.CronTrigger;
@@ -76,7 +77,26 @@
                 continue;
             }
 
-            schedule( schedule, continuum );
+            try
+            {
+                schedule( schedule, continuum );
+            }
+            catch ( SchedulesActivationException e )
+            {
+                getLogger().error( "Can't activate schedule '" + schedule.getName() + "'",
e );
+
+                schedule.setActive( false );
+
+                try
+                {
+                    store.storeSchedule( schedule );
+                }
+                catch ( ContinuumStoreException e1 )
+                {
+                    throw new SchedulesActivationException( "Can't desactivate schedule '"
+ schedule.getName() + "'",
+                                                            e );
+                }
+            }
         }
     }
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/DefaultContinuumScheduler.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/DefaultContinuumScheduler.java?rev=372494&r1=372493&r2=372494&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/DefaultContinuumScheduler.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scheduler/DefaultContinuumScheduler.java
Thu Jan 26 02:04:50 2006
@@ -1,7 +1,7 @@
 package org.apache.maven.continuum.scheduler;
 
 /*
- * Copyright 2004-2005 The Apache Software Foundation.
+ * Copyright 2001-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.



Mime
View raw message