kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mahong...@apache.org
Subject [1/7] kylin git commit: KYLIN-2141: Add program-friendly interfaces for ResourceTool [Forced Update!]
Date Thu, 03 Nov 2016 06:30:47 GMT
Repository: kylin
Updated Branches:
  refs/heads/yang21-hbase1.x 6770b421a -> a93c2758a (forced update)


KYLIN-2141: Add program-friendly interfaces for ResourceTool

Signed-off-by: Yang Li <liyang@apache.org>


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

Branch: refs/heads/yang21-hbase1.x
Commit: f3ac9ff4f20f5d7e4b28eaff99b388f796594824
Parents: b662a95
Author: Yiming Liu <liuyiming.vip@gmail.com>
Authored: Mon Oct 31 17:45:09 2016 +0800
Committer: Yang Li <liyang@apache.org>
Committed: Wed Nov 2 22:03:51 2016 +0800

----------------------------------------------------------------------
 .../kylin/common/persistence/ResourceTool.java  | 28 +++++++++++++++++---
 1 file changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/f3ac9ff4/core-common/src/main/java/org/apache/kylin/common/persistence/ResourceTool.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/persistence/ResourceTool.java
b/core-common/src/main/java/org/apache/kylin/common/persistence/ResourceTool.java
index 2f16eb7..2c8bc83 100644
--- a/core-common/src/main/java/org/apache/kylin/common/persistence/ResourceTool.java
+++ b/core-common/src/main/java/org/apache/kylin/common/persistence/ResourceTool.java
@@ -49,11 +49,11 @@ public class ResourceTool {
 
         String include = System.getProperty("include");
         if (include != null) {
-            includes = include.split("\\s*,\\s*");
+            setIncludes(include.split("\\s*,\\s*"));
         }
         String exclude = System.getProperty("exclude");
         if (exclude != null) {
-            excludes = exclude.split("\\s*,\\s*");
+            setExcludes(exclude.split("\\s*,\\s*"));
         }
 
         String cmd = args[0];
@@ -84,26 +84,46 @@ public class ResourceTool {
         }
     }
 
-    public static void cat(KylinConfig config, String path) throws IOException {
+    public static String[] getIncludes() {
+        return includes;
+    }
+
+    public static void setIncludes(String[] arg) {
+        includes = arg;
+    }
+
+    public static String[] getExcludes() {
+        return excludes;
+    }
+
+    public static void setExcludes(String[] arg) {
+        excludes = arg;
+    }
+
+    public static String cat(KylinConfig config, String path) throws IOException {
         ResourceStore store = ResourceStore.getStore(config);
         InputStream is = store.getResource(path).inputStream;
         BufferedReader br = null;
+        StringBuffer sb = new StringBuffer();
         String line;
         try {
             br = new BufferedReader(new InputStreamReader(is));
             while ((line = br.readLine()) != null) {
                 System.out.println(line);
+                sb.append(line).append('\n');
             }
         } finally {
             IOUtils.closeQuietly(is);
             IOUtils.closeQuietly(br);
         }
+        return sb.toString();
     }
 
-    public static void list(KylinConfig config, String path) throws IOException {
+    public static NavigableSet<String> list(KylinConfig config, String path) throws
IOException {
         ResourceStore store = ResourceStore.getStore(config);
         NavigableSet<String> result = store.listResources(path);
         System.out.println("" + result);
+        return result;
     }
 
     public static void copy(KylinConfig srcConfig, KylinConfig dstConfig, String path) throws
IOException {


Mime
View raw message