Search in sources :

Example 1 with PDSLicenseScanConfig

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);
}
Also used : MetaDataInspection(com.mercedesbenz.sechub.sharedkernel.metadata.MetaDataInspection) ProductResult(com.mercedesbenz.sechub.domain.scan.product.ProductResult) SecHubExecutionContext(com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionContext) InputStream(java.io.InputStream) ProductExecutorContext(com.mercedesbenz.sechub.domain.scan.product.ProductExecutorContext) PDSLicenseScanConfig(com.mercedesbenz.sechub.adapter.pds.PDSLicenseScanConfig)

Aggregations

PDSLicenseScanConfig (com.mercedesbenz.sechub.adapter.pds.PDSLicenseScanConfig)1 ProductExecutorContext (com.mercedesbenz.sechub.domain.scan.product.ProductExecutorContext)1 ProductResult (com.mercedesbenz.sechub.domain.scan.product.ProductResult)1 SecHubExecutionContext (com.mercedesbenz.sechub.sharedkernel.execution.SecHubExecutionContext)1 MetaDataInspection (com.mercedesbenz.sechub.sharedkernel.metadata.MetaDataInspection)1 InputStream (java.io.InputStream)1