Skip to content

Commit

Permalink
Merge pull request #162 from HL7/do-20231213-fpcm-refactor
Browse files Browse the repository at this point in the history
Match refactor of FilesystemPackageCacheManager in core
  • Loading branch information
grahamegrieve authored Dec 13, 2023
2 parents 8e6ed16 + f3b08b1 commit 5ec90b2
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private void buildMap(String web) throws IOException {
}
}
}
FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager(true);
FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager.Builder().build();
Map<String, String> urlMap = new HashMap<>();
loadFromPackage(files, urlMap, "", pcm.loadPackage("hl7.fhir.r5.core"));
loadFromPackage(files, urlMap, "", pcm.loadPackage("hl7.fhir.r5.examples"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/hl7/fhir/tools/publisher/PageProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, SpecMapManager> packages = new HashMap<>();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/hl7/fhir/tools/publisher/Publisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5ec90b2

Please sign in to comment.