Skip to content

Commit

Permalink
Merge pull request #4 from AppSecDev/ScanManager_Update
Browse files Browse the repository at this point in the history
Get results from ScanManager
  • Loading branch information
mattmurp authored Jul 24, 2017
2 parents 8e383f5 + 81b5439 commit 5aa357f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/hcl/appscan/sdk/messages.properties
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/com/hcl/appscan/sdk/scan/IScanManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String, String> properties, IScanServiceProvider provider) throws AppScanException {
try {
m_scan = new SASTScan(properties, progress, provider);
Expand Down

0 comments on commit 5aa357f

Please # to comment.