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);
}
Aggregations