getLogger().info( "Attempting to display scm file information for file: " + filename );
if ( null == filename || filename.length() == 0 )
{
throw new ScmException( "A single filename is required to execute the fileinfo command!" );
}
ScmResult result;
IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
APISession api = iRepo.getAPISession();
Commandline shell = new Commandline();
shell.setWorkingDirectory( workingDirectory );
shell.setExecutable( "si" );
shell.createArg().setValue( "memberinfo" );
shell.createArg().setValue( "--hostname=" + api.getHostName() );
shell.createArg().setValue( "--port=" + api.getPort() );
shell.createArg().setValue( "--user=" + api.getUserName() );
shell.createArg().setValue( '"' + filename + '"' );
IntegrityFileInfoConsumer shellConsumer = new IntegrityFileInfoConsumer( getLogger() );
try
{
getLogger().debug( "Executing: " + shell.getCommandline() );
int exitCode = CommandLineUtils.executeCommandLine( shell, shellConsumer,
new CommandLineUtils.StringStreamConsumer() );
boolean success = ( exitCode == 128 ? false : true );
result = new ScmResult( shell.getCommandline().toString(), "", "Exit Code: " + exitCode, success );
}
catch ( CommandLineException cle )
{
getLogger().error( "Command Line Exception: " + cle.getMessage() );
result = new ScmResult( shell.getCommandline().toString(), cle.getMessage(), "", false );
}
return result;
}