001package org.hl7.fhir.convertors.misc; 002 003import java.io.File; 004import java.io.FileInputStream; 005import java.io.IOException; 006 007import org.hl7.fhir.utilities.filesystem.ManagedFileAccess; 008import org.hl7.fhir.utilities.json.model.JsonObject; 009import org.hl7.fhir.utilities.json.model.JsonProperty; 010import org.hl7.fhir.utilities.npm.NpmPackage; 011 012public class XMLPackageConvertor { 013 014 public static void main(String[] args) throws IOException { 015 new XMLPackageConvertor().process(ManagedFileAccess.file("C:\\web\\hl7.org\\fhir")); 016 } 017 018 private void process(File folder) throws IOException { 019 for (File f : folder.listFiles()) { 020 if (f.isDirectory()) { 021 process(f); 022 } else { 023 if (f.getName().endsWith(".tgz")) { 024 System.out.println("Package " + f.getAbsolutePath()); 025 NpmPackage p = NpmPackage.fromPackage(ManagedFileAccess.inStream(f)); 026 if (p.getNpm().has("dependencies")) { 027 JsonObject dep = p.getNpm().getJsonObject("dependencies"); 028 if (dep.getProperties().isEmpty()) { 029 System.out.println(" Dependencies: none"); 030 } else { 031 System.out.println(" Dependencies:"); 032 for (JsonProperty e : dep.getProperties()) { 033 System.out.println(" " + e.getName() + ": " + e.getValue().toString()); 034 } 035 } 036 } else { 037 System.out.println(" Dependencies: n/a"); 038 } 039 } 040 } 041 042 043 } 044 045 } 046 047}