SmartFrog 3.10.000

org.smartfrog.services.shellscript
Class ScriptExecutionImpl

java.lang.Object
  extended by org.smartfrog.services.shellscript.ScriptExecutionImpl
All Implemented Interfaces:
FilterListener, ScriptExecution

public class ScriptExecutionImpl
extends java.lang.Object
implements ScriptExecution, FilterListener


Nested Class Summary
 class ScriptExecutionImpl.ScriptResultsImpl
           
 
Field Summary
protected static java.text.DateFormat dateFormatter
          Used to format times
 
Constructor Summary
ScriptExecutionImpl(long ID, java.lang.String name, Cmd cmd)
           
ScriptExecutionImpl(java.lang.String name, Cmd cmd, Prim prim)
           
 
Method Summary
 ScriptResults execute(java.util.List commands, long timeout)
          submit a list of commands to the shell
 ScriptResults execute(java.util.List commands, long timeout, boolean verbose)
          submit a list of commands to the shell
 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
 ScriptResults execute(java.lang.String command, long timeout, boolean verbose)
          submit a command to the shell
 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
 void found(java.lang.String line, int filterIndex, java.lang.String filterName)
           
 void kill()
           
 void line(java.lang.String line, java.lang.String filterName)
           
 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.
 LogSF sfLog()
          This method should be used to log Core messages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateFormatter

protected static java.text.DateFormat dateFormatter
Used to format times

Constructor Detail

ScriptExecutionImpl

public ScriptExecutionImpl(java.lang.String name,
                           Cmd cmd,
                           Prim prim)
                    throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

ScriptExecutionImpl

public ScriptExecutionImpl(long ID,
                           java.lang.String name,
                           Cmd cmd)
                    throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException
Method Detail

execute

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

Specified by:
execute in interface ScriptExecution
Parameters:
command - String
lock - ScriptLock
Returns:
ScriptResults
Throws:
SmartFrogException - if the lock object is not valid, i.e. if it is not currently holding the lock

execute

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

Specified by:
execute in interface ScriptExecution
Parameters:
command - String
lock - ScriptLock
verbose - script output
Returns:
ScriptResults
Throws:
SmartFrogException - if the lock object is not valid, i.e. if it is not currently holding the lock

execute

public ScriptResults execute(java.util.List commands,
                             long timeout)
                      throws SmartFrogException
submit a list of commands to the shell

Specified by:
execute in interface ScriptExecution
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:
ScriptResults
Throws:
SmartFrogException - if the lock is not obtained in the requisite time

execute

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

Specified by:
execute in interface ScriptExecution
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 results output will be shown using out/err streams.
Returns:
ScriptResults
Throws:
SmartFrogException - if the lock is not obtained in the requisite time

execute

public ScriptResults execute(java.lang.String command,
                             long timeout,
                             boolean verbose)
                      throws SmartFrogException
submit a command to the shell

Specified by:
execute in interface ScriptExecution
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:
ScriptResults
Throws:
SmartFrogException - if the lock is not obtained in the requisite time

execute

public ScriptResults execute(java.lang.String command,
                             long timeout)
                      throws SmartFrogException
submit a command to the shell

Specified by:
execute in interface ScriptExecution
Parameters:
command - the command
timeout - max number of miliseconds to obtain the lock: 0 is don't wait, -1 is wait forever
Returns:
ScriptResults
Throws:
SmartFrogException - if the lock is not obtained in the requisite time

execute

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

Specified by:
execute in interface ScriptExecution
Parameters:
commands - List
lock - ScriptLock
Returns:
ScriptResults
Throws:
SmartFrogException - if the lock object is not valid, i.e.
SmartFrogException - if the lock object is not valid, i.e. if it is not currently holding the lock

execute

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

Specified by:
execute in interface ScriptExecution
Parameters:
commands - List
lock - ScriptLock
verbose - script output
Returns:
ScriptResults
Throws:
SmartFrogException - if the lock object is not valid, i.e.
SmartFrogException - if the lock object is not valid, i.e. if it is not currently holding the lock

lockShell

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

Specified by:
lockShell in interface ScriptExecution
Parameters:
timeout - max number of miliseconds to obtain the lock: 0 is don't wait, -1 is wait forever
Returns:
ScriptLock
Throws:
SmartFrogException - if the lock is not obtained in the requisite time

releaseShell

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

Specified by:
releaseShell in interface ScriptExecution
Parameters:
lock - the lock object receieved from the lockShell
Throws:
SmartFrogException - if the lock object is not valid, i.e.
SmartFrogException - if the lock object is not valid, i.e. if it is not currently holding the l0ck

kill

public void kill()

line

public void line(java.lang.String line,
                 java.lang.String filterName)
Specified by:
line in interface FilterListener

found

public void found(java.lang.String line,
                  int filterIndex,
                  java.lang.String filterName)
Specified by:
found in interface FilterListener

sfLog

public LogSF sfLog()
This method should be used to log Core messages

Returns:
Logger implementing LogSF and Log

SmartFrog CORE 3.10.000

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