01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.kuali.rice.config;
18:
19: import java.util.ArrayList;
20: import java.util.HashMap;
21: import java.util.List;
22: import java.util.Map;
23: import java.util.Properties;
24:
25: /**
26: * A simple Config implementation which has no base properties
27: * or base objects.
28: *
29: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
30: */
31: public class SimpleConfig extends BaseConfig {
32:
33: private Properties baseProperties;
34: private Map<String, Object> baseObjects;
35:
36: public SimpleConfig() {
37: super (new ArrayList<String>());
38: }
39:
40: public SimpleConfig(Properties properties) {
41: super (new ArrayList<String>());
42: this .baseProperties = properties;
43: }
44:
45: public SimpleConfig(List<String> fileLocs, Properties baseProperties) {
46: super (fileLocs);
47: this .baseProperties = baseProperties;
48: }
49:
50: public SimpleConfig(List<String> fileLocs) {
51: super (fileLocs);
52: }
53:
54: public SimpleConfig(String fileLoc) {
55: this (fileLoc, null);
56: }
57:
58: public SimpleConfig(String fileLoc, Properties baseProperties) {
59: super (fileLoc);
60: this .baseProperties = baseProperties;
61: }
62:
63: @Override
64: public Map<String, Object> getBaseObjects() {
65: if (this .baseObjects == null) {
66: this .baseObjects = new HashMap<String, Object>();
67: }
68: return this .baseObjects;
69: }
70:
71: @Override
72: public Properties getBaseProperties() {
73: if (this .baseProperties == null) {
74: return new Properties();
75: }
76: return this.baseProperties;
77: }
78:
79: }
|