Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SO-1708: Integrate Component Identifier Service #35

Merged
merged 116 commits into from
Nov 25, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
9413d30
SO-1708 Changed identifier service interface.
rporcio Nov 12, 2015
7cd6ab4
SO-1708 Http body models for the CIS communication.
rporcio Nov 12, 2015
96b81e1
SO-1708 Initial implementation of CIS based identifier service.
rporcio Nov 12, 2015
71f8089
SO-1708 Initial implementation of in memory based identifier service.
rporcio Nov 12, 2015
e9c9c8e
SO-1708 Wired in identifier service factory.
rporcio Nov 12, 2015
50738c9
SO-1708 Initial implementation of ID manager.
rporcio Nov 12, 2015
d58998a
SO-1708 Updated id generation strategy behavior.
rporcio Nov 12, 2015
f73b789
SO-1708 Created ID request class.
rporcio Nov 12, 2015
a72d82b
SO-1708 Wired in ID request to commit based requests.
rporcio Nov 12, 2015
4734910
SO-1708 Use new identifier methods during component creation and
rporcio Nov 12, 2015
e04f32c
SO-1708 Added http bundles to required bundles.
rporcio Nov 12, 2015
2b1e8cb
SO-1708 Implemented ID related actions.
rporcio Nov 12, 2015
3e8233e
SO-1708 Updated ID manager to use new actions.
rporcio Nov 12, 2015
ef6612c
SO-1708 Moved reservation check in browser to identifier service.
rporcio Nov 12, 2015
5e2b74a
SO-1708 Updated identifier service factory.
rporcio Nov 12, 2015
0478a86
SO-1708 Temporary fix in classes which used old ID generation.
rporcio Nov 12, 2015
11907f3
SO-1708 Created memory store for snomed identifiers.
rporcio Nov 12, 2015
6d5536c
SO-1708 New skeleton methods to work with mem store.
rporcio Nov 12, 2015
f4c61d5
SO-1708 Use string instead of SnomedIdentifier in methods.
rporcio Nov 12, 2015
44bf191
SO-1708 Deleted snomed identifier memstore, moved login to identifier
rporcio Nov 12, 2015
36a6b50
SO-1708 Implemented skeleton methods.
rporcio Nov 12, 2015
3f4b10d
SO-1708 Changed snomed identifier to string.
rporcio Nov 12, 2015
c16e35e
SO-1708 Implemented test cases of CIS services.
rporcio Nov 12, 2015
182e64f
SO-1708 Fixed namespace generation.
rporcio Nov 13, 2015
c25378e
SO-1708 Fixed identifier service init in SnomedIdentifiers.
rporcio Nov 13, 2015
8f9ae4f
SO-1708 Fixed component deletion request.
rporcio Nov 13, 2015
b23fcc9
SO-1708 Don't throw exception during register if the ID is present in
rporcio Nov 13, 2015
045b55d
Use generated ID instead of hardcoded IDs.
rporcio Nov 13, 2015
6a86004
Merged develop 4.5 into id generation branch.
rporcio Nov 13, 2015
2bc0399
SO-1708 Updated context handling in ID request.
rporcio Nov 13, 2015
24762d4
SO-1708 Added http plugins to launch config.
rporcio Nov 13, 2015
4d4f613
SO-1708 Implemented http body data for bulk requests.
rporcio Nov 13, 2015
4a09df0
SO-1708 Implemented bulk requests.
rporcio Nov 13, 2015
f57dabf
SO-1708 Missing from prev commit.
rporcio Nov 13, 2015
fa7e9b9
SO-1708 Fixed bulk registration data.
rporcio Nov 15, 2015
57f7fa4
SO-1708 Class to test bulk operations.
rporcio Nov 15, 2015
177ef89
SO-1708 Fixed bulk operations, added bulk getter method.
rporcio Nov 15, 2015
accad0f
SO-1708 Added missing javadocs.
rporcio Nov 15, 2015
961185b
SO-1708 Fixed status check in register methods.
rporcio Nov 15, 2015
3c671ed
SO-1708 Added missing bulk getter methods.
rporcio Nov 15, 2015
2c7d735
SO-1708 Check ID in system too before registration.
rporcio Nov 16, 2015
ce36d68
SO-1708 Updated test classes.
rporcio Nov 16, 2015
0bd7db6
SO-1708 Created bulk actions and updated simple actions.
rporcio Nov 16, 2015
a41aeab
SO-1708 Added bulk operations to id manager.
rporcio Nov 16, 2015
4babd39
SO-1708 Check is base action is failed or not before executing rollback
rporcio Nov 16, 2015
6c5dd80
SO-1708 Changed exception type.
rporcio Nov 16, 2015
e03cc3d
SO-1708 Added ID registration process to RF2 import.
rporcio Nov 16, 2015
a87ddc0
SO-1708 Added ID register/release process to classification.
rporcio Nov 16, 2015
575c5d9
SO-1708 Changed register methods.
rporcio Nov 16, 2015
c19669f
SO-1708 Changed int to long.
rporcio Nov 16, 2015
be48fec
SO-1708 Added try-catch to identifier creation and fixed invalid
rporcio Nov 16, 2015
a8af0ef
SO-1708 Converted identifier factory into bootstrap class.
rporcio Nov 16, 2015
571989e
SO-1708 Use partitions in bulk requests to avoid 'request entity too
rporcio Nov 17, 2015
2cf6207
SO-1708 Fixed iteration in job polling.
rporcio Nov 17, 2015
230a280
SO-1708 Added id publication to publish manager.
rporcio Nov 17, 2015
774879c
SO-1708 New method to get all stored sct ids.
rporcio Nov 17, 2015
4a254d3
SO-1708 Fixed typo in service name.
rporcio Nov 17, 2015
6de6d8b
SO-1708 Deleted old identifier service impl and test.
rporcio Nov 17, 2015
b5eb95a
SO-1708 Created in memory identifier service tests and moved common
rporcio Nov 17, 2015
12113f0
SO-1708 Created new config class for identifier related parameters.
rporcio Nov 18, 2015
cc2f120
SO-1708 Changed snomed core config to identifier config.
rporcio Nov 18, 2015
6ab6446
SO-1708 Moved ID release process to change processor. Removed other use
rporcio Nov 18, 2015
a696e61
Merge remote-tracking branch 'origin/develop-4.5' into id_generation
rporcio Nov 18, 2015
d719609
Added back csv plugin.
rporcio Nov 18, 2015
cb73aa4
SO-1708 Skip component IDs with status available when releasing IDs.
rporcio Nov 18, 2015
5cd2b58
SO-1708 Use common status check method.
rporcio Nov 18, 2015
1d8d972
SO-1708 Check ID status at the beginning of the release process.
rporcio Nov 18, 2015
0cea0d0
SO-1708 Made cis based identifier service disposable.
rporcio Nov 18, 2015
b83a02d
SO-1708 Use index service to collect ids.
rporcio Nov 18, 2015
9d396ae
Revert "SO-1708 Use index service to collect ids."
rporcio Nov 18, 2015
a89b799
SO-1708 Implemented and wired in index based identifier service.
rporcio Nov 19, 2015
1d75420
SO-1708 Renamed default identifier service.
rporcio Nov 19, 2015
efcf550
SO-1708 Fixed test classes
rporcio Nov 19, 2015
0860e77
SO-1708 Use memory based identifier service in test.
rporcio Nov 19, 2015
20d97cc
SO-1708 Changed index path.
rporcio Nov 19, 2015
12c431e
Merge remote-tracking branch 'origin/develop-4.5' into id_generation
rporcio Nov 19, 2015
20f1a46
SO-1708 Created new identifier requests.
rporcio Nov 19, 2015
a59aba3
SO-1708 Updated identifier rest service and request handling.
rporcio Nov 19, 2015
0a94002
SO-1708 Made SnomedIdentifier serializable.
rporcio Nov 19, 2015
d0bf979
SO-1708 Refactored component builder methods and id handling.
rporcio Nov 19, 2015
40a0806
SO-1708 Send bulk release only if there are new components.
rporcio Nov 19, 2015
3bee2c5
SO-1708 Fixed identifier api test.
rporcio Nov 19, 2015
b884c71
SO-1708 Updated status check during job polling.
rporcio Nov 20, 2015
d778901
SO-1708 Fixed status check.
rporcio Nov 20, 2015
baeacfd
SO-1708 Throw exception if bulk request ended in error.
rporcio Nov 23, 2015
cdba0ca
Merge remote-tracking branch 'origin/develop-4.5' into id_generation
rporcio Nov 23, 2015
7980194
Implemented put and remove all methods in stores.
rporcio Nov 23, 2015
4e6073e
SO-1708 Use put and remove all store methods in bulk processes.
rporcio Nov 23, 2015
63626eb
SO-1708 Updated releasable logic.
rporcio Nov 23, 2015
16d1d52
SO-1708 Get terminology browser from env. Updated conf processing.
rporcio Nov 23, 2015
e21c575
SO-1708 Removed contains method.
rporcio Nov 23, 2015
ef40c68
SO-1708 Updated partition id and data handling.
rporcio Nov 23, 2015
9a8d7bc
SO-1708 Moved login/logout logic the cis client.
rporcio Nov 23, 2015
33474a0
SO-1708 New namespace setter method.
rporcio Nov 23, 2015
1eca20d
SO-1708 Moved fail check to actions.
rporcio Nov 23, 2015
85b356d
SO-1708 Use enum for job status in job polling.
rporcio Nov 23, 2015
4d18d77
SO-1708 Renamed identifier service classes and bulk method names.
rporcio Nov 23, 2015
0363bf1
SO-1708 Updated attribute names and cis client name.
rporcio Nov 23, 2015
354b970
SO-1708 Fixed and renamed test classes.
rporcio Nov 23, 2015
ee2e5a5
SO-1708 Build comment based on software.
rporcio Nov 23, 2015
30f7448
SO-1708 Renamed data creation methods.
rporcio Nov 23, 2015
7b377f6
SO-1708 Reduced visibility of cis client.
rporcio Nov 23, 2015
9f5182c
SO-1708 Changed exceptions.
rporcio Nov 23, 2015
9302e5c
SO-1708 Moved status check to sct id class.
rporcio Nov 23, 2015
3959f71
SO-1708 Deleted token class and moved use port as part of the base url.
rporcio Nov 23, 2015
96cefaf
SO-1708 Removed reservation behavior from identifier service. Register
rporcio Nov 23, 2015
7c3a3d1
SO-1708 Made protected variable to private.
rporcio Nov 23, 2015
defff4d
SO-1708 Moved id manager login to SnomedIdentifiers. Deleted id manager.
rporcio Nov 23, 2015
7f91146
SO-1708 Updated test config file.
rporcio Nov 24, 2015
6778dc2
SO-1708 Use numbers from conf when polling jobs.
rporcio Nov 24, 2015
c0d1326
SO-1708 Use limit when requesting sct ids to avoid too long url length.
rporcio Nov 24, 2015
db67089
SO-1708 Updated cis based identifier service test.
rporcio Nov 24, 2015
cb19e25
SO-1708 Use milliseconds in time variable.
rporcio Nov 24, 2015
0efb84e
SO-1708 Updated id related part in configuration guide.
rporcio Nov 24, 2015
296013a
Removed invalid table separator.
rporcio Nov 24, 2015
fe74c38
Merge remote-tracking branch 'origin/develop' into id_generation
rporcio Nov 25, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
SO-1708 Wired in identifier service factory.
  • Loading branch information
rporcio committed Nov 12, 2015
commit e9c9c8e8c1b110aba686d236940afa4e06583541
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
* @since 3.4
*/
public class SnomedCoreConfiguration {

public enum IdGenerationStrategy {
MEMORY, // Snow Owl's internal random id generator
CIS // IHTSDO's external id generator
}

public static final String ELK_REASONER_ID = "org.semanticweb.elk.elk.reasoner.factory"; //$NON-NLS-1$
private static final String DEFAULT_REASONER = ELK_REASONER_ID;
Expand Down Expand Up @@ -59,6 +64,22 @@ public class SnomedCoreConfiguration {
@NotEmpty
private String defaultModule = DEFAULT_MODULE;

@JsonProperty(value = "idGenerationStrategy", required = false)
private IdGenerationStrategy idGenerationStrategy = IdGenerationStrategy.MEMORY;
@JsonProperty(value = "cisUrl", required = false)
private String cisUrl;
@JsonProperty(value = "cisPort", required = false)
private String cisPort;
@JsonProperty(value = "cisContextRoot", required = false)
private String cisContextRoot;
@JsonProperty(value = "cisUserName", required = false)
private String cisUserName;
@JsonProperty(value = "cisPassword", required = false)
private String cisPassword;
// the key to associate the client software within the external CIS service
@JsonProperty(value = "cisClientSoftwareKey", required = false)
private String cisClientSoftwareKey = "Snow Owl";

private boolean concreteDomainSupport;
private boolean showReasonerUsageWarning = true;

Expand Down Expand Up @@ -177,5 +198,61 @@ public boolean isShowReasonerUsageWarningEnabled() {
public void setShowReasonerUsageWarningEnabled(boolean showReasonerUsageWarning) {
this.showReasonerUsageWarning = showReasonerUsageWarning;
}

public IdGenerationStrategy getIdGenerationStrategy() {
return idGenerationStrategy;
}

public void setIdGenerationStrategy(IdGenerationStrategy idGenerationStrategy) {
this.idGenerationStrategy = idGenerationStrategy;
}

public String getCisUrl() {
return cisUrl;
}

public void setCisUrl(String cisUrl) {
this.cisUrl = cisUrl;
}

public String getCisPort() {
return cisPort;
}

public void setCisPort(String cisPort) {
this.cisPort = cisPort;
}

public String getCisContextRoot() {
return cisContextRoot;
}

public void setCisContextRoot(String cisContextRoot) {
this.cisContextRoot = cisContextRoot;
}

public String getCisUserName() {
return cisUserName;
}

public void setCisUserName(String cisUserName) {
this.cisUserName = cisUserName;
}

public String getCisPassword() {
return cisPassword;
}

public void setCisPassword(String cisPassword) {
this.cisPassword = cisPassword;
}

public String getCisClientSoftwareKey() {
return cisClientSoftwareKey;
}

public void setCisClientSoftwareKey(String cisClientSoftwareKey) {
this.cisClientSoftwareKey = cisClientSoftwareKey;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* Copyright 2011-2015 B2i Healthcare Pte Ltd, http:https://b2i.sg
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.b2international.snowowl.snomed.datastore.id;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.b2international.snowowl.core.ApplicationContext;
import com.b2international.snowowl.core.config.SnowOwlConfiguration;
import com.b2international.snowowl.core.setup.Environment;
import com.b2international.snowowl.snomed.datastore.SnomedTerminologyBrowser;
import com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration;
import com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration.IdGenerationStrategy;
import com.b2international.snowowl.snomed.datastore.id.cis.CisSnomedIdentfierServiceImpl;
import com.b2international.snowowl.snomed.datastore.id.gen.ItemIdGenerationStrategy;
import com.b2international.snowowl.snomed.datastore.id.memory.InMemorySnomedIdentifierServiceImpl;
import com.b2international.snowowl.snomed.datastore.id.reservations.ISnomedIdentiferReservationService;
import com.b2international.snowowl.snomed.datastore.id.reservations.Reservations;
import com.b2international.snowowl.snomed.datastore.internal.id.reservations.SnomedIdentifierReservationServiceImpl;
import com.google.inject.Provider;

/**
* Factory to create a Snomed CT identifier generator
*
* @since 4.5
*/
public class SnomedIdentifierServiceFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(SnomedIdentifierServiceFactory.class);

private static final String STORE_RESERVATIONS = "internal_store_reservations";
private static final String IDENTIFIER_SERVICE_RESERVATIONS = "identifier_service_reservations";

public static void registerService(final SnowOwlConfiguration configuration, final Environment env) {
checkIdGenerationSource(configuration);

final SnomedCoreConfiguration coreConfiguration = configuration.getModuleConfig(SnomedCoreConfiguration.class);
final ISnomedIdentiferReservationService reservationService = new SnomedIdentifierReservationServiceImpl();

registerBrowser(reservationService);
registerSnomedIdentifierService(coreConfiguration, env, reservationService);
}

private static void checkIdGenerationSource(SnowOwlConfiguration configuration) {
final SnomedCoreConfiguration coreConfiguration = configuration.getModuleConfig(SnomedCoreConfiguration.class);
final IdGenerationStrategy idGenerationSource = coreConfiguration.getIdGenerationStrategy();

if (null == idGenerationSource) {
throw new IllegalStateException("ID generation source is not configured.");
}
}

private static void registerBrowser(final ISnomedIdentiferReservationService reservationService) {
final Provider<SnomedTerminologyBrowser> provider = new Provider<SnomedTerminologyBrowser>() {
@Override
public SnomedTerminologyBrowser get() {
return ApplicationContext.getInstance().getService(SnomedTerminologyBrowser.class);
}
};

reservationService.create(STORE_RESERVATIONS, Reservations.uniqueInStore(provider));
}

private static void registerSnomedIdentifierService(final SnomedCoreConfiguration conf, final Environment env,
final ISnomedIdentiferReservationService reservationService) {
ISnomedIdentifierService identifierService = null;

switch (conf.getIdGenerationStrategy()) {
case MEMORY:
LOGGER.info("Snow Owl is configured to use memory based identifier serivce.");
identifierService = new InMemorySnomedIdentifierServiceImpl(reservationService, ItemIdGenerationStrategy.RANDOM);
break;
case CIS:
LOGGER.info("Snow Owl is configured to use CIS based identifier serivce.");
identifierService = new CisSnomedIdentfierServiceImpl(conf);
break;
default:
throw new IllegalStateException(String.format("Unknown ID generation source configured: %s. ", conf.getIdGenerationStrategy()));
}

reservationService.create(IDENTIFIER_SERVICE_RESERVATIONS, identifierService);
env.services().registerService(ISnomedIdentifierService.class, identifierService);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,20 @@
import com.b2international.snowowl.snomed.datastore.SnomedTerminologyBrowser;
import com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration;
import com.b2international.snowowl.snomed.datastore.id.ISnomedIdentifierService;
import com.b2international.snowowl.snomed.datastore.id.reservations.ISnomedIdentiferReservationService;
import com.b2international.snowowl.snomed.datastore.id.reservations.Reservations;
import com.b2international.snowowl.snomed.datastore.internal.id.SnomedIdentifierServiceImpl;
import com.b2international.snowowl.snomed.datastore.internal.id.reservations.SnomedIdentifierReservationServiceImpl;
import com.b2international.snowowl.snomed.datastore.id.SnomedIdentifierServiceFactory;
import com.b2international.snowowl.snomed.metadata.SnomedMetadata;
import com.b2international.snowowl.snomed.metadata.SnomedMetadataImpl;
import com.google.inject.Provider;

/**
* @since 3.4
*/
@ModuleConfig(fieldName = "snomed", type = SnomedCoreConfiguration.class)
public class SnomedCoreBootstrap extends DefaultBootstrapFragment {

private static final String STORE_RESERVATIONS = "internal_store_reservations";

@Override
public void init(SnowOwlConfiguration configuration, Environment env) throws Exception {
final Provider<SnomedTerminologyBrowser> browser = env.provider(SnomedTerminologyBrowser.class);
final ISnomedIdentiferReservationService reservationService = new SnomedIdentifierReservationServiceImpl();
reservationService.create(STORE_RESERVATIONS, Reservations.uniqueInStore(browser));
final ISnomedIdentifierService idService = new SnomedIdentifierServiceImpl(reservationService);
env.services().registerService(ISnomedIdentiferReservationService.class, reservationService);
env.services().registerService(ISnomedIdentifierService.class, idService);
SnomedIdentifierServiceFactory.registerService(configuration, env);

env.services().registerService(SnomedCoreConfiguration.class, configuration.getModuleConfig(SnomedCoreConfiguration.class));
env.services().registerService(SnomedMetadata.class, new SnomedMetadataImpl(env.provider(SnomedTerminologyBrowser.class)));
}
Expand Down