Search in sources :

Example 1 with DetectBootFactory

use of com.synopsys.integration.detect.lifecycle.boot.DetectBootFactory in project synopsys-detect by blackducksoftware.

the class Application method bootApplication.

private Optional<DetectBootResult> bootApplication(DetectRunId detectRunId, String[] sourceArgs, EventSystem eventSystem, ExitCodeManager exitCodeManager, Gson gson, DetectInfo detectInfo, FileFinder fileFinder, InstalledToolManager installedToolManager, ExceptionUtility exceptionUtility) {
    Optional<DetectBootResult> bootResult = Optional.empty();
    try {
        logger.debug("Detect boot begin.");
        DetectArgumentStateParser detectArgumentStateParser = new DetectArgumentStateParser();
        DetectArgumentState detectArgumentState = detectArgumentStateParser.parseArgs(sourceArgs);
        List<PropertySource> propertySources = new ArrayList<>(SpringConfigurationPropertySource.fromConfigurableEnvironmentSafely(environment, logger::error));
        DetectBootFactory detectBootFactory = new DetectBootFactory(detectRunId, detectInfo, gson, eventSystem, fileFinder);
        DetectBoot detectBoot = new DetectBoot(eventSystem, gson, detectBootFactory, detectArgumentState, propertySources, installedToolManager);
        bootResult = detectBoot.boot(detectInfo.getDetectVersion(), detectInfo.getBuildDateString());
        logger.debug("Detect boot completed.");
    } catch (Exception e) {
        logger.error("Detect boot failed.");
        logger.error("");
        exceptionUtility.logException(e);
        exitCodeManager.requestExitCode(e);
        logger.error("");
    // TODO- should we return a DetectBootResult.exception(...) here?
    }
    return bootResult;
}
Also used : DetectArgumentState(com.synopsys.integration.detect.configuration.help.DetectArgumentState) DetectBoot(com.synopsys.integration.detect.lifecycle.boot.DetectBoot) DetectArgumentStateParser(com.synopsys.integration.detect.configuration.help.DetectArgumentStateParser) ArrayList(java.util.ArrayList) DetectBootResult(com.synopsys.integration.detect.lifecycle.boot.DetectBootResult) DetectBootFactory(com.synopsys.integration.detect.lifecycle.boot.DetectBootFactory) PropertySource(com.synopsys.integration.configuration.source.PropertySource) SpringConfigurationPropertySource(com.synopsys.integration.configuration.source.SpringConfigurationPropertySource)

Aggregations

PropertySource (com.synopsys.integration.configuration.source.PropertySource)1 SpringConfigurationPropertySource (com.synopsys.integration.configuration.source.SpringConfigurationPropertySource)1 DetectArgumentState (com.synopsys.integration.detect.configuration.help.DetectArgumentState)1 DetectArgumentStateParser (com.synopsys.integration.detect.configuration.help.DetectArgumentStateParser)1 DetectBoot (com.synopsys.integration.detect.lifecycle.boot.DetectBoot)1 DetectBootFactory (com.synopsys.integration.detect.lifecycle.boot.DetectBootFactory)1 DetectBootResult (com.synopsys.integration.detect.lifecycle.boot.DetectBootResult)1 ArrayList (java.util.ArrayList)1