1 package org.simantics.maps.server.ui;
3 import org.osgi.framework.BundleActivator;
4 import org.osgi.framework.BundleContext;
5 import org.simantics.district.maps.server.TileserverMapnikInstance;
6 import org.simantics.district.maps.server.prefs.MapsServerPreferences;
7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory;
10 public class Activator implements BundleActivator {
12 private static final Logger LOGGER = LoggerFactory.getLogger(Activator.class);
14 public static final String PLUGIN_ID = "org.simantics.maps.server.ui";
16 private static BundleContext context;
18 static BundleContext getContext() {
25 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.
28 public void start(BundleContext bundleContext) throws Exception {
29 Activator.context = bundleContext;
31 // Let's see if server should be automatically started
32 if (MapsServerPreferences.startAutomatically()) {
33 // execute in a separate thread to not slow down the startup process
36 TileserverMapnikInstance.get().start();
37 } catch (Throwable t) {
38 LOGGER.error("Could not start integrated tile server", t);
48 * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
50 public void stop(BundleContext bundleContext) throws Exception {
52 TileserverMapnikInstance.get().stop();
53 Activator.context = null;