public class FwkExecuteCommand extends FwkDescription implements java.lang.Runnable
Modifier and Type | Class and Description |
---|---|
class |
FwkExecuteCommand.OutputEvent |
class |
FwkExecuteCommand.OutputListener |
static class |
FwkExecuteCommand.StandardOutputListener |
class |
FwkExecuteCommand.StateListener |
Modifier and Type | Field and Description |
---|---|
protected static FwkDescriptionInterface |
descriptor |
protected java.lang.Process |
process |
protected java.lang.Thread |
processReadThread |
protected static FwkExecuteCommand.StandardOutputListener |
standardOutputListener |
static java.lang.String |
version |
author, buildnr, className, company, copyright, creationDate, dateFormatString, description, eMail, FWK_ICON, FWK_ICON_ARRAY, FWK_ICON_BG, FWK_ICON_BG_ARRAY, FWK_ICON_BG_LARGE, FWK_ICON_BG_LARGE_ARRAY, FWK_ICON_LARGE, FWK_ICON_LARGE_ARRAY, icon, ICON, iconCount, iconKey, internetAddress, name, titleName
AUTHOR, BUILDNR, COMPANY, COPYRIGHT, DATE_FORMAT, DEFAULT_ICON, DESCRIPTION, INTERNET, LARGE_ICON, LARGE_KEY_EXT, LARGE_OPAQUE_ICON, LARGE_OPAQUE_KEY_EXT, OPAQUE_ICON, OPAQUE_KEY_EXT, RCS_DATE_FORMAT, SUPPORT_EMAIL, TITLE_NAME
Constructor and Description |
---|
FwkExecuteCommand()
Constructor.
|
FwkExecuteCommand(java.lang.String command)
Constructor receiving the command to be executed.
|
Modifier and Type | Method and Description |
---|---|
void |
addExecuteOutputListener(FwkExecuteOutputListenerInterface listener)
Add an FwkExecuteOutput listener.
|
void |
addExecuteStateListener(FwkExecuteStateListenerInterface listener)
Add an FwkExecuteState listener.
|
void |
addStandardOutputListener()
Add the standard output listener to the listener list.
|
void |
appendArgument(java.lang.String arg)
Append an argument.
|
protected void |
execute() |
protected void |
fireOutputEvent(java.lang.String outString,
java.lang.String errString)
Fire a state event.
|
protected void |
fireStateEvent(int state)
Fire a state event.
|
java.lang.String[] |
getArguments()
Get the arguments
|
protected java.lang.String[] |
getCmdArray()
Get the string array for the execute command.
|
java.lang.String |
getCommandLine()
Return the command line string.
|
static FwkDescriptionInterface |
getDescriptor() |
java.lang.String |
getErrorString()
Get the error string.
|
int |
getExitValue()
Get the exit value.
|
java.lang.String |
getOSCommand()
Get the command string.
|
java.lang.String |
getOutputString()
Get the output string.
|
int |
getState()
Returns the last state.
|
java.lang.String |
getStateString()
Returns the last state.
|
java.lang.String |
getVersion()
Return the version string of the FWK component.
|
java.io.File |
getWorkingDirectory()
Set the working directory.
|
void |
insertArgument(java.lang.String arg,
int index)
Insert an argument.
|
static void |
main(java.lang.String[] args) |
protected void |
printStackTrace(java.lang.Throwable t)
Print the stacktrace to the error buffer.
|
protected void |
readExecuteStreamContent() |
void |
removeArgument(int index)
Remove an argument.
|
void |
removeArgument(java.lang.String arg)
Remove an argument.
|
void |
removeExecuteOutputListener(FwkExecuteOutputListenerInterface listener)
Remove an FwkExecuteOutput listener.
|
void |
removeExecuteStateListener(FwkExecuteStateListenerInterface listener)
Remove an FwkExecuteState listener.
|
void |
removeStandardOutputListener()
Remove the standard output listener from the listener list.
|
void |
run() |
void |
setArguments(java.lang.String[] args)
Set the arguments
|
void |
setOSCommand(java.lang.String command)
Set the command string.
|
void |
setWorkingDirectory(java.io.File dir)
Set the working directory.
|
void |
setWorkingDirectory(java.lang.String dir)
Set the working directory.
|
protected void |
start() |
protected void |
stop() |
getAuthor, getBuild, getClassName, getCompany, getCompanyInternetAddress, getCopyright, getCreationDate, getCreationDate, getDateFormatString, getDescription, getIcon, getIcon, getIconKey, getIconKey, getName, getPresentationString, getPresentationString, getSupportEMail, getTitle, getTitleName, getTransferData, getTransferDataFlavors, isDataFlavorSupported, lostOwnership, setAuthor, setBuild, setClassName, setCompany, setCompanyInternetAddress, setCopyright, setCreationDate, setCreationDate, setDateFormatString, setDescription, setDescriptor, setIcon, setIcon, setIconKey, setIconKey, setName, setSupportEMail, setTitleName, toString
getNiceVersion, release
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
release
public static final java.lang.String version
protected static final FwkDescriptionInterface descriptor
protected static FwkExecuteCommand.StandardOutputListener standardOutputListener
protected java.lang.Thread processReadThread
protected java.lang.Process process
public FwkExecuteCommand()
public FwkExecuteCommand(java.lang.String command)
command
- the OS command string.public java.lang.String getVersion()
FwkInterface
getVersion
in interface FwkInterface
getVersion
in class FwkDescription
public static FwkDescriptionInterface getDescriptor()
public void setWorkingDirectory(java.io.File dir) throws java.io.FileNotFoundException
dir
- the working directory.java.io.FileNotFoundException
public void setWorkingDirectory(java.lang.String dir) throws java.io.FileNotFoundException
dir
- the working directory.java.io.FileNotFoundException
public java.io.File getWorkingDirectory()
dir
- the working directory.protected java.lang.String[] getCmdArray()
public void setArguments(java.lang.String[] args)
args
- The array of argument strings.public java.lang.String[] getArguments()
public void insertArgument(java.lang.String arg, int index)
arg
- the argument string.index
- The position of the new argument in argument array.public void appendArgument(java.lang.String arg)
arg
- the argument string.public void removeArgument(java.lang.String arg)
arg
- the argument string.public void removeArgument(int index)
index
- the index of the arguments.public void setOSCommand(java.lang.String command)
command
- the OS command string.public java.lang.String getOSCommand()
public java.lang.String getCommandLine()
public int getState()
com.highqsoft.interfaces.fwk.FwkStateEventInterface
public java.lang.String getOutputString()
public java.lang.String getErrorString()
public int getExitValue() throws java.lang.IllegalThreadStateException
java.lang.IllegalThreadStateException
Process
protected void execute()
protected void readExecuteStreamContent()
protected void printStackTrace(java.lang.Throwable t)
t
- The exceptionpublic void run()
run
in interface java.lang.Runnable
protected void start()
protected void stop()
public void addStandardOutputListener()
public void removeStandardOutputListener()
public void addExecuteStateListener(FwkExecuteStateListenerInterface listener)
listener
- the listener.public void removeExecuteStateListener(FwkExecuteStateListenerInterface listener)
listener
- the listener.public void addExecuteOutputListener(FwkExecuteOutputListenerInterface listener)
listener
- the listener.public void removeExecuteOutputListener(FwkExecuteOutputListenerInterface listener)
listener
- the listener.protected void fireStateEvent(int state)
state
- the state to be publiched.protected void fireOutputEvent(java.lang.String outString, java.lang.String errString)
state
- the state to be publiched.public java.lang.String getStateString()
com.highqsoft.interfaces.fwk.FwkStateEventInterface
public static void main(java.lang.String[] args)