Repository: zeppelin
Updated Branches:
  refs/heads/master ffa7fa6e8 -> 32d5df359


[ZEPPELIN-906] Apply new mechanism to AlluxioInterpreter

### What is this PR for?
This PR applies the [new interpreter registration 
mechanism](https://issues.apache.org/jira/browse/ZEPPELIN-804) to Alluxio 
interpreter.

### What type of PR is it?
Improvement

### Todos
* [x] - Remove static property definition code lines in 
`AlluxioInterpreter.java` and create `interpreter-setting.json` under 
`alluxio/src/main/resources` dir

### What is the Jira issue?
[ZEPPELIN-906](https://issues.apache.org/jira/browse/ZEPPELIN-906)

### How should this be tested?
1. apply this patch
2. rm -r `interpreter/alluxio` and rm `conf/interpreter.json`
3. build source
4. bin/zeppelin-daemon.sh start
5. Run a paragraph with alluxio commands

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: AhyoungRyu <[email protected]>

Closes #1161 from AhyoungRyu/ZEPPELIN-906 and squashes the following commits:

7a332cc [AhyoungRyu] Fix typo
b86ae3f [AhyoungRyu] Apply new mechanism to AlluxioInterpreter


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

Branch: refs/heads/master
Commit: 32d5df359dd250374a28c361220ff1c0ae06cdc1
Parents: ffa7fa6
Author: AhyoungRyu <[email protected]>
Authored: Mon Jul 11 18:39:07 2016 +0900
Committer: Alexander Bezzubov <[email protected]>
Committed: Tue Jul 12 16:58:14 2016 +0900

----------------------------------------------------------------------
 .../zeppelin/alluxio/AlluxioInterpreter.java    | 15 +++-----------
 .../src/main/resources/interpreter-setting.json | 21 ++++++++++++++++++++
 2 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/32d5df35/alluxio/src/main/java/org/apache/zeppelin/alluxio/AlluxioInterpreter.java
----------------------------------------------------------------------
diff --git 
a/alluxio/src/main/java/org/apache/zeppelin/alluxio/AlluxioInterpreter.java 
b/alluxio/src/main/java/org/apache/zeppelin/alluxio/AlluxioInterpreter.java
index 797a7f1..d450c55 100644
--- a/alluxio/src/main/java/org/apache/zeppelin/alluxio/AlluxioInterpreter.java
+++ b/alluxio/src/main/java/org/apache/zeppelin/alluxio/AlluxioInterpreter.java
@@ -68,15 +68,6 @@ public class AlluxioInterpreter extends Interpreter {
     alluxioMasterPort = property.getProperty(ALLUXIO_MASTER_PORT);
   }
 
-  static {
-    Interpreter.register("alluxio", "alluxio",
-        AlluxioInterpreter.class.getName(),
-        new InterpreterPropertyBuilder()
-                .add(ALLUXIO_MASTER_HOSTNAME, "localhost", "Alluxio master 
hostname")
-                .add(ALLUXIO_MASTER_PORT, "19998", "Alluxio master port")
-                .build());
-  }
-
   @Override
   public void open() {
     logger.info("Starting Alluxio shell to connect to " + 
alluxioMasterHostname +
@@ -116,14 +107,14 @@ public class AlluxioInterpreter extends Interpreter {
     System.setOut(ps);
     
     for (String command : commands) {
-      int commandResuld = 1;
+      int commandResult = 1;
       String[] args = splitAndRemoveEmpty(command, " ");
       if (args.length > 0 && args[0].equals("help")) {
         System.out.println(getCommandList());
       } else {
-        commandResuld = fs.run(args);
+        commandResult = fs.run(args);
       }
-      if (commandResuld != 0) {
+      if (commandResult != 0) {
         isSuccess = false;
         break;
       } else {

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/32d5df35/alluxio/src/main/resources/interpreter-setting.json
----------------------------------------------------------------------
diff --git a/alluxio/src/main/resources/interpreter-setting.json 
b/alluxio/src/main/resources/interpreter-setting.json
new file mode 100644
index 0000000..7bae20b
--- /dev/null
+++ b/alluxio/src/main/resources/interpreter-setting.json
@@ -0,0 +1,21 @@
+[
+  {
+    "group": "alluxio",
+    "name": "alluxio",
+    "className": "org.apache.zeppelin.alluxio.AlluxioInterpreter",
+    "properties": {
+      "alluxio.master.hostname": {
+        "envName": "ALLUXIO_MASTER_HOSTNAME",
+        "propertyName": "alluxio.master.hostname",
+        "defaultValue": "localhost",
+        "description": "Alluxio master hostname"
+      },
+      "alluxio.master.port": {
+        "envName": "ALLUXIO_MASTER_PORT",
+        "propertyName": "alluxio.master.port",
+        "defaultValue": "19998",
+        "description": "Alluxio master port"
+      }
+    }
+  }
+]
\ No newline at end of file

Reply via email to