Repository: zeppelin
Updated Branches:
  refs/heads/master e6f51e718 -> 9efbcd1b6


[HOTFIX][ZEPPELIN-1240] Removed interpreter properties are restored

### What is this PR for?
Fixing the bug that users cannot delete some interpreter settings from 
interpreter tab.

### What type of PR is it?
[Bug Fix | Hot Fix]

### Todos
* [x] - Changed `update` to `set`

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-1240

### How should this be tested?
1. Make new interpreter via interpreter tab
1. remove some properties

### 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: Jongyoul Lee <[email protected]>

Closes #1239 from jongyoul/ZEPPELIN-1240 and squashes the following commits:

4cd5854 [Jongyoul Lee] Enabled to remove some properties
57cd328 [Jongyoul Lee] Changed updateProperties to setProperties


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

Branch: refs/heads/master
Commit: 9efbcd1b6380ff3e3ab8c2033d1a2d2821a58d01
Parents: e6f51e7
Author: Jongyoul Lee <[email protected]>
Authored: Tue Aug 2 21:29:32 2016 +0900
Committer: Mina Lee <[email protected]>
Committed: Thu Aug 4 14:35:25 2016 +0900

----------------------------------------------------------------------
 .../interpreter/InterpreterFactory.java         | 25 ++------------------
 .../interpreter/InterpreterSetting.java         |  4 ++++
 2 files changed, 6 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/9efbcd1b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
index 7f8699d..1c7b9d9 100644
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
@@ -505,7 +505,7 @@ public class InterpreterFactory implements 
InterpreterGroupFactory {
     setting.setGroup(group);
     setting.appendDependencies(dependencies);
     setting.setInterpreterOption(option);
-    setting.updateProperties(p);
+    setting.setProperties(p);
     setting.setInterpreterGroupFactory(this);
     interpreterSettings.put(setting.getId(), setting);
     saveToFile();
@@ -837,7 +837,7 @@ public class InterpreterFactory implements 
InterpreterGroupFactory {
         intpsetting.closeAndRmoveAllInterpreterGroups();
 
         intpsetting.setOption(option);
-        intpsetting.updateProperties(properties);
+        intpsetting.setProperties(properties);
         intpsetting.setDependencies(dependencies);
 
         loadInterpreterDependencies(intpsetting);
@@ -912,8 +912,6 @@ public class InterpreterFactory implements 
InterpreterGroupFactory {
       throws InterpreterException {
     logger.info("Create repl {} from {}", className, dirName);
 
-    updatePropertiesFromRegisteredInterpreter(property, className);
-
     ClassLoader oldcl = Thread.currentThread().getContextClassLoader();
     try {
 
@@ -984,9 +982,6 @@ public class InterpreterFactory implements 
InterpreterGroupFactory {
     String localRepoPath = conf.getInterpreterLocalRepoPath() + "/" + 
interpreterSettingId;
     int maxPoolSize = conf.getInt(ConfVars.ZEPPELIN_INTERPRETER_MAX_POOL_SIZE);
 
-    updatePropertiesFromRegisteredInterpreter(property, className);
-
-
     RemoteInterpreter remoteInterpreter =
         new RemoteInterpreter(property, noteId, className, 
conf.getInterpreterRemoteRunnerPath(),
             interpreterPath, localRepoPath, connectTimeout, maxPoolSize,
@@ -996,22 +991,6 @@ public class InterpreterFactory implements 
InterpreterGroupFactory {
     return new LazyOpenInterpreter(remoteInterpreter);
   }
 
-  private Properties updatePropertiesFromRegisteredInterpreter(Properties 
properties,
-      String className) {
-    RegisteredInterpreter registeredInterpreter =
-        Interpreter.findRegisteredInterpreterByClassName(className);
-    if (null != registeredInterpreter) {
-      Map<String, InterpreterProperty> defaultProperties = 
registeredInterpreter.getProperties();
-      for (String key : defaultProperties.keySet()) {
-        if (!properties.containsKey(key) && null != 
defaultProperties.get(key).getValue()) {
-          properties.setProperty(key, defaultProperties.get(key).getValue());
-        }
-      }
-    }
-
-    return properties;
-  }
-
   /**
    * map interpreter ids into noteId
    *

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/9efbcd1b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java
index 0288eb4..65f60cd 100644
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java
@@ -206,6 +206,10 @@ public class InterpreterSetting {
     this.properties.putAll(p);
   }
 
+  void setProperties(Properties p) {
+    this.properties = p;
+  }
+
   void setGroup(String group) {
     this.group = group;
   }

Reply via email to