some refactoring
This commit is contained in:
parent
44494fe269
commit
3dd8a09e9e
@ -6,11 +6,7 @@ public class Main {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
CommandlineParser cmdParser = new CommandlineParser(args);
|
CommandlineParser cmdParser = new CommandlineParser(args);
|
||||||
String user = cmdParser.getUser();
|
ScriptClient scriptClient = new ScriptClient(cmdParser.getUser(), cmdParser.getRunAs());
|
||||||
String runAs = cmdParser.getRunAs();
|
|
||||||
CASTicket tgt = new CASTicket(user, runAs);
|
|
||||||
RpcClient rpcClient = new RpcClient(tgt);
|
|
||||||
ScriptClient scriptClient = new ScriptClient(tgt, rpcClient);
|
|
||||||
Object o = scriptClient.execute(cmdParser.getExpression());
|
Object o = scriptClient.execute(cmdParser.getExpression());
|
||||||
System.out.println(o);
|
System.out.println(o);
|
||||||
} catch (JSCliException e) {
|
} catch (JSCliException e) {
|
||||||
|
@ -10,7 +10,9 @@ public class ScriptClient {
|
|||||||
|
|
||||||
private ScriptEngine engine;
|
private ScriptEngine engine;
|
||||||
|
|
||||||
public ScriptClient(CASTicket grantingTicket, RpcClient rpcClient) throws JSCliException {
|
public ScriptClient(String user, String runAs) throws JSCliException {
|
||||||
|
CASTicket grantingTicket = new CASTicket(user, runAs);
|
||||||
|
RpcClient rpcClient = new RpcClient(grantingTicket);
|
||||||
ScriptEngineManager engineManager = new ScriptEngineManager();
|
ScriptEngineManager engineManager = new ScriptEngineManager();
|
||||||
engine = engineManager.getEngineByName("js");
|
engine = engineManager.getEngineByName("js");
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user