added configuration for whether or not the nexus analyzer should use the configured proxy

Former-commit-id: 99f3110346941ebc00c14ae1c00220eef76c1e9f
This commit is contained in:
Jeremy Long
2014-03-02 18:16:12 -05:00
parent ef97f9c088
commit 9d609b6085
7 changed files with 58 additions and 1 deletions

View File

@@ -160,6 +160,7 @@ public class App {
final String suppressionFile = cli.getSuppressionFile();
final boolean nexusDisabled = cli.isNexusDisabled();
final String nexusUrl = cli.getNexusUrl();
final boolean nexusUsesProxy = cli.isNexusUsesProxy();
final String databaseDriverName = cli.getDatabaseDriverName();
final String databaseDriverPath = cli.getDatabaseDriverPath();
final String connectionString = cli.getConnectionString();
@@ -215,7 +216,7 @@ public class App {
if (nexusUrl != null && !nexusUrl.isEmpty()) {
Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
}
Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy);
if (databaseDriverName != null && !databaseDriverName.isEmpty()) {
Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
}

View File

@@ -204,6 +204,10 @@ public final class CliParser {
.withDescription("The url to the Nexus Server.")
.create();
final Option nexusUsesProxy = OptionBuilder.withArgName("true/false").hasArg().withLongOpt(ArgumentName.NEXUS_URL)
.withDescription("Whether or not the configured proxy should be used when connecting to Nexus.")
.create();
final Option additionalZipExtensions = OptionBuilder.withArgName("extensions").hasArg()
.withLongOpt(ArgumentName.ADDITIONAL_ZIP_EXTENSIONS)
.withDescription("A comma seperated list of additional extensions to be scanned as ZIP files "
@@ -227,6 +231,7 @@ public final class CliParser {
.addOption(suppressionFile)
.addOption(disableNexusAnalyzer)
.addOption(nexusUrl)
.addOption(nexusUsesProxy)
.addOption(additionalZipExtensions);
}
@@ -342,6 +347,20 @@ public final class CliParser {
}
}
/**
* Returns true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false is
* returned.
*
* @return true if the Nexus Analyzer should use the configured proxy to connect to Nexus; otherwise false
*/
public boolean isNexusUsesProxy() {
if (line == null || !line.hasOption(ArgumentName.NEXUS_USES_PROXY)) {
return true;
} else {
return Boolean.parseBoolean(line.getOptionValue(ArgumentName.NEXUS_USES_PROXY));
}
}
/**
* Displays the command line help message to the standard output.
*/
@@ -697,6 +716,10 @@ public final class CliParser {
* The URL of the nexus server.
*/
public static final String NEXUS_URL = "nexus";
/**
* Whether or not the defined proxy should be used when connecting to Nexus.
*/
public static final String NEXUS_USES_PROXY = "nexusUsesProxy";
/**
* The CLI argument name for setting the connection string.
*/

View File

@@ -28,4 +28,5 @@ Short | Argument Name | Parameter | Description | Requirement
| \-\-dbUser | \<user\> | The username used to connect to the database. | Optional
| \-\-disableNexus | | Disable the Nexus Analyzer. | Optional
| \-\-nexus | \<url\> | The url to the Nexus Server. | Optional
| \-\-nexusUsesProxy | \<true|false\> | Whether or not the defined proxy should be used when connecting to Nexus. | Optional
| \-\-zipExtensions | \<strings\> | A comma-separated list of additional file extensions to be treated like a ZIP file, the contents will be extracted and analyzed. | Optional