Repository: brooklyn-server Updated Branches: refs/heads/master fad6e99b9 -> 5472c1e8d
Deprecate BashCommands.ifExecutableElse(String, List, List) misleading name Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ffa29816 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ffa29816 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ffa29816 Branch: refs/heads/master Commit: ffa29816480ab6e386d62020931b7a639c4c7d4e Parents: a9f9df4 Author: Valentin Aitken <[email protected]> Authored: Sun Apr 10 23:48:42 2016 +0300 Committer: Valentin Aitken <[email protected]> Committed: Wed Apr 13 16:19:55 2016 +0300 ---------------------------------------------------------------------- .../apache/brooklyn/util/ssh/BashCommands.java | 26 ++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ffa29816/utils/common/src/main/java/org/apache/brooklyn/util/ssh/BashCommands.java ---------------------------------------------------------------------- diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/ssh/BashCommands.java b/utils/common/src/main/java/org/apache/brooklyn/util/ssh/BashCommands.java index f73ebc2..e4388a7 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/ssh/BashCommands.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/ssh/BashCommands.java @@ -235,17 +235,33 @@ public class BashCommands { return alternativesGroup(format("which %s", executable), command); } - public static String ifExecutableElse(String command, String ifTrue, String otherwise) { + /** + * @deprecated As of release 0.10.0, replaced by {@link #ifExecutableDoesNotExistElse(String, String, String)} + */ + @Deprecated + public static String ifExecutableElse(String command, String ifNotExist, String ifExist) { + return ifExecutableDoesNotExistElse(command, ifNotExist, ifExist); + } + + public static String ifExecutableDoesNotExistElse(String command, String ifNotExist, String ifExist) { return com.google.common.base.Joiner.on('\n').join( - ifExecutableElse(command, ImmutableList.<String>of(ifTrue), ImmutableList.<String>of(otherwise))); + ifExecutableDoesNotExistElse(command, ImmutableList.<String>of(ifNotExist), ImmutableList.<String>of(ifExist))); + } + + /** + * @deprecated As of release 0.10.0, replaced by {@link #ifExecutableDoesNotExistElse(String, List, List)} + */ + @Deprecated + public static ImmutableList<String> ifExecutableElse(String command, List<String> ifNotExist, List<String> ifExist) { + return ifExecutableDoesNotExistElse(command, ifNotExist, ifExist); } - public static ImmutableList<String> ifExecutableElse(String command, List<String> ifTrue, List<String> otherwise) { + public static ImmutableList<String> ifExecutableDoesNotExistElse(String command, List<String> ifNotExist, List<String> ifExist) { return ImmutableList.<String>builder() .add(String.format("if test -z `which %s`; then", command)) - .addAll(ifTrue) + .addAll(ifNotExist) .add("else") - .addAll(otherwise) + .addAll(ifExist) .add("fi") .build(); }
