brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [2/8] incubator-brooklyn git commit: Basho Riak - Linux Install
Date Fri, 13 Mar 2015 11:20:02 GMT
Basho Riak - Linux Install

Fix code formatting


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

Branch: refs/heads/master
Commit: 83299d1ddd4da7fe770bea32285faec837289e9f
Parents: 3737c11
Author: Valentin Aitken <bostko@gmail.com>
Authored: Thu Feb 26 12:17:40 2015 +0200
Committer: Valentin Aitken <bostko@gmail.com>
Committed: Mon Mar 2 12:09:54 2015 +0200

----------------------------------------------------------------------
 .../entity/nosql/riak/RiakNodeSshDriver.java    | 38 ++++++++++----------
 1 file changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/83299d1d/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
index 9ecb5df..2e4fcd4 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
@@ -96,7 +96,7 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver
implemen
         List<String> commands = Lists.newLinkedList();
         if (osDetails.isLinux()) {
 //            commands.addAll(installLinux(getExpandedInstallDir()));
-            commands.addAll(installPackageCloud());
+            commands.addAll(installFromPackageCloud());
         } else if (osDetails.isMac()) {
             isPackageInstall = false;
             commands.addAll(installMac());
@@ -158,32 +158,32 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver
implemen
                 .build();
     }
     
-    private List<String> installPackageCloud() {
-        return ifExecutable0Else1("yum", installDebianBased(), installRpmBased());
+    private List<String> installFromPackageCloud() {
+        return ifExecutableElse("yum", installDebianBased(), installRpmBased());
     }
 
     private ImmutableList<String> installDebianBased() {
-        ImmutableList.Builder<String> commands = ImmutableList.<String>builder();
-        commands.add("curl https://packagecloud.io/install/repositories/basho/riak/script.deb
| sudo bash");
-        commands.add("sudo apt-get install --assume-yes riak");
-        return commands.build();
+        return ImmutableList.<String>builder()
+                .add("curl https://packagecloud.io/install/repositories/basho/riak/script.deb
| sudo bash")
+                .add("sudo apt-get install --assume-yes riak")
+                .build();
     }
     
     private ImmutableList<String> installRpmBased() {
-        ImmutableList.Builder<String> commands = ImmutableList.<String>builder();
-        commands.add("curl https://packagecloud.io/install/repositories/basho/riak/script.rpm
| sudo bash");
-        commands.add("sudo yum install -y riak");
-        return commands.build();
+        return ImmutableList.<String>builder()
+                .add("curl https://packagecloud.io/install/repositories/basho/riak/script.rpm
| sudo bash")
+                .add("sudo yum install -y riak")
+                .build();
     }
 
-    private static ImmutableList<String> ifExecutable0Else1(String command, List<String>
ifTrue, List<String> otherwise) {
-        ImmutableList.Builder<String> commands = ImmutableList.<String>builder();
-        commands.add(String.format("if test -z `which %s`; then", command));
-        commands.addAll(ifTrue);
-        commands.add("else");
-        commands.addAll(otherwise);
-        commands.add("fi");
-        return commands.build();
+    private static ImmutableList<String> ifExecutableElse(String command, List<String>
ifTrue, List<String> otherwise) {
+        return ImmutableList.<String>builder()
+                .add(String.format("if test -z `which %s`; then", command))
+                .addAll(ifTrue)
+                .add("else")
+                .addAll(otherwise)
+                .add("fi")
+                .build();
     }
 
     protected List<String> installMac() {


Mime
View raw message