| package org.eclipse.openk.elogbook.common; |
| |
| import org.eclipse.openk.elogbook.common.util.ResourceLoaderBase; |
| |
| public class BackendConfig { |
| |
| private static String configFileName = "backendConfigDevLocal.json"; |
| private String importFilesFolderPath; |
| private String portalBaseURL; |
| private int fileRowToRead; |
| private String activePersistencyUnit; |
| |
| private static BackendConfig instance; |
| |
| private BackendConfig() { |
| } |
| |
| public static synchronized BackendConfig getInstance() { |
| if (instance == null) { |
| String jsonConfig = loadJsonConfig(); |
| instance = JsonGeneratorBase.getGson().fromJson(jsonConfig, BackendConfig.class); |
| } |
| |
| return instance; |
| } |
| |
| private static String loadJsonConfig() { |
| ResourceLoaderBase resourceLoaderBase = new ResourceLoaderBase(); |
| return resourceLoaderBase.loadStringFromResource(configFileName); |
| } |
| |
| public String getPortalBaseURL() { |
| return portalBaseURL; |
| } |
| |
| public String getImportFilesFolderPath() { |
| return importFilesFolderPath; |
| } |
| |
| public int getFileRowToRead() { |
| return fileRowToRead; |
| } |
| |
| public String getActivePersistencyUnit() { |
| return activePersistencyUnit; |
| } |
| |
| public static String getConfigFileName() { |
| return configFileName; |
| } |
| |
| public static void setConfigFileName(String configFileName) { |
| BackendConfig.configFileName = configFileName; |
| } |
| |
| |
| } |
| |
| |