better tracking and reporting of snapshot generation issues
This commit is contained in:
parent
b6cec730b5
commit
8902898428
|
@ -271,6 +271,7 @@ public class ContextUtilities implements ProfileKnowledgeProvider {
|
|||
throw new FHIRException(context.formatMessage(I18nConstants.PROFILE___ERROR_GENERATING_SNAPSHOT, p.getName(), p.getUrl()));
|
||||
pu = null;
|
||||
}
|
||||
p.setGeneratedSnapshot(true);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -705,6 +705,7 @@ public interface IWorkerContext {
|
|||
}
|
||||
public void logMessage(String message); // status messages, always display
|
||||
public void logDebugMessage(LogCategory category, String message); // verbose; only when debugging
|
||||
public boolean isDebugLogging(); // whether to log debug information
|
||||
}
|
||||
public void setLogger(@Nonnull ILoggingService logger);
|
||||
public ILoggingService getLogger();
|
||||
|
|
|
@ -670,11 +670,27 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
T r = super.fetchResource(class_, uri, source);
|
||||
if (r instanceof StructureDefinition) {
|
||||
StructureDefinition p = (StructureDefinition)r;
|
||||
try {
|
||||
new ContextUtilities(this).generateSnapshot(p);
|
||||
} catch (Exception e) {
|
||||
// not sure what to do in this case?
|
||||
System.out.println("Unable to generate snapshot for "+uri+": "+e.getMessage());
|
||||
if (!p.isGeneratedSnapshot()) {
|
||||
if (p.isGeneratingSnapshot()) {
|
||||
throw new FHIRException("Attempt to fetch the profile "+p.getVersionedUrl()+" while generating the snapshot for it");
|
||||
}
|
||||
try {
|
||||
if (logger.isDebugLogging()) {
|
||||
System.out.println("Generating snapshot for "+p.getVersionedUrl());
|
||||
}
|
||||
p.setGeneratingSnapshot(true);
|
||||
try {
|
||||
new ContextUtilities(this).generateSnapshot(p);
|
||||
} finally {
|
||||
p.setGeneratingSnapshot(false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// not sure what to do in this case?
|
||||
System.out.println("Unable to generate snapshot for "+p.getVersionedUrl()+": "+e.getMessage());
|
||||
if (logger.isDebugLogging()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
|
|
|
@ -19,7 +19,13 @@ public class SystemOutLoggingService implements IWorkerContext.ILoggingService {
|
|||
@Override
|
||||
public void logDebugMessage(LogCategory category, String message) {
|
||||
if (debug) {
|
||||
System.out.println(" -" + category.name().toLowerCase() + ": " + message);
|
||||
}
|
||||
System.out.println(" -" + category.name().toLowerCase() + ": " + message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDebugLogging() {
|
||||
return debug;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -125,6 +125,7 @@ public abstract class Base implements Serializable, IBase, IElement {
|
|||
userData.remove(name);
|
||||
}
|
||||
|
||||
|
||||
public void setUserDataINN(String name, Object value) {
|
||||
if (value == null)
|
||||
return;
|
||||
|
|
|
@ -5181,6 +5181,24 @@ public class StructureDefinition extends CanonicalResource {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean generatedSnapshot;
|
||||
private boolean generatingSnapshot;
|
||||
|
||||
public boolean isGeneratedSnapshot() {
|
||||
return generatedSnapshot;
|
||||
}
|
||||
|
||||
public void setGeneratedSnapshot(boolean generatedSnapshot) {
|
||||
this.generatedSnapshot = generatedSnapshot;
|
||||
}
|
||||
|
||||
public boolean isGeneratingSnapshot() {
|
||||
return generatingSnapshot;
|
||||
}
|
||||
|
||||
public void setGeneratingSnapshot(boolean generatingSnapshot) {
|
||||
this.generatingSnapshot = generatingSnapshot;
|
||||
}
|
||||
|
||||
// end addition
|
||||
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -19,7 +19,7 @@
|
|||
|
||||
<properties>
|
||||
<hapi_fhir_version>6.2.1</hapi_fhir_version>
|
||||
<validator_test_case_version>1.2.6</validator_test_case_version>
|
||||
<validator_test_case_version>1.2.7-SNAPSHOT</validator_test_case_version>
|
||||
<junit_jupiter_version>5.7.1</junit_jupiter_version>
|
||||
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
||||
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
|
||||
|
|
Loading…
Reference in New Issue