brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grk...@apache.org
Subject [03/10] git commit: Add CLI and launcher option to start BrooklynNode entity
Date Mon, 06 Oct 2014 19:11:43 GMT
Add CLI and launcher option to start BrooklynNode entity


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

Branch: refs/heads/master
Commit: 6ce1b6f1b7e2aab6cdb49f1eef14d2b3ea2dcd2a
Parents: 8d5a127
Author: Andrew Kennedy <grkvlt@apache.org>
Authored: Sat Sep 27 19:55:56 2014 +0100
Committer: Andrew Kennedy <grkvlt@apache.org>
Committed: Mon Oct 6 15:52:57 2014 +0100

----------------------------------------------------------------------
 usage/cli/src/main/java/brooklyn/cli/Main.java  | 11 ++++++++-
 .../brooklyn/launcher/BrooklynLauncher.java     | 25 ++++++++++++++++----
 2 files changed, 30 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6ce1b6f1/usage/cli/src/main/java/brooklyn/cli/Main.java
----------------------------------------------------------------------
diff --git a/usage/cli/src/main/java/brooklyn/cli/Main.java b/usage/cli/src/main/java/brooklyn/cli/Main.java
index 0916a33..204c63c 100644
--- a/usage/cli/src/main/java/brooklyn/cli/Main.java
+++ b/usage/cli/src/main/java/brooklyn/cli/Main.java
@@ -229,7 +229,12 @@ public class Main extends AbstractMain {
                 + "(default is to abort if they fail to start)")
         public boolean ignoreAppErrors = false;
 
-        // Note in some cases, you can get java.util.concurrent.RejectedExecutionException

+        @Beta
+        @Option(name = { "--startBrooklynNode" },
+                description = "Whether to start a BrooklynNode entity representing this Brooklyn
instance")
+        public boolean startBrooklynNode = false;
+
+        // Note in some cases, you can get java.util.concurrent.RejectedExecutionException
         // if shutdown is not co-ordinated, e.g. with Whirr:
         // looks like: {@linktourl https://gist.github.com/47066f72d6f6f79b953e}
         @Beta
@@ -504,6 +509,10 @@ public class Main extends AbstractMain {
                 log.info("Configuring to disable console security");
                 launcher.installSecurityFilter(false);
             }
+            if (startBrooklynNode) {
+                log.info("Configuring BrooklynNode entity startup");
+                launcher.startBrooklynNode(true);
+            }
             if (Strings.isNonEmpty(bindAddress)) {
                 log.debug("Configuring bind address as "+bindAddress);
                 launcher.bindAddress(Networking.getInetAddressWithFixedName(bindAddress));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6ce1b6f1/usage/launcher/src/main/java/brooklyn/launcher/BrooklynLauncher.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/main/java/brooklyn/launcher/BrooklynLauncher.java b/usage/launcher/src/main/java/brooklyn/launcher/BrooklynLauncher.java
index 24f5c8d..8e08bb4 100644
--- a/usage/launcher/src/main/java/brooklyn/launcher/BrooklynLauncher.java
+++ b/usage/launcher/src/main/java/brooklyn/launcher/BrooklynLauncher.java
@@ -137,6 +137,7 @@ public class BrooklynLauncher {
     private final List<Application> apps = new ArrayList<Application>();
     
     private boolean startWebApps = true;
+    private boolean startBrooklynNode = false;
     private PortRange port = PortRanges.fromString("8081+");
     private InetAddress bindAddress = null;
     private InetAddress publicAddress = null;
@@ -382,6 +383,7 @@ public class BrooklynLauncher {
         this.ignorePersistenceErrors = ignorePersistenceErrors;
         return this;
     }
+
     public BrooklynLauncher ignoreWebErrors(boolean ignoreWebErrors) {
         this.ignoreWebErrors = ignoreWebErrors;
         return this;
@@ -396,6 +398,7 @@ public class BrooklynLauncher {
         this.stopWhichAppsOnShutdown = stopWhich;
         return this;
     }
+
     public BrooklynLauncher shutdownOnExit(boolean val) {
         LOG.warn("Call to deprecated `shutdownOnExit`", new Throwable("source of deprecated
call"));
         stopWhichAppsOnShutdown = StopWhichAppsOnShutdown.THESE_IF_NOT_PERSISTED;
@@ -406,12 +409,12 @@ public class BrooklynLauncher {
         this.persistMode = persistMode;
         return this;
     }
-    
+
     public BrooklynLauncher highAvailabilityMode(HighAvailabilityMode highAvailabilityMode)
{
         this.highAvailabilityMode = highAvailabilityMode;
         return this;
     }
-    
+
     public BrooklynLauncher persistenceDir(@Nullable String persistenceDir) {
         this.persistenceDir = persistenceDir;
         return this;
@@ -432,6 +435,11 @@ public class BrooklynLauncher {
         return this;
     }
 
+    public BrooklynLauncher startBrooklynNode(boolean val) {
+        this.startBrooklynNode = val;
+        return this;
+    }
+
     /**
      * Controls both the frequency of heartbeats, and the frequency of checking the health
of other nodes.
      */
@@ -439,7 +447,7 @@ public class BrooklynLauncher {
         this.haHeartbeatPeriod = val;
         return this;
     }
-    
+
     public BrooklynMementoRawData retrieveState() {
         initManagementContext();
 
@@ -535,15 +543,22 @@ public class BrooklynLauncher {
                 handleSubsystemStartupError(ignoreWebErrors, "web apps", e);
             }
         }
-        
+
         try {
             createApps();
             startApps();
-            startBrooklynNode();
         } catch (Exception e) {
             handleSubsystemStartupError(ignoreAppErrors, "managed apps", e);
         }
 
+        if (startBrooklynNode) {
+            try {
+                startBrooklynNode();
+            } catch (Exception e) {
+                handleSubsystemStartupError(ignoreWebErrors, "web apps", e);
+            }
+        }
+
         return this;
     }
 


Mime
View raw message