View Javadoc
1   /*
2    * Kuali Coeus, a comprehensive research administration system for higher education.
3    * 
4    * Copyright 2005-2015 Kuali, Inc.
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package org.kuali.coeus.s2sgen.impl.generate;
20  
21  import org.slf4j.Logger;
22  import org.slf4j.LoggerFactory;
23  import org.springframework.beans.BeansException;
24  import org.springframework.beans.factory.InitializingBean;
25  import org.springframework.context.ApplicationContext;
26  import org.springframework.context.ApplicationContextAware;
27  import org.springframework.stereotype.Component;
28  
29  import java.util.Map;
30  
31  @Component("generatorInitializer")
32  public class GeneratorInitializerImpl implements GeneratorInitializer, ApplicationContextAware, InitializingBean {
33  
34      private static final Logger LOG = LoggerFactory.getLogger(GeneratorInitializerImpl.class);
35  
36      private ApplicationContext applicationContext;
37  
38      @Override
39      public void initialize() {
40          final Map<String, S2SFormGenerator> map = applicationContext.getBeansOfType(S2SFormGenerator.class);
41          LOG.info("Found the following generators: " + map.keySet());
42      }
43  
44      @Override
45      public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
46          this.applicationContext = applicationContext;
47      }
48  
49      @Override
50      public void afterPropertiesSet() throws Exception {
51          initialize();
52      }
53  }