private void parseProtocol(
      XMLExtendedStreamReader reader,
      PathAddress stackAddress,
      Map<PathAddress, ModelNode> operations)
      throws XMLStreamException {

    String type = require(reader, XMLAttribute.TYPE);
    PathAddress address = stackAddress.append(ProtocolResourceDefinition.pathElement(type));
    ModelNode operation = Util.createAddOperation(address);
    operations.put(address, operation);

    for (int i = 0; i < reader.getAttributeCount(); i++) {
      this.parseProtocolAttribute(reader, i, operation);
    }

    while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
      this.parseProtocolElement(reader, address, operations);
    }
  }
  @SuppressWarnings("deprecation")
  @Override
  public void register(ManagementResourceRegistration parentRegistration) {
    ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);

    ResourceDescriptor descriptor =
        new ResourceDescriptor(this.getResourceDescriptionResolver())
            .addAttributes(Attribute.class)
            .addExtraParameters(DeprecatedAttribute.class)
            .addCapabilities(Capability.class);
    ResourceServiceHandler handler =
        new SimpleResourceServiceHandler<>(new ProtocolConfigurationBuilderFactory());
    new RestartParentResourceAddStepHandler<>(this.parentBuilderFactory, descriptor, handler)
        .register(registration);
    new RestartParentResourceRemoveStepHandler<>(this.parentBuilderFactory, descriptor, handler)
        .register(registration);

    for (DeprecatedAttribute attribute : DeprecatedAttribute.values()) {
      registration.registerReadOnlyAttribute(attribute.getDefinition(), null);
    }

    super.register(registration);
  }