All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.devsecops.engine.mojos.sonar.SonarAnalysisFactory Maven / Gradle / Ivy

There is a newer version: 3.4.0
Show newest version
package io.github.devsecops.engine.mojos.sonar;

import io.github.devsecops.engine.core.CommandInvoker;
import io.github.devsecops.engine.core.Log;
import io.github.devsecops.engine.core.contract.Command;
import io.github.devsecops.engine.core.contract.Factory;
import io.github.devsecops.engine.core.contract.Invoker;
import io.github.devsecops.engine.domain.resolver.path.PathResolverBuilder;
import io.github.devsecops.engine.domain.resolver.strategy.Resolver;
import io.github.devsecops.engine.domain.sonar.commands.SonarAnalysisCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.Stack;

@Service
public class SonarAnalysisFactory implements Factory {

    @Autowired
    private Log logger;

    @Autowired
    private PathResolverBuilder pathResolverFactory;

    @Autowired
    private SonarAnalysisCommand sonarAnalysisCommand;

    @Override
    public Invoker build(Map parameters) throws Exception {
        final Resolver resolver = pathResolverFactory.build(parameters);
        sonarAnalysisCommand.setResolver(resolver);
        Stack commands = new Stack<>();
        commands.push(sonarAnalysisCommand);
        return new CommandInvoker(commands, logger);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy