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.property.processor; 017 018import java.util.Properties; 019 020import org.kuali.common.util.PropertyUtils; 021import org.kuali.common.util.property.Constants; 022import org.kuali.common.util.property.GlobalPropertiesMode; 023import org.slf4j.Logger; 024import org.slf4j.LoggerFactory; 025import org.springframework.util.PropertyPlaceholderHelper; 026 027/** 028 * @deprecated 029 */ 030@Deprecated 031public class ResolvePlaceholdersProcessor implements PropertyProcessor { 032 033 private static final Logger logger = LoggerFactory.getLogger(ResolvePlaceholdersProcessor.class); 034 035 PropertyPlaceholderHelper helper = Constants.DEFAULT_PROPERTY_PLACEHOLDER_HELPER; 036 GlobalPropertiesMode globalPropertiesMode = Constants.DEFAULT_GLOBAL_PROPERTIES_MODE; 037 038 public ResolvePlaceholdersProcessor() { 039 this(Constants.DEFAULT_PROPERTY_PLACEHOLDER_HELPER); 040 } 041 042 public ResolvePlaceholdersProcessor(PropertyPlaceholderHelper helper) { 043 this(helper, Constants.DEFAULT_GLOBAL_PROPERTIES_MODE); 044 } 045 046 public ResolvePlaceholdersProcessor(PropertyPlaceholderHelper helper, GlobalPropertiesMode globalPropertiesMode) { 047 super(); 048 this.helper = helper; 049 this.globalPropertiesMode = globalPropertiesMode; 050 } 051 052 @Override 053 public void process(Properties properties) { 054 Properties resolvedProperties = PropertyUtils.getResolvedProperties(properties, helper, globalPropertiesMode); 055 if (resolvedProperties.size() > 0) { 056 logger.debug("Resolved {} property values", resolvedProperties.size()); 057 properties.putAll(resolvedProperties); 058 } 059 } 060 061 public PropertyPlaceholderHelper getHelper() { 062 return helper; 063 } 064 065 public void setHelper(PropertyPlaceholderHelper helper) { 066 this.helper = helper; 067 } 068 069 public GlobalPropertiesMode getGlobalPropertiesMode() { 070 return globalPropertiesMode; 071 } 072 073 public void setGlobalPropertiesMode(GlobalPropertiesMode globalPropertiesMode) { 074 this.globalPropertiesMode = globalPropertiesMode; 075 } 076}