protected void processAttribute(EjbJarMetaData ejbJarMetaData, XMLStreamReader reader, int i)
     throws XMLStreamException {
   final String value = reader.getAttributeValue(i);
   if (attributeHasNamespace(reader, i)) {
     return;
   }
   final EjbJarAttribute ejbJarAttribute =
       EjbJarAttribute.forName(reader.getAttributeLocalName(i));
   switch (ejbJarAttribute) {
     case ID:
       {
         ejbJarMetaData.setId(value);
         break;
       }
     case VERSION:
       {
         ejbJarMetaData.setVersion(value);
         break;
       }
     case METADATA_COMPLETE:
       {
         // metadata-complete applies only to EJB 3.x
         if (ejbJarMetaData.isEJB3x()) {
           if (Boolean.TRUE.equals(Boolean.valueOf(value))) {
             ejbJarMetaData.setMetadataComplete(true);
           }
         } else {
           throw unexpectedAttribute(reader, i);
         }
         break;
       }
     default:
       throw unexpectedAttribute(reader, i);
   }
 }
  /**
   * Reads the "version" attribute of ejb-jar element and returns the corresponding {@link
   * org.jboss.metadata.ejb.spec.EjbJarVersion}.
   *
   * <p>Returns null, if either the "version" attribute is not specified or if the value of the
   * "version" attribute doesn't belong to the known values from {@link
   * org.jboss.metadata.ejb.spec.EjbJarVersion}.
   *
   * @param reader
   * @return
   * @throws XMLStreamException
   */
  protected static EjbJarVersion readVersionAttribute(XMLStreamReader reader)
      throws XMLStreamException {
    EjbJarVersion ejbJarVersion = null;

    // Look at the version attribute
    String versionString = null;
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
      if (attributeHasNamespace(reader, i)) {
        continue;
      }
      final EjbJarAttribute ejbJarVersionAttribute =
          EjbJarAttribute.forName(reader.getAttributeLocalName(i));
      if (ejbJarVersionAttribute == EjbJarAttribute.VERSION) {
        versionString = reader.getAttributeValue(i);
      }
    }
    if ("1.1".equals(versionString)) {
      ejbJarVersion = EjbJarVersion.EJB_1_1;
    } else if ("2.0".equals(versionString)) {
      ejbJarVersion = EjbJarVersion.EJB_2_0;
    } else if ("2.1".equals(versionString)) {
      ejbJarVersion = EjbJarVersion.EJB_2_1;
    } else if ("3.0".equals(versionString)) {
      ejbJarVersion = EjbJarVersion.EJB_3_0;
    } else if ("3.1".equals(versionString)) {
      ejbJarVersion = EjbJarVersion.EJB_3_1;
    }

    return ejbJarVersion;
  }