Search in sources :

Example 1 with IndexConfiguration

use of com.b2international.snowowl.core.config.IndexConfiguration in project snow-owl by b2ihealthcare.

the class SnomedStatedEclEvaluationTest method setup.

@Before
public void setup() {
    SnomedCoreConfiguration config = new SnomedCoreConfiguration();
    config.setConcreteDomainSupported(true);
    RepositoryConfiguration repositoryConfig = new RepositoryConfiguration();
    IndexConfiguration indexConfiguration = new IndexConfiguration();
    indexConfiguration.setResultWindow(IndexClientFactory.DEFAULT_RESULT_WINDOW);
    repositoryConfig.setIndexConfiguration(indexConfiguration);
    context = TestBranchContext.on(MAIN).with(EclParser.class, new DefaultEclParser(INJECTOR.getInstance(IParser.class), INJECTOR.getInstance(IResourceValidator.class))).with(EclSerializer.class, new DefaultEclSerializer(INJECTOR.getInstance(ISerializer.class))).with(Index.class, rawIndex()).with(RevisionIndex.class, index()).with(SnomedCoreConfiguration.class, config).with(RepositoryConfiguration.class, repositoryConfig).with(ResourceURI.class, CodeSystem.uri("SNOMEDCT")).build();
}
Also used : RevisionIndex(com.b2international.index.revision.RevisionIndex) SnomedCoreConfiguration(com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration) RepositoryConfiguration(com.b2international.snowowl.core.config.RepositoryConfiguration) IndexConfiguration(com.b2international.snowowl.core.config.IndexConfiguration) ISerializer(org.eclipse.xtext.serializer.ISerializer) Before(org.junit.Before)

Example 2 with IndexConfiguration

use of com.b2international.snowowl.core.config.IndexConfiguration 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;
}
Also used : DefaultIndex(com.b2international.index.DefaultIndex) TimestampProvider(com.b2international.index.revision.TimestampProvider) RevisionIndex(com.b2international.index.revision.RevisionIndex) DefaultRevisionIndex(com.b2international.index.revision.DefaultRevisionIndex) IndexClient(com.b2international.index.IndexClient) DefaultRevisionIndex(com.b2international.index.revision.DefaultRevisionIndex) Index(com.b2international.index.Index) RevisionIndex(com.b2international.index.revision.RevisionIndex) DefaultRevisionIndex(com.b2international.index.revision.DefaultRevisionIndex) DefaultIndex(com.b2international.index.DefaultIndex) RepositoryConfiguration(com.b2international.snowowl.core.config.RepositoryConfiguration) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) BranchChangedEvent(com.b2international.snowowl.core.branch.BranchChangedEvent) IEventBus(com.b2international.snowowl.eventbus.IEventBus) IndexConfiguration(com.b2international.snowowl.core.config.IndexConfiguration)

Example 3 with IndexConfiguration

use of com.b2international.snowowl.core.config.IndexConfiguration in project snow-owl by b2ihealthcare.

the class BaseSnomedEclEvaluationRequestTest method setup.

@Before
public void setup() {
    SnomedCoreConfiguration config = new SnomedCoreConfiguration();
    config.setConcreteDomainSupported(true);
    RepositoryConfiguration repositoryConfig = new RepositoryConfiguration();
    IndexConfiguration indexConfiguration = new IndexConfiguration();
    indexConfiguration.setResultWindow(IndexClientFactory.DEFAULT_RESULT_WINDOW);
    repositoryConfig.setIndexConfiguration(indexConfiguration);
    context = TestBranchContext.on(MAIN).with(EclParser.class, new DefaultEclParser(INJECTOR.getInstance(IParser.class), INJECTOR.getInstance(IResourceValidator.class))).with(EclSerializer.class, new DefaultEclSerializer(INJECTOR.getInstance(ISerializer.class))).with(Index.class, rawIndex()).with(RevisionIndex.class, index()).with(SnomedCoreConfiguration.class, config).with(ObjectMapper.class, getMapper()).with(TerminologyResource.class, createCodeSystem(MAIN)).with(ResourceURI.class, CodeSystem.uri("SNOMEDCT")).with(RepositoryConfiguration.class, repositoryConfig).build();
}
Also used : ResourceURI(com.b2international.snowowl.core.ResourceURI) RevisionIndex(com.b2international.index.revision.RevisionIndex) SnomedCoreConfiguration(com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration) RepositoryConfiguration(com.b2international.snowowl.core.config.RepositoryConfiguration) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) IndexConfiguration(com.b2international.snowowl.core.config.IndexConfiguration) ISerializer(org.eclipse.xtext.serializer.ISerializer) Before(org.junit.Before)

Example 4 with IndexConfiguration

use of com.b2international.snowowl.core.config.IndexConfiguration in project snow-owl by b2ihealthcare.

the class RepositoryPlugin method initIndexSettings.

private Map<String, Object> initIndexSettings(Environment env) {
    final RepositoryConfiguration repositoryConfig = env.service(RepositoryConfiguration.class);
    final IndexConfiguration indexConfig = repositoryConfig.getIndexConfiguration();
    final ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
    indexConfig.configure(builder);
    builder.put(IndexClientFactory.DATA_DIRECTORY, env.getDataPath().resolve("indexes").toString());
    builder.put(IndexClientFactory.CONFIG_DIRECTORY, env.getConfigPath().toString());
    builder.put(IndexClientFactory.INDEX_PREFIX, repositoryConfig.getDeploymentId());
    return builder.build();
}
Also used : RepositoryConfiguration(com.b2international.snowowl.core.config.RepositoryConfiguration) ImmutableMap(com.google.common.collect.ImmutableMap) IndexConfiguration(com.b2international.snowowl.core.config.IndexConfiguration)

Aggregations

IndexConfiguration (com.b2international.snowowl.core.config.IndexConfiguration)4 RepositoryConfiguration (com.b2international.snowowl.core.config.RepositoryConfiguration)4 RevisionIndex (com.b2international.index.revision.RevisionIndex)3 SnomedCoreConfiguration (com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ISerializer (org.eclipse.xtext.serializer.ISerializer)2 Before (org.junit.Before)2 DefaultIndex (com.b2international.index.DefaultIndex)1 Index (com.b2international.index.Index)1 IndexClient (com.b2international.index.IndexClient)1 DefaultRevisionIndex (com.b2international.index.revision.DefaultRevisionIndex)1 TimestampProvider (com.b2international.index.revision.TimestampProvider)1 ResourceURI (com.b2international.snowowl.core.ResourceURI)1 BranchChangedEvent (com.b2international.snowowl.core.branch.BranchChangedEvent)1 IEventBus (com.b2international.snowowl.eventbus.IEventBus)1 ImmutableMap (com.google.common.collect.ImmutableMap)1