01: /*
02: * Copyright 2007 The Kuali Foundation
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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 edu.iu.uis.eden.messaging.quartz;
17:
18: import java.util.Properties;
19:
20: import org.kuali.rice.core.Core;
21: import org.springframework.beans.factory.config.AbstractFactoryBean;
22:
23: /**
24: * A factory bean which reads quartz-related properties from the Config system and
25: * generates a Properites instance for use when configuration quartz.
26: *
27: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
28: *
29: */
30: public class QuartzConfigPropertiesFactoryBean extends
31: AbstractFactoryBean {
32:
33: private static final String QUARTZ_PREFIX = "ksb.org.quartz";
34:
35: @Override
36: protected Object createInstance() throws Exception {
37: Properties properties = new Properties();
38: Properties configProps = Core.getCurrentContextConfig()
39: .getProperties();
40: for (Object keyObj : configProps.keySet()) {
41: if (keyObj instanceof String) {
42: String key = (String) keyObj;
43: if (key.startsWith(QUARTZ_PREFIX)) {
44: properties.put(key.substring(4), configProps
45: .get(key));
46: }
47: }
48: }
49: return properties;
50: }
51:
52: @Override
53: public Class getObjectType() {
54: return Properties.class;
55: }
56:
57: }
|