Class AbstractJavaTool<Request extends JavaToolRequest>
java.lang.Object
org.apache.maven.shared.utils.cli.javatool.AbstractJavaTool<Request>
- Type Parameters:
 Request- Tool-specific request type
- All Implemented Interfaces:
 JavaTool<Request>
public abstract class AbstractJavaTool<Request extends JavaToolRequest>
extends Object
implements JavaTool<Request>
Abstract implementation of a 
JavaTool.- Since:
 - 0.5
 - Author:
 - Tony Chemit
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprotected abstract CommandlinecreateCommandLine(Request request, String javaToolFileLocation) Create the command line object given the request.protected JavaToolResultprotected StreamConsumercreateSystemErrorStreamConsumer(Request request) protected InputStreamprotected StreamConsumercreateSystemOutStreamConsumer(Request request) Execute the input request and then returns the result of the execution.protected JavaToolResultexecuteCommandLine(Commandline cli, Request request) protected StringReturn the name of the java tool.protected org.slf4j.LoggervoidsetToolchain(Object toolchain) Set an optional tool chain to find out the java tool executable location. 
- 
Constructor Details
- 
AbstractJavaTool
- Parameters:
 javaToolName- The name of the java tool.
 
 - 
 - 
Method Details
- 
createCommandLine
protected abstract Commandline createCommandLine(Request request, String javaToolFileLocation) throws JavaToolException Create the command line object given the request.- Parameters:
 request- User request on the java tooljavaToolFileLocation- Location of the java tool file to use- Returns:
 - the command line
 - Throws:
 JavaToolException- if could not create the command line from the request
 - 
getLogger
protected org.slf4j.Logger getLogger() - 
getJavaToolName
Return the name of the java tool. This is exactly the name (without his extension) of the executable to find in the
jdk/bindirectory.For example:
jarsigner, keytool, javadoc, ...- Specified by:
 getJavaToolNamein interfaceJavaTool<Request extends JavaToolRequest>- Returns:
 - the name of the java tool.
 
 - 
setToolchain
Set an optional tool chain to find out the java tool executable location.- Specified by:
 setToolchainin interfaceJavaTool<Request extends JavaToolRequest>- Parameters:
 toolchain- optional tool chain to find out the java tool executable location. To avoid direct dependency on Maven core, this parameter is an Object that will be used as Toolchain through reflection
 - 
execute
Execute the input request and then returns the result of the execution.
If could not create the java tool invocation, a
JavaToolExceptionwill be thrown.If execution fails, then the result will have a none-zero
JavaToolResult.getExitCode()and hisJavaToolResult.getExecutionException()will be filled with the error, otherwise the exist code will be zero.- Specified by:
 executein interfaceJavaTool<Request extends JavaToolRequest>- Parameters:
 request- the request to perform- Returns:
 - the result of the tool execution
 - Throws:
 JavaToolException- if could not create the java tool invocation
 - 
createSystemInputStream
- Returns:
 InputStream
 - 
createSystemErrorStreamConsumer
- Parameters:
 request- The request.- Returns:
 StreamConsumer
 - 
createSystemOutStreamConsumer
- Parameters:
 request- The request.- Returns:
 StreamConsumer
 - 
createResult
- Returns:
 - The JavaToolResult.
 
 - 
findJavaToolExecutable
- Returns:
 - The location of the java tool executable.
 
 
 -