use of org.openmrs.module.pihcore.setup.ConfigurationSetup in project openmrs-module-pihcore by PIH.
the class PihCoreActivator method configureSystem.
public void configureSystem() {
try {
log.info("Initiating pihcore configuration");
final ConfigurationSetup configurationSetup = Context.getRegisteredComponents(ConfigurationSetup.class).get(0);
configurationSetup.setupBase();
configurationSetup.configureNonConceptDependencies();
AdministrationService as = Context.getAdministrationService();
String runInSeparateThread = as.getGlobalProperty(PihCoreConstants.GP_RUN_CONCEPT_SETUP_TASK_IN_SEPARATE_THREAD);
if ("true".equalsIgnoreCase(runInSeparateThread)) {
// see https://pihemr.atlassian.net/browse/UHM-4459
log.info("Setting up configuration in a separate thread. Please monitor logs to check status.");
Daemon.runInDaemonThread(() -> {
try {
configurationSetup.configureConceptDependencies();
} catch (Exception e) {
log.error("Configuration Setup Failed", e);
throw new RuntimeException(e);
}
}, daemonToken);
} else {
configurationSetup.configureConceptDependencies();
}
log.info("Distribution startup complete.");
} catch (Exception e) {
Module mod = ModuleFactory.getModuleById("pihcore");
ModuleFactory.stopModule(mod, true, true);
throw new RuntimeException("An error occurred while starting the pihcore module", e);
}
}
Aggregations