Search in sources :

Example 1 with CredentialsRestConnection

use of com.blackducksoftware.integration.hub.rest.CredentialsRestConnection in project hub-fortify-ssc-integration-service by blackducksoftware.

the class RestConnectionHelper method getRestConnection.

/**
 * Get the Hub REST connection
 *
 * @param serverConfig
 * @param logLevel
 * @return
 */
private static CredentialsRestConnection getRestConnection(final HubServerConfig serverConfig, final LogLevel logLevel) {
    CredentialsRestConnection restConnection;
    try {
        final ProxyInfo proxyInfo = getProxyInfo(serverConfig);
        restConnection = new CredentialsRestConnection(new PrintStreamIntLogger(System.out, logLevel), serverConfig.getHubUrl(), serverConfig.getGlobalCredentials().getUsername(), serverConfig.getGlobalCredentials().getDecryptedPassword(), serverConfig.getTimeout(), proxyInfo, new UriCombiner());
    } catch (final IllegalArgumentException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    } catch (final EncryptionException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
    return restConnection;
}
Also used : ProxyInfo(com.blackducksoftware.integration.hub.proxy.ProxyInfo) UriCombiner(com.blackducksoftware.integration.hub.rest.UriCombiner) PrintStreamIntLogger(com.blackducksoftware.integration.log.PrintStreamIntLogger) CredentialsRestConnection(com.blackducksoftware.integration.hub.rest.CredentialsRestConnection) EncryptionException(com.blackducksoftware.integration.exception.EncryptionException)

Aggregations

EncryptionException (com.blackducksoftware.integration.exception.EncryptionException)1 ProxyInfo (com.blackducksoftware.integration.hub.proxy.ProxyInfo)1 CredentialsRestConnection (com.blackducksoftware.integration.hub.rest.CredentialsRestConnection)1 UriCombiner (com.blackducksoftware.integration.hub.rest.UriCombiner)1 PrintStreamIntLogger (com.blackducksoftware.integration.log.PrintStreamIntLogger)1