private void writeNewConfigProperties(XMLExtendedStreamWriter streamWriter, ModelNode ra)
     throws XMLStreamException {
   if (ra.hasDefined(CONFIG_PROPERTIES.getName())) {
     for (Property connectionProperty : ra.get(CONFIG_PROPERTIES.getName()).asPropertyList()) {
       writeProperty(
           streamWriter,
           ra,
           connectionProperty.getName(),
           connectionProperty.getValue().get("value").asString(),
           ResourceAdapter.Tag.CONFIG_PROPERTY.getLocalName());
     }
   }
 }
  public void invoke() {
    PathElement ijPe =
        PathElement.pathElement(Constants.IRONJACAMAR_NAME, Constants.IRONJACAMAR_NAME);
    ManagementResourceRegistration ironJacamarChild =
        parentRegistration.registerSubModel(
            ijPe, ResourceAdaptersSubsystemProviders.IRONJACAMAR_DESC);
    PathElement raPath = PathElement.pathElement(RESOURCEADAPTER_NAME);
    ManagementResourceRegistration raChild =
        ironJacamarChild.registerSubModel(raPath, RESOURCEADAPTER_RO_DESC);

    PathElement configPath = PathElement.pathElement(CONFIG_PROPERTIES.getName());
    ManagementResourceRegistration configChild =
        raChild.registerSubModel(configPath, CONFIG_PROPERTIES_RO_DESC);

    PathElement connDefPath = PathElement.pathElement(CONNECTIONDEFINITIONS_NAME);
    ManagementResourceRegistration connChild =
        raChild.registerSubModel(connDefPath, CONNECTION_DEFINITION_RO_DESC);

    PathElement connDefConfigPath = PathElement.pathElement(CONFIG_PROPERTIES.getName());
    ManagementResourceRegistration connDefConfigChild =
        connChild.registerSubModel(connDefConfigPath, CONFIG_PROPERTIES_RO_DESC);

    PathElement adminObjectPath = PathElement.pathElement(ADMIN_OBJECTS_NAME);
    ManagementResourceRegistration adminObjectChild =
        raChild.registerSubModel(adminObjectPath, ADMIN_OBJECT_RO_DESC);

    PathElement adminObjectConfigPath = PathElement.pathElement(CONFIG_PROPERTIES.getName());
    ManagementResourceRegistration adminObjectConfigChild =
        adminObjectChild.registerSubModel(adminObjectConfigPath, CONFIG_PROPERTIES_RO_DESC);

    connChild.registerOperationHandler(
        "flush-idle-connection-in-pool",
        PoolOperations.FlushIdleConnectionInPool.RA_INSTANCE,
        FLUSH_IDLE_CONNECTION_DESC,
        false,
        RUNTIME_ONLY_FLAG);
    connChild.registerOperationHandler(
        "flush-all-connection-in-pool",
        PoolOperations.FlushAllConnectionInPool.RA_INSTANCE,
        FLUSH_ALL_CONNECTION_DESC,
        false,
        RUNTIME_ONLY_FLAG);
    connChild.registerOperationHandler(
        "test-connection-in-pool",
        PoolOperations.TestConnectionInPool.RA_INSTANCE,
        TEST_CONNECTION_DESC,
        false,
        RUNTIME_ONLY_FLAG);
  }
  @Override
  public void initialize(final ExtensionContext context) {
    SUBSYSTEM_RA_LOGGER.debugf("Initializing ResourceAdapters Extension");
    // Register the remoting subsystem
    final SubsystemRegistration registration = context.registerSubsystem(SUBSYSTEM_NAME);

    ReloadRequiredWriteAttributeHandler reloadRequiredWriteAttributeHandler =
        new ReloadRequiredWriteAttributeHandler();

    registration.registerXMLElementWriter(ResourceAdapterSubsystemParser.INSTANCE);

    // Remoting subsystem description and operation handlers
    final ManagementResourceRegistration subsystem = registration.registerSubsystemModel(SUBSYSTEM);
    subsystem.registerOperationHandler(
        ADD, ResourceAdaptersSubSystemAdd.INSTANCE, SUBSYSTEM_ADD_DESC, false);
    subsystem.registerOperationHandler(
        DESCRIBE,
        GenericSubsystemDescribeHandler.INSTANCE,
        GenericSubsystemDescribeHandler.INSTANCE,
        false,
        OperationEntry.EntryType.PRIVATE);

    final ManagementResourceRegistration resourceadapter =
        subsystem.registerSubModel(
            PathElement.pathElement(RESOURCEADAPTER_NAME), RESOURCEADAPTER_DESC);
    resourceadapter.registerOperationHandler(ADD, RaAdd.INSTANCE, ADD_RESOURCEADAPTER_DESC, false);
    resourceadapter.registerOperationHandler(
        REMOVE, RaRemove.INSTANCE, REMOVE_RESOURCEADAPTER_DESC, false);
    for (final String attribute : ResourceAdaptersSubsystemProviders.RESOURCEADAPTER_ATTRIBUTE) {
      resourceadapter.registerReadWriteAttribute(
          attribute, null, reloadRequiredWriteAttributeHandler, Storage.CONFIGURATION);
    }

    final ManagementResourceRegistration configAdapter =
        resourceadapter.registerSubModel(
            PathElement.pathElement(CONFIG_PROPERTIES.getName()), CONFIG_PROPERTIES_DESC);
    configAdapter.registerOperationHandler(
        ADD, ConfigPropertyAdd.INSTANCE, ADD_CONFIG_PROPERTIES_DESC, false);
    configAdapter.registerOperationHandler(
        REMOVE, ReloadRequiredRemoveStepHandler.INSTANCE, REMOVE_CONFIG_PROPERTIES_DESC, false);

    final ManagementResourceRegistration connectionDefinition =
        resourceadapter.registerSubModel(
            PathElement.pathElement(CONNECTIONDEFINITIONS_NAME), CONNECTION_DEFINITION_DESC);
    connectionDefinition.registerOperationHandler(
        ADD, ConnectionDefinitionAdd.INSTANCE, ADD_CONNECTION_DEFINITION_DESC, false);
    connectionDefinition.registerOperationHandler(
        REMOVE, ReloadRequiredRemoveStepHandler.INSTANCE, REMOVE_CONNECTION_DEFINITION_DESC, false);

    final ManagementResourceRegistration configCF =
        connectionDefinition.registerSubModel(
            PathElement.pathElement(CONFIG_PROPERTIES.getName()), CONFIG_PROPERTIES_DESC);
    configCF.registerOperationHandler(
        ADD, CDConfigPropertyAdd.INSTANCE, ADD_CONFIG_PROPERTIES_DESC, false);
    configCF.registerOperationHandler(
        REMOVE, ReloadRequiredRemoveStepHandler.INSTANCE, REMOVE_CONFIG_PROPERTIES_DESC, false);
    for (final SimpleAttributeDefinition attribute :
        ResourceAdaptersSubsystemProviders.CONNECTIONDEFINITIONS_NODEATTRIBUTE) {
      connectionDefinition.registerReadWriteAttribute(
          attribute.getName(), null, reloadRequiredWriteAttributeHandler, Storage.CONFIGURATION);
    }

    final ManagementResourceRegistration adminObject =
        resourceadapter.registerSubModel(
            PathElement.pathElement(ADMIN_OBJECTS_NAME), ADMIN_OBJECT_DESC);
    adminObject.registerOperationHandler(
        ADD, AdminObjectAdd.INSTANCE, ADD_ADMIN_OBJECT_DESC, false);
    adminObject.registerOperationHandler(
        REMOVE, ReloadRequiredRemoveStepHandler.INSTANCE, REMOVE_ADMIN_OBJECT_DESC, false);

    final ManagementResourceRegistration configAO =
        adminObject.registerSubModel(
            PathElement.pathElement(CONFIG_PROPERTIES.getName()), CONFIG_PROPERTIES_DESC);
    configAO.registerOperationHandler(
        ADD, AOConfigPropertyAdd.INSTANCE, ADD_CONFIG_PROPERTIES_DESC, false);
    configAO.registerOperationHandler(
        REMOVE, ReloadRequiredRemoveStepHandler.INSTANCE, REMOVE_CONFIG_PROPERTIES_DESC, false);
    for (final SimpleAttributeDefinition attribute :
        ResourceAdaptersSubsystemProviders.ADMIN_OBJECTS_NODEATTRIBUTE) {
      adminObject.registerReadWriteAttribute(
          attribute.getName(), null, reloadRequiredWriteAttributeHandler, Storage.CONFIGURATION);
    }

    resourceadapter.registerOperationHandler(
        "flush-idle-connection-in-pool",
        PoolOperations.FlushIdleConnectionInPool.RA_INSTANCE,
        FLUSH_IDLE_CONNECTION_DESC,
        false);
    resourceadapter.registerOperationHandler(
        "flush-all-connection-in-pool",
        PoolOperations.FlushAllConnectionInPool.RA_INSTANCE,
        FLUSH_ALL_CONNECTION_DESC,
        false);
    resourceadapter.registerOperationHandler(
        "test-connection-in-pool",
        PoolOperations.TestConnectionInPool.RA_INSTANCE,
        TEST_CONNECTION_DESC,
        false);

    for (final String attributeName : PoolMetrics.ATTRIBUTES) {
      resourceadapter.registerMetric(attributeName, PoolMetrics.RaPoolMetricsHandler.INSTANCE);
    }
  }