Search in sources :

Example 21 with HubServicesFactory

use of com.blackducksoftware.integration.hub.service.HubServicesFactory in project hub-docker-inspector by blackducksoftware.

the class HubClient method phoneHomeHubConnection.

private void phoneHomeHubConnection(final String dockerEngineVersion) throws IOException, EncryptionException {
    final RestConnection restConnection = createRestConnection();
    final HubServicesFactory hubServicesFactory = new HubServicesFactory(restConnection);
    final PhoneHomeService phoner = hubServicesFactory.createPhoneHomeService();
    final PhoneHomeRequestBodyBuilder phoneHomeRequestBodyBuilder = phoner.createInitialPhoneHomeRequestBodyBuilder(THIRD_PARTY_NAME_DOCKER, dockerEngineVersion, programVersion.getProgramVersion());
    phoneHomeRequestBodyBuilder.setBlackDuckName(BlackDuckName.HUB);
    if (!StringUtils.isBlank(config.getCallerName())) {
        phoneHomeRequestBodyBuilder.addToMetaDataMap(PHONE_HOME_METADATA_NAME_CALLER_NAME, config.getCallerName());
    }
    if (!StringUtils.isBlank(config.getCallerVersion())) {
        phoneHomeRequestBodyBuilder.addToMetaDataMap(PHONE_HOME_METADATA_NAME_CALLER_VERSION, config.getCallerVersion());
    }
    final PhoneHomeRequestBody phoneHomeRequestBody = phoneHomeRequestBodyBuilder.buildObject();
    phoner.phoneHome(phoneHomeRequestBody);
    logger.trace("Attempt to phone home completed");
}
Also used : PhoneHomeRequestBody(com.blackducksoftware.integration.phonehome.PhoneHomeRequestBody) PhoneHomeRequestBodyBuilder(com.blackducksoftware.integration.phonehome.PhoneHomeRequestBodyBuilder) RestConnection(com.blackducksoftware.integration.hub.rest.RestConnection) HubServicesFactory(com.blackducksoftware.integration.hub.service.HubServicesFactory) PhoneHomeService(com.blackducksoftware.integration.hub.service.PhoneHomeService)

Aggregations

HubServicesFactory (com.blackducksoftware.integration.hub.service.HubServicesFactory)21 Test (org.junit.Test)7 GlobalProperties (com.blackducksoftware.integration.hub.alert.config.GlobalProperties)6 HubService (com.blackducksoftware.integration.hub.service.HubService)6 ProjectService (com.blackducksoftware.integration.hub.service.ProjectService)5 Logger (org.slf4j.Logger)5 RestConnection (com.blackducksoftware.integration.hub.rest.RestConnection)4 ArrayList (java.util.ArrayList)4 IntegrationException (com.blackducksoftware.integration.exception.IntegrationException)3 HubGroup (com.blackducksoftware.integration.hub.alert.hub.model.HubGroup)3 HubProject (com.blackducksoftware.integration.hub.alert.hub.model.HubProject)3 ComponentVersionView (com.blackducksoftware.integration.hub.api.generated.view.ComponentVersionView)3 UserGroupView (com.blackducksoftware.integration.hub.api.generated.view.UserGroupView)3 ProjectVersionModel (com.blackducksoftware.integration.hub.notification.ProjectVersionModel)3 Date (java.util.Date)3 AlertException (com.blackducksoftware.integration.hub.alert.exception.AlertException)2 ProjectView (com.blackducksoftware.integration.hub.api.generated.view.ProjectView)2 NotificationContentItem (com.blackducksoftware.integration.hub.notification.NotificationContentItem)2 NotificationEvent (com.blackducksoftware.integration.hub.notification.NotificationEvent)2 NotificationResults (com.blackducksoftware.integration.hub.notification.NotificationResults)2