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
34 if (LOGGER.isDebugEnabled())
35 LOGGER.debug("Starting tileserver mapnik automatically");
36 new TileserverMapnikStartJob().schedule();
44 * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
46 public void stop(BundleContext bundleContext) throws Exception {
48 if (LOGGER.isDebugEnabled())
49 LOGGER.debug("Stopping tileserver mapnik");
50 TileserverMapnikInstance.get().stop();
51 Activator.context = null;