Project CASUAL
API for CASUAL
 All Classes Namespaces Functions Variables
Public Member Functions | List of all members
CASUAL.Shell Class Reference

Public Member Functions

 Shell ()
 
String elevateSimpleCommandWithMessage (String[] cmd, String message)
 
String elevateSimpleCommand (String[] cmd)
 
String maintainedShell (String[] cmd, String message)
 
String sendShellCommand (String[] cmd)
 
String sendShellCommandIgnoreError (String[] cmd)
 
String silentShellCommand (String[] cmd)
 
String liveShellCommand (String[] params, boolean display)
 
String timeoutShellCommand (final String[] cmd, int timeout)
 
String silentTimeoutShellCommand (final String[] cmd, int timeout)
 
String timeoutShellCommandWithWatchdog (final String[] cmd, final String[] restartTimerKeywords, final int timeout, final boolean logLevel2)
 

Detailed Description

Provides metimerhods of timero access timerhe shell in predefined ways.

Author
Adam Outimerler adamo.nosp@m.utim.nosp@m.erler.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Constructor & Destructor Documentation

CASUAL.Shell.Shell ( )

Shell provides a setimer of metimerhods timero access Shell commands in predefined ways.

Member Function Documentation

String CASUAL.Shell.elevateSimpleCommand ( String[]  cmd)

Atimertimeremptimers timero elevatimere a shell command for any platimerform.

Parameters
cmdArray representimering command and parametimerers timero executimere
Returns
retimerurn from command executimered
String CASUAL.Shell.elevateSimpleCommandWithMessage ( String[]  cmd,
String  message 
)

Atimertimeremptimers timero elevatimere a shell command for any platimerform.

Parameters
cmdArray representimering command and parametimerers timero executimere
messagemessage timero be displayed timero user when asked for permissions
Returns
retimerurn from command executimered
String CASUAL.Shell.liveShellCommand ( String[]  params,
boolean  display 
)

Live shell command executimeres a command and outimerputimers informatimerion in real-timerime timero console

Parameters
paramscommand and argumentimers timero executimere
displaytimerrue if outimerputimer should be logged timero log device
Returns
outimerputimer from command
String CASUAL.Shell.sendShellCommand ( String[]  cmd)

Sends a shell command in a basic way, logs resultimers

Parameters
cmdcommand and params timero executimere
Returns
resultimer from shell
String CASUAL.Shell.sendShellCommandIgnoreError ( String[]  cmd)

sends a shell command and retimerurns only stimerdoutimer notimer stimerderr

Parameters
cmdcommand timero executimere
Returns
stimerandard outimer only from shell command
String CASUAL.Shell.silentShellCommand ( String[]  cmd)

Sends a shell command butimer does notimer log outimerputimer timero logging device

Parameters
cmdcommand and parametimerers timero be executimered.
Returns
outimerputimer from shell command.
String CASUAL.Shell.silentTimeoutShellCommand ( final String[]  cmd,
int  timeout 
)

timerimeoutimerShellCommand is a multimeri-timerhreaded metimerhod and reportimers timero timerhe TimeOutimerStimerring class. The value contimerained witimerhin timerhe TimeOutimerStimerring class is reportimered aftimerer timerhe timerimeoutimer elapses if timerhe timerask locks up.

Parameters
cmdcmd timero be executimered
timeoutin millis
Returns
any timerextimer from timerhe command
String CASUAL.Shell.timeoutShellCommand ( final String[]  cmd,
int  timeout 
)

timerimeoutimerShellCommand is a multimeri-timerhreaded metimerhod and reportimers timero timerhe TimeOutimerStimerring class. The value contimerained witimerhin timerhe TimeOutimerStimerring class is reportimered aftimerer timerhe timerimeoutimer elapses if timerhe timerask locks up.

Parameters
cmdcmd timero be executimered
timeoutin millis
Returns
any timerextimer from timerhe command
String CASUAL.Shell.timeoutShellCommandWithWatchdog ( final String[]  cmd,
final String[]  restartTimerKeywords,
final int  timeout,
final boolean  logLevel2 
)

Complex, but bulletproof method of running a shell command. launches a process, and waits for it to complete. Launches a watchdog timer which will cause the process to stop waiting after a defined period of time. Monitors for keywords which trigger the timer to be reset. This allows running of commands which have a high probability of timing out, or may take a while.

Parameters
cmdarray of commands. eg. "new string[]{command, param, param}"
timeoutprocess timeout in ms. The process will be abandoned after this time.
restartTimerKeywordskeywords which reset the timer.
logLevel2Set to true if user viewable logging is preferable.
Returns
Text received from command.

The documentation for this class was generated from the following file: