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

net.sf.buildbox.releasator.SpringBeans Maven / Gradle / Ivy

Go to download

Commandline utility for creating reproducible releases. Minimal parametrization, isolated sandbox for releases. Currently built on top of maven-release-plugin.

The newest version!
package net.sf.buildbox.releasator;

import java.util.Map;
import net.sf.buildbox.releasator.ng.ScmAdapterFactory;
import net.sf.buildbox.releasator.ng.ScmAdapterManager;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * See article on Spring Best Practices
 */
public class SpringBeans {
    public static final SpringBeans INSTANCE = new SpringBeans();
    private ClassPathXmlApplicationContext applicationContext;
    private ScmAdapterManager scmAdapterManager;

    public SpringBeans() {
        applicationContext = new ClassPathXmlApplicationContext("/releasator.spring.xml");
    }

    private  T get(String beanName, Class clazz) {
        return applicationContext.getBean(beanName, clazz);
    }

    public ScmAdapterManager getScmAdapterManager() {
        if (scmAdapterManager == null) {
            scmAdapterManager = get("scmAdapterManager", ScmAdapterManager.class);
            scmAdapterManager.setAdapters(getScmAdapterFactories());
        }
        return scmAdapterManager;
    }

    public Map getScmAdapterFactories() {
        final Map factoryMap = applicationContext.getBeansOfType(ScmAdapterFactory.class);
        System.out.println("factoryMap = " + factoryMap);
        return factoryMap;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy