From f3b08b1ee818eb7da7d8e82435f5766e4d174be8 Mon Sep 17 00:00:00 2001 From: dotasek Date: Wed, 13 Dec 2023 14:00:12 -0500 Subject: [PATCH] match refactor of FilesystemPackageCacheManager in core --- .../org/hl7/fhir/tools/converters/NarrativeRemover.java | 2 +- .../org/hl7/fhir/tools/converters/R5RedirectBuilder.java | 2 +- .../fhir/tools/converters/StructureDefinitionScanner.java | 2 +- .../org/hl7/fhir/tools/converters/TerminologyFixer.java | 2 +- .../fhir/tools/converters/VersionTransformGenerator.java | 2 +- .../java/org/hl7/fhir/tools/publisher/PageProcessor.java | 8 ++++---- src/main/java/org/hl7/fhir/tools/publisher/Publisher.java | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/hl7/fhir/tools/converters/NarrativeRemover.java b/src/main/java/org/hl7/fhir/tools/converters/NarrativeRemover.java index 4d759b6c..d31b05eb 100644 --- a/src/main/java/org/hl7/fhir/tools/converters/NarrativeRemover.java +++ b/src/main/java/org/hl7/fhir/tools/converters/NarrativeRemover.java @@ -67,7 +67,7 @@ public static void main(String[] args) throws FHIRFormatError, FileNotFoundExcep private void start(File file) throws FHIRException, IOException { ini = new IniFile("/Users/grahamegrieve/work/r5/source/oids.ini"); checkIni(); - r4 = new FilesystemPackageCacheManager(org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode.USER).loadPackage("hl7.fhir.r4.core"); + r4 = new FilesystemPackageCacheManager.Builder().build().loadPackage("hl7.fhir.r4.core"); ctxt = new SimpleWorkerContextBuilder().fromPackage(r4, new R4ToR5Loader(BuildWorkerContext.defaultTypesToLoad(), new TempLoader(), "4.0.0"), false); remove(file); } diff --git a/src/main/java/org/hl7/fhir/tools/converters/R5RedirectBuilder.java b/src/main/java/org/hl7/fhir/tools/converters/R5RedirectBuilder.java index 2755d6e1..8e876559 100644 --- a/src/main/java/org/hl7/fhir/tools/converters/R5RedirectBuilder.java +++ b/src/main/java/org/hl7/fhir/tools/converters/R5RedirectBuilder.java @@ -192,7 +192,7 @@ private void buildMap(String web) throws IOException { } } } - FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true); + FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager.Builder().build(); Map urlMap = new HashMap<>(); loadFromPackage(files, urlMap, "", pcm.loadPackage("hl7.fhir.r5.core")); loadFromPackage(files, urlMap, "", pcm.loadPackage("hl7.fhir.r5.examples")); diff --git a/src/main/java/org/hl7/fhir/tools/converters/StructureDefinitionScanner.java b/src/main/java/org/hl7/fhir/tools/converters/StructureDefinitionScanner.java index f31dfff3..940f5ff0 100644 --- a/src/main/java/org/hl7/fhir/tools/converters/StructureDefinitionScanner.java +++ b/src/main/java/org/hl7/fhir/tools/converters/StructureDefinitionScanner.java @@ -29,7 +29,7 @@ public static void main(String[] args) throws FHIRException, IOException { private void run(File file) throws FHIRException, IOException { System.out.println("Loading"); - FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true); + FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager.Builder().build(); NpmPackage npm = pcm.loadPackage("hl7.fhir.r5.core"); context = new SimpleWorkerContextBuilder().fromPackage(npm); fpe = new FHIRPathEngine(context); diff --git a/src/main/java/org/hl7/fhir/tools/converters/TerminologyFixer.java b/src/main/java/org/hl7/fhir/tools/converters/TerminologyFixer.java index 81c9e5d5..d400be42 100644 --- a/src/main/java/org/hl7/fhir/tools/converters/TerminologyFixer.java +++ b/src/main/java/org/hl7/fhir/tools/converters/TerminologyFixer.java @@ -43,7 +43,7 @@ public static void main(String[] args) throws FHIRFormatError, FileNotFoundExcep private void start(File file) throws FHIRException, IOException { load(file); - NpmPackage npm = new FilesystemPackageCacheManager(true).loadPackage("hl7.terminology"); + NpmPackage npm = new FilesystemPackageCacheManager.Builder().build().loadPackage("hl7.terminology"); for (String s : npm.listResources("CodeSystem")) { CodeSystem cs = (CodeSystem) new JsonParser().parse(npm.load("package", s)); tho.put(cs.getUrl(), cs); diff --git a/src/main/java/org/hl7/fhir/tools/converters/VersionTransformGenerator.java b/src/main/java/org/hl7/fhir/tools/converters/VersionTransformGenerator.java index a1a83620..8657ee77 100644 --- a/src/main/java/org/hl7/fhir/tools/converters/VersionTransformGenerator.java +++ b/src/main/java/org/hl7/fhir/tools/converters/VersionTransformGenerator.java @@ -43,7 +43,7 @@ public static void main(String[] args) throws FHIRException, IOException { private void run(File file) throws FHIRException, IOException { System.out.println("Loading"); - FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true); + FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager.Builder().build(); NpmPackage npm = pcm.loadPackage("hl7.fhir.r5.core#current"); context = new SimpleWorkerContextBuilder().fromPackage(npm); cu = new ContextUtilities(context); diff --git a/src/main/java/org/hl7/fhir/tools/publisher/PageProcessor.java b/src/main/java/org/hl7/fhir/tools/publisher/PageProcessor.java index 3431dbc4..658d4e55 100644 --- a/src/main/java/org/hl7/fhir/tools/publisher/PageProcessor.java +++ b/src/main/java/org/hl7/fhir/tools/publisher/PageProcessor.java @@ -10447,16 +10447,16 @@ public void setDefinitions(Definitions definitions) throws Exception { workerContext.setLogger(this); workerContext.setAllowLoadingDuplicates(true); log("Load UTG Terminology", LogMessageType.Process); - utg = new FilesystemPackageCacheManager(org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode.USER).loadPackage("hl7.terminology"); + utg = new FilesystemPackageCacheManager.Builder().build().loadPackage("hl7.terminology"); workerContext.loadFromPackage(utg, new R4ToR5Loader(BuildWorkerContext.defaultTypesToLoad(), new UTGLoader(utg.version()), workerContext.getVersion())); log("Load Extensions", LogMessageType.Process); - ext = new FilesystemPackageCacheManager(org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode.USER).loadPackage("hl7.fhir.uv.extensions", "current"); + ext = new FilesystemPackageCacheManager.Builder().build().loadPackage("hl7.fhir.uv.extensions", "current"); workerContext.loadFromPackage(ext, new R4ToR5Loader(BuildWorkerContext.extensionTypesToLoad(), new ExtensionsLoader(ext.version(), extensionsLocation), workerContext.getVersion())); log("Load DICOM Terminology", LogMessageType.Process); - dicom = new FilesystemPackageCacheManager(org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode.USER).loadPackage("fhir.dicom"); + dicom = new FilesystemPackageCacheManager.Builder().build().loadPackage("fhir.dicom"); workerContext.loadFromPackage(dicom, new R4ToR5Loader(BuildWorkerContext.defaultTypesToLoad(), new DICOMLoader(utg.version()), workerContext.getVersion())); log("Load IHE Format Codes", LogMessageType.Process); - NpmPackage ihe = new FilesystemPackageCacheManager(org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode.USER).loadPackage("ihe.formatcode.fhir"); + NpmPackage ihe = new FilesystemPackageCacheManager.Builder().build().loadPackage("ihe.formatcode.fhir"); workerContext.loadFromPackage(ihe, new R4ToR5Loader(BuildWorkerContext.defaultTypesToLoad(), new IHELoader(), workerContext.getVersion())); Map packages = new HashMap<>(); diff --git a/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java b/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java index 48a78efc..74325bf0 100644 --- a/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java +++ b/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java @@ -3414,7 +3414,7 @@ private void produceSpec() throws Exception { npm.finish(); if (!isCIBuild) { String id = pidRoot()+".expansions"; - new FilesystemPackageCacheManager(org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode.USER).addPackageToCache(id, "current", new FileInputStream(Utilities.uncheckedPath(page.getFolders().dstDir, id + ".tgz")), Utilities.uncheckedPath(page.getFolders().dstDir, id + ".tgz")); + new FilesystemPackageCacheManager.Builder().build().addPackageToCache(id, "current", new FileInputStream(Utilities.uncheckedPath(page.getFolders().dstDir, id + ".tgz")), Utilities.uncheckedPath(page.getFolders().dstDir, id + ".tgz")); } serializeResource(expansionFeed, "expansions", false); @@ -3571,7 +3571,7 @@ private void produceSpec() throws Exception { SpecNPMPackageGenerator self = new SpecNPMPackageGenerator(); self.generate(page.getFolders().dstDir, page.getWebLocation(), false, page.getGenDate().getTime(), pidRoot()); if (!isCIBuild) { - new FilesystemPackageCacheManager(org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode.USER).addPackageToCache(pidRoot()+".core", "current", new FileInputStream(Utilities.uncheckedPath(page.getFolders().dstDir, pidRoot() + ".core.tgz")), Utilities.uncheckedPath(page.getFolders().dstDir, pidRoot() + ".core.tgz")); + new FilesystemPackageCacheManager.Builder().build().addPackageToCache(pidRoot()+".core", "current", new FileInputStream(Utilities.uncheckedPath(page.getFolders().dstDir, pidRoot() + ".core.tgz")), Utilities.uncheckedPath(page.getFolders().dstDir, pidRoot() + ".core.tgz")); } page.log(" ...zips", LogMessageType.Process);