File tree Expand file tree Collapse file tree
fhir-bulkdata-webapp/src/main/java/com/ibm/fhir/bulkdata/jbatch/control
fhir-profile/src/test/java/com/ibm/fhir/profile/test/provider
fhir-registry/src/main/java/com/ibm/fhir/registry
fhir-server/src/main/java/com/ibm/fhir/server/listener Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import javax .servlet .annotation .WebListener ;
2222
2323import com .ibm .fhir .config .FHIRConfiguration ;
24+ import com .ibm .fhir .model .util .FHIRUtil ;
25+ import com .ibm .fhir .model .util .ModelSupport ;
26+ import com .ibm .fhir .registry .FHIRRegistry ;
27+ import com .ibm .fhir .search .util .SearchUtil ;
2428
2529/**
2630 * This Servlet Context Listener provides a hook to the BatchRuntime.
@@ -35,6 +39,19 @@ public void contextInitialized(ServletContextEvent sce) {
3539
3640 FHIRConfiguration .setConfigHome (System .getenv ("FHIR_CONFIG_HOME" ));
3741
42+ log .fine ("Initializing ModelSupport..." );
43+ ModelSupport .init ();
44+
45+ log .fine ("Initializing FHIRUtil..." );
46+ FHIRUtil .init ();
47+
48+ log .fine ("Initializing FHIRRegistry..." );
49+ FHIRRegistry .getInstance ();
50+ FHIRRegistry .init ();
51+
52+ log .fine ("Initializing SearchUtil..." );
53+ SearchUtil .init ();
54+
3855 try {
3956 @ SuppressWarnings ("unused" )
4057 Subject subject = Subject .getSubject (AccessController .getContext ());
Original file line number Diff line number Diff line change 867867 <maxmemory >2g</maxmemory >
868868 <!-- doclint is none, otherwise build breaks -->
869869 <doclint >none</doclint >
870- <additionalparam >-Xdoclint:none
871- -Djava.awt.headless=true</additionalparam >
872870 <detectLinks >true</detectLinks >
873871 <!-- control display -->
874872 <author >false</author >
Original file line number Diff line number Diff line change 66
77package com .ibm .fhir .profile .test .provider ;
88
9+ import org .testng .annotations .BeforeClass ;
910import org .testng .annotations .Test ;
1011
1112import com .ibm .fhir .model .annotation .Constraint ;
1213import com .ibm .fhir .model .resource .StructureDefinition ;
1314import com .ibm .fhir .model .type .Extension ;
1415import com .ibm .fhir .model .util .ModelSupport ;
1516import com .ibm .fhir .profile .ProfileSupport ;
17+ import com .ibm .fhir .registry .FHIRRegistry ;
1618import com .ibm .fhir .registry .resource .FHIRRegistryResource ;
1719
1820public class ProviderTest {
21+ @ BeforeClass
22+ public void before () {
23+ FHIRRegistry .getInstance ();
24+ FHIRRegistry .init ();
25+ }
26+
1927 @ Test
20- public static void testProviderWithLocalLookup () throws Exception {
28+ public void testProviderWithLocalLookup () throws Exception {
2129 TestRegistryResourceProvider provider = new TestRegistryResourceProvider ();
2230 for (FHIRRegistryResource registryResource : provider .getRegistryResources ()) {
2331 if (StructureDefinition .class .equals (registryResource .getResourceType ())) {
Original file line number Diff line number Diff line change @@ -350,6 +350,15 @@ private List<FHIRRegistryResourceProvider> loadProviders() {
350350 return providers ;
351351 }
352352
353+ /**
354+ * initializes the Resource Providers.
355+ */
356+ public static void init () {
357+ for (FHIRRegistryResourceProvider provider : getInstance ().providers ) {
358+ provider .init ();
359+ }
360+ }
361+
353362 /**
354363 * Get the singleton instance of this class
355364 *
Original file line number Diff line number Diff line change 1313import com .ibm .fhir .registry .resource .FHIRRegistryResource ;
1414
1515/**
16- * An SPI for {@link FHIRRegistryResource} instances
16+ * An SPI for {@link FHIRRegistryResource} instances.
17+ *
18+ * When implementing this SPI, the constructor and instance variables should not make calls to the FHIRRegistry. Use the init method to call back to the Registry.
1719 */
1820public interface FHIRRegistryResourceProvider {
21+ /**
22+ * Facilitates callbacks after the ServiceLoader has discovered the providers and conditionally loaded the Providers.
23+ */
24+ default void init () {
25+ // NOP
26+ }
27+
1928 /**
2029 * Get the registry resource from this provider for the given resource type, url and version
2130 *
Original file line number Diff line number Diff line change @@ -116,6 +116,8 @@ public void contextInitialized(ServletContextEvent event) {
116116 /*
117117 * The following inits are intended to load the Support / Util classes into the classloader.
118118 * Subsequently, the code activates the static values (and maps).
119+ *
120+ * @see JobControlContextListener to see register these settings for Bulk Data.
119121 */
120122
121123 log .fine ("Initializing ModelSupport..." );
@@ -124,6 +126,10 @@ public void contextInitialized(ServletContextEvent event) {
124126 log .fine ("Initializing FHIRUtil..." );
125127 FHIRUtil .init ();
126128
129+ log .fine ("Initializing FHIRRegistry..." );
130+ FHIRRegistry .getInstance ();
131+ FHIRRegistry .init ();
132+
127133 log .fine ("Initializing SearchUtil..." );
128134 SearchUtil .init ();
129135
@@ -215,9 +221,6 @@ public void contextInitialized(ServletContextEvent event) {
215221 Boolean checkUnicodeChars = fhirConfig .getBooleanProperty (PROPERTY_CHECK_CONTROL_CHARS , Boolean .TRUE );
216222 FHIRModelConfig .setCheckForControlChars (checkUnicodeChars );
217223
218- log .fine ("Initializing FHIRRegistry..." );
219- FHIRRegistry .getInstance ();
220-
221224 Boolean serverRegistryResourceProviderEnabled = fhirConfig .getBooleanProperty (PROPERTY_SERVER_REGISTRY_RESOURCE_PROVIDER_ENABLED , Boolean .FALSE );
222225 if (serverRegistryResourceProviderEnabled ) {
223226 log .info ("Registering ServerRegistryResourceProvider..." );
You can’t perform that action at this time.
0 commit comments