Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 80f7f6216 -> b50e17645


group software process tasks better

causes a much nicer tree to display, rather than lots of steps.
most are no-op and i think this structure makes it better to navigate.
unfortunately it is hard to tell if a step is no-op, as they are methods,
so we don't have a way just to not run empty steps.
it would be better to do away with most of them, finding a different mechanism
for subclasses to insert at the right point, but this helps in the short term.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/39e2a4e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/39e2a4e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/39e2a4e4

Branch: refs/heads/master
Commit: 39e2a4e4a81138e22d35d026cdcd6307fba67eb8
Parents: b28ba02
Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Authored: Thu Jan 21 14:10:09 2016 +0000
Committer: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Committed: Thu Jan 21 14:16:37 2016 +0000

----------------------------------------------------------------------
 .../base/AbstractSoftwareProcessDriver.java     | 99 +++++++++++---------
 1 file changed, 53 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/39e2a4e4/brooklyn-server/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessDriver.java
----------------------------------------------------------------------
diff --git 
a/brooklyn-server/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessDriver.java
 
b/brooklyn-server/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessDriver.java
index d243833..4ffeb1a 100644
--- 
a/brooklyn-server/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessDriver.java
+++ 
b/brooklyn-server/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessDriver.java
@@ -107,40 +107,43 @@ public abstract class AbstractSoftwareProcessDriver 
implements SoftwareProcessDr
             skipStart = entityStarted.or(false);
         }
         if (!skipStart) {
-            Optional<Boolean> locationInstalled = 
Optional.fromNullable(getLocation().getConfig(BrooklynConfigKeys.SKIP_ENTITY_INSTALLATION));
-            Optional<Boolean> entityInstalled = 
Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_ENTITY_INSTALLATION));
-            boolean skipInstall = 
locationInstalled.or(entityInstalled).or(false);
-            if (!skipInstall) {
-                DynamicTasks.queue("copy-pre-install-resources", new 
Runnable() { public void run() {
-                    
waitForConfigKey(BrooklynConfigKeys.PRE_INSTALL_RESOURCES_LATCH);
-                    copyPreInstallResources();
-                }});
-
-                DynamicTasks.queue("pre-install", new Runnable() { public void 
run() {
-                    preInstall();
-                }});
-
-                DynamicTasks.queue("pre-install-command", new Runnable() { 
public void run() {
-                    runPreInstallCommand();
-                }});
-                DynamicTasks.queue("setup", new Runnable() { public void run() 
{
-                    waitForConfigKey(BrooklynConfigKeys.SETUP_LATCH);
-                    setup();
-                }});
-
-                DynamicTasks.queue("copy-install-resources", new Runnable() { 
public void run() {
-                    
waitForConfigKey(BrooklynConfigKeys.INSTALL_RESOURCES_LATCH);
-                    copyInstallResources();
-                }});
+            DynamicTasks.queue("install", new Runnable() { public void run() {
+
+                Optional<Boolean> locationInstalled = 
Optional.fromNullable(getLocation().getConfig(BrooklynConfigKeys.SKIP_ENTITY_INSTALLATION));
+                Optional<Boolean> entityInstalled = 
Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_ENTITY_INSTALLATION));
+                boolean skipInstall = 
locationInstalled.or(entityInstalled).or(false);
+                if (!skipInstall) {
+                    DynamicTasks.queue("copy-pre-install-resources", new 
Runnable() { public void run() {
+                        
waitForConfigKey(BrooklynConfigKeys.PRE_INSTALL_RESOURCES_LATCH);
+                        copyPreInstallResources();
+                    }});
+
+                    DynamicTasks.queue("pre-install", new Runnable() { public 
void run() {
+                        preInstall();
+                    }});
+
+                    DynamicTasks.queue("pre-install-command", new Runnable() { 
public void run() {
+                        runPreInstallCommand();
+                    }});
+                    DynamicTasks.queue("setup", new Runnable() { public void 
run() {
+                        waitForConfigKey(BrooklynConfigKeys.SETUP_LATCH);
+                        setup();
+                    }});
+
+                    DynamicTasks.queue("copy-install-resources", new 
Runnable() { public void run() {
+                        
waitForConfigKey(BrooklynConfigKeys.INSTALL_RESOURCES_LATCH);
+                        copyInstallResources();
+                    }});
+
+                    DynamicTasks.queue("install (main)", new Runnable() { 
public void run() {
+                        waitForConfigKey(BrooklynConfigKeys.INSTALL_LATCH);
+                        install();
+                    }});
+                }
 
-                DynamicTasks.queue("install", new Runnable() { public void 
run() {
-                    waitForConfigKey(BrooklynConfigKeys.INSTALL_LATCH);
-                    install();
+                DynamicTasks.queue("post-install-command", new Runnable() { 
public void run() {
+                    runPostInstallCommand();
                 }});
-            }
-
-            DynamicTasks.queue("post-install-command", new Runnable() { public 
void run() {
-                runPostInstallCommand();
             }});
 
             DynamicTasks.queue("customize", new Runnable() { public void run() 
{
@@ -148,22 +151,24 @@ public abstract class AbstractSoftwareProcessDriver 
implements SoftwareProcessDr
                 customize();
             }});
 
-            DynamicTasks.queue("copy-runtime-resources", new Runnable() { 
public void run() {
-                waitForConfigKey(BrooklynConfigKeys.RUNTIME_RESOURCES_LATCH);
-                copyRuntimeResources();
-            }});
+            DynamicTasks.queue("launch", new Runnable() { public void run() {
+                DynamicTasks.queue("copy-runtime-resources", new Runnable() { 
public void run() {
+                    
waitForConfigKey(BrooklynConfigKeys.RUNTIME_RESOURCES_LATCH);
+                    copyRuntimeResources();
+                }});
 
-            DynamicTasks.queue("pre-launch-command", new Runnable() { public 
void run() {
-                runPreLaunchCommand();
-            }});
+                DynamicTasks.queue("pre-launch-command", new Runnable() { 
public void run() {
+                    runPreLaunchCommand();
+                }});
 
-            DynamicTasks.queue("launch", new Runnable() { public void run() {
-                waitForConfigKey(BrooklynConfigKeys.LAUNCH_LATCH);
-                launch();
-            }});
+                DynamicTasks.queue("launch (main)", new Runnable() { public 
void run() {
+                    waitForConfigKey(BrooklynConfigKeys.LAUNCH_LATCH);
+                    launch();
+                }});
 
-            DynamicTasks.queue("post-launch-command", new Runnable() { public 
void run() {
-                runPostLaunchCommand();
+                DynamicTasks.queue("post-launch-command", new Runnable() { 
public void run() {
+                    runPostLaunchCommand();
+                }});
             }});
         }
 
@@ -187,6 +192,7 @@ public abstract class AbstractSoftwareProcessDriver 
implements SoftwareProcessDr
     public abstract void customize();
     public abstract void runPreLaunchCommand();
     public abstract void launch();
+    /** Only run if launch is run (if start is not skipped). */
     public abstract void runPostLaunchCommand();
 
     @Override
@@ -195,7 +201,8 @@ public abstract class AbstractSoftwareProcessDriver 
implements SoftwareProcessDr
     }
 
     /**
-     * Implement this method in child classes to add some post-launch behavior
+     * Implement this method in child classes to add some post-launch behavior.
+     * This is run even if start is skipped and launch is not run.
      */
     public void postLaunch() {}
 

Reply via email to