View Javadoc

1   package org.kuali.common.util.log.log4j;
2   
3   import org.kuali.common.util.Assert;
4   import org.kuali.common.util.execute.Executable;
5   import org.kuali.common.util.log.log4j.model.Log4JConfiguration;
6   
7   public final class Log4JExecutable implements Executable {
8   
9   	public static final boolean DEFAULT_SKIP = false;
10  
11  	private final boolean skip;
12  	private final Log4JConfiguration context;
13  	private final Log4JService service;
14  
15  	public Log4JExecutable(Log4JService service, Log4JConfiguration context) {
16  		this(service, context, DEFAULT_SKIP);
17  	}
18  
19  	public Log4JExecutable(Log4JService service, Log4JConfiguration context, boolean skip) {
20  		Assert.noNulls(service, context);
21  		this.service = service;
22  		this.context = context;
23  		this.skip = skip;
24  	}
25  
26  	@Override
27  	public void execute() {
28  
29  		// Might have nothing to do
30  		if (skip) {
31  			return;
32  		}
33  
34  		// Configure log4j as indicated by the context
35  		service.configure(context);
36  	}
37  
38  	public boolean isSkip() {
39  		return skip;
40  	}
41  
42  	public Log4JService getService() {
43  		return service;
44  	}
45  
46  	public Log4JConfiguration getContext() {
47  		return context;
48  	}
49  
50  }