private ModelNode parseDatabaseBinaryStorage(
      final XMLExtendedStreamReader reader, final String repositoryName) throws XMLStreamException {
    final ModelNode storageType = new ModelNode();
    storageType.get(OP).set(ADD);
    storageType
        .get(OP_ADDR)
        .add(SUBSYSTEM, ModeShapeExtension.SUBSYSTEM_NAME)
        .add(ModelKeys.REPOSITORY, repositoryName)
        .add(ModelKeys.CONFIGURATION, ModelKeys.BINARY_STORAGE)
        .add(ModelKeys.STORAGE_TYPE, ModelKeys.DB_BINARY_STORAGE);

    if (reader.getAttributeCount() > 0) {
      for (int i = 0; i < reader.getAttributeCount(); i++) {
        String attrName = reader.getAttributeLocalName(i);
        String attrValue = reader.getAttributeValue(i);
        Attribute attribute = Attribute.forName(attrName);
        switch (attribute) {
            // The rest go on the ModelNode for the type ...
          case DATA_SOURCE_JNDI_NAME:
            ModelAttributes.DATA_SOURCE_JNDI_NAME.parseAndSetParameter(
                attrValue, storageType, reader);
            break;
          case MIN_VALUE_SIZE:
            ModelAttributes.MINIMUM_BINARY_SIZE.parseAndSetParameter(
                attrValue, storageType, reader);
            break;
          default:
            throw ParseUtils.unexpectedAttribute(reader, i);
        }
      }
    }
    requireNoElements(reader);

    return storageType;
  }
  private ModelNode parseCustomBinaryStorage(
      final XMLExtendedStreamReader reader, final String repositoryName) throws XMLStreamException {
    final ModelNode storageType = new ModelNode();
    storageType.get(OP).set(ADD);
    storageType
        .get(OP_ADDR)
        .add(SUBSYSTEM, ModeShapeExtension.SUBSYSTEM_NAME)
        .add(ModelKeys.REPOSITORY, repositoryName)
        .add(ModelKeys.CONFIGURATION, ModelKeys.BINARY_STORAGE)
        .add(ModelKeys.STORAGE_TYPE, ModelKeys.CUSTOM_BINARY_STORAGE);

    if (reader.getAttributeCount() > 0) {
      for (int i = 0; i < reader.getAttributeCount(); i++) {
        String attrName = reader.getAttributeLocalName(i);
        String attrValue = reader.getAttributeValue(i);
        Attribute attribute = Attribute.forName(attrName);
        switch (attribute) {
          case CLASSNAME:
            ModelAttributes.CLASSNAME.parseAndSetParameter(attrValue, storageType, reader);
            break;
          case MODULE:
            ModelAttributes.MODULE.parseAndSetParameter(attrValue, storageType, reader);
            break;
          case MIN_VALUE_SIZE:
            ModelAttributes.MINIMUM_BINARY_SIZE.parseAndSetParameter(
                attrValue, storageType, reader);
            break;
          default:
            storageType.get(attrName).set(attrValue);
            break;
        }
      }
    }
    requireNoElements(reader);

    return storageType;
  }