}
@Override
public void initialize(final ExtensionContext context) {
final boolean registerRuntimeOnly = context.isRuntimeOnlyRegistrationValid();
final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, MANAGEMENT_API_MAJOR_VERSION,
MANAGEMENT_API_MINOR_VERSION, MANAGEMENT_API_MICRO_VERSION);
subsystem.registerXMLElementWriter(WSSubsystemWriter.getInstance());
// ws subsystem
ResourceBuilder propertyResource = ResourceBuilder.Factory.create(PROPERTY_PATH, getResourceDescriptionResolver(Constants.PROPERTY))
.setAddOperation(PropertyAdd.INSTANCE)
.setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE)
.addReadWriteAttribute(Attributes.VALUE, null, new ReloadRequiredWriteAttributeHandler(Attributes.VALUE));
ResourceBuilder handlerBuilder = ResourceBuilder.Factory.create(HANDLER_PATH, getResourceDescriptionResolver(HANDLER))
.setAddOperation(HandlerAdd.INSTANCE)
.setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE)
.addReadWriteAttribute(Attributes.CLASS, null, new ReloadRequiredWriteAttributeHandler(Attributes.CLASS));
ResourceBuilder preHandler = ResourceBuilder.Factory.create(PRE_HANDLER_CHAIN_PATH, getResourceDescriptionResolver(Constants.PRE_HANDLER_CHAIN))
.setAddOperation(HandlerChainAdd.INSTANCE)
.setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE)
.addReadWriteAttribute(Attributes.PROTOCOL_BINDINGS, null, new ReloadRequiredWriteAttributeHandler(Attributes.PROTOCOL_BINDINGS))
.pushChild(handlerBuilder).pop();
ResourceBuilder postHandler = ResourceBuilder.Factory.create(POST_HANDLER_CHAIN_PATH, getResourceDescriptionResolver(Constants.POST_HANDLER_CHAIN))
.setAddOperation(HandlerChainAdd.INSTANCE)
.setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE)
.addReadWriteAttribute(Attributes.PROTOCOL_BINDINGS, null, new ReloadRequiredWriteAttributeHandler(Attributes.PROTOCOL_BINDINGS))
.pushChild(handlerBuilder).pop();
ResourceDefinition epConfigsDef = ResourceBuilder.Factory.create(ENDPOINT_CONFIG_PATH, getResourceDescriptionResolver(ENDPOINT_CONFIG))
.setAddOperation(EndpointConfigAdd.INSTANCE)
.setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE)
.pushChild(propertyResource).pop()
.pushChild(preHandler).pop()
.pushChild(postHandler).pop()
.build();
ResourceDefinition clConfigsDef = ResourceBuilder.Factory.create(CLIENT_CONFIG_PATH, getResourceDescriptionResolver(CLIENT_CONFIG))
.setAddOperation(ClientConfigAdd.INSTANCE)
.setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE)
.pushChild(propertyResource).pop()
.pushChild(preHandler).pop()
.pushChild(postHandler).pop()
.build();
ResourceDefinition subsystemResource = ResourceBuilder.Factory.createSubsystemRoot(SUBSYSTEM_PATH, getResourceDescriptionResolver(), WSSubsystemAdd.INSTANCE, WSSubsystemRemove.INSTANCE)
.addReadWriteAttribute(Attributes.WSDL_HOST, null, new WSServerConfigAttributeHandler(Attributes.WSDL_HOST))
.addReadWriteAttribute(Attributes.WSDL_PORT, null, new WSServerConfigAttributeHandler(Attributes.WSDL_PORT))
.addReadWriteAttribute(Attributes.WSDL_SECURE_PORT, null, new WSServerConfigAttributeHandler(Attributes.WSDL_SECURE_PORT))
.addReadWriteAttribute(Attributes.WSDL_URI_SCHEME, null, new WSServerConfigAttributeHandler(Attributes.WSDL_URI_SCHEME))
.addReadWriteAttribute(Attributes.WSDL_PATH_REWRITE_RULE, null, new WSServerConfigAttributeHandler(Attributes.WSDL_PATH_REWRITE_RULE))
.addReadWriteAttribute(Attributes.MODIFY_WSDL_ADDRESS, null, new WSServerConfigAttributeHandler(Attributes.MODIFY_WSDL_ADDRESS))
.addReadWriteAttribute(Attributes.STATISTICS_ENABLED, null, new WSServerConfigAttributeHandler(Attributes.STATISTICS_ENABLED))
.build();
ManagementResourceRegistration subsystemRegistration = subsystem.registerSubsystemModel(subsystemResource);
subsystemRegistration.registerSubModel(epConfigsDef);
subsystemRegistration.registerSubModel(clConfigsDef);
if (registerRuntimeOnly) {
subsystem.registerDeploymentModel(ResourceBuilder.Factory.create(SUBSYSTEM_PATH, getResourceDescriptionResolver("deployment"))
.pushChild(ENDPOINT_PATH)
.addMetrics(WSEndpointMetrics.INSTANCE, WSEndpointMetrics.ATTRIBUTES)
.addReadOnlyAttribute(ENDPOINT_CLASS)
.addReadOnlyAttribute(ENDPOINT_CONTEXT)
.addReadOnlyAttribute(ENDPOINT_NAME)