Adds ConfigSensorAdapter.apply(EntityLocal, AttributeSensorAndConfigKey) Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2dcf8a27 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2dcf8a27 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2dcf8a27
Branch: refs/heads/0.4.0 Commit: 2dcf8a27849c86a9c63550a6ddfe9c6dc80a13ef Parents: f8b3954 Author: Aled Sage <[email protected]> Authored: Thu Oct 11 12:05:41 2012 +0100 Committer: Aled Sage <[email protected]> Committed: Thu Oct 11 12:05:41 2012 +0100 ---------------------------------------------------------------------- .../java/brooklyn/event/adapter/ConfigSensorAdapter.groovy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2dcf8a27/core/src/main/java/brooklyn/event/adapter/ConfigSensorAdapter.groovy ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/event/adapter/ConfigSensorAdapter.groovy b/core/src/main/java/brooklyn/event/adapter/ConfigSensorAdapter.groovy index e50c9dc..4b93f4c 100644 --- a/core/src/main/java/brooklyn/event/adapter/ConfigSensorAdapter.groovy +++ b/core/src/main/java/brooklyn/event/adapter/ConfigSensorAdapter.groovy @@ -27,5 +27,11 @@ public class ConfigSensorAdapter extends AbstractSensorAdapter { } } } - + + //for selectively applying once (e.g. sub-classes of DynamicWebAppCluster that don't want to set HTTP_PORT etc!) + public static void apply(EntityLocal entity, AttributeSensorAndConfigKey key) { + if (entity.getAttribute(key)==null) { + entity.setAttribute(key) + } + } }
