1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package de.smartics.properties.jboss.extension;
17
18 import static de.smartics.properties.jboss.extension.resources.SubsystemDefinition.SUBSYSTEM_NAME;
19
20 import org.jboss.as.controller.Extension;
21 import org.jboss.as.controller.ExtensionContext;
22 import org.jboss.as.controller.SubsystemRegistration;
23 import org.jboss.as.controller.parsing.ExtensionParsingContext;
24 import org.jboss.as.controller.registry.ManagementResourceRegistration;
25 import org.jboss.logging.Logger;
26
27 import de.smartics.properties.jboss.extension.parser.SubsystemParser;
28 import de.smartics.properties.jboss.extension.resources.PropertiesConfigurationResourceDefinition;
29 import de.smartics.properties.jboss.extension.resources.SubsystemDefinition;
30
31
32
33
34 public class SubsystemExtension implements Extension
35 {
36
37
38
39
40
41
42
43
44
45
46 public static final String NAMESPACE = "urn:de.smartics:properties:1.0";
47
48
49
50
51 public static final int MODEL_VERSION_MAJOR = 1;
52
53
54
55
56 public static final int MODEL_VERSION_MINOR = 0;
57
58
59
60
61 public static final int MODEL_VERSION_MICRO = 0;
62
63
64
65
66 private static final Logger LOG = Logger.getLogger(SubsystemExtension.class);
67
68
69
70
71
72
73 private final SubsystemParser parser = new SubsystemParser();
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89 @Override
90 public void initializeParsers(final ExtensionParsingContext context)
91 {
92 context.setSubsystemXmlMapping(SUBSYSTEM_NAME, NAMESPACE, parser);
93 }
94
95 @Override
96 public void initialize(final ExtensionContext context)
97 {
98 LOG.debug("Initializing properties extension");
99 final SubsystemRegistration subsystem =
100 context.registerSubsystem(SUBSYSTEM_NAME, MODEL_VERSION_MAJOR,
101 MODEL_VERSION_MINOR);
102 final ManagementResourceRegistration registration =
103 subsystem.registerSubsystemModel(SubsystemDefinition.INSTANCE);
104 registration
105 .registerSubModel(PropertiesConfigurationResourceDefinition.INSTANCE);
106
107 subsystem.registerXMLElementWriter(parser);
108 }
109
110
111
112 }