use of org.apache.maven.scm.provider.integrity.Member in project maven-scm by apache.
the class IntegrityExportCommand method executeExportCommand.
/**
* {@inheritDoc}
*/
@Override
public ExportScmResult executeExportCommand(ScmProviderRepository repository, ScmFileSet fileSet, ScmVersion scmVersion, String outputDirectory) throws ScmException {
// First lets figure out where we need to export files to...
String exportDir = outputDirectory;
exportDir = ((null != exportDir && exportDir.length() > 0) ? exportDir : fileSet.getBasedir().getAbsolutePath());
// Let the user know where we're going to be exporting the files...
getLogger().info("Attempting to export files to " + exportDir);
ExportScmResult result;
IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
try {
// Lets set our overall export success flag
boolean exportSuccess = true;
// Perform a fresh checkout of each file in the member list...
List<Member> projectMembers = iRepo.getProject().listFiles(exportDir);
// Initialize the list of files we actually exported...
List<ScmFile> scmFileList = new ArrayList<ScmFile>();
for (Iterator<Member> it = projectMembers.iterator(); it.hasNext(); ) {
Member siMember = it.next();
try {
getLogger().info("Attempting to export file: " + siMember.getTargetFilePath() + " at revision " + siMember.getRevision());
siMember.checkout(iRepo.getAPISession());
scmFileList.add(new ScmFile(siMember.getTargetFilePath(), ScmFileStatus.UNKNOWN));
} catch (APIException ae) {
exportSuccess = false;
ExceptionHandler eh = new ExceptionHandler(ae);
getLogger().error("MKS API Exception: " + eh.getMessage());
getLogger().debug(eh.getCommand() + " exited with return code " + eh.getExitCode());
}
}
// Lets advice the user that we've checked out all the members
getLogger().info("Exported " + scmFileList.size() + " files out of a total of " + projectMembers.size() + " files!");
if (exportSuccess) {
result = new ExportScmResult("si co", scmFileList);
} else {
result = new ExportScmResult("si co", "Failed to export all files!", "", exportSuccess);
}
} catch (APIException aex) {
ExceptionHandler eh = new ExceptionHandler(aex);
getLogger().error("MKS API Exception: " + eh.getMessage());
getLogger().debug(eh.getCommand() + " exited with return code " + eh.getExitCode());
result = new ExportScmResult(eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false);
}
return result;
}
use of org.apache.maven.scm.provider.integrity.Member in project maven-scm by apache.
the class IntegrityListCommand method executeListCommand.
/**
* {@inheritDoc}
*/
@Override
public ListScmResult executeListCommand(ScmProviderRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion scmVersion) throws ScmException {
ListScmResult result;
IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
getLogger().info("Listing all files in project " + iRepo.getConfigruationPath());
try {
// Get a listing for all the members in the project...
List<Member> projectMembers = iRepo.getProject().listFiles(fileSet.getBasedir().getAbsolutePath());
// Initialize the list of ScmFile objects for the ListScmResult
List<ScmFile> scmFileList = new ArrayList<ScmFile>();
for (Iterator<Member> it = projectMembers.iterator(); it.hasNext(); ) {
Member siMember = it.next();
scmFileList.add(new ScmFile(siMember.getTargetFilePath(), ScmFileStatus.UNKNOWN));
}
result = new ListScmResult(scmFileList, new ScmResult("si viewproject", "", "", true));
} catch (APIException aex) {
ExceptionHandler eh = new ExceptionHandler(aex);
getLogger().error("MKS API Exception: " + eh.getMessage());
getLogger().debug(eh.getCommand() + " exited with return code " + eh.getExitCode());
result = new ListScmResult(eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false);
}
return result;
}
Aggregations