class AttributesParserFeatureXml implements AttributesParser {

  @Override
  public P2Attributes getAttributesFromBlob(final TempBlob tempBlob, final String extension)
      throws IOException, AttributeParsingException
  {
    Builder p2AttributesBuilder = P2Attributes.builder();
    Optional<Document> featureXmlOpt = documentJarExtractor.getSpecificEntity(tempBlob, extension, XML_FILE_NAME);
    Optional<PropertyResourceBundle> propertiesOpt =
        propertyParser.getBundleProperties(tempBlob, extension, FEATURE_PROPERTIES);

    if (featureXmlOpt.isPresent()) {
      Document document = featureXmlOpt.get();
      String pluginId = extractValueFromDocument(XML_PLUGIN_NAME_PATH, document);
      if (pluginId == null) {
        pluginId = extractValueFromDocument(XML_PLUGIN_ID_PATH, document);
      }

      String componentName = propertyParser.extractValueFromProperty(pluginId, propertiesOpt);
      p2AttributesBuilder
          .componentName(componentName)
          .pluginName(
              propertyParser.extractValueFromProperty(extractValueFromDocument(XML_NAME_PATH, document), propertiesOpt))
          .componentVersion(extractValueFromDocument(XML_VERSION_PATH, document));
    }

    return p2AttributesBuilder.build();
  }

  @Inject public  AttributesParserFeatureXml(final TempBlobConverter tempBlobConverter, final PropertyParser propertyParser);

}