Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ConfigInitializer |
|
| 2.0;2 |
1 | /* | |
2 | * Copyright 2006-2011 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 | ||
17 | package org.kuali.rice.core.impl.config.property; | |
18 | ||
19 | import org.kuali.rice.core.api.config.property.ConfigContext; | |
20 | ||
21 | /** | |
22 | * This initializes a config object into the ConfigContext | |
23 | * as a root config or merges a config object into an already initialized root config | |
24 | * | |
25 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
26 | * | |
27 | */ | |
28 | public class ConfigInitializer { | |
29 | ||
30 | 0 | private ConfigInitializer() { |
31 | 0 | throw new UnsupportedOperationException("do not call"); |
32 | } | |
33 | ||
34 | /** | |
35 | * inits the root config or merges this config with the root config. | |
36 | * | |
37 | * <p> | |
38 | * This logic used to happen in the RiceConfigurer but was moved to facilitate the modularity work. | |
39 | * </p> | |
40 | */ | |
41 | public static void initialize(org.kuali.rice.core.api.config.property.Config config) { | |
42 | 0 | final org.kuali.rice.core.api.config.property.Config rootConfig = ConfigContext.getCurrentContextConfig(); |
43 | 0 | if (rootConfig == null) { |
44 | 0 | ConfigContext.init(config); |
45 | } else { | |
46 | 0 | rootConfig.putConfig(config); |
47 | } | |
48 | 0 | } |
49 | } |