View Javadoc

1   /*
2    * Copyright 2005-2007 The Kuali Foundation
3    *
4    *
5    * Licensed under the Educational Community License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    * http://www.opensource.org/licenses/ecl2.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.core.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 (rice.collab@kuali.org)
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  }