1 package org.codehaus.plexus.container.initialization;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import org.codehaus.plexus.configuration.PlexusConfiguration;
20
21
22
23
24 public class InitializeSystemPropertiesPhase extends AbstractContainerInitializationPhase {
25 public void execute(ContainerInitializationContext context) throws ContainerInitializationException {
26 PlexusConfiguration[] systemProperties = context.getContainerXmlConfiguration()
27 .getChild("system-properties")
28 .getChildren("property");
29
30 for (PlexusConfiguration systemProperty : systemProperties) {
31 String name = systemProperty.getAttribute("name", null);
32
33 String value = systemProperty.getAttribute("value", null);
34
35 if (name == null) {
36 throw new ContainerInitializationException("Missing 'name' attribute in 'property' tag. ");
37 }
38
39 if (value == null) {
40 throw new ContainerInitializationException("Missing 'value' attribute in 'property' tag. ");
41 }
42
43 System.getProperties().setProperty(name, value);
44 }
45 }
46 }