use of org.apache.zeppelin.common.Message in project zeppelin by apache.
the class NotebookServer method getEditorSetting.
private void getEditorSetting(NotebookSocket conn, ServiceContext context, Message fromMessage) throws IOException {
String paragraphId = (String) fromMessage.get("paragraphId");
String paragraphText = (String) fromMessage.get("paragraphText");
String noteId = connectionManager.getAssociatedNoteId(conn);
getNotebookService().getEditorSetting(noteId, paragraphText, context, new WebSocketServiceCallback<Map<String, Object>>(conn) {
@Override
public void onSuccess(Map<String, Object> settings, ServiceContext context) throws IOException {
super.onSuccess(settings, context);
Message resp = new Message(OP.EDITOR_SETTING);
resp.put("paragraphId", paragraphId);
resp.put("editor", settings);
conn.send(serializeMessage(resp));
}
@Override
public void onFailure(Exception ex, ServiceContext context) {
LOG.warn(ex.getMessage());
}
});
}
use of org.apache.zeppelin.common.Message in project zeppelin by apache.
the class NotebookServer method onStatusChange.
@Override
public void onStatusChange(String noteId, String paragraphId, String appId, String status) {
Message msg = new Message(OP.APP_STATUS_CHANGE).put("noteId", noteId).put("paragraphId", paragraphId).put("appId", appId).put("status", status);
connectionManager.broadcast(noteId, msg);
}
use of org.apache.zeppelin.common.Message 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())));
}
}
}
use of org.apache.zeppelin.common.Message in project zeppelin by apache.
the class NotebookServer method permissionError.
void permissionError(NotebookSocket conn, String op, String userName, Set<String> userAndRoles, Set<String> allowed) throws IOException {
LOG.info("Cannot {}. Connection readers {}. Allowed readers {}", op, userAndRoles, allowed);
conn.send(serializeMessage(new Message(OP.AUTH_INFO).put("info", "Insufficient privileges to " + op + " note.\n\n" + "Allowed users or roles: " + allowed.toString() + "\n\n" + "But the user " + userName + " belongs to: " + userAndRoles.toString())));
}
use of org.apache.zeppelin.common.Message in project zeppelin by apache.
the class NotebookServer method getNoteByRevisionForCompare.
private void getNoteByRevisionForCompare(NotebookSocket conn, ServiceContext context, Message fromMessage) throws IOException {
String noteId = (String) fromMessage.get("noteId");
String revisionId = (String) fromMessage.get("revisionId");
String position = (String) fromMessage.get("position");
getNotebookService().getNoteByRevisionForCompare(noteId, revisionId, context, new WebSocketServiceCallback<Note>(conn) {
@Override
public void onSuccess(Note note, ServiceContext context) throws IOException {
super.onSuccess(note, context);
conn.send(serializeMessage(new Message(OP.NOTE_REVISION_FOR_COMPARE).put("noteId", noteId).put("revisionId", revisionId).put("position", position).put("note", note)));
}
});
}
Aggregations