From b1ebf67b66de1d4c7609da8acbd5ce159f2fee3a Mon Sep 17 00:00:00 2001 From: Rerngvit Yanggratoke Date: Wed, 20 Jul 2016 23:29:06 +0200 Subject: [PATCH] This PR applies the new interpreter registration mechanism to HDFSFileInterpreter Improvement - Move interpreter registration properties from static block to interpreter-setting.json https://issues.apache.org/jira/browse/ZEPPELIN-910 1. apply patch 2. rm conf/interpreter.json 3. mvn clean package -DskipTests 4. bin/zeppelin-daemon.sh start 5. Configure %file interpreter setting according to your HDFS setup 6. run some paragraph with HDFS file access * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No --- .../zeppelin/file/HDFSFileInterpreter.java | 11 -------- .../main/resources/interpreter-setting.json | 27 +++++++++++++++++++ 2 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 file/src/main/resources/interpreter-setting.json diff --git a/file/src/main/java/org/apache/zeppelin/file/HDFSFileInterpreter.java b/file/src/main/java/org/apache/zeppelin/file/HDFSFileInterpreter.java index 43dd0482e50..c2caa11d5ae 100644 --- a/file/src/main/java/org/apache/zeppelin/file/HDFSFileInterpreter.java +++ b/file/src/main/java/org/apache/zeppelin/file/HDFSFileInterpreter.java @@ -37,17 +37,6 @@ public class HDFSFileInterpreter extends FileInterpreter { static final String HDFS_USER = "hdfs.user"; static final String HDFS_MAXLENGTH = "hdfs.maxlength"; - static { - Interpreter.register( - "hdfs", - "file", - HDFSFileInterpreter.class.getName(), - new InterpreterPropertyBuilder() - .add(HDFS_URL, "http://localhost:50070/webhdfs/v1/", "The URL for WebHDFS") - .add(HDFS_USER, "hdfs", "The WebHDFS user") - .add(HDFS_MAXLENGTH, "1000", "Maximum number of lines of results fetched").build()); - } - Exception exceptionOnConnect = null; HDFSCommand cmd = null; Gson gson = null; diff --git a/file/src/main/resources/interpreter-setting.json b/file/src/main/resources/interpreter-setting.json new file mode 100644 index 00000000000..85ff74606a5 --- /dev/null +++ b/file/src/main/resources/interpreter-setting.json @@ -0,0 +1,27 @@ +[ + { + "group": "file", + "name": "hdfs", + "className": "org.apache.zeppelin.file.HDFSFileInterpreter", + "properties": { + "hdfs.url": { + "envName": null, + "propertyName": "hdfs.url", + "defaultValue": "http://localhost:50070/webhdfs/v1/", + "description": "The URL for WebHDFS" + }, + "hdfs.user": { + "envName": null, + "propertyName": "hdfs.user", + "defaultValue": "hdfs", + "description": "The WebHDFS user" + }, + "hdfs.maxlength": { + "envName": null, + "propertyName": "hdfs.maxlength", + "defaultValue": "1000", + "description": "Maximum number of lines of results fetched" + } + } + } +]