From 4c8ec00a2ae5233bf99c03808e7784c6246b3246 Mon Sep 17 00:00:00 2001 From: Ingo Bauersachs Date: Sat, 14 Jan 2017 18:53:40 +0100 Subject: Let the config service override the embedded resources --- .../impl/resources/ResourceManagementActivator.java | 20 ++++++++++++++++++++ .../resources/ResourceManagementServiceImpl.java | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'src') diff --git a/src/net/java/sip/communicator/impl/resources/ResourceManagementActivator.java b/src/net/java/sip/communicator/impl/resources/ResourceManagementActivator.java index 6c76906..1e7e7e4 100644 --- a/src/net/java/sip/communicator/impl/resources/ResourceManagementActivator.java +++ b/src/net/java/sip/communicator/impl/resources/ResourceManagementActivator.java @@ -19,6 +19,7 @@ package net.java.sip.communicator.impl.resources; import net.java.sip.communicator.util.*; +import org.jitsi.service.configuration.*; import org.jitsi.service.resources.*; import org.osgi.framework.*; @@ -31,6 +32,7 @@ public class ResourceManagementActivator extends SimpleServiceActivator { static BundleContext bundleContext; + private static ConfigurationService configService; /** * Creates new instance of ResourceManagementActivator @@ -68,4 +70,22 @@ public class ResourceManagementActivator { return new ResourceManagementServiceImpl(); } + + /** + * Returns the ConfigurationService obtained from the bundle + * context. + * @return the ConfigurationService obtained from the bundle + * context + */ + public static ConfigurationService getConfigService() + { + if(configService == null) + { + configService + = ServiceUtils.getService( + bundleContext, + ConfigurationService.class); + } + return configService; + } } diff --git a/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java b/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java index d116fea..1cc2dcf 100644 --- a/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java +++ b/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java @@ -344,4 +344,24 @@ public class ResourceManagementServiceImpl { return SkinJarBuilder.createBundleFromZip(zipFile, getImagePack()); } + + /** + * Gets the specified setting from the config service if present, otherwise + * from the embedded resources (resources/config/defaults.properties). + * + * @param key The setting to lookup. + * @return The setting for the key or {@code null} if not found. + */ + @Override + public String getSettingsString(String key) + { + Object configValue = ResourceManagementActivator + .getConfigService().getProperty(key); + if (configValue == null) + { + configValue = super.getSettingsString(key); + } + + return configValue == null ? null : configValue.toString(); + } } -- cgit v1.1