public class ProcessObserver extends Object
handlers
about lines of characters that have been written
by a process to both stdout
and stderr
output streams.
TODO Develop External Process Invocation API (EPIA) - idea: use velocity to generate input files + command-line from current context - address that executables might have different extensions (and paths) on different OS (.exe, .bat, .sh) Process Descriptor - name - description - n input descriptors (descriptor: name + type + description) - n output descriptors (descriptor: name + type + description) - n parameter descriptors (descriptor: name + type + description + attributes) - 1 command-line velocity template - 1 relative working directory template - n environment variables templates - n velocity file templates - n static files - n static archives to unpack Process Invocation - prepare context: set environment variables set inputs, outputs, parameters
Modifier and Type | Class and Description |
---|---|
static class |
ProcessObserver.DefaultHandler
Default implementation of
ProcessObserver.Handler , which simply prints observations to the console. |
static interface |
ProcessObserver.Handler
A handler that will be notified during the observation of the process.
|
static class |
ProcessObserver.Mode
The observation mode.
|
static interface |
ProcessObserver.ObservedProcess
The observed process.
|
Constructor and Description |
---|
ProcessObserver(Process process)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ProcessObserver.Handler |
getHandler() |
ProcessObserver.Mode |
getMode() |
String |
getName() |
int |
getPollPeriod() |
ProgressMonitor |
getProgressMonitor() |
ProcessObserver |
setHandler(ProcessObserver.Handler handler)
Default-handler prints to stdout / stderr.
|
ProcessObserver |
setMode(ProcessObserver.Mode mode)
Default is
ProcessObserver.Mode.BLOCKING . |
ProcessObserver |
setName(String name)
Default is "process".
|
ProcessObserver |
setPollPeriod(int pollPeriod)
Default is 500 milliseconds.
|
ProcessObserver |
setProgressMonitor(ProgressMonitor progressMonitor)
Default does nothing.
|
ProcessObserver.ObservedProcess |
start()
Starts observing the given process.
|
public ProcessObserver(Process process)
process
- The process to be observedpublic String getName()
public ProcessObserver setName(String name)
name
- A name that represents the process.public ProcessObserver.Handler getHandler()
public ProcessObserver setHandler(ProcessObserver.Handler handler)
handler
- A handler.public ProgressMonitor getProgressMonitor()
public ProcessObserver setProgressMonitor(ProgressMonitor progressMonitor)
progressMonitor
- A progress monitor.public ProcessObserver.Mode getMode()
public ProcessObserver setMode(ProcessObserver.Mode mode)
ProcessObserver.Mode.BLOCKING
.mode
- The observation mode.public int getPollPeriod()
public ProcessObserver setPollPeriod(int pollPeriod)
pollPeriod
- Time in milliseconds between successive process status queries.public ProcessObserver.ObservedProcess start()
Copyright © 2014–2022 European Space Agency (ESA). All rights reserved.