private void loadGlobalConceptDomains() throws Exception { logger.log("Load Concept Domains", LogMessageType.Process); BindingsParser parser = new BindingsParser( new CSFileInputStream(new CSFile(termDir + "bindings.xml")), termDir + "bindings.xml", srcDir, registry); List<BindingSpecification> cds = parser.parse(); for (BindingSpecification cd : cds) { definitions.getBindings().put(cd.getName(), cd); definitions.getCommonBindings().add(cd); } for (BindingSpecification cd : definitions.getBindings().values()) { if (cd.getBinding() == BindingSpecification.Binding.CodeList) { if (!parser.loadCodes(cd)) { File file = new CSFile(termDir + cd.getReference().substring(1) + ".csv"); if (!file.exists()) throw new Exception( "code source file not found for " + cd.getName() + ": " + file.getAbsolutePath()); CodeListParser cparser = new CodeListParser(new CSFileInputStream(file)); cparser.parse(cd.getCodes()); cparser.close(); } } if (cd.getBinding() == Binding.ValueSet && !Utilities.noString(cd.getReference())) { if (cd.getReference().startsWith("http://hl7.org/fhir")) { // ok, it's a reference to a value set defined within this build. Since it's an absolute // reference, it's into the base infrastructure. That's not loaded yet, so we will try // to resolve it later } else if (new File(Utilities.appendSlash(termDir) + cd.getReference() + ".xml").exists()) { XmlParser p = new XmlParser(); FileInputStream input = new FileInputStream(Utilities.appendSlash(termDir) + cd.getReference() + ".xml"); cd.setReferredValueSet((ValueSet) p.parse(input)); } else if (new File(Utilities.appendSlash(termDir) + cd.getReference() + ".json") .exists()) { JsonParser p = new JsonParser(); FileInputStream input = new FileInputStream(Utilities.appendSlash(termDir) + cd.getReference() + ".json"); cd.setReferredValueSet((ValueSet) p.parse(input)); } else throw new Exception( "Unable to find source for " + cd.getReference() + " (" + Utilities.appendSlash(termDir) + cd.getReference() + ".xml/json)"); } } }