Loading src/main/java/org/eclipse/openk/portal/common/BackendConfig.java +10 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ package org.eclipse.openk.portal.common; import org.eclipse.openk.portal.common.util.ResourceLoaderBase; import org.apache.log4j.Logger; public class BackendConfig { private static String configFileName = "backendConfigDevLocal.json"; Loading @@ -26,11 +27,18 @@ public class BackendConfig { private static BackendConfig instance; private static final Logger LOGGER = Logger.getLogger(BackendConfig.class.getName()); private BackendConfig() {} public static synchronized BackendConfig getInstance() { if (instance == null) { String jsonConfig = loadJsonConfig(); if (jsonConfig == null || jsonConfig.isEmpty()) { LOGGER.error("FileNotFound: jsonConfig is empty or NULL"); } else { LOGGER.info("backendConfigFile " + configFileName + " successfully loaded."); } instance = JsonGeneratorBase.getGson().fromJson(jsonConfig, BackendConfig.class); } Loading @@ -39,8 +47,10 @@ public class BackendConfig { private static String loadJsonConfig() { ResourceLoaderBase resourceLoaderBase = new ResourceLoaderBase(); LOGGER.info("backendConfigFile is: " + configFileName); String jsonConfig = resourceLoaderBase.loadStringFromResource(configFileName); if (jsonConfig == null || jsonConfig.isEmpty()) { LOGGER.info("backendConfigFile not found in resources, loading from external path now..."); jsonConfig = resourceLoaderBase.loadFromPath(configFileName); } return jsonConfig; Loading src/main/java/org/eclipse/openk/portal/common/InitUserCacheJob.java +4 −3 Original line number Diff line number Diff line Loading @@ -11,11 +11,12 @@ */ package org.eclipse.openk.portal.common; import java.util.Timer; import java.util.TimerTask; import org.apache.log4j.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import org.apache.log4j.Logger; import java.util.Timer; import java.util.TimerTask; public class InitUserCacheJob extends HttpServlet { Loading src/main/java/org/eclipse/openk/portal/common/util/ResourceLoaderBase.java +4 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,10 @@ public class ResourceLoaderBase { public String loadStringFromResource(String filename) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream jsonstream = classLoader.getResourceAsStream(filename); if (jsonstream==null){ LOGGER.error("Datei nicht gefunden: " + filename); return null; } return stream2String(jsonstream); } Loading src/main/java/org/eclipse/openk/portal/viewmodel/UserModule.java +10 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ */ package org.eclipse.openk.portal.viewmodel; import org.apache.log4j.Logger; import org.eclipse.openk.portal.common.JsonGeneratorBase; import org.eclipse.openk.portal.common.util.ResourceLoaderBase; Loading @@ -27,9 +28,16 @@ public class UserModule { private static UserModule[] instance; private static final Logger LOGGER = Logger.getLogger(UserModule.class.getName()); public static synchronized UserModule[] getInstance() { if (instance == null) { String jsonConfig = loadJsonConfig(); if (jsonConfig == null || jsonConfig.isEmpty()) { LOGGER.error("FileNotFound: jsonConfig is empty or NULL"); } else { LOGGER.info("usermoduleConfigFile " + configFileName + " successfully loaded."); } instance = JsonGeneratorBase.getGson().fromJson(jsonConfig, UserModule[].class); } Loading @@ -38,8 +46,10 @@ public class UserModule { private static String loadJsonConfig() { ResourceLoaderBase resourceLoaderBase = new ResourceLoaderBase(); LOGGER.info("usermoduleConfigFile is: " + configFileName); String jsonConfig = resourceLoaderBase.loadStringFromResource(configFileName); if (jsonConfig == null || jsonConfig.isEmpty()) { LOGGER.info("usermoduleConfigFile not found in resources, loading from external path now..."); jsonConfig = resourceLoaderBase.loadFromPath(configFileName); } return jsonConfig; Loading Loading
src/main/java/org/eclipse/openk/portal/common/BackendConfig.java +10 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ package org.eclipse.openk.portal.common; import org.eclipse.openk.portal.common.util.ResourceLoaderBase; import org.apache.log4j.Logger; public class BackendConfig { private static String configFileName = "backendConfigDevLocal.json"; Loading @@ -26,11 +27,18 @@ public class BackendConfig { private static BackendConfig instance; private static final Logger LOGGER = Logger.getLogger(BackendConfig.class.getName()); private BackendConfig() {} public static synchronized BackendConfig getInstance() { if (instance == null) { String jsonConfig = loadJsonConfig(); if (jsonConfig == null || jsonConfig.isEmpty()) { LOGGER.error("FileNotFound: jsonConfig is empty or NULL"); } else { LOGGER.info("backendConfigFile " + configFileName + " successfully loaded."); } instance = JsonGeneratorBase.getGson().fromJson(jsonConfig, BackendConfig.class); } Loading @@ -39,8 +47,10 @@ public class BackendConfig { private static String loadJsonConfig() { ResourceLoaderBase resourceLoaderBase = new ResourceLoaderBase(); LOGGER.info("backendConfigFile is: " + configFileName); String jsonConfig = resourceLoaderBase.loadStringFromResource(configFileName); if (jsonConfig == null || jsonConfig.isEmpty()) { LOGGER.info("backendConfigFile not found in resources, loading from external path now..."); jsonConfig = resourceLoaderBase.loadFromPath(configFileName); } return jsonConfig; Loading
src/main/java/org/eclipse/openk/portal/common/InitUserCacheJob.java +4 −3 Original line number Diff line number Diff line Loading @@ -11,11 +11,12 @@ */ package org.eclipse.openk.portal.common; import java.util.Timer; import java.util.TimerTask; import org.apache.log4j.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import org.apache.log4j.Logger; import java.util.Timer; import java.util.TimerTask; public class InitUserCacheJob extends HttpServlet { Loading
src/main/java/org/eclipse/openk/portal/common/util/ResourceLoaderBase.java +4 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,10 @@ public class ResourceLoaderBase { public String loadStringFromResource(String filename) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream jsonstream = classLoader.getResourceAsStream(filename); if (jsonstream==null){ LOGGER.error("Datei nicht gefunden: " + filename); return null; } return stream2String(jsonstream); } Loading
src/main/java/org/eclipse/openk/portal/viewmodel/UserModule.java +10 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ */ package org.eclipse.openk.portal.viewmodel; import org.apache.log4j.Logger; import org.eclipse.openk.portal.common.JsonGeneratorBase; import org.eclipse.openk.portal.common.util.ResourceLoaderBase; Loading @@ -27,9 +28,16 @@ public class UserModule { private static UserModule[] instance; private static final Logger LOGGER = Logger.getLogger(UserModule.class.getName()); public static synchronized UserModule[] getInstance() { if (instance == null) { String jsonConfig = loadJsonConfig(); if (jsonConfig == null || jsonConfig.isEmpty()) { LOGGER.error("FileNotFound: jsonConfig is empty or NULL"); } else { LOGGER.info("usermoduleConfigFile " + configFileName + " successfully loaded."); } instance = JsonGeneratorBase.getGson().fromJson(jsonConfig, UserModule[].class); } Loading @@ -38,8 +46,10 @@ public class UserModule { private static String loadJsonConfig() { ResourceLoaderBase resourceLoaderBase = new ResourceLoaderBase(); LOGGER.info("usermoduleConfigFile is: " + configFileName); String jsonConfig = resourceLoaderBase.loadStringFromResource(configFileName); if (jsonConfig == null || jsonConfig.isEmpty()) { LOGGER.info("usermoduleConfigFile not found in resources, loading from external path now..."); jsonConfig = resourceLoaderBase.loadFromPath(configFileName); } return jsonConfig; Loading