mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
set hbase conf dir to classpath
This commit is contained in:
parent
0629d93709
commit
eeb341f40e
3 changed files with 37 additions and 8 deletions
|
|
@ -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}"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ To get start with HBase, please see [HBase Quickstart](https://hbase.apache.org/
|
|||
<td>Path to Ruby scripts relative to 'hbase.home'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>hbase.test.mode</td>
|
||||
<td>zeppelin.hbase.test.mode</td>
|
||||
<td>false</td>
|
||||
<td>Disable checks for unit and manual tests</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue