}
public EnumeratedProfileElement extractEnumeratedProfileElement(String elemName, String varname,
Profile profile, DAS das)
throws NoSuchAttributeException {
EnumeratedProfileElement elem = new EnumeratedProfileElement(profile);
elem.setName(elemName);
AttributeTable attTable = null;
try {
attTable = das.getAttributeTable(elemName);
} catch (NoSuchAttributeException e) {
LOG.log(Level.WARNING, "Error extracting attribute table for element: ["
+ elemName + "]: Message: " + e.getMessage());
throw e;
}
Enumeration attributeNames = attTable.getNames();
while (attributeNames.hasMoreElements()) {
String attrName = (String) attributeNames.nextElement();
Attribute attr = attTable.getAttribute(attrName);
Enumeration attrValues = null;
try {
attrValues = attr.getValues();
} catch (NoSuchAttributeException e) {
LOG.log(Level.WARNING, "Attempt to resolve attribute: [" + attrName
+ "] failed: Message: " + e.getMessage());
continue;
}
while (attrValues.hasMoreElements()) {
String attrValue = (String) attrValues.nextElement();
if (attrName.equals(ACTUAL_RANGE)) {
String[] vals = attrValue.split(" ");
elem.getValues().addAll(Arrays.asList(vals));
} else if (attrName.equals(UNITS)) {
elem.setUnit(attrValue);
} else {
elem.getValues().add(attrValue);
}
}
}