SmartFrog 3.10.000

org.smartfrog.services.shellscript
Interface ScriptExecution

All Known Subinterfaces:
SFScriptExecution
All Known Implementing Classes:
ScriptExecutionImpl, SFScriptExecutionImpl

public interface ScriptExecution

Interface that provides the API to the script component, allowing other co-located components to submit script commands. The interface provides for the submission of lines of script and the ability to lock a script component for unique use for a period. This ensures that sequences of script commands will not be interleaved with other script requets to the component. The operational model is asynchronous, in that the execute operation only queues the execute request and does not wait until it is complete. An object implementing the ScriptResult interface is returned, and this can be queried to find if the script has completed and obtain the resultant output, both error and normal. Commands to be executed are passed in as a list the following format. Each element is either a string, in which case it is treated as a command, or a list in which case the command is the space-separated "toString" of its elements.


Method Summary
 ScriptResults execute(java.util.List commands, long timeout)
          submit a list of commands to the shell as a single atomic lock/execute/unlock
 ScriptResults execute(java.util.List commands, long timeout, boolean verbose)
          submit a list of commands to the shell as a single atomic lock/execute/unlock
 ScriptResults execute(java.util.List commands, ScriptLock lock)
          submit a list of commands to the shell
 ScriptResults execute(java.util.List commands, ScriptLock lock, boolean verbose)
          submit a list of commands to the shell
 ScriptResults execute(java.lang.String command, long timeout)
          submit a command to the shell as a single atomic lock/execute/unlock
 ScriptResults execute(java.lang.String command, long timeout, boolean verbose)
          submit a command to the shell as a single atomic lock/execute/unlock
 ScriptResults execute(java.lang.String command, ScriptLock lock)
          submit a command to the shell
 ScriptResults execute(java.lang.String command, ScriptLock lock, boolean verbose)
          submit a command to the shell
 ScriptLock lockShell(long timeout)
          obtain a lock on the shell, will block until it is available
 void releaseShell(ScriptLock lock)
          release the lock on the shell and resets verbose to false.
 

Method Detail

lockShell

ScriptLock lockShell(long timeout)
                     throws SmartFrogException
obtain a lock on the shell, will block until it is available

Parameters:
timeout - max number of miliseconds to obtain the lock: 0 is don't wait, -1 is wait forever
Returns:
lock object that must be used in follow-up execute and lock release operations
Throws:
SmartFrogException - if the lock is not obtained in the requisite time

execute

ScriptResults execute(java.util.List commands,
                      ScriptLock lock)
                      throws SmartFrogException
submit a list of commands to the shell

Parameters:
commands - the list of commands
lock - the lock object receieved from the lockShell
Returns:
the "future" ScriptResult implementation that allows the code to obtain the results of executnig the script
Throws:
SmartFrogException - if the lock object is not valid, i.e. if it is not currently holding the l0ck

execute

ScriptResults execute(java.util.List commands,
                      ScriptLock lock,
                      boolean verbose)
                      throws SmartFrogException
submit a list of commands to the shell

Parameters:
commands - the list of commands
lock - the lock object receieved from the lockShell
verbose - determines if results output will be shown using out/err streams.
Returns:
the "future" ScriptResult implementation that allows the code to obtain the results of executnig the script
Throws:
SmartFrogException - if the lock object is not valid, i.e. if it is not currently holding the l0ck

execute

ScriptResults execute(java.lang.String command,
                      ScriptLock lock)
                      throws SmartFrogException
submit a command to the shell

Parameters:
command - the command to execute
lock - the lock object receieved from the lockShell
Returns:
the "future" ScriptResult implementation that allows the code to obtain the results of executnig the script
Throws:
SmartFrogException - if the lock object is not valid, i.e. if it is not currently holding the l0ck

execute

ScriptResults execute(java.lang.String command,
                      ScriptLock lock,
                      boolean verbose)
                      throws SmartFrogException
submit a command to the shell

Parameters:
command - the command to execute
lock - the lock object receieved from the lockShell
verbose - determines if results output will be shown using out/err streams.
Returns:
the "future" ScriptResult implementation that allows the code to obtain the results of executnig the script
Throws:
SmartFrogException - if the lock object is not valid, i.e. if it is not currently holding the l0ck

releaseShell

void releaseShell(ScriptLock lock)
                  throws SmartFrogException
release the lock on the shell and resets verbose to false.

Parameters:
lock - the lock object receieved from the lockShell
Throws:
SmartFrogException - if the lock object is not valid, i.e. if it is not currently holding the l0ck

execute

ScriptResults execute(java.util.List commands,
                      long timeout)
                      throws SmartFrogException
submit a list of commands to the shell as a single atomic lock/execute/unlock

Parameters:
commands - the list of commands
timeout - max number of miliseconds to obtain the lock: 0 is don't wait, -1 is wait forever
Returns:
the "future" ScriptResult implementation that allows the code to obtain the results of executnig the script
Throws:
SmartFrogException - if the lock is not obtained in the requisite time

execute

ScriptResults execute(java.util.List commands,
                      long timeout,
                      boolean verbose)
                      throws SmartFrogException
submit a list of commands to the shell as a single atomic lock/execute/unlock

Parameters:
commands - the list of commands
timeout - max number of miliseconds to obtain the lock: 0 is don't wait, -1 is wait forever
verbose - determines if the shell output will be shown using out/err streams.
Returns:
the "future" ScriptResult implementation that allows the code to obtain the results of executnig the script
Throws:
SmartFrogException - if the lock is not obtained in the requisite time

execute

ScriptResults execute(java.lang.String command,
                      long timeout)
                      throws SmartFrogException
submit a command to the shell as a single atomic lock/execute/unlock

Parameters:
command - the command
timeout - max number of miliseconds to obtain the lock: 0 is don't wait, -1 is wait forever
Returns:
the "future" ScriptResult implementation that allows the code to obtain the results of executnig the script
Throws:
SmartFrogException - if the lock is not obtained in the requisite time

execute

ScriptResults execute(java.lang.String command,
                      long timeout,
                      boolean verbose)
                      throws SmartFrogException
submit a command to the shell as a single atomic lock/execute/unlock

Parameters:
command - the command
timeout - max number of miliseconds to obtain the lock: 0 is don't wait, -1 is wait forever
verbose - determines if the shell output will be shown using out/err streams.
Returns:
the "future" ScriptResult implementation that allows the code to obtain the results of executnig the script
Throws:
SmartFrogException - if the lock is not obtained in the requisite time

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP