diff --git a/src/main/java/com/hcl/appscan/sdk/messages.properties b/src/main/java/com/hcl/appscan/sdk/messages.properties index ef269707..8766d2f6 100644 --- a/src/main/java/com/hcl/appscan/sdk/messages.properties +++ b/src/main/java/com/hcl/appscan/sdk/messages.properties @@ -1,6 +1,6 @@ # -# © Copyright IBM Corporation 2016. -# © Copyright HCL Technologies Ltd. 2017. +# © Copyright IBM Corporation 2016. +# © Copyright HCL Technologies Ltd. 2017. # LICENSE: Apache License, Version 2.0 https://www.apache.org/licenses/LICENSE-2.0 # # NLS_MESSAGEFORMAT_VAR @@ -17,6 +17,7 @@ message.extracting.client=Extracting the SAClientUtil package... message.download.complete=Download complete. message.preparing.irx=Preparing the IRX file using SAClientUtil version {0}... message.saclient.old=A newer version of the SAClientUtil package is available:\nCurrent Version: {0}\nAvailable Version: {1} +message.results.unavailable=Scan results are not available. message.unknown=Unknown error.authenticating=An error occurred authenticating with the service. diff --git a/src/main/java/com/hcl/appscan/sdk/scan/IScanManager.java b/src/main/java/com/hcl/appscan/sdk/scan/IScanManager.java index 41c2c960..bafea15a 100644 --- a/src/main/java/com/hcl/appscan/sdk/scan/IScanManager.java +++ b/src/main/java/com/hcl/appscan/sdk/scan/IScanManager.java @@ -6,11 +6,11 @@ package com.hcl.appscan.sdk.scan; +import java.io.File; import java.util.Map; import com.hcl.appscan.sdk.error.AppScanException; import com.hcl.appscan.sdk.logging.IProgress; -import com.hcl.appscan.sdk.scan.IScanServiceProvider; public interface IScanManager { @@ -36,4 +36,11 @@ public interface IScanManager { * @param target */ void addScanTarget(ITarget target); + + /** + * Retrieves the scan results as a file. + * @return A file containing the results. + * @throws AppScanException if there are no results available. + */ + void getScanResults(File destination, String format) throws AppScanException; } diff --git a/src/main/java/com/hcl/appscan/sdk/scanners/sast/SASTScanManager.java b/src/main/java/com/hcl/appscan/sdk/scanners/sast/SASTScanManager.java index 75d06011..2dca0797 100644 --- a/src/main/java/com/hcl/appscan/sdk/scanners/sast/SASTScanManager.java +++ b/src/main/java/com/hcl/appscan/sdk/scanners/sast/SASTScanManager.java @@ -15,6 +15,7 @@ import javax.xml.transform.TransformerException; import com.hcl.appscan.sdk.CoreConstants; +import com.hcl.appscan.sdk.Messages; import com.hcl.appscan.sdk.error.AppScanException; import com.hcl.appscan.sdk.error.InvalidTargetException; import com.hcl.appscan.sdk.error.ScannerException; @@ -65,6 +66,14 @@ public void addScanTarget(ITarget target) { m_targets.add((ISASTTarget)target); } + @Override + public void getScanResults(File destination, String format) throws AppScanException { + if(m_scan != null && m_scan.getResultsProvider() != null) + m_scan.getResultsProvider().getResultsFile(destination, format); + else + throw new AppScanException(Messages.getMessage("message.results.unavailable")); //$NON-NLS-1$ + } + private void run(IProgress progress,Map properties, IScanServiceProvider provider) throws AppScanException { try { m_scan = new SASTScan(properties, progress, provider);