de.tsl2.nano.incubation.terminal.item.Command Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tsl2.nano.terminal Show documentation
Show all versions of tsl2.nano.terminal Show documentation
TSL2 Framework Terminal (Console Application Framework named SIShell, providing Actions, Options, Commands, Inputs, lots of Selectors, PlatformManagement)
package de.tsl2.nano.incubation.terminal.item;
import java.util.ArrayList;
import java.util.Properties;
import org.simpleframework.xml.Element;
import de.tsl2.nano.core.execution.IRunnable;
import de.tsl2.nano.core.execution.SystemUtil;
import de.tsl2.nano.core.util.Util;
/**
* OS Shell Command
*
* @param
* @author Tom, Thomas Schneider
* @version $Revision$
*/
public class Command extends MainAction {
/** serialVersionUID */
private static final long serialVersionUID = 7657014766656806827L;
@Element
String cmd;
transient IRunnable runner;
public Command() {
}
public Command(String name, String command, String... argumentNames) {
super(name, SystemUtil.class, "execute", null, argumentNames);
this.cmd = command;
}
@Override
protected ArrayList createArguments() {
ArrayList args = super.createArguments();
if (!Util.isEmpty(cmd)) {
String cmdargs[] = cmd.split("\\s");
for (int i = 0; i < cmdargs.length; i++) {
args.add(cmdargs[i]);
}
}
return args;
}
}