1 package fi.vtt.simantics.procore.internal;
3 import org.eclipse.core.runtime.IPath;
4 import org.eclipse.core.runtime.IStatus;
5 import org.eclipse.core.runtime.Platform;
6 import org.osgi.framework.Bundle;
7 import org.osgi.framework.BundleActivator;
8 import org.osgi.framework.BundleContext;
9 import org.simantics.db.common.utils.Logger;
12 * A bundle activator for org.simantics.db.procore that takes care of
13 * automatically finding a proper place for storing virtual graph files within
14 * the bundle metadata locations.
16 * @author Tuukka Lehtonen
18 public class Activator implements BundleActivator {
20 public static final String PLUGIN_ID = "org.simantics.db.procore";
22 // The shared instance
23 private static Activator plugin;
25 private Bundle bundle;
28 public void start(BundleContext context) throws Exception {
29 IPath stateLocation = Platform.getStateLocation(context.getBundle());
30 StaticSessionProperties.virtualGraphStoragePath = stateLocation.toFile();
31 this.bundle = context.getBundle();
36 public void stop(BundleContext context) throws Exception {
39 StaticSessionProperties.virtualGraphStoragePath = null;
43 * Returns the shared instance
45 * @return the shared instance
47 public static Activator getDefault() {
54 public static void log(IStatus status) {
55 Activator a = getDefault();
57 // In OSGi environment
58 Platform.getLog(a.bundle).log(status);
60 Logger.defaultLogError(status.getMessage(), status.getException());