com.microfocus.awm.control

## Class AbstractTaurusToolExecutor

- java.lang.Object
- - com.microfocus.awm.control.AbstractTaurusToolExecutor

- All Implemented Interfaces:
    IToolExecutor
  Direct Known Subclasses:
    MergeStructuredFiles, OSCommandExecutor, ReturnPropertyValue

  Deprecated.
  Outdated, since it uses methods from the old tool execution interface. `generateInputParameterStrings(IExecutionContext, ToolDescriptor, List, boolean, IProgressMonitor)` has been replaced by the equally named method in `AbstractCommandBasedToolExecutor`.

      @Deprecated
      public abstract class AbstractTaurusToolExecutor
      extends java.lang.Object
      implements IToolExecutor

  Abstract tool executor which contains methods for parameter handling, especially for mass processing.
  Author:
    Micro Focus

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractTaurusToolExecutor()` Deprecated.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `createMassOutputParameters(java.util.List<java.util.Map<RToolOutParameter,java.lang.String>> pMassToolOutParmValues, IExecutionContext pContext)` Deprecated. Warning! This method clears any existing mass processing context.
    `void` | `createSingleOutputParameters(java.util.List<RToolOutParameter> pRToolOutParams, java.util.List<java.lang.String> pPropValues, IExecutionContext pContext, ToolExecutionStatus pToolExecutionStatus)` Deprecated. Properly registers returned tool parameters in the execution context and execution status.
    `abstract ToolExecutionStatus` | `execTool(IExecutionContext pContext, ToolDescriptor pTauToolDescriptor, java.lang.String pAffectedResName, org.eclipse.core.runtime.IProgressMonitor pMon)` Deprecated. Called by AWM as soon as the tool is executed within an action.
    `IToolOutputReader` | `getOutputReader()` Deprecated. Returns the implementation of the IToolOutputReader which is used for reading the tool output of the implemented IToolExecutor.
    `java.util.List<java.lang.String>` | `readParmFile(ISystemImage pImg, java.lang.String pParmFilePath, org.eclipse.core.runtime.IProgressMonitor pMon)` Deprecated. Converts the contents of a parameter file into a list of strings (lines).

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractTaurusToolExecutor

          public AbstractTaurusToolExecutor()

      Deprecated.

  - ### Method Detail

    - #### execTool

          public abstract ToolExecutionStatus execTool(IExecutionContext pContext,
                                                       ToolDescriptor pTauToolDescriptor,
                                                       java.lang.String pAffectedResName,
                                                       org.eclipse.core.runtime.IProgressMonitor pMon)
                                                throws TaurusToolException

      Deprecated.
      Description copied from interface: `IToolExecutor`
      Called by AWM as soon as the tool is executed within an action.

      ## General

      - Use `IProgressMonitor.setCanceled(boolean)` to cancel the execution of an action. This is common for tools opening a dialog with a `Cancel` button.
      - Throwing a `TaurusToolException` will cancel the action and display the error message in an error dialog.
      - Returning a `ToolExecutionStatus` with a return code higher than the modeled `Max RC` (application option) will also cause the action to abort with an error dialog.
      - Returning a tool execution status with a return code lower than the `Max RC` and a message will display the message at the end of the action.
      - Tools can create `ResourceOperation`s by adding them to the returned `ToolExecutionStatus`.
      - Tools must add output and mass output parameters to the returned `ToolExecutionStatus` need by AWM to process the modeled `ResourceOperation`s.
      - See `TaurusModelUtilities` and `TaurusUtility` useful helper methods.

      ## Processing Input Parameters

      Tools which handle modeled input parameters should:
      - Read contents of referenced files by using `TaurusUtility.readFile(FileDescriptor, IExecutionContext)`.
      - Get modeled parameters with `ToolDescriptor.getInputParm()`.
      - Use `TaurusModelUtilities.getParameterValue(com.microfocus.awm.meta.interfaces.RToolInParameter, IExecutionContext)` to resolve a parameter value.
      - Use `TaurusModelUtilities.getFileDescriptorByInputParam(com.microfocus.awm.meta.interfaces.RToolInParameter, IExecutionContext)` to resolve file input parameters.
      - Ideally validate modeled parameters and throw descriptive `TaurusToolException`s if the tool has not been configured properly.

      ## Processing Output Parameters

      Output parameters are used to add properties and file descriptors into an execution context, so they can be passed to subsequent tools or be picked up by AWM (e.g. for element list creation).
      - Get modeled output parameters with `ToolDescriptor.getOutputParm()`.
      - Use `IExecutionContext.putParmIntoMemory(com.microfocus.awm.meta.interfaces.Property, IPropertyValue)` to add an output parameter into the memory.
      - Use `IExecutionContext.putFileParmIntoMemory(com.microfocus.awm.meta.interfaces.FileDescriptor)` to add a file output parameter into the memory.
      - Use `FileDescriptor.clone()` to create a copy of a modeled file descriptor, before e.g. setting a file descriptor path (physical name) or input stream. Otherwise the loaded model would be altered.
      - Use `IExecutionContext.addParmForOutputDialog(com.microfocus.awm.meta.interfaces.RToolOutParameter)` when `RToolOutParameter.isToOutputDialog()` has been set, to support the AWM modeled output dialog.

      ## Reading Tool Type Attributes

      If additional tool type attributes have been defined for the tool, modeled values can be retrieved by using `DynamicObject.getDynamicAttributes()` or `DynamicObject.getDynamicAttributes()`. Complex attributes can be read by `DynamicObject.getComplexAttributes()`.

      ## Creating an Element List

      To create an element list, the tool needs to have a file output parameter which points to a structured file descriptor. The list must contain records of separated property values as described in the file descriptor. If creating a physical file is not required, using a file descriptor of the type `EFileTypes.INPUT_STREAM_VALUE` is recommended. The stream can be set by using `FileDescriptor.setInputStream(java.io.InputStream)`. Please see Processing Output Parameters on how to add the output file to the memory, since this is required for AWM to find the file reference. AWM only picks up the last file output parameter of a tool to create an element list.

      ## Mass Processing

      To process more than one selected element at once (optional), number and contexts of selected elements can be retrieved using `IExecutionContext.getMassProcessingContexts()`. To find out whether the tool was modeled to process several elements at once, use `ActionExecutor.isMassProcessing(IExecutionContext, ToolDescriptor)` .

      Specified by:
        `execTool` in interface `IToolExecutor`
      Parameters:
        `pContext` - The IExecutionContext. Can be handed over by a previous Tool or created manually.
        `pTauToolDescriptor` - The descriptor of the Tool to be executed.
        `pAffectedResName` - a logical resource name (or `null` if there is none, see `IExecutionContext.getResource(String)`)
        `pMon` - An IProgressMonitor. Setting the progress monitor cancelled using `IProgressMonitor.setCanceled(boolean)` will cause the action to be canceled after the tool.
      Returns:
        `ToolExecutionStatus`
      Throws:
        `TaurusToolException` - if the tool encounters an exception

    - #### createSingleOutputParameters

          public void createSingleOutputParameters(java.util.List<RToolOutParameter> pRToolOutParams,
                                                   java.util.List<java.lang.String> pPropValues,
                                                   IExecutionContext pContext,
                                                   ToolExecutionStatus pToolExecutionStatus)
                                            throws TaurusToolException

      Deprecated.
      Properly registers returned tool parameters in the execution context and execution status.
      Parameters:
        `pRToolOutParams` - a list of output parameters
        `pPropValues` - a list of values for each output parameter
        `pContext` - the execution context
        `pToolExecutionStatus` - the `ToolExecutionStatus` of a tool. A map of output parameters will be set to the `ToolExecutionStatus`.
      Throws:
        `TaurusToolException` - if parameters were modelled incorrectly

    - #### createMassOutputParameters

          public void createMassOutputParameters(java.util.List<java.util.Map<RToolOutParameter,java.lang.String>> pMassToolOutParmValues,
                                                 IExecutionContext pContext)
                                          throws TaurusToolException

      Deprecated.
      Warning! This method clears any existing mass processing context.

      Creates a mass processing context for other tools to read. The tool descriptor for executing this tool must have at least one output parameters of the type `EParameterTypes.MASS_PROCESSING` and would need to be modelled within an action descriptor with mass processing = `true`.

      Parameters:
        `pMassToolOutParmValues` - a map of output parameters with its mass values for each resource
        `pContext` - the execution context
      Throws:
        `TaurusToolException` - if parameters were modelled incorrectly

    - #### getOutputReader

          public IToolOutputReader getOutputReader()

      Deprecated.
      Description copied from interface: `IToolExecutor`
      Returns the implementation of the IToolOutputReader which is used for reading the tool output of the implemented IToolExecutor.

      Only required for tools which are able to execute batch jobs.

      Specified by:
        `getOutputReader` in interface `IToolExecutor`
      Returns:
        the output reader which has been set for the tool

    - #### readParmFile

          public java.util.List<java.lang.String> readParmFile(ISystemImage pImg,
                                                               java.lang.String pParmFilePath,
                                                               org.eclipse.core.runtime.IProgressMonitor pMon)
                                                        throws java.io.IOException

      Deprecated.
      Description copied from interface: `IToolExecutor`
      Converts the contents of a parameter file into a list of strings (lines).

      Only required for tools which are able to execute batch jobs.

      Specified by:
        `readParmFile` in interface `IToolExecutor`
      Parameters:
        `pImg` - the system image
        `pParmFilePath` - the parameter file path
        `pMon` - progress monitor
      Returns:
        a list of strings which represents lines of the parameter file
      Throws:
        `java.io.IOException` - if reading or interpreting the parameter file fails

Copyright © 2015 Micro Focus GmbH. All rights reserved.