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.execute;
017
018import java.util.List;
019import java.util.Properties;
020
021import org.kuali.common.util.Assert;
022import org.kuali.common.util.PropertyUtils;
023import org.slf4j.Logger;
024import org.slf4j.LoggerFactory;
025
026public class ShowPropertiesExecutable implements Executable {
027
028        private static final Logger logger = LoggerFactory.getLogger(ShowPropertiesExecutable.class);
029
030        Properties properties;
031        List<String> includes;
032        List<String> excludes;
033
034        @Override
035        public void execute() {
036                Assert.notNull(properties, "properties is null");
037                Properties duplicate = PropertyUtils.duplicate(properties);
038                PropertyUtils.trim(duplicate, includes, excludes);
039                logger.info("Displaying {} properties\n\n{}", duplicate.size(), PropertyUtils.toString(duplicate));
040        }
041
042        public Properties getProperties() {
043                return properties;
044        }
045
046        public void setProperties(Properties properties) {
047                this.properties = properties;
048        }
049
050        public List<String> getIncludes() {
051                return includes;
052        }
053
054        public void setIncludes(List<String> includes) {
055                this.includes = includes;
056        }
057
058        public List<String> getExcludes() {
059                return excludes;
060        }
061
062        public void setExcludes(List<String> excludes) {
063                this.excludes = excludes;
064        }
065
066}