Class NativeProcess

java.lang.Object
mgui.pipelines.PipelineProcess
mgui.pipelines.NativeProcess
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, InterfaceObject, NamedObject, TreeObject, CleanableObject, XMLObject, IconObject

public class NativeProcess
extends PipelineProcess
Represents a native process; i.e., one which runs from the OS command console.

Specified by the command, which is the native executable; and the path, which is a path to the desired version (an empty string results in the system default).

Since:
1.0
Version:
1.0
Author:
Andrew Reid
See Also:
Serialized Form
  • Field Details

    • command

      protected java.lang.String command
    • path

      protected java.lang.String path
    • set_operator

      protected java.lang.String set_operator
    • current_system_processes

      protected java.util.HashMap<java.lang.Long,​java.lang.Process> current_system_processes
  • Constructor Details

    • NativeProcess

      public NativeProcess​(PipelineProcess process)
    • NativeProcess

      public NativeProcess​(java.lang.String name, java.lang.String command)
    • NativeProcess

      public NativeProcess​(java.lang.String name, java.lang.String command, java.lang.String logger)
    • NativeProcess

      public NativeProcess​(java.lang.String name, java.lang.String command, java.lang.String logger, java.lang.String path)
    • NativeProcess

      public NativeProcess​(java.lang.String name, java.lang.String command, java.lang.String logger, java.lang.String path, java.lang.String set_operator)
  • Method Details

    • setFromProcess

      public void setFromProcess​(PipelineProcess process)
      Overrides:
      setFromProcess in class PipelineProcess
    • showHelp

      public void showHelp()
      Description copied from class: PipelineProcess
      Attempt to display the associated help message
      Specified by:
      showHelp in class PipelineProcess
    • getObjectIcon

      public javax.swing.Icon getObjectIcon()
      Description copied from interface: IconObject
      Returns the Icon associated with this object.
      Specified by:
      getObjectIcon in interface IconObject
      Overrides:
      getObjectIcon in class PipelineProcess
      Returns:
    • getCommand

      public java.lang.String getCommand()
      Returns the native command for this process.
      Returns:
    • setSetOperator

      public void setSetOperator​(java.lang.String set_operator)
      Sets the set operator character for this process. E.g., for a function expecting -param_name param_value, the character is a space (default). For -param_name=param_value, the character is "=".
      Parameters:
      command -
    • getSetOperator

      public java.lang.String getSetOperator()
      Returns the set operator character for this process. E.g., for a function expecting -param_name param_value, the character is a space (default). For -param_name=param_value, the character is "=".
      Returns:
    • setCommand

      public void setCommand​(java.lang.String command)
      Sets the native command for this process.
      Parameters:
      command -
    • getPath

      public java.lang.String getPath()
      Returns the path to the native binaries for this process.
      Returns:
    • setPath

      public void setPath​(java.lang.String path)
      Sets the path to the native binaries for this process.
      Parameters:
      command -
    • getInputArgs

      public java.lang.String[] getInputArgs​(java.lang.String[] args, java.lang.String input_file)
      Description copied from class: PipelineProcess
      Alters an argument array to set an input file for this process, and returns the result.
      Specified by:
      getInputArgs in class PipelineProcess
      Returns:
    • getOutputArgs

      public java.lang.String[] getOutputArgs​(java.lang.String[] args, java.lang.String output_file)
      Description copied from class: PipelineProcess
      Alters an argument array to set an output file for this process, and returns the result.
      Specified by:
      getOutputArgs in class PipelineProcess
      Returns:
    • getCommand

      protected java.lang.String getCommand​(java.lang.String[] args)
    • run

      public boolean run​(java.lang.String[] args, long uid) throws PipelineException
      Description copied from class: PipelineProcess
      Runs an instance of this process
      Specified by:
      run in class PipelineProcess
      Parameters:
      args - Arguments for the process
      Returns:
      Throws:
      PipelineException
    • interrupt

      public boolean interrupt​(long uid) throws PipelineException
      Description copied from class: PipelineProcess
      Interrupts an instance of this process
      Specified by:
      interrupt in class PipelineProcess
      Parameters:
      uid - The unique identifier of the process instance to interrupt
      Returns:
      Throws:
      PipelineException
    • getFailureMessage

      public java.lang.String getFailureMessage()
      Description copied from class: PipelineProcess
      Returns the message to be displayed when this process has failed.
      Specified by:
      getFailureMessage in class PipelineProcess
      Returns:
    • getSuccessMessage

      public java.lang.String getSuccessMessage()
      Description copied from class: PipelineProcess
      Returns the message to be displayed when this process has succeeded.
      Specified by:
      getSuccessMessage in class PipelineProcess
      Returns:
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer, ProgressUpdater progressBar) throws java.io.IOException
      Description copied from interface: XMLObject
      Writes the XML representation of this object to file, as XMLType.Normal. The default format of XMLFormat.Ascii will be used. The basic contract for this method is that it should not write a newline character at its start or end.
      Specified by:
      writeXML in interface XMLObject
      Overrides:
      writeXML in class PipelineProcess
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      progressBar - Optional progress updater (may be null)
      Throws:
      java.io.IOException
    • getXML

      public java.lang.String getXML​(int tab)
      Description copied from interface: XMLObject
      Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use the XMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater) functions to write larger objects to file.
      Specified by:
      getXML in interface XMLObject
      Overrides:
      getXML in class PipelineProcess
      Parameters:
      tab - The number of tabs to place before the opening XML wrapper
      Returns:
    • clone

      public java.lang.Object clone()
      Specified by:
      clone in class PipelineProcess