1 package org.simantics.scl.osgi.internal;
3 import java.util.Hashtable;
5 import org.osgi.framework.BundleActivator;
6 import org.osgi.framework.BundleContext;
7 import org.simantics.scl.compiler.module.repository.ModuleRepository;
8 import org.simantics.scl.compiler.module.repository.UpdateListener;
9 import org.simantics.scl.compiler.source.repository.ModuleSourceRepository;
10 import org.simantics.scl.compiler.source.repository.ProceduralModuleSourceRepository;
11 import org.simantics.scl.compiler.source.repository.SourceRepositories;
12 import org.simantics.scl.osgi.SCLOsgi;
14 public class Activator implements BundleActivator {
16 public static final String PLUGIN_ID = "org.simantics.scl.osgi";
18 private static BundleContext context;
20 public static BundleContext getContext() {
24 @SuppressWarnings({ "rawtypes", "unchecked" })
25 public void start(BundleContext bundleContext) throws Exception {
26 Activator.context = bundleContext;
28 Hashtable properties = new Hashtable();
29 bundleContext.registerService(ModuleSourceRepository.class,
30 SourceRepositories.BUILTIN_SOURCE_REPOSITORY,
32 bundleContext.registerService(ModuleSourceRepository.class,
33 new ProceduralModuleSourceRepository() {
35 protected ModuleRepository getModuleRepository(UpdateListener listener) {
36 return SCLOsgi.MODULE_REPOSITORY;
42 public void stop(BundleContext bundleContext) throws Exception {
43 Activator.context = null;