Class DefaultFhirRegistry
java.lang.Object
org.openehealth.ipf.commons.ihe.fhir.DefaultFhirRegistry
- All Implemented Interfaces:
FhirRegistry
Default implementation of
FhirRegistry. Instances are thread-safe; registration of resource providers
and servlets is serialized.- Since:
- 3.2
- Author:
- Christian Ohr
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FhirRegistrygetFhirRegistry(String name) Lookup or create a new FHIR registry if none exists with the given (servlet) namebooleanhasServlet(String servletName) Returns true if there is already a registered FHIR servlet with the provided namevoidregister(RestfulServer servlet) Registers the FHIR servlet, usually during its init phase.voidRegisters the FHIR resource provider.static FhirRegistryremoveFhirRegistry(String name) Removes the FHIR registry with the given (servlet) name.resolveProvider(FhirProvider candidate) Returns the resource provider instance to be used for the servlet(s) of this registry.voidunregister(RestfulServer servlet) Unregisters the FHIR servlet, usually during its destroy phasevoidunregister(Object resourceProvider) Unregisters the FHIR resource provider.
-
Constructor Details
-
DefaultFhirRegistry
public DefaultFhirRegistry()Creates a new registry. Use this for a registry that is shared between a FHIR servlet and FHIR endpoints by explicit configuration rather than by servlet name, seegetFhirRegistry(String).- Since:
- 6.1
-
-
Method Details
-
getFhirRegistry
Lookup or create a new FHIR registry if none exists with the given (servlet) name -
removeFhirRegistry
Removes the FHIR registry with the given (servlet) name. Note that FHIR servlets do not remove their registry when being destroyed, because the registry keeps track of the resource providers of the FHIR consumers, which may outlive the servlet. Call this only if neither servlets nor consumers use the registry anymore, e.g. in tests. -
resolveProvider
Description copied from interface:FhirRegistryReturns the resource provider instance to be used for the servlet(s) of this registry. All endpoints that resolve a provider of the same class get the same instance, so that e.g. aSharedFhirProvideris shared between endpoints of the same servlet, but not between different servlets.The default implementation returns the candidate itself.
- Specified by:
resolveProviderin interfaceFhirRegistry- Parameters:
candidate- new resource provider instance, used if this registry does not yet know an instance of the same class- Returns:
- the resource provider instance to be connected and registered
-
register
Description copied from interface:FhirRegistryRegisters the FHIR resource provider.- Specified by:
registerin interfaceFhirRegistry- Parameters:
resourceProvider- resource provider
-
unregister
Description copied from interface:FhirRegistryUnregisters the FHIR resource provider.- Specified by:
unregisterin interfaceFhirRegistry- Parameters:
resourceProvider- resource provider
-
register
Description copied from interface:FhirRegistryRegisters the FHIR servlet, usually during its init phase.- Specified by:
registerin interfaceFhirRegistry- Parameters:
servlet- FHIR servlet- Throws:
IllegalStateException- if a different servlet with the same name is already registered
-
unregister
Description copied from interface:FhirRegistryUnregisters the FHIR servlet, usually during its destroy phase- Specified by:
unregisterin interfaceFhirRegistry- Parameters:
servlet- FHIR servlet
-
hasServlet
Description copied from interface:FhirRegistryReturns true if there is already a registered FHIR servlet with the provided name- Specified by:
hasServletin interfaceFhirRegistry- Parameters:
servletName- name of the servlet- Returns:
- true if there is already a registered FHIR servlet with this name
-