terp - the Codemesh Modular
Template Interpreter v1.3.337

com.codemesh.terp.eval.executors
Class JavaExecutor

java.lang.Object
  extended by com.codemesh.terp.api.Executor.AbstractExecutor<ProcessExecutor.Result>
      extended by com.codemesh.terp.eval.executors.ProcessExecutor
          extended by com.codemesh.terp.eval.executors.ShellExecutor
              extended by com.codemesh.terp.eval.executors.BatchExecutor
                  extended by com.codemesh.terp.eval.executors.JavaExecutor
All Implemented Interfaces:
Executor<ProcessExecutor.Result>, Named, Versioned, java.io.Serializable

public class JavaExecutor
extends BatchExecutor
implements Named, Versioned, java.io.Serializable

An executor for Java programs.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.codemesh.terp.eval.executors.ProcessExecutor
ProcessExecutor.Result
 
Nested classes/interfaces inherited from interface com.codemesh.terp.api.Executor
Executor.AbstractExecutor<T>, Executor.ForMethod
 
Field Summary
protected static boolean bIsMacOS
           
protected static boolean bIsWindows
           
protected static java.lang.String EXECUTABLE
           
protected static java.lang.String JAVA_EXE_NAME
           
protected static java.lang.String JDK
           
protected static java.lang.String JRE
           
protected static java.util.logging.Logger logger
           
protected static java.lang.String MAKER
           
protected static java.util.regex.Pattern SUN_JAVA_VERSION
           
protected  Jre theJre
           
protected  java.lang.String theMaker
           
protected static OS theOS
           
protected  Version theVersion
           
protected static ToFile TO_FILE
           
protected static ToJdk TO_JDK
           
protected static ToJre TO_JRE
           
protected static ToVersion TO_VERSION
           
protected static java.lang.String VERSION
           
 
Fields inherited from class com.codemesh.terp.eval.executors.ShellExecutor
theAddedEnvSettings, theExecFlag, theRemovedEnvSettings, theShell, TO_STRING
 
Fields inherited from class com.codemesh.terp.eval.executors.ProcessExecutor
EOL, IS_WINDOWS, theEnvironment, theExecutable, theTerpCmdVar, theWorkingDir, TO_LIST
 
Constructor Summary
JavaExecutor()
           
 
Method Summary
 ProcessExecutor.Result batchExecute(java.util.List<java.lang.Object> args)
           
 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.
static JavaExecutor fromMap(JavaExecutor exec, java.util.Map<java.lang.String,java.lang.Object> map)
           
 Jre getJre()
          Returns the JRE to which this Java executable belongs.
 java.lang.String getMaker()
          Returns a code for the maker of the JRE.
 java.lang.String getName()
          Returns the named object's name.
 Version getVersion()
          Returns the Java version as reported by running the executable with the -version argument.
 void setJre(Jre jre)
           
 void setMaker(java.lang.String maker)
          Sets the Java executor's maker code.
 
Methods inherited from class com.codemesh.terp.eval.executors.BatchExecutor
batchFromFile, batchFromMap, batchFromMap, batchFromString, writeCommandsFile
 
Methods inherited from class com.codemesh.terp.eval.executors.ShellExecutor
addToEnvironment, createEnvironment, getExecFlag, getShell, marshallArguments, removeFromEnvironment, setExecFlag, setShell, shellFromFile, shellFromMap, shellFromMap, shellFromString
 
Methods inherited from class com.codemesh.terp.eval.executors.ProcessExecutor
appendToEnvironment, execute, fromFile, fromMap, fromMap, fromString, getEnvironment, getExecutable, getWorkingDir, matches, setEnvironment, setExecutable, setWorkingDir
 
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

JAVA_EXE_NAME

protected static final java.lang.String JAVA_EXE_NAME

theOS

protected static final OS theOS

bIsWindows

protected static final boolean bIsWindows

bIsMacOS

protected static final boolean bIsMacOS

EXECUTABLE

protected static final java.lang.String EXECUTABLE
See Also:
Constant Field Values

JRE

protected static final java.lang.String JRE
See Also:
Constant Field Values

JDK

protected static final java.lang.String JDK
See Also:
Constant Field Values

MAKER

protected static final java.lang.String MAKER
See Also:
Constant Field Values

VERSION

protected static final java.lang.String VERSION
See Also:
Constant Field Values

SUN_JAVA_VERSION

protected static final java.util.regex.Pattern SUN_JAVA_VERSION

TO_VERSION

protected static final ToVersion TO_VERSION

TO_FILE

protected static final ToFile TO_FILE

TO_JRE

protected static final ToJre TO_JRE

TO_JDK

protected static final ToJdk TO_JDK

logger

protected static final java.util.logging.Logger logger

theJre

protected Jre theJre

theVersion

protected Version theVersion

theMaker

protected java.lang.String theMaker
Constructor Detail

JavaExecutor

public JavaExecutor()
Method Detail

setJre

public void setJre(Jre jre)

getJre

public Jre getJre()
Returns the JRE to which this Java executable belongs.

Returns:
the owning JRE.

getName

public java.lang.String getName()
Returns the named object's name.

Specified by:
getName in interface Named
Returns:
the name.

getVersion

public Version getVersion()
Returns the Java version as reported by running the executable with the -version argument.

Specified by:
getVersion in interface Versioned
Returns:
the Java version.

setMaker

public void setMaker(java.lang.String maker)
Sets the Java executor's maker code.

Parameters:
maker - the maker code.
See Also:
for a list of supported maker codes.

getMaker

public java.lang.String getMaker()
Returns a code for the maker of the JRE. Currently supported maker codes include: sun, ibm, oracle, and bea.

Returns:
the maker code.

fromMap

public static JavaExecutor fromMap(JavaExecutor exec,
                                   java.util.Map<java.lang.String,java.lang.Object> map)

execute

public ProcessExecutor.Result execute(java.util.List<java.lang.Object> args,
                                      TerpEvaluator eval,
                                      TerpContext ctx)
Description copied from interface: Executor
Performs the executor's action on the given arguments in the given context. Typically, your custom executor will implement this method to provide its core functionality.

Specified by:
execute in interface Executor<ProcessExecutor.Result>
Overrides:
execute in class BatchExecutor
Parameters:
args - the arguments.
eval - the evaluator to use. Can frequently be null.
ctx - the context in which the execution occurs. Can frequently be null.
Returns:
the execution result.

batchExecute

public ProcessExecutor.Result batchExecute(java.util.List<java.lang.Object> args)

terp - the Codemesh Modular
Template Interpreter v1.3.337

Copyright © 2008-2016 by Codemesh, Inc. All Rights Reserved.