View Javadoc
1   /**
2    * Copyright 2010-2013 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.property.processor;
17  
18  import java.util.Properties;
19  
20  import org.kuali.common.util.PropertyUtils;
21  import org.kuali.common.util.property.Constants;
22  import org.kuali.common.util.property.GlobalPropertiesMode;
23  import org.slf4j.Logger;
24  import org.slf4j.LoggerFactory;
25  import org.springframework.util.PropertyPlaceholderHelper;
26  
27  /**
28   * @deprecated
29   */
30  @Deprecated
31  public class ResolvePlaceholdersProcessor implements PropertyProcessor {
32  
33  	private static final Logger logger = LoggerFactory.getLogger(ResolvePlaceholdersProcessor.class);
34  
35  	PropertyPlaceholderHelper helper = Constants.DEFAULT_PROPERTY_PLACEHOLDER_HELPER;
36  	GlobalPropertiesMode globalPropertiesMode = Constants.DEFAULT_GLOBAL_PROPERTIES_MODE;
37  
38  	public ResolvePlaceholdersProcessor() {
39  		this(Constants.DEFAULT_PROPERTY_PLACEHOLDER_HELPER);
40  	}
41  
42  	public ResolvePlaceholdersProcessor(PropertyPlaceholderHelper helper) {
43  		this(helper, Constants.DEFAULT_GLOBAL_PROPERTIES_MODE);
44  	}
45  
46  	public ResolvePlaceholdersProcessor(PropertyPlaceholderHelper helper, GlobalPropertiesMode globalPropertiesMode) {
47  		super();
48  		this.helper = helper;
49  		this.globalPropertiesMode = globalPropertiesMode;
50  	}
51  
52  	@Override
53  	public void process(Properties properties) {
54  		Properties resolvedProperties = PropertyUtils.getResolvedProperties(properties, helper, globalPropertiesMode);
55  		if (resolvedProperties.size() > 0) {
56  			logger.debug("Resolved {} property values", resolvedProperties.size());
57  			properties.putAll(resolvedProperties);
58  		}
59  	}
60  
61  	public PropertyPlaceholderHelper getHelper() {
62  		return helper;
63  	}
64  
65  	public void setHelper(PropertyPlaceholderHelper helper) {
66  		this.helper = helper;
67  	}
68  
69  	public GlobalPropertiesMode getGlobalPropertiesMode() {
70  		return globalPropertiesMode;
71  	}
72  
73  	public void setGlobalPropertiesMode(GlobalPropertiesMode globalPropertiesMode) {
74  		this.globalPropertiesMode = globalPropertiesMode;
75  	}
76  }