29
29
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .EXTENSION ;
30
30
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .INTERFACE ;
31
31
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .JVM ;
32
+ import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .MANAGEMENT_CLIENT_CONTENT ;
32
33
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .PATH ;
33
34
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .PROCESS_TYPE ;
34
35
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .PROFILE ;
35
36
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .RELEASE_CODENAME ;
36
37
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .RELEASE_VERSION ;
37
38
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .REMOVE ;
39
+ import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .ROLLOUT_PLAN ;
40
+ import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .ROLLOUT_PLANS ;
38
41
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .SERVER_GROUP ;
39
42
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .SOCKET_BINDING_GROUP ;
40
43
import static org .jboss .as .controller .descriptions .ModelDescriptionConstants .SOCKET_BINDING_PORT_OFFSET ;
74
77
import org .jboss .as .controller .operations .global .WriteAttributeHandlers ;
75
78
import org .jboss .as .controller .operations .global .WriteAttributeHandlers .IntRangeValidatingHandler ;
76
79
import org .jboss .as .controller .operations .global .WriteAttributeHandlers .ModelTypeValidatingHandler ;
80
+ import org .jboss .as .controller .operations .validation .ModelTypeValidator ;
81
+ import org .jboss .as .controller .operations .validation .ParameterValidator ;
77
82
import org .jboss .as .controller .persistence .ExtensibleConfigurationPersister ;
78
83
import org .jboss .as .controller .registry .AttributeAccess .Storage ;
79
84
import org .jboss .as .controller .registry .ManagementResourceRegistration ;
80
85
import org .jboss .as .controller .registry .OperationEntry ;
86
+ import org .jboss .as .controller .registry .Resource ;
81
87
import org .jboss .as .controller .resource .SocketBindingGroupResourceDefinition ;
82
88
import org .jboss .as .domain .controller .descriptions .DomainDescriptionProviders ;
89
+ import org .jboss .as .domain .controller .descriptions .DomainRootDescription ;
83
90
import org .jboss .as .domain .controller .operations .ApplyRemoteMasterDomainModelHandler ;
84
91
import org .jboss .as .domain .controller .operations .DomainServerLifecycleHandlers ;
85
92
import org .jboss .as .domain .controller .operations .ProcessTypeHandler ;
104
111
import org .jboss .as .domain .controller .operations .deployment .ServerGroupDeploymentReplaceHandler ;
105
112
import org .jboss .as .domain .controller .operations .deployment .ServerGroupDeploymentUndeployHandler ;
106
113
import org .jboss .as .domain .controller .resource .SocketBindingResourceDefinition ;
114
+ import org .jboss .as .management .client .content .ManagedDMRContentResourceDefinition ;
115
+ import org .jboss .as .management .client .content .ManagedDMRContentTypeResourceDefinition ;
107
116
import org .jboss .as .server .ServerEnvironment ;
108
117
import org .jboss .as .server .controller .descriptions .ServerDescriptionConstants ;
109
118
import org .jboss .as .server .deployment .repository .api .ContentRepository ;
@@ -125,10 +134,10 @@ public class DomainModelUtil {
125
134
/**
126
135
* Update the model to hold domain level configuration.
127
136
*
128
- * @param rootModel - the model to be updated.
137
+ * @param rootResource the root resource to be updated.
129
138
*/
130
- public static void updateCoreModel (final ModelNode rootModel ) {
131
-
139
+ public static void updateCoreModel (final Resource rootResource ) {
140
+ final ModelNode rootModel = rootResource . getModel ();
132
141
rootModel .get (RELEASE_VERSION ).set (Version .AS_VERSION );
133
142
rootModel .get (RELEASE_CODENAME ).set (Version .AS_RELEASE_CODENAME );
134
143
}
@@ -140,8 +149,8 @@ public static ExtensionContext initializeMasterDomainRegistry(final ManagementRe
140
149
}
141
150
142
151
public static ExtensionContext initializeSlaveDomainRegistry (final ManagementResourceRegistration root , final ExtensibleConfigurationPersister configurationPersister ,
143
- final FileRepository fileRepository , final LocalHostControllerInfo hostControllerInfo ) {
144
- return initializeDomainRegistry (root , configurationPersister , null , fileRepository , false , null , null , hostControllerInfo );
152
+ final ContentRepository contentRepository , final FileRepository fileRepository , final LocalHostControllerInfo hostControllerInfo ) {
153
+ return initializeDomainRegistry (root , configurationPersister , contentRepository , fileRepository , false , null , null , hostControllerInfo );
145
154
}
146
155
147
156
private static ExtensionContext initializeDomainRegistry (final ManagementResourceRegistration root , final ExtensibleConfigurationPersister configurationPersister ,
@@ -154,18 +163,21 @@ private static ExtensionContext initializeDomainRegistry(final ManagementResourc
154
163
// Other root resource operations
155
164
XmlMarshallingHandler xmh = new XmlMarshallingHandler (configurationPersister );
156
165
root .registerOperationHandler (XmlMarshallingHandler .OPERATION_NAME , xmh , xmh , false , OperationEntry .EntryType .PUBLIC , readOnly );
166
+
157
167
root .registerOperationHandler (NamespaceAddHandler .OPERATION_NAME , NamespaceAddHandler .INSTANCE , NamespaceAddHandler .INSTANCE , false );
158
168
root .registerOperationHandler (NamespaceRemoveHandler .OPERATION_NAME , NamespaceRemoveHandler .INSTANCE , NamespaceRemoveHandler .INSTANCE , false );
159
169
root .registerOperationHandler (SchemaLocationAddHandler .OPERATION_NAME , SchemaLocationAddHandler .INSTANCE , SchemaLocationAddHandler .INSTANCE , false );
160
170
root .registerOperationHandler (SchemaLocationRemoveHandler .OPERATION_NAME , SchemaLocationRemoveHandler .INSTANCE , SchemaLocationRemoveHandler .INSTANCE , false );
161
- DeploymentUploadBytesHandler dubh = new DeploymentUploadBytesHandler (contentRepo );
171
+
172
+ DeploymentUploadBytesHandler dubh = isMaster ? new DeploymentUploadBytesHandler (contentRepo ) : new DeploymentUploadBytesHandler ();
162
173
root .registerOperationHandler (DeploymentUploadBytesHandler .OPERATION_NAME , dubh , dubh , false , OperationEntry .EntryType .PUBLIC , deploymentUpload );
163
- DeploymentUploadURLHandler duuh = new DeploymentUploadURLHandler (contentRepo );
174
+ DeploymentUploadURLHandler duuh = isMaster ? new DeploymentUploadURLHandler (contentRepo ) : new DeploymentUploadURLHandler ( );
164
175
root .registerOperationHandler (DeploymentUploadURLHandler .OPERATION_NAME , duuh , duuh , false , OperationEntry .EntryType .PUBLIC , deploymentUpload );
165
- DeploymentUploadStreamAttachmentHandler dush = new DeploymentUploadStreamAttachmentHandler (contentRepo );
176
+ DeploymentUploadStreamAttachmentHandler dush = isMaster ? new DeploymentUploadStreamAttachmentHandler (contentRepo ) : new DeploymentUploadStreamAttachmentHandler ( );
166
177
root .registerOperationHandler (DeploymentUploadStreamAttachmentHandler .OPERATION_NAME , dush , dush , false , OperationEntry .EntryType .PUBLIC , deploymentUpload );
167
178
DeploymentFullReplaceHandler dfrh = isMaster ? new DeploymentFullReplaceHandler (contentRepo ) : new DeploymentFullReplaceHandler (fileRepository );
168
179
root .registerOperationHandler (DeploymentFullReplaceHandler .OPERATION_NAME , dfrh , dfrh );
180
+
169
181
SnapshotDeleteHandler snapshotDelete = new SnapshotDeleteHandler (configurationPersister );
170
182
root .registerOperationHandler (SnapshotDeleteHandler .OPERATION_NAME , snapshotDelete , snapshotDelete , false );
171
183
SnapshotListHandler snapshotList = new SnapshotListHandler (configurationPersister );
@@ -242,11 +254,19 @@ private static ExtensionContext initializeDomainRegistry(final ManagementResourc
242
254
243
255
// Root Deployments
244
256
final ManagementResourceRegistration deployments = root .registerSubModel (PathElement .pathElement (DEPLOYMENT ), DomainDescriptionProviders .DEPLOYMENT_PROVIDER );
245
- DeploymentAddHandler dah = new DeploymentAddHandler (contentRepo );
257
+ DeploymentAddHandler dah = isMaster ? new DeploymentAddHandler (contentRepo ) : new DeploymentAddHandler ( );
246
258
deployments .registerOperationHandler (DeploymentAddHandler .OPERATION_NAME , dah , dah );
247
- DeploymentRemoveHandler drh = new DeploymentRemoveHandler (contentRepo );
259
+ DeploymentRemoveHandler drh = isMaster ? new DeploymentRemoveHandler (contentRepo ) : new DeploymentRemoveHandler ( );
248
260
deployments .registerOperationHandler (DeploymentRemoveHandler .OPERATION_NAME , drh , drh );
249
261
262
+ // Management client content
263
+ ManagedDMRContentTypeResourceDefinition plansDef = new ManagedDMRContentTypeResourceDefinition (contentRepo , ROLLOUT_PLAN ,
264
+ PathElement .pathElement (MANAGEMENT_CLIENT_CONTENT , ROLLOUT_PLANS ), DomainRootDescription .getResourceDescriptionResolver (ROLLOUT_PLANS ));
265
+ ManagementResourceRegistration mgmtContent = root .registerSubModel (plansDef );
266
+ ParameterValidator contentValidator = new ModelTypeValidator (ModelType .OBJECT ); // TODO create a structural validator
267
+ ManagedDMRContentResourceDefinition planDef = ManagedDMRContentResourceDefinition .create (ROLLOUT_PLAN , contentValidator , DomainRootDescription .getResourceDescriptionResolver (ROLLOUT_PLAN ));
268
+ mgmtContent .registerSubModel (planDef );
269
+
250
270
// Extensions
251
271
final ManagementResourceRegistration extensions = root .registerSubModel (PathElement .pathElement (EXTENSION ), CommonProviders .EXTENSION_PROVIDER );
252
272
final ExtensionContext extensionContext = new ExtensionContextImpl (profile , deployments , configurationPersister , ProcessType .HOST_CONTROLLER );
@@ -256,7 +276,7 @@ private static ExtensionContext initializeDomainRegistry(final ManagementResourc
256
276
extensions .registerOperationHandler (ExtensionRemoveHandler .OPERATION_NAME , removeExtensionHandler , removeExtensionHandler , false );
257
277
258
278
if (!isMaster ) {
259
- ApplyRemoteMasterDomainModelHandler armdmh = new ApplyRemoteMasterDomainModelHandler (extensionContext , fileRepository , hostControllerInfo );
279
+ ApplyRemoteMasterDomainModelHandler armdmh = new ApplyRemoteMasterDomainModelHandler (extensionContext , fileRepository , contentRepo , hostControllerInfo );
260
280
root .registerOperationHandler (ApplyRemoteMasterDomainModelHandler .OPERATION_NAME , armdmh , armdmh , false , OperationEntry .EntryType .PRIVATE );
261
281
} else {
262
282
ReadMasterDomainModelHandler rmdmh = new ReadMasterDomainModelHandler (domainController , registry );
0 commit comments