some refactoring

This commit is contained in:
Peter Hormanns 2012-07-24 16:52:54 +00:00
parent 44494fe269
commit 3dd8a09e9e
2 changed files with 4 additions and 6 deletions

View File

@ -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) {

View File

@ -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 {