ScmVersion version, boolean recursive )
throws ScmException
{
if ( fileSet.getFileList().size() != 0 )
{
throw new ScmException( "This provider doesn't support checking out subsets of a project" );
}
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "executing checkout command..." );
}
SynergyScmProviderRepository repo = (SynergyScmProviderRepository) repository;
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( fileSet.toString() );
}
String ccmAddr = SynergyUtil.start( getLogger(), repo.getUser(), repo.getPassword(), null );
File waPath;
try
{
String projectSpec =
SynergyUtil.getWorkingProject( getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr );
if ( projectSpec != null )
{
if ( getLogger().isInfoEnabled() )
{
getLogger().info( "A working project already exists [" + projectSpec + "]." );
}
SynergyUtil.synchronize( getLogger(), projectSpec, ccmAddr );
}
else
{
SynergyUtil.checkoutProject( getLogger(), null, repo.getProjectSpec(), version,
repo.getProjectPurpose(), repo.getProjectRelease(), ccmAddr );
projectSpec =
SynergyUtil.getWorkingProject( getLogger(), repo.getProjectSpec(), repo.getUser(), ccmAddr );
if ( getLogger().isInfoEnabled() )
{
getLogger().info( "A new working project [" + projectSpec + "] was created." );
}
}
SynergyUtil.reconfigure( getLogger(), projectSpec, ccmAddr );
waPath = SynergyUtil.getWorkArea( getLogger(), projectSpec, ccmAddr );
}
finally
{
SynergyUtil.stop( getLogger(), ccmAddr );
}
File source = new File( waPath, repo.getProjectName() );
if ( getLogger().isInfoEnabled() )
{
getLogger().info(
"We will now copy files from Synergy Work Area [" + source
+ "] to expected folder [" + fileSet.getBasedir() + "]" );
}
// Move files to the expected folder
try
{
FileUtils.copyDirectoryStructure( source, fileSet.getBasedir() );
}
catch ( IOException e1 )
{
throw new ScmException( "Unable to copy directory structure", e1 );
}
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "We will list content of checkout directory." );
}
// We need to list files in the directory
List<ScmFile> files = new ArrayList<ScmFile>();
try
{
@SuppressWarnings( "unchecked" )
List<File> realFiles = FileUtils.getFiles( fileSet.getBasedir(), null, "_ccmwaid.inf" );
for ( File f : realFiles )
{
files.add( new ScmFile( f.getPath(), ScmFileStatus.CHECKED_OUT ) );
}
}
catch ( IOException e )
{
throw new ScmException( "Unable to list files in checkout directory", e );
}
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "checkout command end successfully ..." );