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