Search in sources :

Example 1 with CurrentVersionView

use of com.blackducksoftware.integration.hub.api.generated.response.CurrentVersionView in project hub-detect by blackducksoftware.

the class HubServiceWrapper method init.

public void init() throws IntegrationException, DetectUserFriendlyException {
    try {
        slf4jIntLogger = new Slf4jIntLogger(logger);
        hubServerConfig = createHubServerConfig(slf4jIntLogger);
        hubServicesFactory = createHubServicesFactory(slf4jIntLogger, hubServerConfig);
    } catch (IllegalStateException | EncryptionException e) {
        throw new DetectUserFriendlyException(String.format("Not able to initialize Hub connection: %s", e.getMessage()), e, ExitCodeType.FAILURE_HUB_CONNECTIVITY);
    }
    final HubService hubService = createHubService();
    final CurrentVersionView currentVersion = hubService.getResponse(ApiDiscovery.CURRENT_VERSION_LINK_RESPONSE);
    logger.info(String.format("Successfully connected to Hub (version %s)!", currentVersion.version));
    detectPhoneHomeManager.init(createPhoneHomeService());
    detectPhoneHomeManager.startPhoneHome();
}
Also used : CurrentVersionView(com.blackducksoftware.integration.hub.api.generated.response.CurrentVersionView) DetectUserFriendlyException(com.blackducksoftware.integration.hub.detect.exception.DetectUserFriendlyException) Slf4jIntLogger(com.blackducksoftware.integration.log.Slf4jIntLogger) EncryptionException(com.blackducksoftware.integration.exception.EncryptionException) HubService(com.blackducksoftware.integration.hub.service.HubService)

Aggregations

EncryptionException (com.blackducksoftware.integration.exception.EncryptionException)1 CurrentVersionView (com.blackducksoftware.integration.hub.api.generated.response.CurrentVersionView)1 DetectUserFriendlyException (com.blackducksoftware.integration.hub.detect.exception.DetectUserFriendlyException)1 HubService (com.blackducksoftware.integration.hub.service.HubService)1 Slf4jIntLogger (com.blackducksoftware.integration.log.Slf4jIntLogger)1