1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.fulcrum.yaafi.framework.configuration;
20
21 import java.util.Properties;
22
23 /**
24 * A implementation to provide out-of-the-box component configuration properties
25 * using the following algorithm:
26 *
27 * <ul>
28 * <li>add the user-supplied defaults to the result<li>
29 * <li>add the system properties to the result<li>
30 * <li>add the Merlin context entries to the result<li>
31 * </ul>
32 *
33 * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
34 */
35 public class ComponentConfigurationPropertiesResolverImpl
36 extends ComponentConfigurationPropertiesResolverBaseImpl
37 {
38 /**
39 * @see org.apache.fulcrum.yaafi.framework.configuration.ComponentConfigurationPropertiesResolver#resolve(java.util.Properties)
40 */
41 public Properties resolve(Properties defaults) throws Exception
42 {
43 String location = this.getLocation();
44 Properties result = this.loadProperties(location);
45
46 if(defaults != null)
47 {
48 result.putAll(defaults);
49 }
50
51 result.putAll(System.getProperties());
52 this.addAvalonContext(result);
53
54 return result;
55 }
56 }