public void registerFhirProviders ( FhirProviderBundle bundle , Map < String , Object > props ) throws FhirConfigurationException { if ( bundle != null ) { Collection < Object > providers = bundle . getProviders ( ) ; if ( providers != null && ! providers . isEmpty ( ) ) { try { String serverName = ( String ) props . get ( FhirServer . SVCPROP_SERVICE_NAME ) ; String ourServerName = getServerName ( serverName ) ; String bundleName = ( String ) props . get ( "name" ) ; if ( null == bundleName ) { bundleName = "<default>" ; } log . trace ( "Register FHIR Provider Bundle [" + bundleName + "] on FHIR Server [" + ourServerName + "]" ) ; FhirServer server = registeredServers . get ( ourServerName ) ; if ( server != null ) { registerProviders ( providers , server , serverName ) ; } else { log . trace ( "Queue the Provider Bundle waiting for FHIR Server to be registered" ) ; Collection < Collection < Object > > pending ; synchronized ( pendingProviders ) { pending = pendingProviders . get ( serverName ) ; if ( null == pending ) { pending = Collections . synchronizedCollection ( new ArrayList < Collection < Object > > ( ) ) ; pendingProviders . put ( serverName , pending ) ; } } pending . add ( providers ) ; } } catch ( BadServerException e ) { throw new FhirConfigurationException ( "Unable to register the OSGi FHIR Provider. Multiple Restful Servers exist. Specify the [" + FhirServer . SVCPROP_SERVICE_NAME + "] service-property" ) ; } } } }
Register a new FHIR Provider - Bundle OSGi service .