use of com.blackducksoftware.integration.hub.service.CodeLocationService in project hub-docker-inspector by blackducksoftware.
the class HubClient method uploadBdioToHub.
public void uploadBdioToHub(final File bdioFile) throws IntegrationException {
final RestConnection restConnection = createRestConnection();
final HubServicesFactory hubServicesFactory = new HubServicesFactory(restConnection);
final CodeLocationService bomImportRequestService = hubServicesFactory.createCodeLocationService();
bomImportRequestService.importBomFile(bdioFile);
logger.info(String.format("Uploaded bdio file %s to %s", bdioFile.getName(), config.getHubUrl()));
}
use of com.blackducksoftware.integration.hub.service.CodeLocationService in project hub-detect by blackducksoftware.
the class HubManager method updateHubProjectVersion.
public ProjectVersionView updateHubProjectVersion(final DetectProject detectProject, final List<File> createdBdioFiles) throws IntegrationException {
final ProjectService projectService = hubServiceWrapper.createProjectService();
ProjectVersionView projectVersionView = ensureProjectVersionExists(detectProject, projectService);
if (null != createdBdioFiles && !createdBdioFiles.isEmpty()) {
final HubServerConfig hubServerConfig = hubServiceWrapper.getHubServerConfig();
final CodeLocationService codeLocationService = hubServiceWrapper.createCodeLocationService();
bdioUploader.uploadBdioFiles(hubServerConfig, codeLocationService, detectProject, createdBdioFiles);
} else {
logger.debug("Did not create any bdio files.");
}
if (!detectConfiguration.getHubSignatureScannerDisabled()) {
final HubServerConfig hubServerConfig = hubServiceWrapper.getHubServerConfig();
final SignatureScannerService signatureScannerService = hubServiceWrapper.createSignatureScannerService();
final ProjectVersionView scanProject = hubSignatureScanner.scanPaths(hubServerConfig, signatureScannerService, detectProject);
if (null == projectVersionView) {
projectVersionView = scanProject;
}
}
return projectVersionView;
}
use of com.blackducksoftware.integration.hub.service.CodeLocationService in project hub-detect by blackducksoftware.
the class HubManager method manageExistingCodeLocations.
public void manageExistingCodeLocations(final List<String> codeLocationNames) {
if (!detectConfiguration.getHubOfflineMode()) {
final CodeLocationService codeLocationService = hubServiceWrapper.createCodeLocationService();
for (final String codeLocationName : codeLocationNames) {
try {
final CodeLocationView codeLocationView = codeLocationService.getCodeLocationByName(codeLocationName);
if (detectConfiguration.getProjectCodeLocationDeleteOldNames()) {
try {
codeLocationService.deleteCodeLocation(codeLocationView);
logger.info(String.format("Deleted code location '%s'", codeLocationName));
} catch (final IntegrationException e) {
logger.error(String.format("Not able to delete the code location '%s': %s", codeLocationName, e.getMessage()));
}
} else {
logger.warn(String.format("Found a code location with a naming pattern that is no longer supported: %s. This code location may need to be removed to avoid duplicate entries in the Bill of Materials. You can run with --detect.project.codelocation.delete.old.names=true which will automatically delete these code locations, but please USE CAUTION.", codeLocationName));
}
} catch (final DoesNotExistException e) {
logger.debug(String.format("Didn't find the code location %s - this is a good thing!", codeLocationName));
} catch (final IntegrationException e) {
logger.error(String.format("Error finding the code location name %s: %s", codeLocationName, e.getMessage()));
}
}
}
}
Aggregations