You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2016/12/07 04:32:01 UTC

[02/50] [abbrv] kylin git commit: KYLIN-2195 support backward-compatibility properties in get-properties.sh

KYLIN-2195 support backward-compatibility properties in get-properties.sh


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

Branch: refs/heads/master-cdh5.7
Commit: b1448e5789ce65d5b94ed246df01fa4c269515b2
Parents: a2ecf18
Author: lidongsjtu <li...@apache.org>
Authored: Mon Nov 28 23:37:41 2016 +0800
Committer: lidongsjtu <li...@apache.org>
Committed: Mon Nov 28 23:37:41 2016 +0800

----------------------------------------------------------------------
 build/bin/get-properties.sh                     |  4 +-
 .../org/apache/kylin/tool/KylinConfigCLI.java   | 42 ++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/b1448e57/build/bin/get-properties.sh
----------------------------------------------------------------------
diff --git a/build/bin/get-properties.sh b/build/bin/get-properties.sh
index 1a086ea..170442d 100755
--- a/build/bin/get-properties.sh
+++ b/build/bin/get-properties.sh
@@ -25,5 +25,7 @@ then
     exit -1
 fi
 
-result=`cat ${KYLIN_HOME}/conf/kylin.properties | grep -w "^$1" | grep -v '^#' | awk -F= '{ n = index($0,"="); print substr($0,n+1)}' | cut -c 1- |tail -1`
+job_jar=$(ls $KYLIN_HOME/lib/kylin-job-*.jar)
+tool_jar=$(ls $KYLIN_HOME/tool/kylin-tool-*.jar)
+result=`java -cp $job_jar:$tool_jar org.apache.kylin.tool.KylinConfigCLI $1 2>/dev/null`
 echo "$result"

http://git-wip-us.apache.org/repos/asf/kylin/blob/b1448e57/tool/src/main/java/org/apache/kylin/tool/KylinConfigCLI.java
----------------------------------------------------------------------
diff --git a/tool/src/main/java/org/apache/kylin/tool/KylinConfigCLI.java b/tool/src/main/java/org/apache/kylin/tool/KylinConfigCLI.java
new file mode 100644
index 0000000..e1a5b99
--- /dev/null
+++ b/tool/src/main/java/org/apache/kylin/tool/KylinConfigCLI.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.tool;
+
+import java.util.Properties;
+
+import org.apache.kylin.common.BackwardCompatibilityConfig;
+import org.apache.kylin.common.KylinConfig;
+
+public class KylinConfigCLI {
+    public static void main(String[] args) {
+        if (args.length != 1) {
+            System.err.println("Usage: KylinConfigCLI conf_name");
+            System.err.println("Example: KylinConfigCLI kylin.server.mode");
+            System.exit(1);
+        }
+
+        Properties config = KylinConfig.getKylinProperties();
+        BackwardCompatibilityConfig bcc = new BackwardCompatibilityConfig();
+        String value = config.getProperty(bcc.check(args[0]));
+        if (value == null) {
+            value = "";
+        }
+        System.out.println(value);
+    }
+}