use of org.platformlayer.ops.Command.Argument in project platformlayer by platformlayer.
the class JavaCommandBuilder method get.
public Command get() {
Command command = Command.build("java");
command.addLiteral("-server");
for (Map.Entry<String, String> define : defines.entrySet()) {
command.addLiteral("-D" + define.getKey() + "=" + define.getValue());
}
StringBuilder cp = new StringBuilder();
for (ClasspathEntry entry : classpath) {
if (cp.length() != 0) {
cp.append(":");
}
String s = entry.path.getAbsolutePath();
if (entry.wildcard) {
// TODO: Adding * is gross
s += "/*";
}
cp.append(s);
}
// TODO: This is not nice either
if (cp.length() == 0) {
cp.append(".");
} else {
cp.append(":.");
}
command.addLiteral("-cp").addQuoted(cp.toString());
if (jar != null) {
command.addLiteral("-jar").addFile(jar);
} else {
command.addQuoted(mainClass);
}
for (Argument argument : arguments) {
command.addArgument(argument);
}
return command;
}