View Javadoc

1   /**
2    * Copyright 2010-2012 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.execute;
17  
18  import org.kuali.common.util.service.DefaultSpringService;
19  import org.kuali.common.util.service.SpringContext;
20  import org.kuali.common.util.service.SpringService;
21  import org.slf4j.Logger;
22  import org.slf4j.LoggerFactory;
23  
24  public class SpringContextLoaderExecutable implements Executable {
25  
26  	private static final Logger logger = LoggerFactory.getLogger(SpringContextLoaderExecutable.class);
27  
28  	SpringService service = new DefaultSpringService();
29  	SpringContext context;
30  	boolean skip;
31  
32  	@Override
33  	public void execute() {
34  		if (skip) {
35  			logger.info("Skipping execution");
36  		} else {
37  			service.load(context);
38  		}
39  	}
40  
41  	public SpringService getService() {
42  		return service;
43  	}
44  
45  	public void setService(SpringService service) {
46  		this.service = service;
47  	}
48  
49  	public SpringContext getContext() {
50  		return context;
51  	}
52  
53  	public void setContext(SpringContext context) {
54  		this.context = context;
55  	}
56  
57  	public boolean isSkip() {
58  		return skip;
59  	}
60  
61  	public void setSkip(boolean skip) {
62  		this.skip = skip;
63  	}
64  }