more packaging fixes

This commit is contained in:
Grahame Grieve 2019-12-05 12:31:25 +11:00
parent e213c1e433
commit ea06dacda7
2 changed files with 15 additions and 30 deletions

View File

@ -103,6 +103,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
private String date;
private IValidatorFactory validatorFactory;
private boolean ignoreProfileErrors;
private boolean progress;
public SimpleWorkerContext() throws FileNotFoundException, IOException, FHIRException {
super();
@ -287,7 +288,9 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
}
public void loadFromPackage(NpmPackage pi, IContextResourceLoader loader, String... types) throws FileNotFoundException, IOException, FHIRException {
System.out.println("Load Package "+pi.name()+"#"+pi.version());
if (progress) {
System.out.println("Load Package "+pi.name()+"#"+pi.version());
}
if (types.length == 0)
types = new String[] { "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"};
for (String s : pi.listResources(types)) {
@ -633,6 +636,14 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
return Utilities.listCanonicalUrls(transforms.keys());
}
public boolean isProgress() {
return progress;
}
public void setProgress(boolean progress) {
this.progress = progress;
}

View File

@ -413,6 +413,9 @@ public class NpmPackage {
*/
public InputStream load(String folder, String file) throws IOException {
NpmPackageFolder f = folders.get(folder);
if (f == null) {
f = folders.get(Utilities.path("package", folder));
}
if (f != null && f.hasFile(file)) {
return new ByteArrayInputStream(f.fetchFile(file));
} else {
@ -611,35 +614,6 @@ public class NpmPackage {
return folders;
}
//
//
// public void unPack(String dir) throws IOException {
// unPack (dir, false);
// }
//
// public void unPackWithAppend(String dir) throws IOException {
// unPack (dir, true);
// }
//
// public void unPack(String dir, boolean withAppend) throws IOException {
// for (String s : content.keySet()) {
// String fn = Utilities.path(dir, s);
// String dn = Utilities.getDirectoryForFile(fn);
// Utilities.createDirectory(dn);
// File f = new File(s);
// if (withAppend && f.getName().startsWith("_append.")) {
// String appendFn = Utilities.path(dir, Utilities.getDirectoryForFile(s), f.getName().substring(8));
// if (new File(appendFn).exists())
// TextFile.appendBytesToFile(content.get(s), appendFn);
// else
// TextFile.bytesToFile(content.get(s), appendFn);
// } else
// TextFile.bytesToFile(content.get(s), fn);
// }
// if (path != null)
// FileUtils.copyDirectory(new File(path), new File(dir));
// }
public void save(OutputStream stream) throws IOException {
TarArchiveOutputStream tar;
ByteArrayOutputStream OutputStream;