terp - the Codemesh Modular
Template Interpreter v1.3.304

com.codemesh.terp.eval.executors
Class JavaToolExecutor<T extends JavaToolExecutor>

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.JavaToolExecutor<T>
All Implemented Interfaces:
Executor<ProcessExecutor.Result>, Named, Versioned, java.io.Serializable
Direct Known Subclasses:
JarExecutor, JavacExecutor, JavadocExecutor

public abstract class JavaToolExecutor<T extends JavaToolExecutor>
extends BatchExecutor
implements Named, Versioned, java.io.Serializable

The baseclass for Java tool executors. Java tools are the executables in the JDK's bin directory. They include tools such as javac, jaavadoc, jar, etc.

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 bIsWindows
           
protected static java.lang.String COMPILER
           
protected static java.lang.String EXECUTABLE
           
protected static java.lang.String JAR_EXE_NAME
           
protected static java.lang.String JAVA_EXE_NAME
           
protected static java.lang.String JAVAC_EXE_NAME
           
protected static java.lang.String JAVADOC_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  Jdk theJdk
           
protected static OS theOS
           
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
theExecFlag, theShell, TO_STRING
 
Fields inherited from class com.codemesh.terp.eval.executors.ProcessExecutor
EOL, IS_WINDOWS, theEnvironment, theExecutable, theWorkingDir, TO_LIST
 
Constructor Summary
JavaToolExecutor()
           
 
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
<T extends JavaToolExecutor>
JavaToolExecutor<T>
fromMap(JavaToolExecutor<T> exec, java.util.Map<java.lang.String,java.lang.Object> map)
           
protected abstract  java.lang.String getExeName()
          Returns the tool's executable name.
 Jdk getJdk()
          Returns the JDK to which the java compiler executor belongs.
 java.lang.String getMaker()
          Returns a code for the maker of the JRE.
abstract  java.lang.String getName()
          Returns the named object's name.
protected abstract  T getTool()
          Returns the tool from the JDK.
 Version getVersion()
          Returns the Java version as reported by running the java executable with the -version argument.
 void setJdk(Jdk jdk)
          Sets the JDK to which this compiler executor belongs.
 
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
createEnvironment, getExecFlag, getShell, marshallArguments, setExecFlag, setShell, shellFromFile, shellFromMap, shellFromMap, shellFromString
 
Methods inherited from class com.codemesh.terp.eval.executors.ProcessExecutor
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

JAVAC_EXE_NAME

protected static final java.lang.String JAVAC_EXE_NAME

JAVADOC_EXE_NAME

protected static final java.lang.String JAVADOC_EXE_NAME

JAR_EXE_NAME

protected static final java.lang.String JAR_EXE_NAME

theOS

protected static final OS theOS

bIsWindows

protected static final boolean bIsWindows

COMPILER

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

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

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

theJdk

protected Jdk theJdk
Constructor Detail

JavaToolExecutor

public JavaToolExecutor()
Method Detail

getExeName

protected abstract java.lang.String getExeName()
Returns the tool's executable name. This method is implemented by concrete subclasses.

Returns:
the platform-appropriate executable name.

getTool

protected abstract T getTool()
Returns the tool from the JDK. This method is implemented by concrete subclasses.

Returns:
the tool instance.

getName

public abstract java.lang.String getName()
Returns the named object's name. This method is implemented by concrete subclasses.

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

setJdk

public void setJdk(Jdk jdk)
Sets the JDK to which this compiler executor belongs.

Parameters:
jdk - the owning JDK.

getJdk

public Jdk getJdk()
Returns the JDK to which the java compiler executor belongs.

Returns:
the owning JDK.

getVersion

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

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

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 <T extends JavaToolExecutor> JavaToolExecutor<T> fromMap(JavaToolExecutor<T> 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.304

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