Search in sources :

Example 6 with ExitCodeRequest

use of com.blackducksoftware.integration.hub.detect.lifecycle.shutdown.ExitCodeRequest in project hub-detect by blackducksoftware.

the class ToolRunner method publishExtractionResults.

private void publishExtractionResults(final EventSystem eventSystem, final RunResult runResult, final Extraction extractionResult) {
    runResult.addToolNameVersionIfPresent(toolDetector.getToolEnum(), Optional.of(new NameVersion(extractionResult.projectName, extractionResult.projectVersion)));
    Optional<Object> dockerTar = extractionResult.getMetaDataValue(DockerExtractor.DOCKER_TAR_META_DATA_KEY);
    if (dockerTar.isPresent()) {
        runResult.addDockerFile(Optional.of((File) dockerTar.get()));
    }
    runResult.addDetectCodeLocations(extractionResult.codeLocations);
    if (extractionResult.result == Extraction.ExtractionResultType.SUCCESS) {
        eventSystem.publishEvent(Event.StatusSummary, new Status(toolDetector.getToolEnum().toString(), StatusType.SUCCESS));
    } else {
        eventSystem.publishEvent(Event.StatusSummary, new Status(toolDetector.getToolEnum().toString(), StatusType.FAILURE));
        eventSystem.publishEvent(Event.ExitCode, new ExitCodeRequest(ExitCodeType.FAILURE_GENERAL_ERROR, extractionResult.description));
    }
}
Also used : Status(com.blackducksoftware.integration.hub.detect.workflow.status.Status) NameVersion(com.synopsys.integration.util.NameVersion) ExitCodeRequest(com.blackducksoftware.integration.hub.detect.lifecycle.shutdown.ExitCodeRequest) File(java.io.File)

Example 7 with ExitCodeRequest

use of com.blackducksoftware.integration.hub.detect.lifecycle.shutdown.ExitCodeRequest in project hub-detect by blackducksoftware.

the class ToolRunner method publishNotExtractableResults.

private void publishNotExtractableResults(final EventSystem eventSystem, final DetectorResult extractableResult, final String toolName) {
    logger.error(String.format("%s was not extractable: %s", toolName, extractableResult.toDescription()));
    eventSystem.publishEvent(Event.StatusSummary, new Status(DetectTool.BAZEL.toString(), StatusType.FAILURE));
    eventSystem.publishEvent(Event.ExitCode, new ExitCodeRequest(ExitCodeType.FAILURE_GENERAL_ERROR, extractableResult.toDescription()));
}
Also used : Status(com.blackducksoftware.integration.hub.detect.workflow.status.Status) ExitCodeRequest(com.blackducksoftware.integration.hub.detect.lifecycle.shutdown.ExitCodeRequest)

Aggregations

ExitCodeRequest (com.blackducksoftware.integration.hub.detect.lifecycle.shutdown.ExitCodeRequest)7 DirectoryManager (com.blackducksoftware.integration.hub.detect.workflow.file.DirectoryManager)4 DetectConfiguration (com.blackducksoftware.integration.hub.detect.configuration.DetectConfiguration)3 ConnectivityManager (com.blackducksoftware.integration.hub.detect.workflow.ConnectivityManager)3 EventSystem (com.blackducksoftware.integration.hub.detect.workflow.event.EventSystem)3 NameVersion (com.synopsys.integration.util.NameVersion)3 DetectInfo (com.blackducksoftware.integration.hub.detect.DetectInfo)2 DetectConfigurationFactory (com.blackducksoftware.integration.hub.detect.configuration.DetectConfigurationFactory)2 DetectUserFriendlyException (com.blackducksoftware.integration.hub.detect.exception.DetectUserFriendlyException)2 ExitCodeType (com.blackducksoftware.integration.hub.detect.exitcode.ExitCodeType)2 CodeLocationNameManager (com.blackducksoftware.integration.hub.detect.workflow.codelocation.CodeLocationNameManager)2 DiagnosticManager (com.blackducksoftware.integration.hub.detect.workflow.diagnostic.DiagnosticManager)2 Status (com.blackducksoftware.integration.hub.detect.workflow.status.Status)2 DetectorBeanConfiguration (com.blackducksoftware.integration.hub.detect.DetectorBeanConfiguration)1 RunBeanConfiguration (com.blackducksoftware.integration.hub.detect.RunBeanConfiguration)1 ConnectionManager (com.blackducksoftware.integration.hub.detect.configuration.ConnectionManager)1 DetectProperty (com.blackducksoftware.integration.hub.detect.configuration.DetectProperty)1 DetectPropertyMap (com.blackducksoftware.integration.hub.detect.configuration.DetectPropertyMap)1 DetectPropertySource (com.blackducksoftware.integration.hub.detect.configuration.DetectPropertySource)1 DetectorEnvironment (com.blackducksoftware.integration.hub.detect.detector.DetectorEnvironment)1