review change create such class AuthenticationInfo, and pass it into InterpreterContext

This commit is contained in:
Prabhjyot Singh 2016-02-16 21:53:32 +05:30
parent 320790cf45
commit 57ca5771f9
14 changed files with 248 additions and 188 deletions

View file

@ -66,6 +66,7 @@ public class ShellInterpreter extends Interpreter {
@Override
public InterpreterResult interpret(String cmd, InterpreterContext contextInterpreter) {
logger.debug("Run shell command '" + cmd + "'");
logger.error("user info found as :::" + contextInterpreter.getAuthenticationInfo().getUser());
CommandLine cmdLine = CommandLine.parse("bash");
cmdLine.addArgument("-c", false);
cmdLine.addArgument(cmd, false);

View file

@ -28,7 +28,7 @@ trait AbstractAngularModelTest extends FlatSpec
with BeforeAndAfter with BeforeAndAfterEach with Eventually with Matchers {
override def beforeEach() {
val intpGroup = new InterpreterGroup()
val context = new InterpreterContext("note", "id", "title", "text", null,
val context = new InterpreterContext("note", "id", "title", "text", new AuthenticationInfo(),
new java.util.HashMap[String, Object](), new GUI(), new AngularObjectRegistry(
intpGroup.getId(), null),
null,

View file

@ -0,0 +1,55 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.zeppelin.interpreter;
/***
*
*/
public class AuthenticationInfo {
String user;
String ticket;
public AuthenticationInfo() {}
/***
*
* @param user
* @param ticket
*/
public AuthenticationInfo(String user, String ticket) {
this.user = user;
this.ticket = ticket;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getTicket() {
return ticket;
}
public void setTicket(String ticket) {
this.ticket = ticket;
}
}

View file

@ -48,7 +48,7 @@ public class InterpreterContext {
private final String paragraphTitle;
private final String paragraphId;
private final String paragraphText;
private final String user;
private AuthenticationInfo authenticationInfo;
private final Map<String, Object> config;
private GUI gui;
private AngularObjectRegistry angularObjectRegistry;
@ -59,7 +59,7 @@ public class InterpreterContext {
String paragraphId,
String paragraphTitle,
String paragraphText,
String user,
AuthenticationInfo authenticationInfo,
Map<String, Object> config,
GUI gui,
AngularObjectRegistry angularObjectRegistry,
@ -71,7 +71,7 @@ public class InterpreterContext {
this.paragraphId = paragraphId;
this.paragraphTitle = paragraphTitle;
this.paragraphText = paragraphText;
this.user = user;
this.authenticationInfo = authenticationInfo;
this.config = config;
this.gui = gui;
this.angularObjectRegistry = angularObjectRegistry;
@ -97,8 +97,8 @@ public class InterpreterContext {
return paragraphTitle;
}
public String getUser() {
return user;
public AuthenticationInfo getAuthenticationInfo() {
return authenticationInfo;
}
public Map<String, Object> getConfig() {

View file

@ -364,7 +364,7 @@ public class RemoteInterpreter extends Interpreter {
ic.getParagraphId(),
ic.getParagraphTitle(),
ic.getParagraphText(),
ic.getUser(),
gson.toJson(ic.getAuthenticationInfo()),
gson.toJson(ic.getConfig()),
gson.toJson(ic.getGui()),
gson.toJson(ic.getRunners()));

View file

@ -392,7 +392,7 @@ public class RemoteInterpreterServer
ric.getParagraphId(),
ric.getParagraphTitle(),
ric.getParagraphText(),
ric.getUser(),
gson.fromJson(ric.getAuthenticationInfo(), AuthenticationInfo.class),
(Map<String, Object>) gson.fromJson(ric.getConfig(),
new TypeToken<Map<String, Object>>() {}.getType()),
gson.fromJson(ric.getGui(), GUI.class),

View file

@ -16,7 +16,7 @@
* limitations under the License.
*/
/**
* Autogenerated by Thrift Compiler (0.9.2)
* Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
@ -51,7 +51,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-24")
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-02-16")
public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteInterpreterContext, RemoteInterpreterContext._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterContext> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterContext");
@ -59,7 +59,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
private static final org.apache.thrift.protocol.TField PARAGRAPH_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("paragraphId", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField PARAGRAPH_TITLE_FIELD_DESC = new org.apache.thrift.protocol.TField("paragraphTitle", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField PARAGRAPH_TEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("paragraphText", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField("user", org.apache.thrift.protocol.TType.STRING, (short)5);
private static final org.apache.thrift.protocol.TField AUTHENTICATION_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("authenticationInfo", org.apache.thrift.protocol.TType.STRING, (short)5);
private static final org.apache.thrift.protocol.TField CONFIG_FIELD_DESC = new org.apache.thrift.protocol.TField("config", org.apache.thrift.protocol.TType.STRING, (short)6);
private static final org.apache.thrift.protocol.TField GUI_FIELD_DESC = new org.apache.thrift.protocol.TField("gui", org.apache.thrift.protocol.TType.STRING, (short)7);
private static final org.apache.thrift.protocol.TField RUNNERS_FIELD_DESC = new org.apache.thrift.protocol.TField("runners", org.apache.thrift.protocol.TType.STRING, (short)8);
@ -74,7 +74,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
public String paragraphId; // required
public String paragraphTitle; // required
public String paragraphText; // required
public String user; // required
public String authenticationInfo; // required
public String config; // required
public String gui; // required
public String runners; // required
@ -85,7 +85,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
PARAGRAPH_ID((short)2, "paragraphId"),
PARAGRAPH_TITLE((short)3, "paragraphTitle"),
PARAGRAPH_TEXT((short)4, "paragraphText"),
USER((short)5, "user"),
AUTHENTICATION_INFO((short)5, "authenticationInfo"),
CONFIG((short)6, "config"),
GUI((short)7, "gui"),
RUNNERS((short)8, "runners");
@ -111,8 +111,8 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
return PARAGRAPH_TITLE;
case 4: // PARAGRAPH_TEXT
return PARAGRAPH_TEXT;
case 5: // USER
return USER;
case 5: // AUTHENTICATION_INFO
return AUTHENTICATION_INFO;
case 6: // CONFIG
return CONFIG;
case 7: // GUI
@ -162,21 +162,21 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NOTE_ID, new org.apache.thrift.meta_data.FieldMetaData("noteId", org.apache.thrift.TFieldRequirementType.DEFAULT,
tmpMap.put(_Fields.NOTE_ID, new org.apache.thrift.meta_data.FieldMetaData("noteId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.PARAGRAPH_ID, new org.apache.thrift.meta_data.FieldMetaData("paragraphId", org.apache.thrift.TFieldRequirementType.DEFAULT,
tmpMap.put(_Fields.PARAGRAPH_ID, new org.apache.thrift.meta_data.FieldMetaData("paragraphId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.PARAGRAPH_TITLE, new org.apache.thrift.meta_data.FieldMetaData("paragraphTitle", org.apache.thrift.TFieldRequirementType.DEFAULT,
tmpMap.put(_Fields.PARAGRAPH_TITLE, new org.apache.thrift.meta_data.FieldMetaData("paragraphTitle", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.PARAGRAPH_TEXT, new org.apache.thrift.meta_data.FieldMetaData("paragraphText", org.apache.thrift.TFieldRequirementType.DEFAULT,
tmpMap.put(_Fields.PARAGRAPH_TEXT, new org.apache.thrift.meta_data.FieldMetaData("paragraphText", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user", org.apache.thrift.TFieldRequirementType.DEFAULT,
tmpMap.put(_Fields.AUTHENTICATION_INFO, new org.apache.thrift.meta_data.FieldMetaData("authenticationInfo", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.CONFIG, new org.apache.thrift.meta_data.FieldMetaData("config", org.apache.thrift.TFieldRequirementType.DEFAULT,
tmpMap.put(_Fields.CONFIG, new org.apache.thrift.meta_data.FieldMetaData("config", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.GUI, new org.apache.thrift.meta_data.FieldMetaData("gui", org.apache.thrift.TFieldRequirementType.DEFAULT,
tmpMap.put(_Fields.GUI, new org.apache.thrift.meta_data.FieldMetaData("gui", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.RUNNERS, new org.apache.thrift.meta_data.FieldMetaData("runners", org.apache.thrift.TFieldRequirementType.DEFAULT,
tmpMap.put(_Fields.RUNNERS, new org.apache.thrift.meta_data.FieldMetaData("runners", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RemoteInterpreterContext.class, metaDataMap);
@ -186,21 +186,21 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
}
public RemoteInterpreterContext(
String noteId,
String paragraphId,
String paragraphTitle,
String paragraphText,
String user,
String config,
String gui,
String runners)
String noteId,
String paragraphId,
String paragraphTitle,
String paragraphText,
String authenticationInfo,
String config,
String gui,
String runners)
{
this();
this.noteId = noteId;
this.paragraphId = paragraphId;
this.paragraphTitle = paragraphTitle;
this.paragraphText = paragraphText;
this.user = user;
this.authenticationInfo = authenticationInfo;
this.config = config;
this.gui = gui;
this.runners = runners;
@ -222,8 +222,8 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
if (other.isSetParagraphText()) {
this.paragraphText = other.paragraphText;
}
if (other.isSetUser()) {
this.user = other.user;
if (other.isSetAuthenticationInfo()) {
this.authenticationInfo = other.authenticationInfo;
}
if (other.isSetConfig()) {
this.config = other.config;
@ -246,7 +246,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
this.paragraphId = null;
this.paragraphTitle = null;
this.paragraphText = null;
this.user = null;
this.authenticationInfo = null;
this.config = null;
this.gui = null;
this.runners = null;
@ -348,27 +348,27 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
}
}
public String getUser() {
return this.user;
public String getAuthenticationInfo() {
return this.authenticationInfo;
}
public RemoteInterpreterContext setUser(String user) {
this.user = user;
public RemoteInterpreterContext setAuthenticationInfo(String authenticationInfo) {
this.authenticationInfo = authenticationInfo;
return this;
}
public void unsetUser() {
this.user = null;
public void unsetAuthenticationInfo() {
this.authenticationInfo = null;
}
/** Returns true if field user is set (has been assigned a value) and false otherwise */
public boolean isSetUser() {
return this.user != null;
/** Returns true if field authenticationInfo is set (has been assigned a value) and false otherwise */
public boolean isSetAuthenticationInfo() {
return this.authenticationInfo != null;
}
public void setUserIsSet(boolean value) {
public void setAuthenticationInfoIsSet(boolean value) {
if (!value) {
this.user = null;
this.authenticationInfo = null;
}
}
@ -446,98 +446,98 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NOTE_ID:
if (value == null) {
unsetNoteId();
} else {
setNoteId((String)value);
}
break;
case NOTE_ID:
if (value == null) {
unsetNoteId();
} else {
setNoteId((String)value);
}
break;
case PARAGRAPH_ID:
if (value == null) {
unsetParagraphId();
} else {
setParagraphId((String)value);
}
break;
case PARAGRAPH_ID:
if (value == null) {
unsetParagraphId();
} else {
setParagraphId((String)value);
}
break;
case PARAGRAPH_TITLE:
if (value == null) {
unsetParagraphTitle();
} else {
setParagraphTitle((String)value);
}
break;
case PARAGRAPH_TITLE:
if (value == null) {
unsetParagraphTitle();
} else {
setParagraphTitle((String)value);
}
break;
case PARAGRAPH_TEXT:
if (value == null) {
unsetParagraphText();
} else {
setParagraphText((String)value);
}
break;
case PARAGRAPH_TEXT:
if (value == null) {
unsetParagraphText();
} else {
setParagraphText((String)value);
}
break;
case USER:
if (value == null) {
unsetUser();
} else {
setUser((String) value);
}
break;
case AUTHENTICATION_INFO:
if (value == null) {
unsetAuthenticationInfo();
} else {
setAuthenticationInfo((String)value);
}
break;
case CONFIG:
if (value == null) {
unsetConfig();
} else {
setConfig((String)value);
}
break;
case CONFIG:
if (value == null) {
unsetConfig();
} else {
setConfig((String)value);
}
break;
case GUI:
if (value == null) {
unsetGui();
} else {
setGui((String)value);
}
break;
case GUI:
if (value == null) {
unsetGui();
} else {
setGui((String)value);
}
break;
case RUNNERS:
if (value == null) {
unsetRunners();
} else {
setRunners((String)value);
}
break;
case RUNNERS:
if (value == null) {
unsetRunners();
} else {
setRunners((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case NOTE_ID:
return getNoteId();
case NOTE_ID:
return getNoteId();
case PARAGRAPH_ID:
return getParagraphId();
case PARAGRAPH_ID:
return getParagraphId();
case PARAGRAPH_TITLE:
return getParagraphTitle();
case PARAGRAPH_TITLE:
return getParagraphTitle();
case PARAGRAPH_TEXT:
return getParagraphText();
case PARAGRAPH_TEXT:
return getParagraphText();
case USER:
return getUser();
case AUTHENTICATION_INFO:
return getAuthenticationInfo();
case CONFIG:
return getConfig();
case CONFIG:
return getConfig();
case GUI:
return getGui();
case GUI:
return getGui();
case RUNNERS:
return getRunners();
case RUNNERS:
return getRunners();
}
throw new IllegalStateException();
@ -550,22 +550,22 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
}
switch (field) {
case NOTE_ID:
return isSetNoteId();
case PARAGRAPH_ID:
return isSetParagraphId();
case PARAGRAPH_TITLE:
return isSetParagraphTitle();
case PARAGRAPH_TEXT:
return isSetParagraphText();
case USER:
return isSetUser();
case CONFIG:
return isSetConfig();
case GUI:
return isSetGui();
case RUNNERS:
return isSetRunners();
case NOTE_ID:
return isSetNoteId();
case PARAGRAPH_ID:
return isSetParagraphId();
case PARAGRAPH_TITLE:
return isSetParagraphTitle();
case PARAGRAPH_TEXT:
return isSetParagraphText();
case AUTHENTICATION_INFO:
return isSetAuthenticationInfo();
case CONFIG:
return isSetConfig();
case GUI:
return isSetGui();
case RUNNERS:
return isSetRunners();
}
throw new IllegalStateException();
}
@ -619,12 +619,12 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
return false;
}
boolean this_present_user = true && this.isSetUser();
boolean that_present_user = true && that.isSetUser();
if (this_present_user || that_present_user) {
if (!(this_present_user && that_present_user))
boolean this_present_authenticationInfo = true && this.isSetAuthenticationInfo();
boolean that_present_authenticationInfo = true && that.isSetAuthenticationInfo();
if (this_present_authenticationInfo || that_present_authenticationInfo) {
if (!(this_present_authenticationInfo && that_present_authenticationInfo))
return false;
if (!this.user.equals(that.user))
if (!this.authenticationInfo.equals(that.authenticationInfo))
return false;
}
@ -682,10 +682,10 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
if (present_paragraphText)
list.add(paragraphText);
boolean present_user = true && (isSetUser());
list.add(present_user);
if (present_user)
list.add(user);
boolean present_authenticationInfo = true && (isSetAuthenticationInfo());
list.add(present_authenticationInfo);
if (present_authenticationInfo)
list.add(authenticationInfo);
boolean present_config = true && (isSetConfig());
list.add(present_config);
@ -753,12 +753,12 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser());
lastComparison = Boolean.valueOf(isSetAuthenticationInfo()).compareTo(other.isSetAuthenticationInfo());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUser()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user);
if (isSetAuthenticationInfo()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authenticationInfo, other.authenticationInfo);
if (lastComparison != 0) {
return lastComparison;
}
@ -845,11 +845,11 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
}
first = false;
if (!first) sb.append(", ");
sb.append("user:");
if (this.user == null) {
sb.append("authenticationInfo:");
if (this.authenticationInfo == null) {
sb.append("null");
} else {
sb.append(this.user);
sb.append(this.authenticationInfo);
}
first = false;
if (!first) sb.append(", ");
@ -915,7 +915,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
@ -923,7 +923,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.noteId = iprot.readString();
struct.setNoteIdIsSet(true);
} else {
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@ -931,7 +931,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.paragraphId = iprot.readString();
struct.setParagraphIdIsSet(true);
} else {
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@ -939,7 +939,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.paragraphTitle = iprot.readString();
struct.setParagraphTitleIsSet(true);
} else {
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@ -947,15 +947,15 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.paragraphText = iprot.readString();
struct.setParagraphTextIsSet(true);
} else {
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // USER
case 5: // AUTHENTICATION_INFO
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.user = iprot.readString();
struct.setUserIsSet(true);
} else {
struct.authenticationInfo = iprot.readString();
struct.setAuthenticationInfoIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@ -963,7 +963,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.config = iprot.readString();
struct.setConfigIsSet(true);
} else {
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@ -971,7 +971,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.gui = iprot.readString();
struct.setGuiIsSet(true);
} else {
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@ -979,7 +979,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.runners = iprot.readString();
struct.setRunnersIsSet(true);
} else {
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@ -1018,9 +1018,9 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
oprot.writeString(struct.paragraphText);
oprot.writeFieldEnd();
}
if (struct.user != null) {
oprot.writeFieldBegin(USER_FIELD_DESC);
oprot.writeString(struct.user);
if (struct.authenticationInfo != null) {
oprot.writeFieldBegin(AUTHENTICATION_INFO_FIELD_DESC);
oprot.writeString(struct.authenticationInfo);
oprot.writeFieldEnd();
}
if (struct.config != null) {
@ -1068,7 +1068,7 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
if (struct.isSetParagraphText()) {
optionals.set(3);
}
if (struct.isSetUser()) {
if (struct.isSetAuthenticationInfo()) {
optionals.set(4);
}
if (struct.isSetConfig()) {
@ -1093,8 +1093,8 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
if (struct.isSetParagraphText()) {
oprot.writeString(struct.paragraphText);
}
if (struct.isSetUser()) {
oprot.writeString(struct.user);
if (struct.isSetAuthenticationInfo()) {
oprot.writeString(struct.authenticationInfo);
}
if (struct.isSetConfig()) {
oprot.writeString(struct.config);
@ -1128,8 +1128,8 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
struct.setParagraphTextIsSet(true);
}
if (incoming.get(4)) {
struct.user = iprot.readString();
struct.setUserIsSet(true);
struct.authenticationInfo = iprot.readString();
struct.setAuthenticationInfoIsSet(true);
}
if (incoming.get(5)) {
struct.config = iprot.readString();

View file

@ -16,7 +16,7 @@
* limitations under the License.
*/
/**
* Autogenerated by Thrift Compiler (0.9.2)
* Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
@ -51,7 +51,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-24")
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-02-16")
public class RemoteInterpreterEvent implements org.apache.thrift.TBase<RemoteInterpreterEvent, RemoteInterpreterEvent._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterEvent> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterEvent");

View file

@ -16,7 +16,7 @@
* limitations under the License.
*/
/**
* Autogenerated by Thrift Compiler (0.9.2)
* Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated

View file

@ -16,7 +16,7 @@
* limitations under the License.
*/
/**
* Autogenerated by Thrift Compiler (0.9.2)
* Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
@ -51,7 +51,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-24")
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-02-16")
public class RemoteInterpreterResult implements org.apache.thrift.TBase<RemoteInterpreterResult, RemoteInterpreterResult._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterResult> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterResult");

View file

@ -16,7 +16,7 @@
* limitations under the License.
*/
/**
* Autogenerated by Thrift Compiler (0.9.2)
* Autogenerated by Thrift Compiler (0.9.3)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
@ -51,7 +51,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-1-24")
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-02-16")
public class RemoteInterpreterService {
public interface Iface {
@ -6900,7 +6900,7 @@ public class RemoteInterpreterService {
public Object getFieldValue(_Fields field) {
switch (field) {
case SUCCESS:
return Integer.valueOf(getSuccess());
return getSuccess();
}
throw new IllegalStateException();
@ -8079,7 +8079,7 @@ public class RemoteInterpreterService {
return getBuf();
case CURSOR:
return Integer.valueOf(getCursor());
return getCursor();
}
throw new IllegalStateException();

View file

@ -24,7 +24,7 @@ struct RemoteInterpreterContext {
2: string paragraphId,
3: string paragraphTitle,
4: string paragraphText,
5: string user,
5: string authenticationInfo,
6: string config, // json serialized config
7: string gui, // json serialized gui
8: string runners // json serialized runner

View file

@ -23,6 +23,7 @@ import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars;
import org.apache.zeppelin.display.AngularObject;
import org.apache.zeppelin.display.AngularObjectRegistry;
import org.apache.zeppelin.display.AngularObjectRegistryListener;
import org.apache.zeppelin.interpreter.AuthenticationInfo;
import org.apache.zeppelin.interpreter.InterpreterOutput;
import org.apache.zeppelin.interpreter.InterpreterResult;
import org.apache.zeppelin.interpreter.InterpreterSetting;
@ -690,9 +691,12 @@ public class NotebookServer extends WebSocketServlet implements
p.setText(text);
p.setTitle((String) fromMessage.get("title"));
if (!fromMessage.principal.equals("anonymous")) {
p.setUser(fromMessage.principal);
AuthenticationInfo authenticationInfo = new AuthenticationInfo(fromMessage.principal,
fromMessage.ticket);
p.setAuthenticationInfo(authenticationInfo);
} else {
p.setUser(null);
p.setAuthenticationInfo(new AuthenticationInfo());
}
Map<String, Object> params = (Map<String, Object>) fromMessage

View file

@ -45,7 +45,7 @@ public class Paragraph extends Job implements Serializable, Cloneable {
String title;
String text;
String user;
AuthenticationInfo authenticationInfo;
Date dateUpdated;
private Map<String, Object> config; // paragraph configs like isOpen, colWidth, etc
public final GUI settings; // form and parameter settings
@ -56,7 +56,7 @@ public class Paragraph extends Job implements Serializable, Cloneable {
this.replLoader = replLoader;
title = null;
text = null;
user = null;
authenticationInfo = null;
dateUpdated = null;
settings = new GUI();
config = new HashMap<String, Object>();
@ -76,12 +76,12 @@ public class Paragraph extends Job implements Serializable, Cloneable {
this.dateUpdated = new Date();
}
public String getUser() {
return user;
public AuthenticationInfo getAuthenticationInfo() {
return authenticationInfo;
}
public void setUser(String user) {
this.user = user;
public void setAuthenticationInfo(AuthenticationInfo authenticationInfo) {
this.authenticationInfo = authenticationInfo;
}
public String getTitle() {
@ -285,7 +285,7 @@ public class Paragraph extends Job implements Serializable, Cloneable {
getId(),
this.getTitle(),
this.getText(),
this.getUser(),
this.getAuthenticationInfo(),
this.getConfig(),
this.settings,
registry,