About the OS Command API

The OS Command component provides an API for programmatically configuring the OS Command component using a Java program.

For more information about component APIs, see Component APIs.

The OS Command component API consists of the following methods:

  • getString("type"), set("type", theType). This method allows you to get/set whether this component executes a command ("command") or a script ("Script").

  • getString("command"), set("command", theCommand). This method allows you to get/set the command to execute. To substitute parameters into the script, see “quote” below.

  • getString("commandargs"), set("commandargs", theArgs). This method allows you to get/set the arguments to supply with the command.

  • getString("scriptinterpreter"), set("scriptinterpreter", interp). This method allows you to get/set the interpreter to use for executing the script. The interpreter types are defined in the OSCommand preferences.

  • getString("scriptarguments"), set("scriptarguments", theArgs). This method allows you to get/set the arguments to supply to the script for execution.

  • getString ("script"), set ("script", text). This method sets the script text if the script mode is not already set. To substitute parameters into the script, see “quote” below.

  • getString("waitforfile"), set("waitforfile", fileName). This method allows you to get/set the name of a file that must exist before the component considers its execution to be complete.

  • getInt("waitforfiledelay"), set("waitforfiledelay", delaySecs). This method allows you to get/set the amount of time (in seconds) that the component must wait after it finds the specified file to wait for (and optionally text in that file) before considering its execution to be complete.

  • getString("waitfortextinfile"), set("waitfortextinfile", text). This method allows you to get/set the text that must exist in the specified file before the component considers its execution to be complete.

  • getInt("maxexecutiontime"), set("maxexecutiontime", maxTime). This method allows you to get/set the amount of time (in seconds) the component is allowed to execute before it is forcefully failed.

  • getInt("retrylimit"), set("retrylimit", numRetry). This method allows you to get/set the number of times that the component execution should be retried if it fails.

  • getInt("retrydelay"), set("retrydelay", delaySecs). This method allows you to get/set the amount of time (in seconds) that the component should wait before retrying execution after failure.

  • getInt("retryiffailedbefore"), set("retryiffailedbefore", time). This method allows you to get/set the amount of time (in seconds) within which a component will retry execution if it fails. Typically, this method is used to retry execution of longer running codes when they fail at the start of execution (caused by unavailable licenses or other environmental problems/conflicts). However, this method does not retry execution when the codes fail later (after the code has begun executing properly).

  • getInt("loglinelimit"), set("loglinelimit", numLines). This method allows you to get/set the limit on the number of lines that are written to the log from standard output or standard error.

  • getBoolean("logstderror"), set("logstderror", logIt). This method allows you to get/set whether or not standard error messages are written to the job log.

  • getBoolean("logstdoutput"), set("logstdoutput", logIt). This method allows you to get/set whether or not standard output messages are written to the job log.

  • getBoolean("failwhenstderror"), set("failwhenstderror", fail). This method allows you to get/set whether or not to fail execution when something is written to standard error.

  • getBoolean("failwhenstdoutput"), set("failwhenstdoutput", fail). This method allows you to get/set whether or not to fail execution when something is written to standard output.

  • getString("xwindowshost"), set("xwindowshost", hostName). This method allows you to get/set the Linux hostname to use for the X-Windows display.

  • call("quote", String parameterName). This method allows you to quote a parameter correctly for including in the command line or the text of a script. The returned value is added to the command or script. The parameter name can select an aggregate member or an array element. For example:

    api.set ("command",
    " cmd /C copy "+ api.call("quote", "inFile")+
    " " + api.call("quote", "outFileList[3]"));