Search in sources :

Example 1 with AngularObject

use of org.apache.zeppelin.display.AngularObject in project zeppelin by apache.

the class ZeppelinContext method getAngularObject.

private AngularObject getAngularObject(String name, InterpreterContext interpreterContext) {
    AngularObjectRegistry registry = interpreterContext.getAngularObjectRegistry();
    String noteId = interpreterContext.getNoteId();
    // try get local object
    AngularObject paragraphAo = registry.get(name, noteId, interpreterContext.getParagraphId());
    AngularObject noteAo = registry.get(name, noteId, null);
    AngularObject ao = paragraphAo != null ? paragraphAo : noteAo;
    if (ao == null) {
        // then global object
        ao = registry.get(name, null, null);
    }
    return ao;
}
Also used : AngularObject(org.apache.zeppelin.display.AngularObject) AngularObjectRegistry(org.apache.zeppelin.display.AngularObjectRegistry)

Example 2 with AngularObject

use of org.apache.zeppelin.display.AngularObject in project zeppelin by apache.

the class GObject method getAngularObject.

private AngularObject getAngularObject(String name) {
    AngularObjectRegistry registry = interpreterContext.getAngularObjectRegistry();
    String noteId = interpreterContext.getNoteId();
    // try get local object
    AngularObject paragraphAo = registry.get(name, noteId, interpreterContext.getParagraphId());
    AngularObject noteAo = registry.get(name, noteId, null);
    AngularObject ao = paragraphAo != null ? paragraphAo : noteAo;
    if (ao == null) {
        // then global object
        ao = registry.get(name, null, null);
    }
    return ao;
}
Also used : AngularObject(org.apache.zeppelin.display.AngularObject) AngularObjectRegistry(org.apache.zeppelin.display.AngularObjectRegistry)

Example 3 with AngularObject

use of org.apache.zeppelin.display.AngularObject in project zeppelin by apache.

the class SubmarineUtils method getAgulObjValue.

public static String getAgulObjValue(InterpreterContext context, String name) {
    String value = "";
    AngularObject angularObject = context.getAngularObjectRegistry().get(name, context.getNoteId(), context.getParagraphId());
    if (null != angularObject && null != angularObject.get()) {
        value = angularObject.get().toString();
    }
    return value;
}
Also used : AngularObject(org.apache.zeppelin.display.AngularObject)

Example 4 with AngularObject

use of org.apache.zeppelin.display.AngularObject in project zeppelin by apache.

the class NotebookServer method pushAngularObjectToRemoteRegistry.

private AngularObject pushAngularObjectToRemoteRegistry(String noteId, String paragraphId, String varName, Object varValue, RemoteAngularObjectRegistry remoteRegistry, String interpreterGroupId, NotebookSocket conn) {
    final AngularObject ao = remoteRegistry.addAndNotifyRemoteProcess(varName, varValue, noteId, paragraphId);
    connectionManager.broadcastExcept(noteId, new Message(OP.ANGULAR_OBJECT_UPDATE).put("angularObject", ao).put("interpreterGroupId", interpreterGroupId).put("noteId", noteId).put("paragraphId", paragraphId), conn);
    return ao;
}
Also used : OnMessage(javax.websocket.OnMessage) ClusterMessage(org.apache.zeppelin.cluster.event.ClusterMessage) Message(org.apache.zeppelin.common.Message) AngularObject(org.apache.zeppelin.display.AngularObject)

Example 5 with AngularObject

use of org.apache.zeppelin.display.AngularObject in project zeppelin by apache.

the class NotebookServer method sendAllAngularObjects.

private void sendAllAngularObjects(Note note, String user, NotebookSocket conn) throws IOException {
    List<InterpreterSetting> settings = getNotebook().getBindedInterpreterSettings(note.getId());
    if (settings == null || settings.isEmpty()) {
        return;
    }
    for (InterpreterSetting intpSetting : settings) {
        if (intpSetting.getInterpreterGroup(user, note.getId()) == null) {
            continue;
        }
        AngularObjectRegistry registry = intpSetting.getInterpreterGroup(user, note.getId()).getAngularObjectRegistry();
        List<AngularObject> objects = registry.getAllWithGlobal(note.getId());
        for (AngularObject object : objects) {
            conn.send(serializeMessage(new Message(OP.ANGULAR_OBJECT_UPDATE).put("angularObject", object).put("interpreterGroupId", intpSetting.getInterpreterGroup(user, note.getId()).getId()).put("noteId", note.getId()).put("paragraphId", object.getParagraphId())));
        }
    }
}
Also used : OnMessage(javax.websocket.OnMessage) ClusterMessage(org.apache.zeppelin.cluster.event.ClusterMessage) Message(org.apache.zeppelin.common.Message) InterpreterSetting(org.apache.zeppelin.interpreter.InterpreterSetting) AngularObject(org.apache.zeppelin.display.AngularObject) RemoteAngularObjectRegistry(org.apache.zeppelin.interpreter.remote.RemoteAngularObjectRegistry) AngularObjectRegistry(org.apache.zeppelin.display.AngularObjectRegistry)

Aggregations

AngularObject (org.apache.zeppelin.display.AngularObject)38 AngularObjectRegistry (org.apache.zeppelin.display.AngularObjectRegistry)21 IOException (java.io.IOException)12 Map (java.util.Map)11 TException (org.apache.thrift.TException)11 RemoteAngularObjectRegistry (org.apache.zeppelin.interpreter.remote.RemoteAngularObjectRegistry)10 List (java.util.List)8 InterpreterGroup (org.apache.zeppelin.interpreter.InterpreterGroup)8 InterpreterSetting (org.apache.zeppelin.interpreter.InterpreterSetting)8 UnknownHostException (java.net.UnknownHostException)7 HashMap (java.util.HashMap)7 Message (org.apache.zeppelin.common.Message)7 ServiceException (org.apache.zeppelin.interpreter.thrift.ServiceException)7 AuthenticationInfo (org.apache.zeppelin.user.AuthenticationInfo)7 ArrayList (java.util.ArrayList)6 HashSet (java.util.HashSet)6 ZeppelinConfiguration (org.apache.zeppelin.conf.ZeppelinConfiguration)5 Arrays (java.util.Arrays)4 LinkedList (java.util.LinkedList)4 OP (org.apache.zeppelin.common.Message.OP)4