org.codehaus.mojo.keytool
Class DefaultKeyTool

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.codehaus.mojo.keytool.DefaultKeyTool
All Implemented Interfaces:
KeyTool, org.codehaus.plexus.logging.LogEnabled

public class DefaultKeyTool
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements KeyTool

Default implementation of component KeyTool.

Since:
1.1
Version:
$Id: DefaultKeyTool.java 16259 2012-04-08 11:11:07Z tchemit $
Author:
tchemit
Plexus component:
role:
"org.codehaus.mojo.keytool.KeyTool"
role-hint:
"default"

Field Summary
protected  KeyToolCommandLineBuilder builder
          Command line builder.
protected  String keyToolFile
          The location of the keyTool executable file.
 
Fields inherited from interface org.codehaus.mojo.keytool.KeyTool
ROLE
 
Constructor Summary
DefaultKeyTool()
           
 
Method Summary
protected  org.codehaus.plexus.util.cli.Commandline createCommandLine(KeyToolRequest request)
          Creates the commandline given the request.
 KeyToolResult execute(KeyToolRequest request)
          Executes KeyTool tool using the parameters specified by the given invocation request.
protected  KeyToolResult executeCommandLine(org.codehaus.plexus.util.cli.Commandline cli, KeyToolRequest request)
          Launch execution of the given commandline
protected  String findExecutable(String command, String homeDir, String[] subDirs)
          Finds the specified command in any of the given sub directories of the specified JDK/JRE home directory.
protected  String findKeyToolExecutable()
          Finds the keeytool executable location.
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyToolFile

protected String keyToolFile
The location of the keyTool executable file.


builder

protected KeyToolCommandLineBuilder builder
Command line builder.

Plexus requirement
Constructor Detail

DefaultKeyTool

public DefaultKeyTool()
Method Detail

execute

public KeyToolResult execute(KeyToolRequest request)
                      throws KeyToolException
Executes KeyTool tool using the parameters specified by the given invocation request.

Specified by:
execute in interface KeyTool
Parameters:
request - The invocation request to execute, must not be null.
Returns:
The result of the KeyTool invocation, never null.
Throws:
KeyToolException - if something fails while init the command

createCommandLine

protected org.codehaus.plexus.util.cli.Commandline createCommandLine(KeyToolRequest request)
                                                              throws KeyToolException
Creates the commandline given the request.

Parameters:
request - keytool request
Returns:
the prepared command line object
Throws:
KeyToolException - if could not find the keytool command

executeCommandLine

protected KeyToolResult executeCommandLine(org.codehaus.plexus.util.cli.Commandline cli,
                                           KeyToolRequest request)
Launch execution of the given commandline

Parameters:
cli - the commandline client ready to be executed
request - the incoming keytool request
Returns:
result of the execution of the commandline

findKeyToolExecutable

protected String findKeyToolExecutable()
                                throws IOException
Finds the keeytool executable location.

Returns:
location of the keyttol executable
Throws:
IOException - if could not find the executable

findExecutable

protected String findExecutable(String command,
                                String homeDir,
                                String[] subDirs)
Finds the specified command in any of the given sub directories of the specified JDK/JRE home directory.

Parameters:
command - The command to find, must not be null.
homeDir - The home directory to search in, may be null.
subDirs - The sub directories of the home directory to search in, must not be null.
Returns:
The (absolute) path to the command if found, null otherwise.


Copyright © 2005-2012 Codehaus. All Rights Reserved.