← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12424: Function for skipping startup routines during development by appending -Ddhis.skip.startup=true o...

 

------------------------------------------------------------
revno: 12424
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-10-04 11:01:42 +0200
message:
  Function for skipping startup routines during development by appending -Ddhis.skip.startup=true on command line
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/startup/DefaultStartupRoutineExecutor.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/startup/DefaultStartupRoutineExecutor.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/startup/DefaultStartupRoutineExecutor.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/startup/DefaultStartupRoutineExecutor.java	2013-10-04 09:01:42 +0000
@@ -36,9 +36,14 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import static org.hisp.dhis.datavalue.DataValue.TRUE;
+
 /**
  * Default implementation of StartupRoutineExecutor. The execute method will
- * execute the added StartupRoutines ordered by their runlevels.
+ * execute the added StartupRoutines ordered by their runlevels. Startup routines
+ * can be ignored from the command line by appending the below.
+ * 
+ * <code>-Ddhis.skip.startup=true</code>
  * 
  * @author <a href="mailto:torgeilo@xxxxxxxxx";>Torgeir Lorange Ostby</a>
  * @version $Id: DefaultStartupRoutineExecutor.java 5781 2008-10-01 12:12:48Z larshelg $
@@ -49,6 +54,8 @@
 {
     private static final Log LOG = LogFactory.getLog( DefaultStartupRoutineExecutor.class );
 
+    private static final String SKIP_PROP = "dhis.skip.startup";
+    
     private List<StartupRoutine> routines = new ArrayList<StartupRoutine>();
 
     // -------------------------------------------------------------------------
@@ -87,6 +94,12 @@
     private void execute( boolean testing )
         throws Exception
     {
+        if ( TRUE.equalsIgnoreCase( System.getProperty( SKIP_PROP ) ) )
+        {
+            LOG.info( "Skipping startup routines" );
+            return;
+        }
+        
         Collections.sort( routines, new StartupRoutineComparator() );
 
         int total = routines.size();