Search in sources :

Example 1 with CLIDownloadUtility

use of com.blackducksoftware.integration.hub.cli.CLIDownloadUtility in project hub-detect by blackducksoftware.

the class OfflineScanner method installSignatureScannerFromUrl.

private void installSignatureScannerFromUrl(final IntLogger intLogger, final HubScanConfig hubScanConfig, final CIEnvironmentVariables ciEnvironmentVariables) throws DetectUserFriendlyException {
    try {
        OfflineScanner.logger.info(String.format("Attempting to download the signature scanner from %s", detectConfiguration.getHubSignatureScannerHostUrl()));
        final UnauthenticatedRestConnectionBuilder restConnectionBuilder = new UnauthenticatedRestConnectionBuilder();
        restConnectionBuilder.setBaseUrl(detectConfiguration.getHubSignatureScannerHostUrl());
        restConnectionBuilder.setTimeout(detectConfiguration.getHubTimeout());
        restConnectionBuilder.applyProxyInfo(detectConfiguration.getHubProxyInfo());
        restConnectionBuilder.setLogger(intLogger);
        final RestConnection restConnection = restConnectionBuilder.build();
        final CLIDownloadUtility cliDownloadUtility = new CLIDownloadUtility(intLogger, restConnection);
        cliDownloadUtility.performInstallation(hubScanConfig.getToolsDir(), ciEnvironmentVariables, detectConfiguration.getHubSignatureScannerHostUrl(), "unknown", "hub-detect");
    } catch (final Exception e) {
        throw new DetectUserFriendlyException(String.format("There was a problem downloading the signature scanner from %s: %s", detectConfiguration.getHubSignatureScannerHostUrl(), e.getMessage()), e, ExitCodeType.FAILURE_GENERAL_ERROR);
    }
}
Also used : RestConnection(com.blackducksoftware.integration.hub.rest.RestConnection) DetectUserFriendlyException(com.blackducksoftware.integration.hub.detect.exception.DetectUserFriendlyException) UnauthenticatedRestConnectionBuilder(com.blackducksoftware.integration.hub.rest.UnauthenticatedRestConnectionBuilder) CLIDownloadUtility(com.blackducksoftware.integration.hub.cli.CLIDownloadUtility) DetectUserFriendlyException(com.blackducksoftware.integration.hub.detect.exception.DetectUserFriendlyException) IOException(java.io.IOException) IntegrationException(com.blackducksoftware.integration.exception.IntegrationException)

Aggregations

IntegrationException (com.blackducksoftware.integration.exception.IntegrationException)1 CLIDownloadUtility (com.blackducksoftware.integration.hub.cli.CLIDownloadUtility)1 DetectUserFriendlyException (com.blackducksoftware.integration.hub.detect.exception.DetectUserFriendlyException)1 RestConnection (com.blackducksoftware.integration.hub.rest.RestConnection)1 UnauthenticatedRestConnectionBuilder (com.blackducksoftware.integration.hub.rest.UnauthenticatedRestConnectionBuilder)1 IOException (java.io.IOException)1