this.conf = conf;
}
public RangedProfileElement extractRangedProfileElement(String elemName, String varname,
Profile profile, DAS das) throws NoSuchAttributeException {
RangedProfileElement elem = new RangedProfileElement(profile);
elem.setName(elemName);
AttributeTable attTable = null;
try {
attTable = das.getAttributeTable(varname);
// make variable names case insensitive
if(attTable == null) attTable = das.getAttributeTable(varname.toLowerCase());
if(attTable == null) attTable = das.getAttributeTable(varname.toUpperCase());
if(attTable == null) throw new NoSuchAttributeException("Att table for ["+varname+"] is null!");
} catch (NoSuchAttributeException e) {
e.printStackTrace();
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);
if (!attr.isContainer()) {
Enumeration attrValues = null;
try {
attrValues = attr.getValues();
} catch (NoSuchAttributeException e) {
e.printStackTrace();
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)) {
elem.setMinValue(attrValue);
if (attrValues.hasMoreElements()) {
elem.setMaxValue((String) attrValues.nextElement());
}
} else if (attrName.equals(UNITS)) {
elem.setUnit(attrValue);
} else if (attrName.equals(START)) {
elem.setMinValue(attrValue);
} else if (attrName.equals(END)) {
elem.setMaxValue(attrValue);
}
}
}
} // not a container attribute