Adds a configuration property allowing to enable/disable different configuration forms from provisioning.

cusax-fix
Yana Stamcheva 15 years ago
parent 76cecff08d
commit 76c5df100b

@ -39,6 +39,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 void start(BundleContext bundleContext)
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>();

@ -2,6 +2,7 @@
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.*;
@ -31,6 +32,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
@ -41,6 +56,10 @@ public void start(BundleContext bc)
{
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 static ResourceManagementService getResources()
= 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;
}
}

@ -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 void start(BundleContext bc) throws Exception
{
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);

@ -78,6 +78,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
@ -93,22 +100,28 @@ public void start(BundleContext bc)
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,

@ -9,6 +9,7 @@
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.*;
@ -30,6 +31,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
@ -40,6 +55,10 @@ public void start(BundleContext bc)
{
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 static NotificationService getNotificationService()
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;
}
}

@ -60,6 +60,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
@ -70,6 +77,10 @@ public void start(BundleContext bc) throws Exception
{
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;

Loading…
Cancel
Save