catch ( IOException e )
{
throw new CommandLineConfigurationException( e.getMessage(), e );
}
Commandline cli = new Commandline();
cli.setExecutable( jarSignerFile );
cli.setWorkingDirectory( request.getWorkingDirectory() );
if ( request.isVerbose() )
{
cli.createArg().setValue( "-verbose" );
}
String keystore = request.getKeystore();
if ( !StringUtils.isEmpty( keystore ) )
{
cli.createArg().setValue( "-keystore" );
cli.createArg().setValue( keystore );
}
if ( request.isProtectedAuthenticationPath() )
{
cli.createArg().setValue( "-protected" );
}
String maxMemory = request.getMaxMemory();
if ( StringUtils.isNotEmpty( maxMemory ) )
{
cli.createArg().setValue( "-J-Xmx" + maxMemory );
}
String[] arguments = request.getArguments();
if ( arguments != null )
{
cli.addArguments( arguments );
}
if ( request instanceof JarSignerSignRequest )
{
build( (JarSignerSignRequest) request, cli );
}
if ( request instanceof JarSignerVerifyRequest )
{
build( (JarSignerVerifyRequest) request, cli );
}
cli.createArg().setFile( request.getArchive() );
String alias = request.getAlias();
if ( !StringUtils.isEmpty( alias ) )
{
cli.createArg().setValue( alias );
}
return cli;
}