1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package info.magnolia.init;
35
36 import static info.magnolia.objectfactory.Components.getComponent;
37
38 import info.magnolia.init.properties.EnvironmentPropertySource;
39 import info.magnolia.init.properties.InitPathsPropertySource;
40 import info.magnolia.init.properties.ModulePropertiesSource;
41 import info.magnolia.init.properties.SystemPropertySource;
42 import info.magnolia.module.ModuleRegistry;
43
44 import java.io.IOException;
45 import java.util.Collections;
46 import java.util.List;
47
48 import javax.inject.Inject;
49 import javax.inject.Singleton;
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 @Singleton
66 public class DefaultMagnoliaConfigurationProperties extends AbstractMagnoliaConfigurationProperties {
67
68 private final MagnoliaInitPaths initPaths;
69 private final ModuleRegistry moduleRegistry;
70 private final MagnoliaPropertiesResolver resolver;
71 private final SystemPropertySource systemPropertySource;
72 private final EnvironmentPropertySource environmentPropertySource;
73
74 @Inject
75 public DefaultMagnoliaConfigurationProperties(MagnoliaInitPaths initPaths, ModuleRegistry moduleRegistry, MagnoliaPropertiesResolver resolver, SystemPropertySource systemPropertySource, EnvironmentPropertySource environmentPropertySource) {
76 this.initPaths = initPaths;
77 this.moduleRegistry = moduleRegistry;
78 this.resolver = resolver;
79 this.systemPropertySource = systemPropertySource;
80 this.environmentPropertySource = environmentPropertySource;
81 }
82
83
84
85
86 @Deprecated
87 public DefaultMagnoliaConfigurationProperties(MagnoliaInitPaths initPaths, ModuleRegistry moduleRegistry, MagnoliaPropertiesResolver resolver) {
88 this(initPaths, moduleRegistry, resolver, getComponent(SystemPropertySource.class), getComponent(EnvironmentPropertySource.class));
89 }
90
91 @Override
92 public void init() throws Exception {
93 sources.add(systemPropertySource);
94 sources.add(environmentPropertySource);
95 final List<PropertySource> configuredSources = resolver.getSources();
96 for (PropertySource source : configuredSources) {
97 sources.add(source);
98 }
99 sources.add(new ModulePropertiesSource(moduleRegistry));
100 sources.add(new InitPathsPropertySource(initPaths));
101 }
102
103
104
105
106 @Deprecated
107 protected static List<PropertySource> makeSources(MagnoliaInitPaths initPaths, ModuleRegistry moduleRegistry, MagnoliaPropertiesResolver resolver) throws IOException {
108 return Collections.emptyList();
109 }
110 }