|
terp - the Codemesh Modular Template Interpreter v1.3.304 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.codemesh.terp.api.Executor.AbstractExecutor<ProcessExecutor.Result>
com.codemesh.terp.eval.executors.ProcessExecutor
public class ProcessExecutor
An executor that runs a process on behalf of the terp runtime.
The ProcessExecutor executor is registered with the terp runtime
under the ^exec name.
You need to configure at least the executable property, the
other two properties are optional. Retrieve the process execution's
result as a ProcessExecutor.Result instance directly from the
invoked execute() method.
| Nested Class Summary | |
|---|---|
static class |
ProcessExecutor.Result
The result of any ProcessExecutor invocation. |
| Nested classes/interfaces inherited from interface com.codemesh.terp.api.Executor |
|---|
Executor.AbstractExecutor<T>, Executor.ForMethod |
| Field Summary | |
|---|---|
static java.util.regex.Pattern |
EOL
The EOL pattern used to split process output into lines. |
protected static boolean |
IS_WINDOWS
True if the host's OS is Windows. |
protected static java.util.logging.Logger |
logger
The logger. |
protected java.lang.String[] |
theEnvironment
The environment strings for the newly launched process. |
protected java.io.File |
theExecutable
The executable that will be launched as a process. |
protected java.io.File |
theWorkingDir
The working directory of the newly launched process. |
protected static Converter<java.io.File> |
TO_FILE
A to file converter instance. |
protected static Converter<java.util.List> |
TO_LIST
A to list converter instance. |
| Constructor Summary | |
|---|---|
ProcessExecutor()
|
|
| Method Summary | |
|---|---|
ProcessExecutor.Result |
execute(java.util.List<java.lang.Object> args,
TerpEvaluator eval,
TerpContext ctx)
Performs the executor's action on the given arguments in the given context. |
ProcessExecutor.Result |
execute(java.lang.String... args)
|
static ProcessExecutor |
fromFile(java.io.File executable)
|
static ProcessExecutor |
fromMap(java.util.Map<java.lang.String,java.lang.Object> map)
|
static ProcessExecutor |
fromMap(ProcessExecutor exec,
java.util.Map<java.lang.String,java.lang.Object> map)
|
static ProcessExecutor |
fromString(java.lang.String executable)
|
java.util.SortedSet<java.lang.String> |
getEnvironment()
Returns the configured environment as a sorted set. |
java.io.File |
getExecutable()
Returns the executable. |
java.io.File |
getWorkingDir()
Returns the wroking directory for the process. |
java.lang.String[] |
marshallArguments(java.util.List<java.lang.Object> args)
|
boolean |
matches(java.util.List<java.lang.Object> args)
Returns true if the executor applies to the given arguments. |
void |
setEnvironment(java.util.Set<java.lang.String> env)
Sets the process' environment. |
void |
setExecutable(java.io.File exec)
Sets the file to execute. |
void |
setWorkingDir(java.io.File workingDir)
Sets the working directory for the launched process. |
| Methods inherited from class com.codemesh.terp.api.Executor.AbstractExecutor |
|---|
execute |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.io.File theExecutable
protected java.io.File theWorkingDir
protected java.lang.String[] theEnvironment
public static final java.util.regex.Pattern EOL
protected static final boolean IS_WINDOWS
protected static final Converter<java.io.File> TO_FILE
protected static final Converter<java.util.List> TO_LIST
protected static final java.util.logging.Logger logger
| Constructor Detail |
|---|
public ProcessExecutor()
| Method Detail |
|---|
public void setExecutable(java.io.File exec)
exec - the executable.public java.io.File getExecutable()
public void setWorkingDir(java.io.File workingDir)
workingDir - the working directory for the process.public java.io.File getWorkingDir()
public void setEnvironment(java.util.Set<java.lang.String> env)
env - a set of environment strings.public java.util.SortedSet<java.lang.String> getEnvironment()
public static ProcessExecutor fromString(java.lang.String executable)
public static ProcessExecutor fromFile(java.io.File executable)
public static ProcessExecutor fromMap(java.util.Map<java.lang.String,java.lang.Object> map)
public static ProcessExecutor fromMap(ProcessExecutor exec,
java.util.Map<java.lang.String,java.lang.Object> map)
public boolean matches(java.util.List<java.lang.Object> args)
Executor
args - the arguments passed to the executor.
public java.lang.String[] marshallArguments(java.util.List<java.lang.Object> args)
public ProcessExecutor.Result execute(java.lang.String... args)
public ProcessExecutor.Result execute(java.util.List<java.lang.Object> args,
TerpEvaluator eval,
TerpContext ctx)
Executor
args - the arguments.eval - the evaluator to use. Can frequently be null.ctx - the context in which the execution occurs. Can frequently be null.
|
terp - the Codemesh Modular Template Interpreter v1.3.304 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||