1 package net.mograsim.logic.model.am2900;
3 import java.io.IOException;
4 import java.io.InputStream;
5 import java.util.concurrent.atomic.AtomicBoolean;
7 import org.osgi.framework.BundleActivator;
8 import org.osgi.framework.BundleContext;
10 import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator;
11 import net.mograsim.logic.model.serializing.ResourceLoader;
13 public class Am2900Loader implements BundleActivator
15 private static AtomicBoolean activated = new AtomicBoolean(false);
18 public void start(BundleContext context) throws Exception
20 setup(); // TODO: useful?
24 public void stop(BundleContext context) throws Exception
29 public static void setup()
31 if (activated.getAndSet(true))
33 IndirectGUIComponentCreator.registerResourceLoader(new Am2900ResourceLoader(), "Am2900Loader");
34 IndirectGUIComponentCreator.loadStandardComponentIDs(Am2900Loader.class.getResourceAsStream("standardComponentIDMapping.json"));
35 System.out.println("SETUP DONE");
46 public static ResourceLoader resourceLoader()
48 return new Am2900ResourceLoader();
51 static class Am2900ResourceLoader implements ResourceLoader
54 public InputStream loadResource(String path) throws IOException
56 return Am2900ResourceLoader.class.getResourceAsStream(path);
60 public Class<?> loadClass(String name) throws ClassNotFoundException
62 return Class.forName(name, true, Am2900ResourceLoader.class.getClassLoader());