@Override public Properties exportPlatformSettings() { MotechSettings currentSettings = configLoader.loadMotechSettings(); SettingsRecord settingsRecord = settingService.retrieve("id", 1); SettingsRecord dbSettings = (settingsRecord == null ? new SettingsRecord() : settingsRecord); Properties export = new Properties(); if (currentSettings != null) { export.putAll(currentSettings.asProperties()); } if (dbSettings != null) { export.putAll(dbSettings.getActivemqProperties()); export.put(ConfigurationConstants.LANGUAGE, dbSettings.getLanguage()); } return export; } }
public SettingsRecord loadMotechSettings() { SettingsRecord settingsRecord; ConfigLocation configLocation = coreConfigurationService.getConfigLocation(); Resource configLocationResource = configLocation.toResource(); try { Resource motechSettings = configLocationResource.createRelative(ConfigurationConstants.SETTINGS_FILE_NAME); settingsRecord = loadSettingsFromStream(motechSettings); settingsRecord.setFilePath(configLocationResource.getURL().getPath()); checkSettingsRecord(settingsRecord); if (eventAdmin != null) { Map<String, String> properties = new HashMap<>(); Properties activemqProperties = settingsRecord.getActivemqProperties(); if (activemqProperties != null && activemqProperties.containsKey(AMQ_BROKER_URL)) { properties.put(AMQ_BROKER_URL, activemqProperties.getProperty(AMQ_BROKER_URL)); eventAdmin.postEvent(new Event("org/motechproject/osgi/event/RELOAD", properties)); } } } catch (IOException e) { throw new MotechConfigurationException(String.format("Could not read settings from file at location %s", configLocation), e); } return settingsRecord; }