View Javadoc
1   /**
2    * Copyright 2010-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.common.util.metainf.spring;
17  
18  import java.util.List;
19  
20  import org.kuali.common.util.execute.Executable;
21  import org.kuali.common.util.metainf.model.MetaInfContext;
22  import org.kuali.common.util.metainf.service.MetaInfExecutable;
23  import org.kuali.common.util.metainf.service.MetaInfService;
24  import org.kuali.common.util.metainf.service.MetaInfUtils;
25  import org.kuali.common.util.spring.ExecutionConfig;
26  import org.kuali.common.util.spring.env.EnvironmentService;
27  import org.kuali.common.util.spring.service.SpringServiceConfig;
28  import org.springframework.beans.factory.annotation.Autowired;
29  import org.springframework.context.annotation.Bean;
30  import org.springframework.context.annotation.Configuration;
31  import org.springframework.context.annotation.Import;
32  
33  @Configuration
34  @Import({ MetaInfServiceConfig.class, SpringServiceConfig.class })
35  public class MetaInfExecutableConfig implements ExecutionConfig {
36  
37  	@Autowired
38  	EnvironmentService env;
39  
40  	@Autowired
41  	MetaInfContextsConfig contextsConfig;
42  
43  	@Autowired
44  	MetaInfService service;
45  
46  	@Override
47  	@Bean(initMethod = "execute")
48  	public Executable executable() {
49  		boolean skip = env.getBoolean(MetaInfUtils.PROPERTY_PREFIX + ".skip", false);
50  		List<MetaInfContext> contexts = contextsConfig.metaInfContexts();
51  		return new MetaInfExecutable(contexts, service, skip);
52  	}
53  
54  }