Skip to content

Commit 57ca577

Browse files
review change create such class AuthenticationInfo, and pass it into InterpreterContext
1 parent 320790c commit 57ca577

File tree

14 files changed

+248
-188
lines changed

14 files changed

+248
-188
lines changed

shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public void close() {}
6666
@Override
6767
public InterpreterResult interpret(String cmd, InterpreterContext contextInterpreter) {
6868
logger.debug("Run shell command '" + cmd + "'");
69+
logger.error("user info found as :::" + contextInterpreter.getAuthenticationInfo().getUser());
6970
CommandLine cmdLine = CommandLine.parse("bash");
7071
cmdLine.addArgument("-c", false);
7172
cmdLine.addArgument(cmd, false);

zeppelin-display/src/test/scala/org/apache/zeppelin/display/angular/AbstractAngularModelTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ trait AbstractAngularModelTest extends FlatSpec
2828
with BeforeAndAfter with BeforeAndAfterEach with Eventually with Matchers {
2929
override def beforeEach() {
3030
val intpGroup = new InterpreterGroup()
31-
val context = new InterpreterContext("note", "id", "title", "text", null,
31+
val context = new InterpreterContext("note", "id", "title", "text", new AuthenticationInfo(),
3232
new java.util.HashMap[String, Object](), new GUI(), new AngularObjectRegistry(
3333
intpGroup.getId(), null),
3434
null,
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
19+
package org.apache.zeppelin.interpreter;
20+
21+
/***
22+
*
23+
*/
24+
public class AuthenticationInfo {
25+
String user;
26+
String ticket;
27+
28+
public AuthenticationInfo() {}
29+
30+
/***
31+
*
32+
* @param user
33+
* @param ticket
34+
*/
35+
public AuthenticationInfo(String user, String ticket) {
36+
this.user = user;
37+
this.ticket = ticket;
38+
}
39+
40+
public String getUser() {
41+
return user;
42+
}
43+
44+
public void setUser(String user) {
45+
this.user = user;
46+
}
47+
48+
public String getTicket() {
49+
return ticket;
50+
}
51+
52+
public void setTicket(String ticket) {
53+
this.ticket = ticket;
54+
}
55+
}

zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static void remove() {
4848
private final String paragraphTitle;
4949
private final String paragraphId;
5050
private final String paragraphText;
51-
private final String user;
51+
private AuthenticationInfo authenticationInfo;
5252
private final Map<String, Object> config;
5353
private GUI gui;
5454
private AngularObjectRegistry angularObjectRegistry;
@@ -59,7 +59,7 @@ public InterpreterContext(String noteId,
5959
String paragraphId,
6060
String paragraphTitle,
6161
String paragraphText,
62-
String user,
62+
AuthenticationInfo authenticationInfo,
6363
Map<String, Object> config,
6464
GUI gui,
6565
AngularObjectRegistry angularObjectRegistry,
@@ -71,7 +71,7 @@ public InterpreterContext(String noteId,
7171
this.paragraphId = paragraphId;
7272
this.paragraphTitle = paragraphTitle;
7373
this.paragraphText = paragraphText;
74-
this.user = user;
74+
this.authenticationInfo = authenticationInfo;
7575
this.config = config;
7676
this.gui = gui;
7777
this.angularObjectRegistry = angularObjectRegistry;
@@ -97,8 +97,8 @@ public String getParagraphTitle() {
9797
return paragraphTitle;
9898
}
9999

100-
public String getUser() {
101-
return user;
100+
public AuthenticationInfo getAuthenticationInfo() {
101+
return authenticationInfo;
102102
}
103103

104104
public Map<String, Object> getConfig() {

zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ private RemoteInterpreterContext convert(InterpreterContext ic) {
364364
ic.getParagraphId(),
365365
ic.getParagraphTitle(),
366366
ic.getParagraphText(),
367-
ic.getUser(),
367+
gson.toJson(ic.getAuthenticationInfo()),
368368
gson.toJson(ic.getConfig()),
369369
gson.toJson(ic.getGui()),
370370
gson.toJson(ic.getRunners()));

zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ private InterpreterContext convert(RemoteInterpreterContext ric) {
392392
ric.getParagraphId(),
393393
ric.getParagraphTitle(),
394394
ric.getParagraphText(),
395-
ric.getUser(),
395+
gson.fromJson(ric.getAuthenticationInfo(), AuthenticationInfo.class),
396396
(Map<String, Object>) gson.fromJson(ric.getConfig(),
397397
new TypeToken<Map<String, Object>>() {}.getType()),
398398
gson.fromJson(ric.getGui(), GUI.class),

0 commit comments

Comments
 (0)