1 package org.simantics.district.maps.server;
3 import java.io.IOException;
4 import java.net.URISyntaxException;
6 import java.nio.file.Path;
7 import java.nio.file.Paths;
9 import org.eclipse.core.runtime.FileLocator;
10 import org.osgi.framework.BundleActivator;
11 import org.osgi.framework.BundleContext;
13 public class Activator implements BundleActivator {
15 public static final String PLUGIN_ID = "org.simantics.maps.server";
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;
36 * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
38 public void stop(BundleContext bundleContext) throws Exception {
39 Activator.context = null;
42 public static Path getNodeJSRoot() throws IOException, URISyntaxException {
43 URL nodeURL = getContext().getBundle().getEntry("/node");
44 URL nodeFileURL = FileLocator.toFileURL(nodeURL);
45 return Paths.get(nodeFileURL.toURI());
48 public static Path getTileserverMapnikRoot() throws IOException, URISyntaxException {
49 URL serverURL = getContext().getBundle().getEntry("/server");
50 URL serverFileURL = FileLocator.toFileURL(serverURL);
51 return Paths.get(serverFileURL.toURI());