Search in sources :

Example 1 with CisSnomedIdentifierService

use of com.b2international.snowowl.snomed.cis.client.CisSnomedIdentifierService in project snow-owl by b2ihealthcare.

the class CisSnomedIdentifierServiceTest method init.

@Before
public void init() {
    final SnomedIdentifierConfiguration conf = new SnomedIdentifierConfiguration();
    conf.setCisBaseUrl("http://107.170.101.181:3000");
    conf.setCisContextRoot("api");
    conf.setCisClientSoftwareKey("Snow Owl dev. tests");
    conf.setCisUserName("snowowl-dev-b2i");
    conf.setCisPassword("hAAYLYMX5gc98SDEz9cr");
    conf.setCisTimeBetweenPollTries(1000);
    conf.setCisNumberOfPollTries(5);
    final ISnomedIdentifierReservationService reservationService = new SnomedIdentifierReservationServiceImpl();
    service = new CisSnomedIdentifierService(conf, reservationService, mapper);
}
Also used : SnomedIdentifierReservationServiceImpl(com.b2international.snowowl.snomed.cis.internal.reservations.SnomedIdentifierReservationServiceImpl) CisSnomedIdentifierService(com.b2international.snowowl.snomed.cis.client.CisSnomedIdentifierService) ISnomedIdentifierReservationService(com.b2international.snowowl.snomed.cis.reservations.ISnomedIdentifierReservationService) SnomedIdentifierConfiguration(com.b2international.snowowl.snomed.cis.SnomedIdentifierConfiguration) Before(org.junit.Before)

Example 2 with CisSnomedIdentifierService

use of com.b2international.snowowl.snomed.cis.client.CisSnomedIdentifierService in project snow-owl by b2ihealthcare.

the class SnomedIdentifierPlugin method registerSnomedIdentifierService.

private void registerSnomedIdentifierService(final SnomedIdentifierConfiguration conf, final Environment env, final ISnomedIdentifierReservationService reservationService) {
    ISnomedIdentifierService identifierService = null;
    switch(conf.getStrategy()) {
        case EMBEDDED:
            final Index index = Indexes.createIndex(SNOMED_IDS_INDEX, env.service(ObjectMapper.class), new Mappings(SctId.class), env.service(IndexSettings.class).forIndex(env.service(RepositoryConfiguration.class).getIndexConfiguration(), SNOMED_IDS_INDEX));
            index.admin().create();
            final ItemIdGenerationStrategy generationStrategy = new SequentialItemIdGenerationStrategy(reservationService);
            identifierService = new DefaultSnomedIdentifierService(index, generationStrategy, reservationService, conf);
            break;
        case CIS:
            final ObjectMapper mapper = new ObjectMapper();
            identifierService = new CisSnomedIdentifierService(conf, reservationService, mapper);
            break;
        default:
            throw new IllegalStateException(String.format("Unknown ID generation source configured: %s. ", conf.getStrategy()));
    }
    env.services().registerService(ISnomedIdentifierService.class, identifierService);
    LOGGER.info("Snow Owl is configured to use {} based identifier service.", conf.getStrategy());
}
Also used : SequentialItemIdGenerationStrategy(com.b2international.snowowl.snomed.cis.gen.SequentialItemIdGenerationStrategy) SequentialItemIdGenerationStrategy(com.b2international.snowowl.snomed.cis.gen.SequentialItemIdGenerationStrategy) ItemIdGenerationStrategy(com.b2international.snowowl.snomed.cis.gen.ItemIdGenerationStrategy) Mappings(com.b2international.index.mapping.Mappings) CisSnomedIdentifierService(com.b2international.snowowl.snomed.cis.client.CisSnomedIdentifierService) DefaultSnomedIdentifierService(com.b2international.snowowl.snomed.cis.memory.DefaultSnomedIdentifierService) Index(com.b2international.index.Index) RepositoryConfiguration(com.b2international.snowowl.core.config.RepositoryConfiguration) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SctId(com.b2international.snowowl.snomed.cis.domain.SctId)

Aggregations

CisSnomedIdentifierService (com.b2international.snowowl.snomed.cis.client.CisSnomedIdentifierService)2 Index (com.b2international.index.Index)1 Mappings (com.b2international.index.mapping.Mappings)1 RepositoryConfiguration (com.b2international.snowowl.core.config.RepositoryConfiguration)1 SnomedIdentifierConfiguration (com.b2international.snowowl.snomed.cis.SnomedIdentifierConfiguration)1 SctId (com.b2international.snowowl.snomed.cis.domain.SctId)1 ItemIdGenerationStrategy (com.b2international.snowowl.snomed.cis.gen.ItemIdGenerationStrategy)1 SequentialItemIdGenerationStrategy (com.b2international.snowowl.snomed.cis.gen.SequentialItemIdGenerationStrategy)1 SnomedIdentifierReservationServiceImpl (com.b2international.snowowl.snomed.cis.internal.reservations.SnomedIdentifierReservationServiceImpl)1 DefaultSnomedIdentifierService (com.b2international.snowowl.snomed.cis.memory.DefaultSnomedIdentifierService)1 ISnomedIdentifierReservationService (com.b2international.snowowl.snomed.cis.reservations.ISnomedIdentifierReservationService)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Before (org.junit.Before)1