in modules/shell/src/main/java/org/apache/tuscany/sca/shell/Shell.java [511:624]
Callable<Boolean> eval(final List<String> toks) {
final String op = toks.size() > 0 ? toks.get(0) : "";
if (commands.keySet().contains(op)) {
toks.remove(0);
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return commands.get(op).invoke(toks.toArray(new String[0]));
}
};
}
if (op.equalsIgnoreCase("domain"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return domain(toks.size() > 1 ? toks.get(1) : "");
}
};
if (op.equalsIgnoreCase("domains"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return domains();
}
};
if (op.equalsIgnoreCase("domainComposite"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return domainComposite();
}
};
if (op.equalsIgnoreCase("install"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return install(toks);
}
};
if (op.equalsIgnoreCase("installed"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return installed(toks);
}
};
if (op.equalsIgnoreCase("load"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return load(toks.get(1));
}
};
if (op.equalsIgnoreCase("nodes"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return nodes();
}
};
if (op.equalsIgnoreCase("run"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return run(toks.get(1));
}
};
if (op.equalsIgnoreCase("help"))
return new Callable<Boolean>() {
public Boolean call() {
return help(toks);
}
};
if (op.equalsIgnoreCase("save"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return save(toks.get(1));
}
};
if (op.equalsIgnoreCase("services"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return services();
}
};
if (op.equalsIgnoreCase("bye"))
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return bye();
}
};
if (op.equalsIgnoreCase("started"))
return new Callable<Boolean>() {
public Boolean call() {
return started(toks);
}
};
if (op.equalsIgnoreCase("status"))
return new Callable<Boolean>() {
public Boolean call() {
return status();
}
};
if (op.equalsIgnoreCase("history"))
return new Callable<Boolean>() {
public Boolean call() {
return history();
}
};
if (op.equalsIgnoreCase("") || op.startsWith("#"))
return new Callable<Boolean>() {
public Boolean call() {
return true;
}
};
return new Callable<Boolean>() {
public Boolean call() {
out.println("unknown command");
return true;
}
};
}