diff --git a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/AbstractAngularElem.scala b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/AbstractAngularElem.scala index 66961fd6758..db8feb3d3af 100644 --- a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/AbstractAngularElem.scala +++ b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/AbstractAngularElem.scala @@ -29,7 +29,7 @@ import scala.xml._ */ abstract class AbstractAngularElem(val interpreterContext: InterpreterContext, val modelName: String, - val angularObjects: Map[String, AngularObject[Any]], + val angularObjects: Map[String, AngularObject], prefix: String, label: String, attributes1: MetaData, @@ -70,7 +70,7 @@ abstract class AbstractAngularElem(val interpreterContext: InterpreterContext, * @return */ @ZeppelinApi - def model(name: String, value: Any): AbstractAngularElem = { + def model(name: String, value: AnyRef): AbstractAngularElem = { val registry = interpreterContext.getAngularObjectRegistry // create AngularFunction in current paragraph @@ -79,7 +79,7 @@ abstract class AbstractAngularElem(val interpreterContext: InterpreterContext, Null) val angularObject = addAngularObject(name, value) - .asInstanceOf[AngularObject[Any]] + .asInstanceOf[AngularObject] newElem( interpreterContext, @@ -111,7 +111,7 @@ abstract class AbstractAngularElem(val interpreterContext: InterpreterContext, * @return */ @ZeppelinApi - def model(): Any = { + def model(): AnyRef = { if (angularObjects.contains(modelName)) { angularObjects(modelName).get() } else { @@ -134,7 +134,7 @@ abstract class AbstractAngularElem(val interpreterContext: InterpreterContext, Text(s"${functionName}=${functionName} + 1"), Null) - val angularObject = addAngularObject(functionName, 0) + val angularObject = addAngularObject(functionName, Int.box(0)) angularObject.addWatcher(new AngularObjectWatcher(interpreterContext) { override def watch(oldObject: scala.Any, newObject: scala.Any, context: InterpreterContext) @@ -151,11 +151,11 @@ abstract class AbstractAngularElem(val interpreterContext: InterpreterContext, elem) } - protected def addAngularObject(name: String, value: Any): AngularObject[Any] + protected def addAngularObject(name: String, value: AnyRef): AngularObject protected def newElem(interpreterContext: InterpreterContext, name: String, - angularObjects: Map[String, AngularObject[Any]], + angularObjects: Map[String, AngularObject], elem: scala.xml.Elem): AbstractAngularElem /** diff --git a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/AbstractAngularModel.scala b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/AbstractAngularModel.scala index de9b2b33f35..32ea400a6bb 100644 --- a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/AbstractAngularModel.scala +++ b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/AbstractAngularModel.scala @@ -35,13 +35,13 @@ abstract class AbstractAngularModel(name: String) { * @param newValue value */ @ZeppelinApi - def this(name: String, newValue: Any) = { + def this(name: String, newValue: AnyRef) = { this(name) value(newValue) } - protected def getAngularObject(): AngularObject[Any] - protected def addAngularObject(value: Any): AngularObject[Any] + protected def getAngularObject(): AngularObject + protected def addAngularObject(value: AnyRef): AngularObject /** * Get value of the model @@ -49,7 +49,7 @@ abstract class AbstractAngularModel(name: String) { * @return */ @ZeppelinApi - def apply(): Any = { + def apply(): AnyRef = { value() } @@ -59,7 +59,7 @@ abstract class AbstractAngularModel(name: String) { * @return */ @ZeppelinApi - def value(): Any = { + def value(): AnyRef = { val angularObject = getAngularObject() if (angularObject == null) { None @@ -69,7 +69,7 @@ abstract class AbstractAngularModel(name: String) { } @ZeppelinApi - def apply(newValue: Any): Unit = { + def apply(newValue: AnyRef): Unit = { value(newValue) } @@ -80,7 +80,7 @@ abstract class AbstractAngularModel(name: String) { * @param newValue */ @ZeppelinApi - def value(newValue: Any): Unit = { + def value(newValue: AnyRef): Unit = { var angularObject = getAngularObject() if (angularObject == null) { // create new object @@ -92,7 +92,7 @@ abstract class AbstractAngularModel(name: String) { } @ZeppelinApi - def remove(): Any = { + def remove(): AnyRef = { val angularObject = getAngularObject() if (angularObject == null) { diff --git a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/notebookscope/AngularElem.scala b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/notebookscope/AngularElem.scala index 8fd3164720a..201af47942b 100644 --- a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/notebookscope/AngularElem.scala +++ b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/notebookscope/AngularElem.scala @@ -29,7 +29,7 @@ import scala.xml._ */ class AngularElem(override val interpreterContext: InterpreterContext, override val modelName: String, - override val angularObjects: Map[String, AngularObject[Any]], + override val angularObjects: Map[String, AngularObject], prefix: String, label: String, attributes1: MetaData, @@ -40,15 +40,15 @@ class AngularElem(override val interpreterContext: InterpreterContext, interpreterContext, modelName, angularObjects, prefix, label, attributes1, scope, minimizeEmpty, child: _*) { - override protected def addAngularObject(name: String, value: Any): AngularObject[Any] = { + override protected def addAngularObject(name: String, value: AnyRef): AngularObject = { val registry = interpreterContext.getAngularObjectRegistry - registry.add(name, value, interpreterContext.getNoteId, null).asInstanceOf[AngularObject[Any]] + registry.add(name, value, interpreterContext.getNoteId, null).asInstanceOf[AngularObject] } override protected def newElem(interpreterContext: InterpreterContext, name: String, - angularObjects: Map[String, AngularObject[Any]], + angularObjects: Map[String, AngularObject], elem: scala.xml.Elem): angular.AbstractAngularElem = { new AngularElem( interpreterContext, @@ -66,7 +66,7 @@ class AngularElem(override val interpreterContext: InterpreterContext, object AngularElem { implicit def Elem2AngularDisplayElem(elem: Elem): AbstractAngularElem = { new AngularElem(InterpreterContext.get(), null, - Map[String, AngularObject[Any]](), + Map[String, AngularObject](), elem.prefix, elem.label, elem.attributes, elem.scope, elem.minimizeEmpty, elem.child:_*); } diff --git a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/notebookscope/AngularModel.scala b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/notebookscope/AngularModel.scala index 1ef89831204..4cce99e7b5c 100644 --- a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/notebookscope/AngularModel.scala +++ b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/notebookscope/AngularModel.scala @@ -26,17 +26,17 @@ import org.apache.zeppelin.interpreter.InterpreterContext class AngularModel(name: String) extends org.apache.zeppelin.display.angular.AbstractAngularModel(name) { - def this(name: String, newValue: Any) = { + def this(name: String, newValue: AnyRef) = { this(name) value(newValue) } - override protected def getAngularObject(): AngularObject[Any] = { - registry.get(name, context.getNoteId, null).asInstanceOf[AngularObject[Any]] + override protected def getAngularObject(): AngularObject = { + registry.get(name, context.getNoteId, null).asInstanceOf[AngularObject] } - override protected def addAngularObject(value: Any): AngularObject[Any] = { - registry.add(name, value, context.getNoteId, null).asInstanceOf[AngularObject[Any]] + override protected def addAngularObject(value: AnyRef): AngularObject = { + registry.add(name, value, context.getNoteId, null).asInstanceOf[AngularObject] } } @@ -46,7 +46,7 @@ object AngularModel { new AngularModel(name) } - def apply(name: String, newValue: Any): AbstractAngularModel = { + def apply(name: String, newValue: AnyRef): AbstractAngularModel = { new AngularModel(name, newValue) } } \ No newline at end of file diff --git a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularElem.scala b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularElem.scala index e424202a5c6..5432545546f 100644 --- a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularElem.scala +++ b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularElem.scala @@ -30,7 +30,7 @@ import scala.xml._ */ class AngularElem(override val interpreterContext: InterpreterContext, override val modelName: String, - override val angularObjects: Map[String, AngularObject[Any]], + override val angularObjects: Map[String, AngularObject], prefix: String, label: String, attributes1: MetaData, @@ -41,16 +41,16 @@ class AngularElem(override val interpreterContext: InterpreterContext, interpreterContext, modelName, angularObjects, prefix, label, attributes1, scope, minimizeEmpty, child: _*) { - override protected def addAngularObject(name: String, value: Any): AngularObject[Any] = { + override protected def addAngularObject(name: String, value: Object): AngularObject = { val registry = interpreterContext.getAngularObjectRegistry registry.add(name, value, interpreterContext.getNoteId, interpreterContext.getParagraphId) - .asInstanceOf[AngularObject[Any]] + .asInstanceOf[AngularObject] } override protected def newElem(interpreterContext: InterpreterContext, name: String, - angularObjects: Map[String, AngularObject[Any]], + angularObjects: Map[String, AngularObject], elem: scala.xml.Elem): angular.AbstractAngularElem = { new AngularElem( interpreterContext, @@ -68,7 +68,7 @@ class AngularElem(override val interpreterContext: InterpreterContext, object AngularElem { implicit def Elem2AngularDisplayElem(elem: Elem): AbstractAngularElem = { new AngularElem(InterpreterContext.get(), null, - Map[String, AngularObject[Any]](), + Map[String, AngularObject](), elem.prefix, elem.label, elem.attributes, elem.scope, elem.minimizeEmpty, elem.child:_*); } diff --git a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularModel.scala b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularModel.scala index ed28687290b..495a18100ba 100644 --- a/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularModel.scala +++ b/spark/interpreter/src/main/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularModel.scala @@ -25,19 +25,19 @@ import org.apache.zeppelin.display.angular.AbstractAngularModel class AngularModel(name: String) extends org.apache.zeppelin.display.angular.AbstractAngularModel(name) { - def this(name: String, newValue: Any) = { + def this(name: String, newValue: AnyRef) = { this(name) value(newValue) } - override protected def getAngularObject(): AngularObject[Any] = { + override protected def getAngularObject(): AngularObject = { registry.get(name, - context.getNoteId, context.getParagraphId).asInstanceOf[AngularObject[Any]] + context.getNoteId, context.getParagraphId).asInstanceOf[AngularObject] } - override protected def addAngularObject(value: Any): AngularObject[Any] = { + override protected def addAngularObject(value: AnyRef): AngularObject = { registry.add(name, value, - context.getNoteId, context.getParagraphId).asInstanceOf[AngularObject[Any]] + context.getNoteId, context.getParagraphId).asInstanceOf[AngularObject] } } @@ -47,7 +47,7 @@ object AngularModel { new AngularModel(name) } - def apply(name: String, newValue: Any): AbstractAngularModel = { + def apply(name: String, newValue: AnyRef): AbstractAngularModel = { new AngularModel(name, newValue) } } \ No newline at end of file diff --git a/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/AbstractAngularElemTest.scala b/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/AbstractAngularElemTest.scala index 5b61729039b..d1ede66f8fe 100644 --- a/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/AbstractAngularElemTest.scala +++ b/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/AbstractAngularElemTest.scala @@ -142,7 +142,7 @@ trait AbstractAngularElemTest // simulate click def fireEvent(eventName: String, elem: org.apache.zeppelin.display.angular.AbstractAngularElem) = { - val angularObject: AngularObject[Any] = elem.angularObjects(eventName); + val angularObject: AngularObject = elem.angularObjects(eventName); angularObject.set("event"); } } diff --git a/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/AbstractAngularModelTest.scala b/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/AbstractAngularModelTest.scala index 6573d46312c..bade3d6be9f 100644 --- a/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/AbstractAngularModelTest.scala +++ b/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/AbstractAngularModelTest.scala @@ -41,7 +41,7 @@ with BeforeAndAfter with BeforeAndAfterEach with Eventually { } def angularModel(name: String): AbstractAngularModel - def angularModel(name: String, value: Any): AbstractAngularModel + def angularModel(name: String, value: AnyRef): AbstractAngularModel "AngularModel" should "able to create AngularObject" in { val registry = InterpreterContext.get().getAngularObjectRegistry diff --git a/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/notebookscope/AngularModelTest.scala b/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/notebookscope/AngularModelTest.scala index 10197939bab..ad55430212e 100644 --- a/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/notebookscope/AngularModelTest.scala +++ b/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/notebookscope/AngularModelTest.scala @@ -26,7 +26,7 @@ class AngularModelTest extends AbstractAngularModelTest { AngularModel(name) } - override def angularModel(name: String, value: Any): AbstractAngularModel = { + override def angularModel(name: String, value: AnyRef): AbstractAngularModel = { AngularModel(name, value) } } diff --git a/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularModelTest.scala b/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularModelTest.scala index c6e1eb08863..ab7df2484a4 100644 --- a/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularModelTest.scala +++ b/spark/interpreter/src/test/scala/org/apache/zeppelin/display/angular/paragraphscope/AngularModelTest.scala @@ -26,7 +26,7 @@ class AngularModelTest extends AbstractAngularModelTest { AngularModel(name) } - override def angularModel(name: String, value: Any): AbstractAngularModel = { + override def angularModel(name: String, value: AnyRef): AbstractAngularModel = { AngularModel(name, value) } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObject.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObject.java index a2393b32a35..11b55b1180a 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObject.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObject.java @@ -35,12 +35,12 @@ * * @param */ -public class AngularObject implements JsonSerializable { +public class AngularObject implements JsonSerializable { private static final Logger LOGGER = LoggerFactory.getLogger(AngularObject.class); private static final Gson GSON = new Gson(); private String name; - private T object; + private Object object; private transient AngularObjectListener listener; private transient List watchers = new LinkedList<>(); @@ -66,7 +66,7 @@ public AngularObject() { * @param paragraphId paragraphId belongs to. can be null * @param listener event listener */ - public AngularObject(String name, T o, String noteId, String paragraphId, + public AngularObject(String name, Object o, String noteId, String paragraphId, AngularObjectListener listener) { this.name = name; this.noteId = noteId; @@ -127,7 +127,7 @@ public boolean isGlobal() { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - AngularObject that = (AngularObject) o; + AngularObject that = (AngularObject) o; return Objects.equals(name, that.name) && Objects.equals(noteId, that.noteId) && Objects.equals(paragraphId, that.paragraphId); @@ -160,7 +160,7 @@ public void emit() { * Set value * @param o reference to new user provided object */ - public void set(T o) { + public void set(Object o) { set(o, true); } @@ -170,15 +170,14 @@ public void set(T o) { * @param emit false on skip firing event for listener. note that it does not skip invoke * watcher.watch() in any case */ - public void set(T o, boolean emit) { - final T before = object; - final T after = o; + public void set(Object o, boolean emit) { + final Object before = object; + final Object after = o; object = o; if (emit) { emit(); } LOGGER.debug("Update angular object: {} with value: {}", name, o); - final Logger LOGGER = LoggerFactory.getLogger(AngularObject.class); List ws = new LinkedList<>(); synchronized (watchers) { ws.addAll(watchers); @@ -186,16 +185,14 @@ public void set(T o, boolean emit) { ExecutorService executor = ExecutorFactory.singleton().createOrGet("angularObjectWatcher", 50); for (final AngularObjectWatcher w : ws) { - executor.submit(new Runnable() { - @Override - public void run() { - try { - w.watch(before, after); - } catch (Exception e) { - LOGGER.error("Exception on watch", e); - } + Runnable task = () -> { + try { + w.watch(before, after); + } catch (Exception e) { + LOGGER.error("Exception on watch", e); } - }); + }; + executor.submit(task); } } @@ -262,7 +259,7 @@ public String toJson() { return GSON.toJson(this); } - public static AngularObject fromJson(String json) { + public static AngularObject fromJson(String json) { return GSON.fromJson(json, AngularObject.class); } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObjectRegistry.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObjectRegistry.java index 54d9814f714..699db48762c 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObjectRegistry.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/display/AngularObjectRegistry.java @@ -21,6 +21,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Map.Entry; /** * AngularObjectRegistry keeps all the object that binded to Angular Display System. @@ -32,7 +33,7 @@ */ public class AngularObjectRegistry { Map> registry = new HashMap<>(); - private final String GLOBAL_KEY = "_GLOBAL_"; + private static final String GLOBAL_KEY = "_GLOBAL_"; private AngularObjectRegistryListener listener; private String interpreterGroupId; private AngularObjectListener angularObjectListener; @@ -41,14 +42,12 @@ public AngularObjectRegistry(final String interpreterGroupId, final AngularObjectRegistryListener listener) { this.interpreterGroupId = interpreterGroupId; this.listener = listener; - angularObjectListener = new AngularObjectListener() { - @Override - public void updated(AngularObject updatedObject) { - if (listener != null) { - listener.onUpdateAngularObject(interpreterGroupId, updatedObject); - } + angularObjectListener = (AngularObject updatedObject) -> { + if (listener != null) { + listener.onUpdateAngularObject(interpreterGroupId, updatedObject); } }; + } public AngularObjectRegistryListener getListener() { @@ -83,15 +82,11 @@ private String getRegistryKey(String noteId, String paragraphId) { } } } - + private Map getRegistryForKey(String noteId, String paragraphId) { synchronized (registry) { String key = getRegistryKey(noteId, paragraphId); - if (!registry.containsKey(key)) { - registry.put(key, new HashMap()); - } - - return registry.get(key); + return registry.computeIfAbsent(key, k -> new HashMap<>()); } } @@ -214,7 +209,7 @@ public List getAll(String noteId, String paragraphId) { } return all; } - + /** * Get all angular object related to specific note. * That includes all global scope objects, notebook scope objects and paragraph scope objects @@ -230,9 +225,9 @@ public List getAllWithGlobal(String noteId) { if (global != null) { all.addAll(global.values()); } - for (String key : registry.keySet()) { - if (key.startsWith(noteId)) { - all.addAll(registry.get(key).values()); + for (Entry> registryEntry : registry.entrySet()) { + if (registryEntry.getKey().startsWith(noteId)) { + all.addAll(registryEntry.getValue().values()); } } } diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/display/AngularObjectBuilder.java b/zeppelin-server/src/test/java/org/apache/zeppelin/display/AngularObjectBuilder.java index cfbdc31f930..ed9823c8984 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/display/AngularObjectBuilder.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/display/AngularObjectBuilder.java @@ -17,8 +17,8 @@ package org.apache.zeppelin.display; public class AngularObjectBuilder { - public static AngularObject build(String varName, T value, String noteId, + public static AngularObject build(String varName, Object value, String noteId, String paragraphId) { - return new AngularObject<>(varName, value, noteId, paragraphId, null); + return new AngularObject(varName, value, noteId, paragraphId, null); } } diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/socket/NotebookServerTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/socket/NotebookServerTest.java index 3eaf74d6835..2d2aa3101db 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/socket/NotebookServerTest.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/socket/NotebookServerTest.java @@ -562,7 +562,7 @@ void bindAngularObjectToRemoteForParagraphs() throws Exception { when(paragraph.getBindedInterpreter().getInterpreterGroup()).thenReturn(mdGroup); - final AngularObject ao1 = AngularObjectBuilder.build(varName, value, "noteId", + final AngularObject ao1 = AngularObjectBuilder.build(varName, value, "noteId", "paragraphId"); when(mdRegistry.addAndNotifyRemoteProcess(varName, value, "noteId", "paragraphId")) @@ -621,7 +621,7 @@ void unbindAngularObjectFromRemoteForParagraphs() throws Exception { when(paragraph.getBindedInterpreter().getInterpreterGroup()).thenReturn(mdGroup); - final AngularObject ao1 = AngularObjectBuilder.build(varName, value, "noteId", + final AngularObject ao1 = AngularObjectBuilder.build(varName, value, "noteId", "paragraphId"); when(mdRegistry.removeAndNotifyRemoteProcess(varName, "noteId", "paragraphId")).thenReturn(ao1); NotebookSocket conn = mock(NotebookSocket.class); diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java index d2649ab226e..19b769576d4 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/RemoteInterpreterEventServer.java @@ -49,7 +49,6 @@ import org.apache.zeppelin.interpreter.thrift.RemoteInterpreterResultMessage; import org.apache.zeppelin.interpreter.thrift.RunParagraphsEvent; import org.apache.zeppelin.interpreter.thrift.WebUrlInfo; -import org.apache.zeppelin.notebook.Note; import org.apache.zeppelin.resource.RemoteResource; import org.apache.zeppelin.resource.Resource; import org.apache.zeppelin.resource.ResourceId; @@ -286,7 +285,7 @@ public void runParagraphs(RunParagraphsEvent event) throws InterpreterRPCExcepti @Override public void addAngularObject(String intpGroupId, String json) throws InterpreterRPCException, TException { LOGGER.debug("Add AngularObject, interpreterGroupId: {}, json: {}", intpGroupId, json); - AngularObject angularObject = AngularObject.fromJson(json); + AngularObject angularObject = AngularObject.fromJson(json); InterpreterGroup interpreterGroup = interpreterSettingManager.getInterpreterGroupById(intpGroupId); if (interpreterGroup == null) { @@ -314,7 +313,7 @@ public void addAngularObject(String intpGroupId, String json) throws Interpreter @Override public void updateAngularObject(String intpGroupId, String json) throws InterpreterRPCException, TException { - AngularObject angularObject = AngularObject.fromJson(json); + AngularObject angularObject = AngularObject.fromJson(json); InterpreterGroup interpreterGroup = interpreterSettingManager.getInterpreterGroupById(intpGroupId); if (interpreterGroup == null) { diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/display/AngularObjectBuilder.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/display/AngularObjectBuilder.java index c2018588cf3..a1dfcd10f65 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/display/AngularObjectBuilder.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/display/AngularObjectBuilder.java @@ -19,8 +19,8 @@ public class AngularObjectBuilder { - public static AngularObject build(String varName, T value, String noteId, + public static AngularObject build(String varName, Object value, String noteId, String paragraphId) { - return new AngularObject<>(varName, value, noteId, paragraphId, null); + return new AngularObject(varName, value, noteId, paragraphId, null); } } \ No newline at end of file diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java index 869d5622fcb..380a0897b8a 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/ParagraphTest.java @@ -221,10 +221,10 @@ void should_extract_variable_from_angular_object_registry() throws Exception { final Paragraph paragraph = new Paragraph(note, null); final String paragraphId = paragraph.getId(); - final AngularObject nameAO = AngularObjectBuilder.build("name", "DuyHai DOAN", noteId, + final AngularObject nameAO = AngularObjectBuilder.build("name", "DuyHai DOAN", noteId, paragraphId); - final AngularObject ageAO = AngularObjectBuilder.build("age", 34, noteId, null); + final AngularObject ageAO = AngularObjectBuilder.build("age", 34, noteId, null); when(note.getId()).thenReturn(noteId); when(registry.get("name", noteId, paragraphId)).thenReturn(nameAO);