@Override
public CheckOutScmResult executeCheckOutCommand( ScmProviderRepository repository, ScmFileSet fileSet,
ScmVersion scmVersion, boolean recursive )
throws ScmException
{
CheckOutScmResult result;
IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
try
{
getLogger().info(
"Attempting to checkout source for project " + iRepo.getProject().getConfigurationPath() );
String checkoutDir = System.getProperty( "checkoutDirectory" );
// Override the sandbox definition, if a checkout directory is specified for this command
Sandbox siSandbox;
if ( null != checkoutDir && checkoutDir.length() > 0 )
{
siSandbox = new Sandbox( iRepo.getAPISession(), iRepo.getProject(), checkoutDir );
iRepo.setSandbox( siSandbox );
}
else
{
siSandbox = iRepo.getSandbox();
}
getLogger().info( "Sandbox location is " + siSandbox.getSandboxDir() );
// Now attempt to create the sandbox, if it doesn't already exist
if ( siSandbox.create() )
{
// Resynchronize the new or previously created sandbox
Response res = siSandbox.resync();
// Lets output what we got from running this command
WorkItemIterator wit = res.getWorkItems();
while ( wit.hasNext() )
{
WorkItem wi = wit.next();
if ( wi.getModelType().equals( SIModelTypeName.MEMBER ) )
{
Result message = wi.getResult();
getLogger().debug( wi.getDisplayId() + " " + ( null != message ? message.getMessage() : "" ) );
}
}
int exitCode = res.getExitCode();
boolean success = ( exitCode == 0 ? true : false );
result = new CheckOutScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );
}
else
{
result = new CheckOutScmResult( "si createsandbox", "Failed to create sandbox!", "", false );
}
}
catch ( APIException aex )
{
ExceptionHandler eh = new ExceptionHandler( aex );
getLogger().error( "MKS API Exception: " + eh.getMessage() );
getLogger().info( eh.getCommand() + " exited with return code " + eh.getExitCode() );
result = new CheckOutScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
}
return result;
}