private static KerberosPrincipalType getKerberosPrincipalTypeValue(Map<?, ?> map, String key) {
    String type = getStringValue(map, key);
    if ((type == null) || type.isEmpty()) {
      return null;
    } else {
      return KerberosPrincipalType.valueOf(type.toUpperCase());
    }
  }
Translates a string value representing a principal type to a KerberosPrincipalType.

@param map a Map containing the relevant data
@param key a String declaring the item to retrieve
@return a KerberosPrincipalType, or null is not specified in the map
@throws IllegalArgumentException if the principal type value is not one of the expected types.
ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptor.java