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 );
}
String storepass = request.getStorepass();
if ( !StringUtils.isEmpty( storepass ) )
{
cli.createArg().setValue( "-storepass" );
Arg arg = cli.createArg();
arg.setValue( storepass );
arg.setMask( true );
}
String storetype = request.getStoretype();
if ( !StringUtils.isEmpty( storetype ) )
{
cli.createArg().setValue( "-storetype" );
cli.createArg().setValue( storetype );
}
String providerName = request.getProviderName();
if ( !StringUtils.isEmpty( providerName ) )
{
cli.createArg().setValue( "-providerName" );
cli.createArg().setValue( providerName );
}
String providerClass = request.getProviderClass();
if ( !StringUtils.isEmpty( providerClass ) )
{
cli.createArg().setValue( "-providerClass" );
cli.createArg().setValue( providerClass );
}
String providerArg = request.getProviderArg();
if ( !StringUtils.isEmpty( providerArg ) )
{
cli.createArg().setValue( "-providerArg" );
cli.createArg().setValue( providerArg );
}
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;
}