use of com.b2international.snowowl.core.branch.BranchChangedEvent in project snow-owl by b2ihealthcare.
the class TerminologyRepository method initIndex.
private RevisionIndex initIndex(final ServiceProvider context, Mappings mappings) {
final ObjectMapper mapper = context.service(ObjectMapper.class);
IndexConfiguration indexConfiguration = context.service(RepositoryConfiguration.class).getIndexConfiguration();
final IndexClient indexClient = Indexes.createIndexClient(repositoryId, mapper, mappings, context.service(IndexSettings.class).forIndex(indexConfiguration, repositoryId));
final Index index = new DefaultIndex(indexClient);
final RevisionIndex revisionIndex = new DefaultRevisionIndex(index, context.service(TimestampProvider.class), mapper);
revisionIndex.branching().addBranchChangeListener(path -> {
new BranchChangedEvent(repositoryId, path).publish(context.service(IEventBus.class));
});
// register IndexClient per terminology
bind(IndexClient.class, indexClient);
// register index and revision index access, the underlying index is the same
bind(Index.class, index);
bind(RevisionIndex.class, revisionIndex);
// register branching services
bind(BaseRevisionBranching.class, revisionIndex.branching());
return revisionIndex;
}
Aggregations