diff --git a/bin/interpreter.sh b/bin/interpreter.sh
index 62deba1ff1..6836fe6dcd 100755
--- a/bin/interpreter.sh
+++ b/bin/interpreter.sh
@@ -128,6 +128,14 @@ if [[ "${INTERPRETER_ID}" == "spark" ]]; then
export SPARK_CLASSPATH+=":${ZEPPELIN_CLASSPATH}"
fi
+elif [[ "${INTERPRETER_ID}" == "hbase" ]]; then
+ if [[ -n "${HBASE_CONF_DIR}" ]]; then
+ ZEPPELIN_CLASSPATH+=":${HBASE_CONF_DIR}"
+ elif [[ -n "${HBASE_HOME}" ]]; then
+ ZEPPELIN_CLASSPATH+=":${HBASE_CONF_DIR}/conf"
+ else
+ echo "HBASE_HOME and HBASE_CONF_DIR are not set, configuration might not be loaded"
+ fi
fi
addJarInDir "${LOCAL_INTERPRETER_REPO}"
diff --git a/docs/interpreter/hbase.md b/docs/interpreter/hbase.md
index 05031f2d21..a0a7606e6f 100644
--- a/docs/interpreter/hbase.md
+++ b/docs/interpreter/hbase.md
@@ -31,7 +31,7 @@ To get start with HBase, please see [HBase Quickstart](https://hbase.apache.org/
Path to Ruby scripts relative to 'hbase.home' |
- | hbase.test.mode |
+ zeppelin.hbase.test.mode |
false |
Disable checks for unit and manual tests |
diff --git a/hbase/src/main/java/org/apache/zeppelin/hbase/HbaseInterpreter.java b/hbase/src/main/java/org/apache/zeppelin/hbase/HbaseInterpreter.java
index dbcb33d4d9..197d3300aa 100644
--- a/hbase/src/main/java/org/apache/zeppelin/hbase/HbaseInterpreter.java
+++ b/hbase/src/main/java/org/apache/zeppelin/hbase/HbaseInterpreter.java
@@ -47,11 +47,10 @@ import java.util.Properties;
* that the client is configured properly.
*
* The interpreter takes 3 config parameters:
- * hbase.home: Root dir. where hbase is installed. Default is /usr/lib/hbase/
+ * hbase.home: Root directory where hbase is installed. Default is /usr/lib/hbase/
* hbase.ruby.sources: Dir where shell ruby code is installed.
* Path is relative to hbase.home. Default: lib/ruby
- * hbase.irb.load: (Testing only) Default is true.
- * Whether to load irb in the interpreter.
+ * zeppelin.hbase.test.mode: (Testing only) Disable checks for unit and manual tests. Default: false
*/
public class HbaseInterpreter extends Interpreter {
private Logger logger = LoggerFactory.getLogger(HbaseInterpreter.class);
@@ -62,11 +61,13 @@ public class HbaseInterpreter extends Interpreter {
static {
Interpreter.register("hbase", "hbase", HbaseInterpreter.class.getName(),
new InterpreterPropertyBuilder()
- .add("hbase.home", "/usr/lib/hbase/", "Installation dir. of Hbase")
+ .add("hbase.home",
+ getSystemDefault("HBASE_HOME", "hbase.home", "/usr/lib/hbase/"),
+ "Installation directory of Hbase")
.add("hbase.ruby.sources", "lib/ruby",
"Path to Ruby scripts relative to 'hbase.home'")
- .add("hbase.test.mode", "false", "Disable checks for unit and manual tests")
- .build());
+ .add("zeppelin.hbase.test.mode", "false", "Disable checks for unit and manual tests")
+ .build());
}
public HbaseInterpreter(Properties property) {
@@ -79,7 +80,7 @@ public class HbaseInterpreter extends Interpreter {
this.writer = new StringWriter();
scriptingContainer.setOutput(this.writer);
- if (!Boolean.parseBoolean(getProperty("hbase.test.mode"))) {
+ if (!Boolean.parseBoolean(getProperty("zeppelin.hbase.test.mode"))) {
String hbase_home = getProperty("hbase.home");
String ruby_src = getProperty("hbase.ruby.sources");
Path abs_ruby_src = Paths.get(hbase_home, ruby_src).toAbsolutePath();
@@ -155,4 +156,24 @@ public class HbaseInterpreter extends Interpreter {
return null;
}
+ private static String getSystemDefault(
+ String envName,
+ String propertyName,
+ String defaultValue) {
+
+ if (envName != null && !envName.isEmpty()) {
+ String envValue = System.getenv().get(envName);
+ if (envValue != null) {
+ return envValue;
+ }
+ }
+
+ if (propertyName != null && !propertyName.isEmpty()) {
+ String propValue = System.getProperty(propertyName);
+ if (propValue != null) {
+ return propValue;
+ }
+ }
+ return defaultValue;
+ }
}