All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.tsl2.nano.incubation.terminal.item.Command Maven / Gradle / Ivy

Go to download

TSL2 Framework Terminal (Console Application Framework named SIShell, providing Actions, Options, Commands, Inputs, lots of Selectors, PlatformManagement)

There is a newer version: 2.5.2
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy