use of com.synopsys.integration.detect.workflow.blackduck.developer.RapidScanOptions in project synopsys-detect by blackducksoftware.
the class OperationFactory method performRapidUpload.
// Rapid
public final List<HttpUrl> performRapidUpload(BlackDuckRunData blackDuckRunData, BdioResult bdioResult, @Nullable File rapidScanConfig) throws OperationException {
return auditLog.namedInternal("Rapid Upload", () -> {
BlackDuckServicesFactory blackDuckServicesFactory = blackDuckRunData.getBlackDuckServicesFactory();
RapidScanOptions rapidScanOptions = detectConfigurationFactory.createRapidScanOptions();
RapidModeUploadOperation operation = new RapidModeUploadOperation(DetectRapidScanService.fromBlackDuckServicesFactory(directoryManager, blackDuckServicesFactory));
return operation.run(bdioResult, rapidScanOptions, rapidScanConfig);
});
}
use of com.synopsys.integration.detect.workflow.blackduck.developer.RapidScanOptions in project synopsys-detect by blackducksoftware.
the class RapidScanUploadService method uploadFiles.
private HttpUrl uploadFiles(UploadTarget uploadTarget, List<BdioFileContent> bdioFiles, RapidScanOptions rapidScanOptions, @Nullable NameVersion nameVersion, @Nullable File rapidScanConfig, @Nullable File rapidScanWorkingDirectory) throws IntegrationException, IOException {
if (bdioFiles.isEmpty()) {
throw new IllegalArgumentException("BDIO files cannot be empty.");
}
BdioFileContent header = bdioFiles.stream().filter(content -> content.getFileName().equals(FILE_NAME_BDIO_HEADER_JSONLD)).findFirst().orElseThrow(() -> new BlackDuckIntegrationException("Cannot find BDIO header file" + FILE_NAME_BDIO_HEADER_JSONLD + "."));
List<BdioFileContent> remainingFiles = bdioFiles.stream().filter(content -> !content.getFileName().equals(FILE_NAME_BDIO_HEADER_JSONLD)).collect(Collectors.toList());
int count = remainingFiles.size();
logger.debug("BDIO upload file count = " + count);
BlackDuckRequestBuilderEditor editor = builder -> {
builder.addHeader(RapidCompareMode.HEADER_NAME, rapidScanOptions.getCompareMode().getHeaderValue());
if (nameVersion != null) {
builder.addHeader(Bdio2StreamUploader.PROJECT_NAME_HEADER, nameVersion.getName()).addHeader(Bdio2StreamUploader.VERSION_NAME_HEADER, nameVersion.getVersion());
}
};
HttpUrl url;
if (rapidScanConfig != null) {
url = bdio2Uploader.startWithConfig(zip(uploadTarget, rapidScanConfig, header, rapidScanWorkingDirectory), editor);
} else {
url = bdio2Uploader.start(header, editor);
}
for (BdioFileContent content : remainingFiles) {
bdio2Uploader.append(url, count, content, editor);
}
bdio2Uploader.finish(url, count, editor);
return url;
}
Aggregations