diff options
author | Emil Ivov <emcho@jitsi.org> | 2009-09-29 20:22:34 +0000 |
---|---|---|
committer | Emil Ivov <emcho@jitsi.org> | 2009-09-29 20:22:34 +0000 |
commit | 9aa5ad03b169d0636f1a92314b55d68a3d7fafbc (patch) | |
tree | dc1736a0c7a0db9c69ec725e26be58a4f8e33090 /src/net/java/sip/communicator/impl/sparkle | |
parent | 254cc7b09c2313413b27055e2f3bdd56b754199d (diff) | |
download | jitsi-9aa5ad03b169d0636f1a92314b55d68a3d7fafbc.zip jitsi-9aa5ad03b169d0636f1a92314b55d68a3d7fafbc.tar.gz jitsi-9aa5ad03b169d0636f1a92314b55d68a3d7fafbc.tar.bz2 |
Commits a bunch of stuff that had individual commit messages which got lost from git after java.net failed (yet again today) to take the initial commit. Anyways, hopefully the last commit before I start changing the SIP module in an irreparable way so that it would start using neomedia
Diffstat (limited to 'src/net/java/sip/communicator/impl/sparkle')
-rw-r--r-- | src/net/java/sip/communicator/impl/sparkle/SparkleActivator.java | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/src/net/java/sip/communicator/impl/sparkle/SparkleActivator.java b/src/net/java/sip/communicator/impl/sparkle/SparkleActivator.java index 85c953e..b3fbe5c 100644 --- a/src/net/java/sip/communicator/impl/sparkle/SparkleActivator.java +++ b/src/net/java/sip/communicator/impl/sparkle/SparkleActivator.java @@ -17,13 +17,21 @@ import net.java.sip.communicator.util.*; public class SparkleActivator implements BundleActivator { + /** + * Our class logger. + */ private static Logger logger = Logger.getLogger(SparkleActivator.class); - - /** + + /** * Native method declaration + * + * @param pathToSparkleFramework the path to the Sparkle framerok + * @param updateAtStartup specifies whether Sparkle should be checking for + * updates on startup. + * @param checkInterval specifies an interval for the update checks. */ - public native static void initSparkle(String pathToSparkleFramework, - boolean updateAtStartup, + public native static void initSparkle(String pathToSparkleFramework, + boolean updateAtStartup, int checkInterval); /** @@ -37,12 +45,10 @@ public class SparkleActivator private int checkInterval = 86400; // 1 day /** - * Dynamically loads JNI object. Will fail if non-MacOSX - * or when libinit_sparkle.dylib is outside of the LD_LIBRARY_PATH - */ - static { - System.loadLibrary("sparkle_init"); - } + * Internal flag that we use in order to determine whether the native + * Sparkle libs have already been loaded. + */ + private static boolean sparkleLibLoaded = false; /** * Initialize and start Sparkle @@ -52,13 +58,41 @@ public class SparkleActivator */ public void start(BundleContext bundleContext) throws Exception { + /** + * Dynamically loads JNI object. Will fail if non-MacOSX + * or when libinit_sparkle.dylib is outside of the LD_LIBRARY_PATH + */ + try + { + if ( ! SparkleActivator.sparkleLibLoaded) + { + System.loadLibrary("sparkle_init"); + SparkleActivator.sparkleLibLoaded = true; + } + } + catch(Throwable t) + { + logger.warn("Couldn't load sparkle library."); + logger.debug("Couldn't load sparkle library.", t); + + return; + } + // TODO: better way to get the Sparkle Framework path? - initSparkle(System.getProperty("user.dir") + initSparkle(System.getProperty("user.dir") + "/../../Frameworks/Sparkle.framework", updateAtStartup, checkInterval); logger.info("Sparkle Plugin ...[Started]"); } + /** + * Stops this bundle + * + * @param bundleContext a reference to the currently valid + * <tt>BundleContext</tt> + * + * @throws Exception if anything goes wrong (original, right ;) ) + */ public void stop(BundleContext bundleContext) throws Exception { logger.info("Sparkle Plugin ...[Stopped]"); |