public abstract class CommandShell<INPUT,OUTPUT> extends Object implements net.idea.modbcum.i.processors.IProcessor<INPUT,OUTPUT>
getExecutable(String, String)
.
Modifier and Type | Field and Description |
---|---|
protected boolean |
enabled |
protected Hashtable<String,Command> |
executables |
protected int |
exitCode |
protected String |
inputFile |
protected Logger |
logger |
static String |
os_FreeBSD |
static String |
os_LINUX |
static String |
os_LINUX64 |
static String |
os_MAC |
static String |
os_WINDOWS |
static String |
os_WINDOWS7 |
static String |
os_WINDOWSVISTA |
protected String |
outputFile |
protected String |
prefix |
protected boolean |
runAsync |
protected String |
workFolder |
Modifier | Constructor and Description |
---|---|
protected |
CommandShell() |
Modifier and Type | Method and Description |
---|---|
String |
addExecutable(String executable,
String[] morefiles) |
String |
addExecutable(String osname,
String executable,
String[] morefiles) |
String |
addExecutableFreeBSD(String executable,
String[] morefiles) |
String |
addExecutableLinux(String executable,
String[] morefiles) |
String |
addExecutableLinux64(String executable,
String[] morefiles) |
String |
addExecutableMac(String executable,
String[] morefiles) |
String |
addExecutableWin(String executable,
String[] morefiles) |
void |
close() |
protected boolean |
exitCodeOK(int exitVal) |
String |
getExecutable()
invokes
getExecutable(String, String) with
System.getProperty("os.name") as argument |
String |
getExecutable(String osname,
String osarch) |
int |
getExitCode() |
protected String |
getHomeDir(File file) |
String |
getHomeFromConfig(String propertiesResource,
String propertyHome) |
long |
getID() |
String |
getInputFile() |
static String |
getMsgemptymolecule() |
String |
getOutputFile() |
protected String |
getPath(File file) |
String |
getWorkFolder() |
protected void |
initialize() |
boolean |
isEnabled() |
void |
open() |
protected abstract OUTPUT |
parseOutput(String path,
INPUT mol)
Does nothing, override with smth meaningfull
|
protected OUTPUT |
parseOutput(String path,
INPUT mol,
int exitVal) |
protected List<String> |
prepareInput(String path,
INPUT mol)
Returns empty string, override with smth meaningfull
|
OUTPUT |
process(INPUT target) |
protected void |
processStdOut(InputStream is) |
OUTPUT |
runShell(INPUT mol) |
protected OUTPUT |
runShell(INPUT input,
String execString) |
void |
setEnabled(boolean enabled) |
void |
setExitCode(int exitCode) |
void |
setInputFile(String inputFile) |
void |
setOutputFile(String outputFile) |
void |
setWorkFolder(String workFolder) |
protected INPUT |
transform_input(INPUT input) |
protected abstract OUTPUT |
transform(INPUT mol) |
protected OUTPUT |
transform(Process process,
INPUT cmd) |
protected String prefix
public static final String os_MAC
public static final String os_WINDOWS
public static final String os_WINDOWSVISTA
public static final String os_WINDOWS7
public static final String os_LINUX
public static final String os_LINUX64
public static final String os_FreeBSD
protected String workFolder
protected Logger logger
protected String inputFile
protected String outputFile
protected boolean runAsync
protected boolean enabled
protected int exitCode
protected CommandShell() throws ShellException
ShellException
public String getWorkFolder()
public void setWorkFolder(String workFolder)
public static String getMsgemptymolecule()
public long getID()
public boolean isEnabled()
public void setEnabled(boolean enabled)
public int getExitCode()
public void setExitCode(int exitCode)
protected void initialize() throws ShellException
ShellException
public String addExecutable(String executable, String[] morefiles) throws ShellException
ShellException
public String addExecutable(String osname, String executable, String[] morefiles) throws ShellException
ShellException
public String addExecutableMac(String executable, String[] morefiles) throws ShellException
ShellException
public String addExecutableWin(String executable, String[] morefiles) throws ShellException
ShellException
public String addExecutableLinux(String executable, String[] morefiles) throws ShellException
ShellException
public String addExecutableLinux64(String executable, String[] morefiles) throws ShellException
ShellException
public String addExecutableFreeBSD(String executable, String[] morefiles) throws ShellException
ShellException
public String getExecutable(String osname, String osarch) throws Exception
Exception
public String getExecutable() throws ShellException
getExecutable(String, String)
with
System.getProperty("os.name") as argumentShellException
public OUTPUT runShell(INPUT mol) throws ShellException
ShellException
protected List<String> prepareInput(String path, INPUT mol) throws ShellException
mol
- ShellException
protected abstract OUTPUT parseOutput(String path, INPUT mol) throws ShellException
ShellException
protected OUTPUT parseOutput(String path, INPUT mol, int exitVal) throws ShellException
ShellException
protected INPUT transform_input(INPUT input) throws net.idea.modbcum.i.exceptions.AmbitException
net.idea.modbcum.i.exceptions.AmbitException
protected OUTPUT runShell(INPUT input, String execString) throws ShellException
ShellException
protected void processStdOut(InputStream is) throws IOException
IOException
protected boolean exitCodeOK(int exitVal)
public String getInputFile()
public void setInputFile(String inputFile)
public String getOutputFile()
public void setOutputFile(String outputFile)
public void open() throws Exception
public void close() throws Exception
public String getHomeFromConfig(String propertiesResource, String propertyHome) throws ShellException
ShellException
Copyright © 2004–2020 Ideaconsult Ltd.. All rights reserved.