variableIds.put(id, child);
}
}
// now create a manager with the defined variable identifiers
VariableManager manager = new VariableManager(variableIds, metaData);
definitions = new HashSet<VariableDefinition>();
// next, collect the Policy-specific elements
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
String name = child.getNodeName();
if (name.equals("Rule")) {
rules.add(Rule.getInstance(child, metaData, manager));
} else if (name.equals("RuleCombinerParameters")) {
String ref = child.getAttributes().getNamedItem("RuleIdRef").getNodeValue();
// if we found the parameter before than add it the end of
// the previous paramters, otherwise create a new entry
if (parameters.containsKey(ref)) {
List<CombinerParameter> list = parameters.get(ref);
parseParameters(list, child);
} else {
List<CombinerParameter> list = new ArrayList<CombinerParameter>();
parseParameters(list, child);
parameters.put(ref, list);
}
} else if (name.equals("VariableDefinition")) {
String id = child.getAttributes().getNamedItem("VariableId").getNodeValue();
// parsing definitions is a little strange, since they can
// contain references to definitions we haven't yet parsed
// or circular references, but we still want to verify the
// references and the types...so, for each definition, we
// ask the manager though getDefinition, which takes care
// of loading any forward references, handles loops, etc.
// It also handles caching definitions, so we don't end
// up parsing the same definitions multiple times
definitions.add(manager.getDefinition(id));
}
}
definitions = Collections.unmodifiableSet(definitions);