Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.ifs.admin.actions
Class ForkProcessAction

    java.lang.Object
      oracle.ifs.utils.action.AbstractAction
          oracle.ifs.admin.actions.ForkProcessAction

All Implemented Interfaces:
  Action, IfsParameters

Direct Known Subclasses:
  DropJavaAction, LoadJavaAction, OsCommandAction

    public abstract class ForkProcessAction

extends AbstractAction
implements IfsParameters

The ForkProcessAction class provides an abstract Action implementation that executes an external Process.

Note: this class should be extended to implement the getCommand method, which returns the OS command that should be executed as an external process.

This class defines the following key:
`timeout` - the timeout value in seconds. If this time elapses and the process has not exited, the process will be forcibly terminated by `Process.destroy()`.

Modified:
  lsaenz 06/11/2001 Added 'throws ActionFailedException' to processFinished method., lsaenz 03/20/2001 Added logging and "infinite" timeout., lsaenz 03/15/2001 Created.

Field Summary
`static java.lang.String` | `LOG_KEY` Boolean key telling whether to log the command and its standard output or not.
`protected boolean` | `m_log`
`static java.lang.String` | `TIMEOUT_KEY` Key mapping to the timeout value in seconds.

Fields inherited from class oracle.ifs.utils.action.AbstractAction
`CONTINUE_ON_ERROR, m_defaultOptions, m_options`

Fields inherited from interface oracle.ifs.utils.common.IfsParameters
`APPEND_LOG, DATABASE_URL, DB_USER_NAME, DB_USER_PASSWORD, DOMAIN_TYPE, ENABLE_SSL_SUPPORT, FOR_SCHEMA_UPGRADE, IFS_DOMAIN_DISPLAY_NAME, IFS_DOMAIN_NAME, IFS_SCHEMA_NAME, IFS_SCHEMA_PASSWORD, IFS_SERVICE_NAME, IFS_USER_NAME, IFS_USER_PASSWORD, INCLUDE_PATH, INITIAL_CONTEXT_FACTORY, LDAP_URL_DAS_LOOKUP, LDAP_USER_NAME, LDAP_USER_PASSWORD, OUTPUT_FILE, PARAMETER_FILE, REGISTRY, SCHEMA_VERSION_KEY, SECURITY_PROTOCOL_NAME, SERVICE_CONFIGURATION_NAME`

Constructor Summary
`ForkProcessAction()`

Method Summary
`void` | `failed(java.lang.Throwable t)` Does nothing.
`protected abstract java.lang.String` | `getCommand()` Returns the OS command that should be invoked as an external process.
`void` | `perform()` Executes the process specified by the `getCommand` method.
`protected void` | `processDestroyed(java.io.StringWriter out, java.io.StringWriter err)` Invoked when the external process was destroyed by this Action, due to a timeout, an interrupt from another Thread, or other exceptional conditions.
`protected void` | `processFinished(int code, java.io.StringWriter out, java.io.StringWriter err)` Invoked when the external process has finished on its own.
`void` | `stop()` Forcibly stops the external process.

Methods inherited from class oracle.ifs.utils.action.AbstractAction
`getDescription, getName, getValue, isContinueOnError, putValue, setDefaultOptions, setDescription, setName, setOptions`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TIMEOUT_KEY

    public static final java.lang.String TIMEOUT_KEY

  Description copied from class: `ForkProcessAction`
  Key mapping to the timeout value in seconds. Defined as "timeout".

  See Also:
    Constant Field Values

### LOG_KEY

    public static final java.lang.String LOG_KEY

  Description copied from class: `ForkProcessAction`
  Boolean key telling whether to log the command and its standard output or not. Defined as "log". Defaults to "true". Set to "false" if you do not wish to log the command.

  See Also:
    Constant Field Values

### m_log

    protected boolean m_log

Constructor Detail

### ForkProcessAction

    public ForkProcessAction()

Method Detail

### perform

    public void perform()
                 throws ActionFailedException

  Description copied from class: `ForkProcessAction`
  Executes the process specified by the `getCommand` method. Waits until the process has finished and then calls the `processFinished` method. If the specified timeout period has passed and the external process is still running, the external process will be forcibly stopped, and the `processFailed` method will be invoked.

  Specified by:
    `perform` in interface `Action`
  Throws:
    `ActionFailedException` - if the action could not be performed.

### stop

    public void stop()

  Description copied from class: `ForkProcessAction`
  Forcibly stops the external process.

  Specified by:
    `stop` in interface `Action`

### failed

    public void failed(java.lang.Throwable t)

  Description copied from class: `ForkProcessAction`
  Does nothing.

  Specified by:
    `failed` in interface `Action`
  Parameters:
    `t` - the error that occurred.

### getCommand

    protected abstract java.lang.String getCommand()

  Description copied from class: `ForkProcessAction`
  Returns the OS command that should be invoked as an external process.
  Note: subclasses must implement this method.

  Returns:
    a command String that can be passed to the Runtime.exec method.

### processFinished

    protected void processFinished(int code,
                                   java.io.StringWriter out,
                                   java.io.StringWriter err)
                            throws ActionFailedException

  Description copied from class: `ForkProcessAction`
  Invoked when the external process has finished on its own.

  Note: subclasses may override this method; it has an empty implementation.

  Note: subclasses may decide (based on the output from the process or the exit code) that the process did not finish successfully. In this case, the subclass may throw an ActionFailedException to notify that the action has in fact failed, even though the external process finished.

  Parameters:
    `code` - the exit code returned by the Process.
    `out` - a closed StringWriter with stdout output from the Process.
    `err` - a closed StringWriter with stderr output form the Process.
  Throws:
    `ActionFailedException` - if the process finished but was not considered (by the action implementing this method) a successful execution; thus the action has failed.

### processDestroyed

    protected void processDestroyed(java.io.StringWriter out,
                                    java.io.StringWriter err)

  Description copied from class: `ForkProcessAction`
  Invoked when the external process was destroyed by this Action, due to a timeout, an interrupt from another Thread, or other exceptional conditions.
  Note: subclasses may override this method; it has an empty implementation.

  Parameters:
    `out` - a closed StringWriter with stdout output from the Process.
    `err` - a closed StringWriter with stderr output form the Process.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD