aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/plugin/provisioning
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2012-02-16 11:32:56 +0000
committerDamian Minkov <damencho@jitsi.org>2012-02-16 11:32:56 +0000
commitb71ad6f750cb271721eb000fafd2ad56d6e0c825 (patch)
tree7ee7165e4d17b7c2084fe97c091cc5d8581632a1 /src/net/java/sip/communicator/plugin/provisioning
parent784eaa286c7a427dee210c51e4811de455f480ba (diff)
downloadjitsi-b71ad6f750cb271721eb000fafd2ad56d6e0c825.zip
jitsi-b71ad6f750cb271721eb000fafd2ad56d6e0c825.tar.gz
jitsi-b71ad6f750cb271721eb000fafd2ad56d6e0c825.tar.bz2
Adds property which can make provisioning mandatory, and if user cancels application will exit.
Diffstat (limited to 'src/net/java/sip/communicator/plugin/provisioning')
-rw-r--r--src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java2
-rw-r--r--src/net/java/sip/communicator/plugin/provisioning/ProvisioningServiceImpl.java51
2 files changed, 52 insertions, 1 deletions
diff --git a/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java b/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java
index b5aac39..bb9a772 100644
--- a/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java
+++ b/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java
@@ -36,7 +36,7 @@ public class ProvisioningActivator
/**
* The current BundleContext.
*/
- private static BundleContext bundleContext = null;
+ static BundleContext bundleContext = null;
/**
* A reference to the ConfigurationService implementation instance that
diff --git a/src/net/java/sip/communicator/plugin/provisioning/ProvisioningServiceImpl.java b/src/net/java/sip/communicator/plugin/provisioning/ProvisioningServiceImpl.java
index 58d2e57..ad58de3 100644
--- a/src/net/java/sip/communicator/plugin/provisioning/ProvisioningServiceImpl.java
+++ b/src/net/java/sip/communicator/plugin/provisioning/ProvisioningServiceImpl.java
@@ -13,6 +13,7 @@ import net.java.sip.communicator.service.httputil.*;
import net.java.sip.communicator.service.provisioning.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
+import org.osgi.framework.*;
/**
* Provisioning service.
@@ -62,6 +63,12 @@ public class ProvisioningServiceImpl
= "net.java.sip.communicator.plugin.provisioning.METHOD";
/**
+ * Name of the property, whether provisioning is mandatory.
+ */
+ private static final String PROPERTY_PROVISIONING_MANDATORY
+ = "net.java.sip.communicator.plugin.provisioning.MANDATORY";
+
+ /**
* Name of the property that contains enforce prefix list (separated by
* pipe) for the provisioning. The retrieved configuration properties will
* be checked against these prefixes to avoid having incorrect content in
@@ -420,7 +427,51 @@ public class ProvisioningServiceImpl
// if there was an error in retrieving stop
if(res == null)
+ {
+ // if canceled, lets check whether provisioning is
+ // mandatory
+ boolean provisioningMandatory = false;
+
+ String defaultSettingsProp =
+ ProvisioningActivator.getResourceService()
+ .getSettingsString(PROPERTY_PROVISIONING_MANDATORY);
+ if(defaultSettingsProp != null
+ && Boolean.parseBoolean(defaultSettingsProp))
+ provisioningMandatory = true;
+
+ if(ProvisioningActivator.getConfigurationService().getBoolean(
+ PROPERTY_PROVISIONING_MANDATORY, provisioningMandatory))
+ {
+ // as shutdown service is not started and other bundles
+ // are scheduled to start, stop all of them
+ {
+ for(Bundle b : ProvisioningActivator.bundleContext
+ .getBundles())
+ {
+ try
+ {
+ // skip our Bundle avoiding stopping us while
+ // starting and NPE in felix
+ if(ProvisioningActivator.bundleContext
+ .equals(b.getBundleContext()))
+ {
+ continue;
+ }
+ b.stop();
+ }
+ catch (BundleException ex)
+ {
+ logger.error(
+ "Failed to being gentle stop " +
+ b.getLocation(), ex);
+ }
+ }
+ }
+ }
+
+ // stop processing
return null;
+ }
String userPass[] = res.getCredentials();
if(userPass[0] != null && userPass[1] != null)