Search in sources :

Example 1 with RepositoryConfiguration

use of com.b2international.snowowl.core.config.RepositoryConfiguration 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 RepositoryConfiguration

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

the class RepositoryPlugin method init.

@Override
public void init(SnowOwlConfiguration configuration, Environment env) throws Exception {
    final IManagedContainer container = env.container();
    final boolean gzip = configuration.isGzip();
    final RpcConfiguration rpcConfig = configuration.getModuleConfig(RpcConfiguration.class);
    LOG.debug("Preparing RPC communication (config={},gzip={})", rpcConfig, gzip);
    RpcUtil.prepareContainer(container, rpcConfig, gzip);
    LOG.debug("Preparing EventBus communication (gzip={})", gzip);
    RepositoryConfiguration repositoryConfiguration = configuration.getModuleConfig(RepositoryConfiguration.class);
    env.services().registerService(RepositoryConfiguration.class, repositoryConfiguration);
    int maxThreads = repositoryConfiguration.getMaxThreads();
    EventBusNet4jUtil.prepareContainer(container, gzip, maxThreads);
    env.services().registerService(IEventBus.class, EventBusNet4jUtil.getBus(container, maxThreads));
    LOG.debug("Preparing JSON support");
    final ObjectMapper mapper = JsonSupport.getDefaultObjectMapper();
    mapper.registerModule(new PrimitiveCollectionModule());
    env.services().registerService(ObjectMapper.class, mapper);
    // initialize Notification support
    env.services().registerService(Notifications.class, new Notifications(env.service(IEventBus.class), env.plugins().getCompositeClassLoader()));
    env.services().registerService(RepositoryCommitNotificationSender.class, new RepositoryCommitNotificationSender());
    // initialize Index Settings
    final IndexSettings indexSettings = new IndexSettings();
    indexSettings.putAll(initIndexSettings(env));
    env.services().registerService(IndexSettings.class, indexSettings);
}
Also used : PrimitiveCollectionModule(com.b2international.collections.PrimitiveCollectionModule) IManagedContainer(org.eclipse.net4j.util.container.IManagedContainer) IndexSettings(com.b2international.snowowl.core.config.IndexSettings) RepositoryConfiguration(com.b2international.snowowl.core.config.RepositoryConfiguration) Notifications(com.b2international.snowowl.core.events.Notifications) RpcConfiguration(com.b2international.snowowl.rpc.RpcConfiguration) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 3 with RepositoryConfiguration

use of com.b2international.snowowl.core.config.RepositoryConfiguration 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 RepositoryConfiguration

use of com.b2international.snowowl.core.config.RepositoryConfiguration 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

RepositoryConfiguration (com.b2international.snowowl.core.config.RepositoryConfiguration)4 IndexConfiguration (com.b2international.snowowl.core.config.IndexConfiguration)3 RevisionIndex (com.b2international.index.revision.RevisionIndex)2 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 PrimitiveCollectionModule (com.b2international.collections.PrimitiveCollectionModule)1 ResourceURI (com.b2international.snowowl.core.ResourceURI)1 IndexSettings (com.b2international.snowowl.core.config.IndexSettings)1 Notifications (com.b2international.snowowl.core.events.Notifications)1 RpcConfiguration (com.b2international.snowowl.rpc.RpcConfiguration)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 IManagedContainer (org.eclipse.net4j.util.container.IManagedContainer)1