001/*
002 * Kuali Coeus, a comprehensive research administration system for higher education.
003 * 
004 * Copyright 2005-2015 Kuali, Inc.
005 * 
006 * This program is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU Affero General Public License as
008 * published by the Free Software Foundation, either version 3 of the
009 * License, or (at your option) any later version.
010 * 
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU Affero General Public License for more details.
015 * 
016 * You should have received a copy of the GNU Affero General Public License
017 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
018 */
019package org.kuali.coeus.s2sgen.impl.generate;
020
021import org.slf4j.Logger;
022import org.slf4j.LoggerFactory;
023import org.springframework.beans.BeansException;
024import org.springframework.beans.factory.InitializingBean;
025import org.springframework.context.ApplicationContext;
026import org.springframework.context.ApplicationContextAware;
027import org.springframework.stereotype.Component;
028
029import java.util.Map;
030
031@Component("generatorInitializer")
032public class GeneratorInitializerImpl implements GeneratorInitializer, ApplicationContextAware, InitializingBean {
033
034    private static final Logger LOG = LoggerFactory.getLogger(GeneratorInitializerImpl.class);
035
036    private ApplicationContext applicationContext;
037
038    @Override
039    public void initialize() {
040        final Map<String, S2SFormGenerator> map = applicationContext.getBeansOfType(S2SFormGenerator.class);
041        LOG.info("Found the following generators: " + map.keySet());
042    }
043
044    @Override
045    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
046        this.applicationContext = applicationContext;
047    }
048
049    @Override
050    public void afterPropertiesSet() throws Exception {
051        initialize();
052    }
053}