}
public static Map<String, ProfileElement> getProfileElements(
OpendapConfig conf, DConnect dConn, Metadata datasetMet, Profile profile) throws Exception {
OpendapProfileElementExtractor pe = new OpendapProfileElementExtractor(conf);
Map<String, ProfileElement> profElements = new HashMap<String, ProfileElement>();
// extracts all variables defined in DDS
try {
DDS dds = dConn.getDDS();
// loop over all variables found
Enumeration variables = dds.getVariables();
while (variables.hasMoreElements()) {
BaseType variable = (BaseType)variables.nextElement();
String varName = variable.getName();
if (variable instanceof DArray) {
LOG.log(Level.FINE, "Extracting Darray variable: "+varName);
} else if (variable instanceof DGrid) {
LOG.log(Level.FINE, "Extracting Dgrid variable: "+varName);
}
RewriteSpec spec = getProfileElementSpec(varName, conf);
if (spec!=null) {
// use configuration to set variable re-name and type
String peName = spec.getRename() != null && !spec.getRename().equals("") ? spec.getRename() : spec.getOrigName();
if (spec.getElementType().equals(RANGED_ELEMENT_TYPE)) {
profElements.put(peName, pe.extractRangedProfileElement(peName, spec.getOrigName(), profile, dConn.getDAS()));
} else if (spec.getElementType().equals(ENUM_ELEMENT_TYPE)) {
profElements.put(peName, pe.extractEnumeratedProfileElement(peName, spec.getOrigName(), profile, dConn.getDAS()));
}
} else {
// if not explicitly configured, assume variable if of RANGED_ELEMENT_TYPE
profElements.put(varName, pe.extractRangedProfileElement(varName, varName, profile, dConn.getDAS()));
}
}
} catch(Exception e) {