falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajayyad...@apache.org
Subject falcon git commit: FALCON-1359 Improve output format for Feed Instance Listing. Contributed by Ajay Yadava.
Date Fri, 07 Aug 2015 15:16:17 GMT
Repository: falcon
Updated Branches:
  refs/heads/master 5c9fe56b2 -> 0582e6197


FALCON-1359 Improve output format for Feed Instance Listing. Contributed by Ajay Yadava.


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/0582e619
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/0582e619
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/0582e619

Branch: refs/heads/master
Commit: 0582e6197699fe422cef4b4685a45df7dfdda275
Parents: 5c9fe56
Author: Ajay Yadava <ajaynsit@gmail.com>
Authored: Fri Aug 7 20:31:16 2015 +0530
Committer: Ajay Yadava <ajaynsit@gmail.com>
Committed: Fri Aug 7 20:32:27 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../java/org/apache/falcon/ResponseHelper.java  | 43 ++++++--------------
 2 files changed, 15 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/0582e619/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2c16bd8..6a0ccfb 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -11,6 +11,8 @@ Trunk (Unreleased)
     FALCON-796 Enable users to triage data processing issues through falcon (Ajay Yadava)
     
   IMPROVEMENTS
+    FALCON-1359 Improve output format for Feed Instance Listing(Ajay Yadava)
+
     FALCON-1368 Improve Falcon server restart time(Sandeep Samudrala via Ajay Yadava)
 
     FALCON-1361 Default end date should be now(Pragya Mittal via Ajay Yadava)

http://git-wip-us.apache.org/repos/asf/falcon/blob/0582e619/client/src/main/java/org/apache/falcon/ResponseHelper.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/ResponseHelper.java b/client/src/main/java/org/apache/falcon/ResponseHelper.java
index 2df3e00..a13682b 100644
--- a/client/src/main/java/org/apache/falcon/ResponseHelper.java
+++ b/client/src/main/java/org/apache/falcon/ResponseHelper.java
@@ -29,6 +29,7 @@ import org.apache.falcon.resource.InstancesSummaryResult;
 import org.apache.falcon.resource.TriageResult;
 
 import java.util.Date;
+import java.util.Formatter;
 import java.util.Map;
 
 /**
@@ -121,39 +122,21 @@ public final class ResponseHelper {
             .append("\n");
 
         sb.append("\nInstances:\n");
-        sb.append("Cluster\t\tInstance\t\tStatus\t\tSize\t\tCreationTime\t\tDetails\n");
+        Formatter formatter = new Formatter(sb);
+        formatter.format("%-16s%-20s%-16s%-16s%-20s%-16s", "Cluster", "Instance", "Status",
"Size", "CreationTime",
+                "Details");
+        sb.append("\n");
         sb.append("-----------------------------------------------------------------------------------------------\n");
         if (result.getInstances() != null) {
             for (FeedInstanceResult.Instance instance : result.getInstances()) {
-
-                toAppend =
-                    instance.getCluster() != null ? instance.getCluster() : "-";
-                sb.append(toAppend).append("\t");
-
-                toAppend =
-                    instance.getInstance() != null ? instance.getInstance()
-                        : "-";
-                sb.append(toAppend).append("\t");
-
-                toAppend =
-                    instance.getStatus() != null ? instance.getStatus() : "-";
-                sb.append(toAppend).append("\t");
-
-                toAppend =
-                    instance.getSize() != -1 ? instance
-                        .getSizeH() : "-";
-                sb.append(toAppend).append("\t");
-
-                toAppend =
-                    instance.getCreationTime() != 0
-                        ? SchemaHelper.formatDateUTC(new Date(instance
-                            .getCreationTime())) : "-";
-                sb.append(toAppend).append("\t");
-
-                toAppend =
-                    StringUtils.isEmpty(instance.getUri()) ? "-" : instance
-                        .getUri();
-                sb.append(toAppend).append("\n");
+                formatter.format("%-16s", instance.getCluster() != null ? instance.getCluster()
: "-");
+                formatter.format("%-20s", instance.getInstance() != null ? instance.getInstance()
: "-");
+                formatter.format("%-16s", instance.getStatus() != null ? instance.getStatus()
: "-");
+                formatter.format("%-16s", instance.getSize() != -1 ? instance.getSizeH()
: "-");
+                formatter.format("%-20s", instance.getCreationTime() != 0
+                        ? SchemaHelper.formatDateUTC(new Date(instance.getCreationTime()))
: "-");
+                formatter.format("%-16s", StringUtils.isEmpty(instance.getUri()) ? "-" :
instance.getUri());
+                sb.append("\n");
             }
         }
         sb.append("\nAdditional Information:\n");


Mime
View raw message