Search in sources :

Example 1 with TerminologyRegistry

use of com.b2international.snowowl.core.terminology.TerminologyRegistry in project snow-owl by b2ihealthcare.

the class TerminologyRepositoryPlugin method run.

@Override
public final void run(SnowOwlConfiguration configuration, Environment env) throws Exception {
    // register terminology and component definitions
    TerminologyRegistry registry = env.service(TerminologyRegistry.class);
    registry.register(this);
    getAdditionalTerminologyComponents().values().forEach(additionalTerminologyComponent -> registry.register(getToolingId(), additionalTerminologyComponent));
    if (env.isServer()) {
        final DefaultRepositoryManager repositories = (DefaultRepositoryManager) env.service(RepositoryManager.class);
        final RepositoryBuilder builder = repositories.prepareCreate(getToolingId());
        final Repository repo = builder.withPreCommitHook(getTerminologyRepositoryPreCommitHook(builder.log())).addTerminologyComponents(getTerminologyComponents()).addTerminologyComponents(getAdditionalTerminologyComponents()).addMappings(getAdditionalMappings()).bind(ComponentDeletionPolicy.class, getComponentDeletionPolicy()).bind(VersioningRequestBuilder.class, getVersioningRequestBuilder()).bind(ComponentRevisionConflictProcessor.class, getComponentRevisionConflictProcessor()).bind(ConceptSearchRequestEvaluator.class, getConceptSearchRequestEvaluator()).bind(ValueSetMemberSearchRequestEvaluator.class, getMemberSearchRequestEvaluator()).bind(ConceptMapMappingSearchRequestEvaluator.class, getConceptMapMappingSearchRequestEvaluator()).bind(QueryOptimizer.class, getQueryOptimizer()).bind(ContentAvailabilityInfoProvider.class, getContentAvailabilityInfoProvider()).bind(ContextConfigurer.class, getRequestConfigurer()).bind(ResourceURLSchemaSupport.class, getTerminologyURISupport()).build(env);
        RepositoryInfo status = repo.status();
        if (status.health() == Health.GREEN) {
            LOG.info("Started repository '{}' with status '{}'", repo.id(), status.health());
        } else {
            LOG.warn("Started repository '{}' with status '{}'. Diagnosis: {}.", status.id(), status.health(), status.diagnosis());
        }
        // register EsClient from repository globally
        env.services().registerService(EsClient.class, repo.service(IndexClient.class).client());
    }
    afterRun(configuration, env);
}
Also used : Repository(com.b2international.snowowl.core.Repository) VersioningRequestBuilder(com.b2international.snowowl.core.request.version.VersioningRequestBuilder) RepositoryInfo(com.b2international.snowowl.core.RepositoryInfo) ResourceURLSchemaSupport(com.b2international.snowowl.core.uri.ResourceURLSchemaSupport) TerminologyRegistry(com.b2international.snowowl.core.terminology.TerminologyRegistry) RepositoryManager(com.b2international.snowowl.core.RepositoryManager)

Aggregations

Repository (com.b2international.snowowl.core.Repository)1 RepositoryInfo (com.b2international.snowowl.core.RepositoryInfo)1 RepositoryManager (com.b2international.snowowl.core.RepositoryManager)1 VersioningRequestBuilder (com.b2international.snowowl.core.request.version.VersioningRequestBuilder)1 TerminologyRegistry (com.b2international.snowowl.core.terminology.TerminologyRegistry)1 ResourceURLSchemaSupport (com.b2international.snowowl.core.uri.ResourceURLSchemaSupport)1