001/* 002 * Copyright 2007-2008 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.ole.sys.context; 017 018import java.io.IOException; 019import java.util.Properties; 020 021import org.kuali.rice.core.api.config.property.Config; 022import org.kuali.rice.core.api.config.property.ConfigContext; 023import org.kuali.rice.core.impl.config.property.ConfigLogger; 024import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; 025 026/** 027 * Configures a property placeholder in Spring which will allow access to the properties configured in the workflow configuration. 028 * 029 * @author Kuali Rice Team (rice.collab@kuali.org) 030 */ 031public class ConfigPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { 032 protected static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ConfigPropertyPlaceholderConfigurer.class); 033 034 public ConfigPropertyPlaceholderConfigurer() { 035 setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE); 036 } 037 038 @Override 039 protected void loadProperties(Properties props) throws IOException { 040 // perform standard property resource file loading 041 super.loadProperties(props); 042 // put the properties into the Rice configuration context 043 ConfigContext.getCurrentContextConfig().putProperties(props); 044 // load the Rice properties 045 if ( LOG.isDebugEnabled() ) { 046 Config config = ConfigContext.getCurrentContextConfig(); 047 if (config != null) { 048 LOG.debug("Replacing parameters in Spring using config:\r\n" + config); 049 ConfigLogger.logConfig(config); 050 } 051 } 052 } 053}