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 private static BundleContext context;
18 public static BundleContext getContext() {
22 @SuppressWarnings({ "rawtypes", "unchecked" })
23 public void start(BundleContext bundleContext) throws Exception {
24 Activator.context = bundleContext;
26 Hashtable properties = new Hashtable();
27 bundleContext.registerService(ModuleSourceRepository.class,
28 SourceRepositories.BUILTIN_SOURCE_REPOSITORY,
30 bundleContext.registerService(ModuleSourceRepository.class,
31 new ProceduralModuleSourceRepository() {
33 protected ModuleRepository getModuleRepository(UpdateListener listener) {
34 return SCLOsgi.MODULE_REPOSITORY;
40 public void stop(BundleContext bundleContext) throws Exception {
41 Activator.context = null;