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.slf4j.Logger;
19  import org.slf4j.LoggerFactory;
20  import org.springframework.util.Assert;
21  
22  /**
23   * Execute the <code>executable</code> supplied to this bean
24   */
25  public class ExecutableExecutable implements Executable {
26  
27  	private static final Logger logger = LoggerFactory.getLogger(ExecutableExecutable.class);
28  
29  	Executable executable;
30  	boolean skip;
31  
32  	@Override
33  	public void execute() {
34  		if (skip) {
35  			logger.info("Skipping execution - {}", executable.getClass());
36  			return;
37  		}
38  		Assert.notNull(executable);
39  		executable.execute();
40  	}
41  
42  	public Executable getExecutable() {
43  		return executable;
44  	}
45  
46  	public void setExecutable(Executable executable) {
47  		this.executable = executable;
48  	}
49  
50  	public boolean isSkip() {
51  		return skip;
52  	}
53  
54  	public void setSkip(boolean skip) {
55  		this.skip = skip;
56  	}
57  }