]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.auditlogging/src/org/simantics/audit/Activator.java
Generic HTTP REST Client/Server AuditLogging framework
[simantics/platform.git] / bundles / org.simantics.auditlogging / src / org / simantics / audit / Activator.java
diff --git a/bundles/org.simantics.auditlogging/src/org/simantics/audit/Activator.java b/bundles/org.simantics.auditlogging/src/org/simantics/audit/Activator.java
new file mode 100644 (file)
index 0000000..7451ffd
--- /dev/null
@@ -0,0 +1,42 @@
+package org.simantics.audit;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+       private static BundleContext context;
+       private static Path logLocation;
+
+       static BundleContext getContext() {
+               return context;
+       }
+
+       /*
+        * (non-Javadoc)
+        * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+        */
+       public void start(BundleContext bundleContext) throws Exception {
+               Activator.context = bundleContext;
+               IPath ipath = Platform.getStateLocation(getContext().getBundle());
+               logLocation = Paths.get(ipath.toOSString());
+       }
+
+       /*
+        * (non-Javadoc)
+        * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+        */
+       public void stop(BundleContext bundleContext) throws Exception {
+               Activator.context = null;
+       }
+       
+    public static Path getLogLocation() {
+        return logLocation;
+    }
+
+}