diff options
author | Yana Stamcheva <yana@jitsi.org> | 2011-06-21 14:59:42 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2011-06-21 14:59:42 +0000 |
commit | 76c5df100be8a1fefe098c725bacb3a16766c059 (patch) | |
tree | e748681dfee8216e0e13e75b5ff153b1404761f5 | |
parent | 76cecff08d03207c38e32abd8ec81852d5521fb7 (diff) | |
download | jitsi-76c5df100be8a1fefe098c725bacb3a16766c059.zip jitsi-76c5df100be8a1fefe098c725bacb3a16766c059.tar.gz jitsi-76c5df100be8a1fefe098c725bacb3a16766c059.tar.bz2 |
Adds a configuration property allowing to enable/disable different configuration forms from provisioning.
6 files changed, 172 insertions, 38 deletions
diff --git a/src/net/java/sip/communicator/impl/neomedia/NeomediaActivator.java b/src/net/java/sip/communicator/impl/neomedia/NeomediaActivator.java index c29a415..0c9d563 100644 --- a/src/net/java/sip/communicator/impl/neomedia/NeomediaActivator.java +++ b/src/net/java/sip/communicator/impl/neomedia/NeomediaActivator.java @@ -40,6 +40,20 @@ public class NeomediaActivator private final Logger logger = Logger.getLogger(NeomediaActivator.class); /** + * Indicates if the audio configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String AUDIO_CONFIG_DISABLED_PROP + = "net.java.sip.communicator.impl.neomedia.AUDIO_CONFIG_DISABLED"; + + /** + * Indicates if the video configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String VIDEO_CONFIG_DISABLED_PROP + = "net.java.sip.communicator.impl.neomedia.VIDEO_CONFIG_DISABLED"; + + /** * The context in which the one and only <tt>NeomediaActivator</tt> instance * has started executing. */ @@ -129,29 +143,38 @@ public class NeomediaActivator mediaProps.put( ConfigurationForm.FORM_TYPE, ConfigurationForm.GENERAL_TYPE); - // Audio - bundleContext.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - "net.java.sip.communicator.impl.neomedia" - + ".AudioConfigurationPanel", - getClass().getClassLoader(), - "plugin.mediaconfig.AUDIO_ICON", - "impl.neomedia.configform.AUDIO", - 3), - mediaProps); + // If the audio configuration form is disabled don't register it. + if (!getConfigurationService().getBoolean( + AUDIO_CONFIG_DISABLED_PROP, false)) + { + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.impl.neomedia" + + ".AudioConfigurationPanel", + getClass().getClassLoader(), + "plugin.mediaconfig.AUDIO_ICON", + "impl.neomedia.configform.AUDIO", + 3), + mediaProps); + } + + // If the video configuration form is disabled don't register it. + if (!getConfigurationService().getBoolean( + VIDEO_CONFIG_DISABLED_PROP, false)) + { + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.impl.neomedia" + + ".VideoConfigurationPanel", + getClass().getClassLoader(), + "plugin.mediaconfig.VIDEO_ICON", + "impl.neomedia.configform.VIDEO", + 4), + mediaProps); + } - // Video - bundleContext.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - "net.java.sip.communicator.impl.neomedia" - + ".VideoConfigurationPanel", - getClass().getClassLoader(), - "plugin.mediaconfig.VIDEO_ICON", - "impl.neomedia.configform.VIDEO", - 4), - mediaProps); // H.264 Dictionary<String, String> h264Props = new Hashtable<String, String>(); diff --git a/src/net/java/sip/communicator/plugin/advancedconfig/AdvancedConfigActivator.java b/src/net/java/sip/communicator/plugin/advancedconfig/AdvancedConfigActivator.java index 5dfc8e4..3423e45 100644 --- a/src/net/java/sip/communicator/plugin/advancedconfig/AdvancedConfigActivator.java +++ b/src/net/java/sip/communicator/plugin/advancedconfig/AdvancedConfigActivator.java @@ -2,6 +2,7 @@ package net.java.sip.communicator.plugin.advancedconfig; import java.util.*; +import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.resources.*; import net.java.sip.communicator.util.*; @@ -32,6 +33,20 @@ public class AdvancedConfigActivator private static ResourceManagementService resourceService; /** + * The <tt>ConfigurationService</tt> registered in {@link #bundleContext} + * and used by the <tt>SecurityConfigActivator</tt> instance to read and + * write configuration properties. + */ + private static ConfigurationService configurationService; + + /** + * Indicates if the advanced configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.advancedconfig.DISABLED"; + + /** * Starts this bundle. * @param bc the bundle context * @throws Exception if something goes wrong @@ -41,6 +56,10 @@ public class AdvancedConfigActivator { bundleContext = bc; + // If the notification configuration form is disabled don't continue. + if (getConfigurationService().getBoolean(DISABLED_PROP, false)) + return; + Dictionary<String, String> properties = new Hashtable<String, String>(); properties.put( ConfigurationForm.FORM_TYPE, ConfigurationForm.GENERAL_TYPE); @@ -74,4 +93,23 @@ public class AdvancedConfigActivator = ResourceManagementServiceUtils.getService(bundleContext); return resourceService; } + + /** + * Returns a reference to the ConfigurationService implementation currently + * registered in the bundle context or null if no such implementation was + * found. + * + * @return a currently valid implementation of the ConfigurationService. + */ + public static ConfigurationService getConfigurationService() + { + if (configurationService == null) + { + configurationService + = ServiceUtils.getService( + bundleContext, + ConfigurationService.class); + } + return configurationService; + } } diff --git a/src/net/java/sip/communicator/plugin/chatconfig/ChatConfigActivator.java b/src/net/java/sip/communicator/plugin/chatconfig/ChatConfigActivator.java index 182d3d9..774dc14 100644 --- a/src/net/java/sip/communicator/plugin/chatconfig/ChatConfigActivator.java +++ b/src/net/java/sip/communicator/plugin/chatconfig/ChatConfigActivator.java @@ -53,7 +53,14 @@ public class ChatConfigActivator */ private static final Map<String, ReplacementService> replacementSourcesMap = new Hashtable<String, ReplacementService>(); - + + /** + * Indicates if the chat configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.chatconfig.DISABLED"; + /** * Starts this bundle. * @@ -65,6 +72,10 @@ public class ChatConfigActivator { bundleContext = bc; + // If the chat configuration form is disabled don't continue. + if (getConfigurationService().getBoolean(DISABLED_PROP, false)) + return; + Dictionary<String, String> properties = new Hashtable<String, String>(); properties.put(ConfigurationForm.FORM_TYPE, ConfigurationForm.GENERAL_TYPE); diff --git a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java index f058a28..e43de08 100644 --- a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java +++ b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java @@ -79,6 +79,13 @@ public class GeneralConfigPluginActivator private static ResourceManagementService resourceService; /** + * Indicates if the general configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.generalconfig.DISABLED"; + + /** * Starts this bundle. * @param bc the bundle context * @throws Exception if something goes wrong @@ -93,22 +100,28 @@ public class GeneralConfigPluginActivator uiService = (UIService) bundleContext.getService(uiServiceRef); - ConfigurationManager.loadGuiConfigurations(); + Dictionary<String, String> properties + = new Hashtable<String, String>(); - Dictionary<String, String> properties = new Hashtable<String, String>(); - properties.put( ConfigurationForm.FORM_TYPE, - ConfigurationForm.GENERAL_TYPE); - bundleContext - .registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - "net.java.sip.communicator.plugin." + - "generalconfig.GeneralConfigurationPanel", - getClass().getClassLoader(), - "plugin.generalconfig.PLUGIN_ICON", - "service.gui.GENERAL", - 0), - properties); + // If the general configuration form is disabled don't continue. + if (!getConfigurationService().getBoolean(DISABLED_PROP, false)) + { + ConfigurationManager.loadGuiConfigurations(); + + properties.put( ConfigurationForm.FORM_TYPE, + ConfigurationForm.GENERAL_TYPE); + bundleContext + .registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin." + + "generalconfig.GeneralConfigurationPanel", + getClass().getClassLoader(), + "plugin.generalconfig.PLUGIN_ICON", + "service.gui.GENERAL", + 0), + properties); + } // Registers the sip config panel as advanced configuration form. properties.put( ConfigurationForm.FORM_TYPE, diff --git a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationActivator.java b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationActivator.java index f47fa70..9640d4b 100644 --- a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationActivator.java +++ b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationActivator.java @@ -9,6 +9,7 @@ package net.java.sip.communicator.plugin.notificationconfiguration; import java.util.*; import net.java.sip.communicator.service.audionotifier.*; +import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.notification.*; import net.java.sip.communicator.util.*; @@ -31,6 +32,20 @@ public class NotificationConfigurationActivator private static AudioNotifierService audioService; /** + * The <tt>ConfigurationService</tt> registered in {@link #bundleContext} + * and used by the <tt>SecurityConfigActivator</tt> instance to read and + * write configuration properties. + */ + private static ConfigurationService configurationService; + + /** + * Indicates if the notification configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.notificationconfiguration.DISABLED"; + + /** * Starts this bundle and adds the <tt>AudioConfigurationConfigForm</tt> * contained in it to the configuration window obtained from the * <tt>UIService</tt>. @@ -40,6 +55,10 @@ public class NotificationConfigurationActivator { bundleContext = bc; + // If the notification configuration form is disabled don't continue. + if (getConfigurationService().getBoolean(DISABLED_PROP, false)) + return; + Dictionary<String, String> properties = new Hashtable<String, String>(); properties.put( ConfigurationForm.FORM_TYPE, ConfigurationForm.GENERAL_TYPE); @@ -100,4 +119,23 @@ public class NotificationConfigurationActivator return ServiceUtils.getService(bundleContext, NotificationService.class); } + + /** + * Returns a reference to the ConfigurationService implementation currently + * registered in the bundle context or null if no such implementation was + * found. + * + * @return a currently valid implementation of the ConfigurationService. + */ + public static ConfigurationService getConfigurationService() + { + if (configurationService == null) + { + configurationService + = ServiceUtils.getService( + bundleContext, + ConfigurationService.class); + } + return configurationService; + } } diff --git a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java index e5baf1c..27f6a84 100644 --- a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java +++ b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java @@ -61,6 +61,13 @@ public class SecurityConfigActivator private static UIService uiService; /** + * Indicates if the security configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.securityconfig.DISABLED"; + + /** * Starts this plugin. * @param bc the BundleContext * @throws Exception if some of the operations executed in the start method @@ -70,6 +77,10 @@ public class SecurityConfigActivator { bundleContext = bc; + // If the security configuration form is disabled don't continue. + if (getConfigurationService().getBoolean(DISABLED_PROP, false)) + return; + // Register the configuration form. Dictionary<String, String> properties; |