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