Gridarta Editor
net.sf.gridarta.utils.ProcessRunner Class Reference

Class to run an external process. More...

+ Inheritance diagram for net.sf.gridarta.utils.ProcessRunner:
+ Collaboration diagram for net.sf.gridarta.utils.ProcessRunner:

Classes

class  CopyOutput
 Class for reading data from a stream and appending it to a JTextArea. More...
 

Public Member Functions

void controlClear ()
 Action method for clearing the log. More...
 
void controlStart ()
 Action method for starting. More...
 
void controlStop ()
 Action method for stopping. More...
 
 ProcessRunner (@NotNull final String key, @NotNull final String[] command)
 Creates a ProcessRunner for running the given command in its directory. More...
 
void setCommand (@NotNull final String[] command)
 Set the command to be executed by this ProcessRunner. More...
 
void showDialog (@NotNull final Frame parent)
 Show a dialog if not already visible. More...
 

Private Member Functions

void createDialog (@NotNull final Frame parent)
 Create the dialog. More...
 
 ProcessRunner (@NotNull final String key, @NotNull final String[] command, @Nullable final String dir)
 Creates a ProcessRunner for running the given command in the given directory. More...
 

Private Attributes

String [] command
 The command and arguments. More...
 
final Action controlStart = ACTION_BUILDER.createAction(false, "controlStart", this)
 Action for start. More...
 
final Action controlStop = ACTION_BUILDER.createAction(false, "controlStop", this)
 Action for stop. More...
 
Window dialog
 The Dialog. More...
 
final File dir
 The working directory for the command. More...
 
final String key
 The i18n key. More...
 
final Object lock = new Object()
 The lock object for thread synchronization. More...
 
transient Process process
 The Process. More...
 
final CopyOutput stderr = new CopyOutput("stderr", stdtxt)
 CopyOutput for stderr. More...
 
final CopyOutput stdout = new CopyOutput("stdout", stdtxt)
 CopyOutput for stdout. More...
 
final JTextArea stdtxt = new JTextArea(25, 80)
 JTextArea with log. More...
 

Static Private Attributes

static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
 Action Builder. More...
 
static final Category LOG = Logger.getLogger(ProcessRunner.class)
 The Logger for printing log messages. More...
 
static final long serialVersionUID = 1L
 Serial Version. More...
 

Detailed Description

Class to run an external process.

Author
Christian.Hujer

Definition at line 52 of file ProcessRunner.java.

Constructor & Destructor Documentation

◆ ProcessRunner() [1/2]

net.sf.gridarta.utils.ProcessRunner.ProcessRunner ( @NotNull final String  key,
@NotNull final String []  command,
@Nullable final String  dir 
)
private

Creates a ProcessRunner for running the given command in the given directory.

Parameters
keyi18n key
commandthe command to run and its arguments
dirthe working directory for command

Definition at line 153 of file ProcessRunner.java.

References net.sf.gridarta.utils.ProcessRunner.key, and net.sf.gridarta.utils.ActionBuilderUtils.newLabel().

+ Here is the call graph for this function:

◆ ProcessRunner() [2/2]

net.sf.gridarta.utils.ProcessRunner.ProcessRunner ( @NotNull final String  key,
@NotNull final String []  command 
)

Creates a ProcessRunner for running the given command in its directory.

Parameters
keyi18n key
commandthe command to run and its arguments

Definition at line 181 of file ProcessRunner.java.

References net.sf.gridarta.utils.ProcessRunner.command, and net.sf.gridarta.utils.ProcessRunner.key.

Member Function Documentation

◆ controlClear()

void net.sf.gridarta.utils.ProcessRunner.controlClear ( )

Action method for clearing the log.

Definition at line 283 of file ProcessRunner.java.

◆ controlStart()

void net.sf.gridarta.utils.ProcessRunner.controlStart ( )

Action method for starting.

Definition at line 224 of file ProcessRunner.java.

References net.sf.gridarta.utils.ProcessRunner.lock, and net.sf.gridarta.utils.ProcessRunner.CopyOutput.start().

+ Here is the call graph for this function:

◆ controlStop()

void net.sf.gridarta.utils.ProcessRunner.controlStop ( )

Action method for stopping.

Definition at line 271 of file ProcessRunner.java.

◆ createDialog()

void net.sf.gridarta.utils.ProcessRunner.createDialog ( @NotNull final Frame  parent)
private

Create the dialog.

Parameters
parentowner frame to display on

Definition at line 203 of file ProcessRunner.java.

References net.sf.gridarta.utils.ActionBuilderUtils.getString().

Referenced by net.sf.gridarta.utils.ProcessRunner.showDialog().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCommand()

void net.sf.gridarta.utils.ProcessRunner.setCommand ( @NotNull final String []  command)

Set the command to be executed by this ProcessRunner.

Parameters
commandthe command to run and its arguments

Definition at line 216 of file ProcessRunner.java.

Referenced by net.sf.gridarta.action.ControlClientAction.controlClient(), and net.sf.gridarta.action.ControlServerAction.controlServer().

+ Here is the caller graph for this function:

◆ showDialog()

void net.sf.gridarta.utils.ProcessRunner.showDialog ( @NotNull final Frame  parent)

Show a dialog if not already visible.

Parameters
parentowner frame to display on

Definition at line 189 of file ProcessRunner.java.

References net.sf.gridarta.utils.ProcessRunner.createDialog().

Referenced by net.sf.gridarta.action.ControlClientAction.controlClient(), and net.sf.gridarta.action.ControlServerAction.controlServer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ ACTION_BUILDER

final ActionBuilder net.sf.gridarta.utils.ProcessRunner.ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
staticprivate

Action Builder.

Definition at line 69 of file ProcessRunner.java.

◆ command

String [] net.sf.gridarta.utils.ProcessRunner.command
private

The command and arguments.

include

Definition at line 90 of file ProcessRunner.java.

Referenced by net.sf.gridarta.utils.ProcessRunner.ProcessRunner().

◆ controlStart

final Action net.sf.gridarta.utils.ProcessRunner.controlStart = ACTION_BUILDER.createAction(false, "controlStart", this)
private

Action for start.

include

Definition at line 131 of file ProcessRunner.java.

◆ controlStop

final Action net.sf.gridarta.utils.ProcessRunner.controlStop = ACTION_BUILDER.createAction(false, "controlStop", this)
private

Action for stop.

include

Definition at line 138 of file ProcessRunner.java.

◆ dialog

Window net.sf.gridarta.utils.ProcessRunner.dialog
private

The Dialog.

include

Definition at line 76 of file ProcessRunner.java.

◆ dir

final File net.sf.gridarta.utils.ProcessRunner.dir
private

The working directory for the command.

include

Definition at line 97 of file ProcessRunner.java.

◆ key

final String net.sf.gridarta.utils.ProcessRunner.key
private

The i18n key.

include

Definition at line 83 of file ProcessRunner.java.

Referenced by net.sf.gridarta.utils.ProcessRunner.ProcessRunner().

◆ lock

final Object net.sf.gridarta.utils.ProcessRunner.lock = new Object()
private

The lock object for thread synchronization.

Definition at line 144 of file ProcessRunner.java.

Referenced by net.sf.gridarta.utils.ProcessRunner.controlStart().

◆ LOG

final Category net.sf.gridarta.utils.ProcessRunner.LOG = Logger.getLogger(ProcessRunner.class)
staticprivate

The Logger for printing log messages.

Definition at line 58 of file ProcessRunner.java.

◆ process

transient Process net.sf.gridarta.utils.ProcessRunner.process
private

The Process.

Definition at line 103 of file ProcessRunner.java.

◆ serialVersionUID

final long net.sf.gridarta.utils.ProcessRunner.serialVersionUID = 1L
staticprivate

Serial Version.

Definition at line 63 of file ProcessRunner.java.

◆ stderr

final CopyOutput net.sf.gridarta.utils.ProcessRunner.stderr = new CopyOutput("stderr", stdtxt)
private

CopyOutput for stderr.

include

Definition at line 124 of file ProcessRunner.java.

◆ stdout

final CopyOutput net.sf.gridarta.utils.ProcessRunner.stdout = new CopyOutput("stdout", stdtxt)
private

CopyOutput for stdout.

include

Definition at line 117 of file ProcessRunner.java.

◆ stdtxt

final JTextArea net.sf.gridarta.utils.ProcessRunner.stdtxt = new JTextArea(25, 80)
private

JTextArea with log.

include

Definition at line 110 of file ProcessRunner.java.


The documentation for this class was generated from the following file: