use of com.mercedesbenz.sechub.adapter.pds.PDSLicenseScanConfig in project sechub by mercedes-benz.
the class PDSLicenseScanProductExecutor method executeByAdapter.
@Override
protected List<ProductResult> executeByAdapter(ProductExecutorData data) throws Exception {
LOG.debug("Trigger PDS adapter execution");
ProductExecutorContext executorContext = data.getProductExecutorContext();
PDSExecutorConfigSuppport configSupport = PDSExecutorConfigSuppport.createSupportAndAssertConfigValid(executorContext.getExecutorConfig(), systemEnvironment);
SecHubExecutionContext context = data.getSechubExecutionContext();
PDSStorageContentProvider contentProvider = contentProviderFactory.createContentProvider(context, configSupport, getScanType());
ProductResult result = resilientActionExecutor.executeResilient(() -> {
try (InputStream sourceCodeZipFileInputStreamOrNull = contentProvider.getSourceZipFileInputStreamOrNull();
InputStream binariesTarFileInputStreamOrNull = contentProvider.getBinariesTarFileInputStreamOrNull()) {
/* @formatter:off */
PDSLicenseScanConfig pdsLicenseScanConfig = PDSLicenseScanConfigImpl.builder().configure(PDSAdapterConfigurationStrategy.builder().setScanType(getScanType()).setProductExecutorData(data).setConfigSupport(configSupport).setSourceCodeZipFileInputStreamOrNull(sourceCodeZipFileInputStreamOrNull).setBinariesTarFileInputStreamOrNull(binariesTarFileInputStreamOrNull).setContentProvider(contentProvider).setInstallSetup(installSetup).build()).build();
/* @formatter:on */
/* inspect */
MetaDataInspection inspection = scanMetaDataCollector.inspect(ProductIdentifier.PDS_LICENSESCAN.name());
inspection.notice(MetaDataInspection.TRACE_ID, pdsLicenseScanConfig.getTraceID());
/* execute PDS by adapter and update product result */
String pdsResult = pdsAdapter.start(pdsLicenseScanConfig, executorContext.getCallback());
// product result is set by callback
ProductResult productResult = executorContext.getCurrentProductResult();
productResult.setResult(pdsResult);
return productResult;
}
});
return Collections.singletonList(result);
}
Aggregations