You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by gr...@apache.org on 2015/01/13 16:55:55 UTC
[1/5] incubator-brooklyn git commit: Add configuration to skip start
if entity already running
Repository: incubator-brooklyn
Updated Branches:
refs/heads/master 36f7c922e -> 895fb9acc
Add configuration to skip start if entity already running
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/d5b34e14
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/d5b34e14
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/d5b34e14
Branch: refs/heads/master
Commit: d5b34e145ebf08fb834ef0eea48a8754f7e32db5
Parents: eeb681a
Author: Andrew Kennedy <gr...@apache.org>
Authored: Tue Nov 25 23:55:50 2014 +0000
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Mon Jan 12 21:45:00 2015 +0000
----------------------------------------------------------------------
.../entity/basic/BrooklynConfigKeys.java | 5 ++--
.../basic/PortAttributeSensorAndConfigKey.java | 10 +++++---
.../basic/AbstractSoftwareProcessDriver.java | 25 ++++++++++++++++----
.../brooklyn/entity/basic/SoftwareProcess.java | 3 +++
4 files changed, 34 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d5b34e14/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java b/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
index be627f3..f26280d 100644
--- a/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
+++ b/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
@@ -55,8 +55,9 @@ public class BrooklynConfigKeys {
"this should include something readable, and must include a hash of all data which differentiates an installation " +
"(e.g. version, plugins, etc), but should be the same where install dirs can be shared to allow for re-use");
- public static final ConfigKey<Boolean> ENTITY_STARTED = newBooleanConfigKey("entity.started", "Skip the startup process entirely, for running services", Boolean.FALSE);
- public static final ConfigKey<Boolean> SKIP_INSTALLATION = newBooleanConfigKey("install.skip", "Skip the driver install commands entirely, for pre-installed software", Boolean.FALSE);
+ public static final ConfigKey<Boolean> ENTITY_STARTED = newBooleanConfigKey("entity.started", "Skip the startup process entirely, for running services");
+ public static final ConfigKey<Boolean> ENTITY_RUNNING = newBooleanConfigKey("entity.running", "Skip the startup process entirely, if service already running");
+ public static final ConfigKey<Boolean> SKIP_INSTALLATION = newBooleanConfigKey("install.skip", "Skip the driver install commands entirely, for pre-installed software");
// The implementation in AbstractSoftwareSshDriver runs this command as an SSH command
public static final ConfigKey<String> PRE_INSTALL_COMMAND = ConfigKeys.newStringConfigKey("pre.install.command",
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d5b34e14/core/src/main/java/brooklyn/event/basic/PortAttributeSensorAndConfigKey.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/event/basic/PortAttributeSensorAndConfigKey.java b/core/src/main/java/brooklyn/event/basic/PortAttributeSensorAndConfigKey.java
index 7d21d6d..e68fa92 100644
--- a/core/src/main/java/brooklyn/event/basic/PortAttributeSensorAndConfigKey.java
+++ b/core/src/main/java/brooklyn/event/basic/PortAttributeSensorAndConfigKey.java
@@ -93,8 +93,12 @@ public class PortAttributeSensorAndConfigKey extends AttributeSensorAndConfigKey
}
if (lo.isPresent()) {
Location l = lo.get();
- Boolean skip = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_INSTALLATION)).or(false);
- Boolean started = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_STARTED)).or(false);
+ Optional<Boolean> locationRunning = Optional.fromNullable(l.getConfig(BrooklynConfigKeys.ENTITY_RUNNING));
+ Optional<Boolean> entityRunning = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_RUNNING));
+ Optional<Boolean> locationInstalled = Optional.fromNullable(l.getConfig(BrooklynConfigKeys.SKIP_INSTALLATION));
+ Optional<Boolean> entityInstalled = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_INSTALLATION));
+ Optional<Boolean> entityStarted = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_STARTED));
+ boolean skipCheck = locationRunning.or(entityRunning).or(locationInstalled).or(entityInstalled).or(entityStarted).or(false);
if (l instanceof PortSupplier) {
int p = ((PortSupplier) l).obtainPort(value);
if (p != -1) {
@@ -102,7 +106,7 @@ public class PortAttributeSensorAndConfigKey extends AttributeSensorAndConfigKey
return p;
}
// If we are not skipping install or already started, fail now
- if (!(skip || started)) {
+ if (!skipCheck) {
int rangeSize = Iterables.size(value);
if (rangeSize == 0) {
LOG.warn("{}: no port available for {} (empty range {})", new Object[] { entity, getName(), value });
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d5b34e14/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
index e4a26da..b9fcff0 100644
--- a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
+++ b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
@@ -74,13 +74,28 @@ public abstract class AbstractSoftwareProcessDriver implements SoftwareProcessDr
* be called after the {@link #launch()} metheod is executed, but the
* process may not be completely initialised at this stage, so care is
* required when implementing these stages.
+ * <p>
+ * The {@link BrooklynConfigKeys#ENTITY_RUNNING} key can be set on the location
+ * or the entity to skip the startup process if the entity is already running,
+ * according to the {@link #isRunning()} method. To force the startup to be
+ * skipped, {@link BrooklynConfigKeys#ENTITY_STARTED} can be set on the entity.
+ * The {@link BrooklynConfigKeys#SKIP_INSTALLATION} key can also be used to
+ * skip the {@link #setup()}, {@link #copyInstallResources()} and
+ * {@link #install()} methods if set on the entity or location.
*
* @see #stop()
*/
@Override
public void start() {
- Boolean started = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_STARTED)).or(false);
- if (!started) {
+ boolean skipStart = false;
+ Optional<Boolean> locationRunning = Optional.fromNullable(getLocation().getConfig(BrooklynConfigKeys.ENTITY_RUNNING));
+ Optional<Boolean> entityRunning = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_RUNNING));
+ if (locationRunning.or(entityRunning).or(false)) {
+ skipStart = isRunning();
+ } else {
+ skipStart = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_STARTED)).or(false);
+ }
+ if (!skipStart) {
DynamicTasks.queue("pre-install", new Runnable() { public void run() {
preInstall();
}});
@@ -91,8 +106,10 @@ public abstract class AbstractSoftwareProcessDriver implements SoftwareProcessDr
}});
};
- Boolean skip = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_INSTALLATION)).or(false);
- if (!skip) {
+ Optional<Boolean> locationInstalled = Optional.fromNullable(getLocation().getConfig(BrooklynConfigKeys.SKIP_INSTALLATION));
+ Optional<Boolean> entityInstalled = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_INSTALLATION));
+ boolean skipInstall = locationInstalled.or(entityInstalled).or(false);
+ if (!skipInstall) {
DynamicTasks.queue("setup", new Runnable() { public void run() {
waitForConfigKey(BrooklynConfigKeys.SETUP_LATCH);
setup();
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d5b34e14/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
index 62fe9e0..717b7ea 100644
--- a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
+++ b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
@@ -69,6 +69,9 @@ public interface SoftwareProcess extends Entity, Startable {
@SetFromFlag("entityStarted")
ConfigKey<Boolean> ENTITY_STARTED = BrooklynConfigKeys.ENTITY_STARTED;
+ @SetFromFlag("entityRunning")
+ ConfigKey<Boolean> ENTITY_RUNNING = BrooklynConfigKeys.ENTITY_RUNNING;
+
@SetFromFlag("skipInstall")
ConfigKey<Boolean> SKIP_INSTALLATION = BrooklynConfigKeys.SKIP_INSTALLATION;
[4/5] incubator-brooklyn git commit: Update name of configuration
keys for skipping start and install
Posted by gr...@apache.org.
Update name of configuration keys for skipping start and install
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/79adb86e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/79adb86e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/79adb86e
Branch: refs/heads/master
Commit: 79adb86e3bbb2478e2d694097533239827e9eff0
Parents: 0e90d52
Author: Andrew Kennedy <gr...@apache.org>
Authored: Mon Jan 12 21:51:28 2015 +0000
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Tue Jan 13 15:24:36 2015 +0000
----------------------------------------------------------------------
.../brooklyn/entity/basic/BrooklynConfigKeys.java | 6 +++---
.../event/basic/PortAttributeSensorAndConfigKey.java | 10 +++++-----
.../entity/basic/AbstractSoftwareProcessDriver.java | 14 +++++++-------
.../java/brooklyn/entity/basic/SoftwareProcess.java | 10 +++++-----
4 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/79adb86e/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java b/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
index e40be9a..6038d0c 100644
--- a/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
+++ b/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
@@ -68,7 +68,7 @@ public class BrooklynConfigKeys {
*
* @see #ENTITY_RUNNING
*/
- public static final ConfigKey<Boolean> ENTITY_STARTED = newBooleanConfigKey("entity.started", "Skip the startup process entirely, for running services");
+ public static final ConfigKey<Boolean> SKIP_ENTITY_START = newBooleanConfigKey("entity.started", "Skip the startup process entirely, for running services");
/**
* Set this configuration value to true to skip the entity startup process as with {@link #ENTITY_STARTED} if the process or
@@ -79,14 +79,14 @@ public class BrooklynConfigKeys {
*
* @see #ENTITY_STARTED
*/
- public static final ConfigKey<Boolean> ENTITY_RUNNING = newBooleanConfigKey("entity.running", "Skip the startup process entirely, if service already running");
+ public static final ConfigKey<Boolean> SKIP_ENTITY_START_IF_RUNNING = newBooleanConfigKey("entity.running", "Skip the startup process entirely, if service already running");
/**
* Set this configuration value to true if the entity installation, customization and launch process is to be skipped entirely.
* <p>
* This will skip the installation phase of the lifecycle, and move directl;y to customization and launching of the entity.
*/
- public static final ConfigKey<Boolean> SKIP_INSTALLATION = newBooleanConfigKey("install.skip", "Skip the driver install commands entirely, for pre-installed software");
+ public static final ConfigKey<Boolean> SKIP_ENTITY_INSTALLATION = newBooleanConfigKey("install.skip", "Skip the driver install commands entirely, for pre-installed software");
// The implementation in AbstractSoftwareSshDriver runs this command as an SSH command
public static final ConfigKey<String> PRE_INSTALL_COMMAND = ConfigKeys.newStringConfigKey("pre.install.command",
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/79adb86e/core/src/main/java/brooklyn/event/basic/PortAttributeSensorAndConfigKey.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/event/basic/PortAttributeSensorAndConfigKey.java b/core/src/main/java/brooklyn/event/basic/PortAttributeSensorAndConfigKey.java
index e68fa92..e4e613e 100644
--- a/core/src/main/java/brooklyn/event/basic/PortAttributeSensorAndConfigKey.java
+++ b/core/src/main/java/brooklyn/event/basic/PortAttributeSensorAndConfigKey.java
@@ -93,11 +93,11 @@ public class PortAttributeSensorAndConfigKey extends AttributeSensorAndConfigKey
}
if (lo.isPresent()) {
Location l = lo.get();
- Optional<Boolean> locationRunning = Optional.fromNullable(l.getConfig(BrooklynConfigKeys.ENTITY_RUNNING));
- Optional<Boolean> entityRunning = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_RUNNING));
- Optional<Boolean> locationInstalled = Optional.fromNullable(l.getConfig(BrooklynConfigKeys.SKIP_INSTALLATION));
- Optional<Boolean> entityInstalled = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_INSTALLATION));
- Optional<Boolean> entityStarted = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_STARTED));
+ Optional<Boolean> locationRunning = Optional.fromNullable(l.getConfig(BrooklynConfigKeys.SKIP_ENTITY_START_IF_RUNNING));
+ Optional<Boolean> entityRunning = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_ENTITY_START_IF_RUNNING));
+ Optional<Boolean> locationInstalled = Optional.fromNullable(l.getConfig(BrooklynConfigKeys.SKIP_ENTITY_INSTALLATION));
+ Optional<Boolean> entityInstalled = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_ENTITY_INSTALLATION));
+ Optional<Boolean> entityStarted = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_ENTITY_START));
boolean skipCheck = locationRunning.or(entityRunning).or(locationInstalled).or(entityInstalled).or(entityStarted).or(false);
if (l instanceof PortSupplier) {
int p = ((PortSupplier) l).obtainPort(value);
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/79adb86e/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
index 817af29..67af47f 100644
--- a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
+++ b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
@@ -78,8 +78,8 @@ public abstract class AbstractSoftwareProcessDriver implements SoftwareProcessDr
* The {@link BrooklynConfigKeys#ENTITY_RUNNING} key can be set on the location
* or the entity to skip the startup process if the entity is already running,
* according to the {@link #isRunning()} method. To force the startup to be
- * skipped, {@link BrooklynConfigKeys#ENTITY_STARTED} can be set on the entity.
- * The {@link BrooklynConfigKeys#SKIP_INSTALLATION} key can also be used to
+ * skipped, {@link BrooklynConfigKeys#SKIP_ENTITY_START} can be set on the entity.
+ * The {@link BrooklynConfigKeys#SKIP_ENTITY_INSTALLATION} key can also be used to
* skip the {@link #setup()}, {@link #copyInstallResources()} and
* {@link #install()} methods if set on the entity or location.
*
@@ -88,9 +88,9 @@ public abstract class AbstractSoftwareProcessDriver implements SoftwareProcessDr
@Override
public void start() {
boolean skipStart = false;
- Optional<Boolean> locationRunning = Optional.fromNullable(getLocation().getConfig(BrooklynConfigKeys.ENTITY_RUNNING));
- Optional<Boolean> entityRunning = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_RUNNING));
- Optional<Boolean> entityStarted = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_STARTED));
+ Optional<Boolean> locationRunning = Optional.fromNullable(getLocation().getConfig(BrooklynConfigKeys.SKIP_ENTITY_START_IF_RUNNING));
+ Optional<Boolean> entityRunning = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_ENTITY_START_IF_RUNNING));
+ Optional<Boolean> entityStarted = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_ENTITY_START));
if (locationRunning.or(entityRunning).or(false)) {
skipStart = isRunning();
} else {
@@ -107,8 +107,8 @@ public abstract class AbstractSoftwareProcessDriver implements SoftwareProcessDr
}});
};
- Optional<Boolean> locationInstalled = Optional.fromNullable(getLocation().getConfig(BrooklynConfigKeys.SKIP_INSTALLATION));
- Optional<Boolean> entityInstalled = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.SKIP_INSTALLATION));
+ 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("setup", new Runnable() { public void run() {
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/79adb86e/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
index 717b7ea..6e0f9fa 100644
--- a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
+++ b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
@@ -66,14 +66,14 @@ public interface SoftwareProcess extends Entity, Startable {
@SetFromFlag("launchLatch")
ConfigKey<Boolean> LAUNCH_LATCH = BrooklynConfigKeys.LAUNCH_LATCH;
- @SetFromFlag("entityStarted")
- ConfigKey<Boolean> ENTITY_STARTED = BrooklynConfigKeys.ENTITY_STARTED;
+ @SetFromFlag("skipStart")
+ ConfigKey<Boolean> ENTITY_STARTED = BrooklynConfigKeys.SKIP_ENTITY_START;
- @SetFromFlag("entityRunning")
- ConfigKey<Boolean> ENTITY_RUNNING = BrooklynConfigKeys.ENTITY_RUNNING;
+ @SetFromFlag("skipStartIfRunning")
+ ConfigKey<Boolean> SKIP_ENTITY_START_IF_RUNNING = BrooklynConfigKeys.SKIP_ENTITY_START_IF_RUNNING;
@SetFromFlag("skipInstall")
- ConfigKey<Boolean> SKIP_INSTALLATION = BrooklynConfigKeys.SKIP_INSTALLATION;
+ ConfigKey<Boolean> SKIP_INSTALLATION = BrooklynConfigKeys.SKIP_ENTITY_INSTALLATION;
@SetFromFlag("preInstallCommand")
ConfigKey<String> PRE_INSTALL_COMMAND = BrooklynConfigKeys.PRE_INSTALL_COMMAND;
[5/5] incubator-brooklyn git commit: This closes #364
Posted by gr...@apache.org.
This closes #364
* github/pr/364:
Update name of configuration keys for skipping start and install
Added Javadoc describing new entity lifecycle configuration keys
Refactor entity started check for readability
Add configuration to skip start if entity already running
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/895fb9ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/895fb9ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/895fb9ac
Branch: refs/heads/master
Commit: 895fb9acc90623fd79feef8a8e32add63b69dce4
Parents: 36f7c92 79adb86
Author: Andrew Kennedy <gr...@apache.org>
Authored: Tue Jan 13 15:55:48 2015 +0000
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Tue Jan 13 15:55:48 2015 +0000
----------------------------------------------------------------------
.../entity/basic/BrooklynConfigKeys.java | 34 ++++++++++++++++++--
.../basic/PortAttributeSensorAndConfigKey.java | 10 ++++--
.../basic/AbstractSoftwareProcessDriver.java | 26 ++++++++++++---
.../brooklyn/entity/basic/SoftwareProcess.java | 9 ++++--
4 files changed, 67 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
[3/5] incubator-brooklyn git commit: Refactor entity started check
for readability
Posted by gr...@apache.org.
Refactor entity started check for readability
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/d02e107f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/d02e107f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/d02e107f
Branch: refs/heads/master
Commit: d02e107ffd7aabd88eef4334f9e868ab7a05f0bd
Parents: d5b34e1
Author: Andrew Kennedy <gr...@apache.org>
Authored: Wed Dec 17 13:55:18 2014 +0000
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Mon Jan 12 21:45:01 2015 +0000
----------------------------------------------------------------------
.../java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d02e107f/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
index b9fcff0..817af29 100644
--- a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
+++ b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessDriver.java
@@ -90,10 +90,11 @@ public abstract class AbstractSoftwareProcessDriver implements SoftwareProcessDr
boolean skipStart = false;
Optional<Boolean> locationRunning = Optional.fromNullable(getLocation().getConfig(BrooklynConfigKeys.ENTITY_RUNNING));
Optional<Boolean> entityRunning = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_RUNNING));
+ Optional<Boolean> entityStarted = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_STARTED));
if (locationRunning.or(entityRunning).or(false)) {
skipStart = isRunning();
} else {
- skipStart = Optional.fromNullable(entity.getConfig(BrooklynConfigKeys.ENTITY_STARTED)).or(false);
+ skipStart = entityStarted.or(false);
}
if (!skipStart) {
DynamicTasks.queue("pre-install", new Runnable() { public void run() {
[2/5] incubator-brooklyn git commit: Added Javadoc describing new
entity lifecycle configuration keys
Posted by gr...@apache.org.
Added Javadoc describing new entity lifecycle configuration keys
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/0e90d52f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/0e90d52f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/0e90d52f
Branch: refs/heads/master
Commit: 0e90d52f6c8141cc6f52eeeb094f3161cef0647d
Parents: d02e107
Author: Andrew Kennedy <gr...@apache.org>
Authored: Fri Dec 19 14:19:22 2014 +0000
Committer: Andrew Kennedy <gr...@apache.org>
Committed: Mon Jan 12 21:45:01 2015 +0000
----------------------------------------------------------------------
.../entity/basic/BrooklynConfigKeys.java | 29 ++++++++++++++++++++
1 file changed, 29 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/0e90d52f/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java b/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
index f26280d..e40be9a 100644
--- a/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
+++ b/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
@@ -21,8 +21,10 @@ package brooklyn.entity.basic;
import static brooklyn.entity.basic.ConfigKeys.*;
import brooklyn.config.BrooklynServerConfig;
import brooklyn.config.ConfigKey;
+import brooklyn.entity.trait.Startable;
import brooklyn.event.basic.AttributeSensorAndConfigKey;
import brooklyn.event.basic.TemplatedStringAttributeSensorAndConfigKey;
+import brooklyn.location.Location;
import brooklyn.util.internal.ssh.ShellTool;
import brooklyn.util.internal.ssh.SshTool;
import brooklyn.util.time.Duration;
@@ -55,8 +57,35 @@ public class BrooklynConfigKeys {
"this should include something readable, and must include a hash of all data which differentiates an installation " +
"(e.g. version, plugins, etc), but should be the same where install dirs can be shared to allow for re-use");
+ /**
+ * Set this configuration value to true if the entity installation, customization and launch process is to be skipped entirely.
+ * <p>
+ * This is usually because the process or service the entity represents is already present and started, as part of the image
+ * being used. The {@link Startable#SERVICE_UP} attribute will be set in the usual manner.
+ * <p>
+ * If this key is set on a {@link Location} then all entities in that location will be treated in this way. This is useful
+ * when the location is configured with a particular image containing installed and running services.
+ *
+ * @see #ENTITY_RUNNING
+ */
public static final ConfigKey<Boolean> ENTITY_STARTED = newBooleanConfigKey("entity.started", "Skip the startup process entirely, for running services");
+
+ /**
+ * Set this configuration value to true to skip the entity startup process as with {@link #ENTITY_STARTED} if the process or
+ * service represented by the entity is already running, otherwise proceed normally. This is determined using the driver's
+ * {@code isRunning()} method.
+ * <p>
+ * If this key is set on a {@link Location} then all entities in that location will be treated in this way, again as with {@link #ENTITY_STARTED}.
+ *
+ * @see #ENTITY_STARTED
+ */
public static final ConfigKey<Boolean> ENTITY_RUNNING = newBooleanConfigKey("entity.running", "Skip the startup process entirely, if service already running");
+
+ /**
+ * Set this configuration value to true if the entity installation, customization and launch process is to be skipped entirely.
+ * <p>
+ * This will skip the installation phase of the lifecycle, and move directl;y to customization and launching of the entity.
+ */
public static final ConfigKey<Boolean> SKIP_INSTALLATION = newBooleanConfigKey("install.skip", "Skip the driver install commands entirely, for pre-installed software");
// The implementation in AbstractSoftwareSshDriver runs this command as an SSH command