Gridarta Editor
net.sf.gridarta.utils.ProcessRunner Class Reference
+ Inheritance diagram for net.sf.gridarta.utils.ProcessRunner:
+ Collaboration diagram for net.sf.gridarta.utils.ProcessRunner:

Classes

class  CopyOutput
 

Public Member Functions

void controlClear ()
 
void controlStart ()
 
void controlStop ()
 
 ProcessRunner (@NotNull final String key, @NotNull final String @NotNull[] command)
 
void setCommand (@NotNull final String @NotNull[] command)
 
void showDialog (@NotNull final Frame parent)
 

Private Member Functions

void createDialog (@NotNull final Frame parent)
 
 ProcessRunner (@NotNull final String key, @NotNull final String @NotNull[] command, @Nullable final String dir)
 

Private Attributes

String[] command
 
final Action controlStart = ACTION_BUILDER.createAction(false, "controlStart", this)
 
final Action controlStop = ACTION_BUILDER.createAction(false, "controlStop", this)
 
Window dialog
 
final File dir
 
final String key
 
final Object lock = new Object()
 
transient Process process
 
final CopyOutput stderr = new CopyOutput("stderr", stdtxt)
 
final CopyOutput stdout = new CopyOutput("stdout", stdtxt)
 
final JTextArea stdtxt = new JTextArea(25, 80)
 

Static Private Attributes

static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
 
static final Category LOG = Logger.getLogger(ProcessRunner.class)
 
static final long serialVersionUID = 1L
 

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 @NotNull[]  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.ACTION_BUILDER, net.sf.gridarta.utils.ProcessRunner.command, net.sf.gridarta.utils.ProcessRunner.controlStart, net.sf.gridarta.utils.ProcessRunner.controlStop, net.sf.gridarta.utils.ProcessRunner.dir, net.sf.gridarta.utils.ProcessRunner.key, net.sf.gridarta.utils.ActionBuilderUtils.newLabel(), and net.sf.gridarta.utils.ProcessRunner.stdtxt.

+ Here is the call graph for this function:

◆ ProcessRunner() [2/2]

net.sf.gridarta.utils.ProcessRunner.ProcessRunner ( @NotNull final String  key,
@NotNull final String @NotNull[]  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.

References net.sf.gridarta.utils.ProcessRunner.stdtxt.

◆ controlStart()

◆ controlStop()

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

◆ createDialog()

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

Creates the dialog.

Parameters
parentthe owner frame to display on

Definition at line 203 of file ProcessRunner.java.

References net.sf.gridarta.utils.ProcessRunner.ACTION_BUILDER, net.sf.gridarta.utils.ProcessRunner.dialog, net.sf.gridarta.utils.ActionBuilderUtils.getString(), and net.sf.gridarta.utils.ProcessRunner.key.

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 @NotNull[]  command)

Sets the command to be executed by this ProcessRunner.

Parameters
commandthe command to run and its arguments

Definition at line 216 of file ProcessRunner.java.

References net.sf.gridarta.utils.ProcessRunner.command.

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(), and net.sf.gridarta.utils.ProcessRunner.dialog.

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

◆ command

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

◆ controlStart

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

◆ controlStop

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

◆ dialog

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

The Dialog. @serial include

Definition at line 76 of file ProcessRunner.java.

Referenced by net.sf.gridarta.utils.ProcessRunner.createDialog(), and net.sf.gridarta.utils.ProcessRunner.showDialog().

◆ dir

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

The working directory for the command. @serial include

Definition at line 97 of file ProcessRunner.java.

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

◆ key

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

The i18n key. @serial include

Definition at line 83 of file ProcessRunner.java.

Referenced by net.sf.gridarta.utils.ProcessRunner.createDialog(), and 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.

Referenced by net.sf.gridarta.utils.ProcessRunner.controlStart(), and net.sf.gridarta.utils.ProcessRunner.CopyOutput.start().

◆ process

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

◆ 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. @serial include

Definition at line 124 of file ProcessRunner.java.

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

◆ stdout

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

CopyOutput for stdout. @serial include

Definition at line 117 of file ProcessRunner.java.

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

◆ stdtxt

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

JTextArea with log. @serial include

Definition at line 110 of file ProcessRunner.java.

Referenced by net.sf.gridarta.utils.ProcessRunner.controlClear(), and net.sf.gridarta.utils.ProcessRunner.ProcessRunner().


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