001/**
002 * Copyright 2010-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.common.util.log4j;
017
018import org.kuali.common.util.Assert;
019import org.kuali.common.util.execute.Executable;
020
021/**
022 * @deprecated
023 */
024@Deprecated
025public class Log4JExecutable implements Executable {
026
027        boolean skip;
028        org.kuali.common.util.log4j.model.Log4JContext context;
029        Log4JService service;
030
031        public Log4JExecutable() {
032                this(null, null);
033        }
034
035        public Log4JExecutable(Log4JService service, org.kuali.common.util.log4j.model.Log4JContext context) {
036                this(service, context, false);
037        }
038
039        public Log4JExecutable(Log4JService service, org.kuali.common.util.log4j.model.Log4JContext context, boolean skip) {
040                super();
041                this.service = service;
042                this.context = context;
043                this.skip = skip;
044        }
045
046        @Override
047        public void execute() {
048
049                // Might have nothing to do
050                if (skip) {
051                        return;
052                }
053
054                // Make sure we are configured correctly
055                Assert.notNull(service, "service is null");
056                Assert.notNull(context, "context is null");
057
058                // Configure log4j as indicated by the context
059                service.configure(context);
060        }
061
062        public boolean isSkip() {
063                return skip;
064        }
065
066        public void setSkip(boolean skip) {
067                this.skip = skip;
068        }
069
070        public Log4JService getService() {
071                return service;
072        }
073
074        public void setService(Log4JService service) {
075                this.service = service;
076        }
077
078        public org.kuali.common.util.log4j.model.Log4JContext getContext() {
079                return context;
080        }
081
082        public void setContext(org.kuali.common.util.log4j.model.Log4JContext context) {
083                this.context = context;
084        }
085
086}