/** * Implements BundleActivator.start(). Registers an instance of a dictionary service using the * bundle context; attaches properties to the service that can be queried when performing a * service look-up. * * @param context the framework context for the bundle. */ public void start(BundleContext context) throws Exception { // System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMDevicesConfig) GsonUtils.jsonToObject("./conf/autosim-sampledevices.json", AutoSIMDevicesConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]); for (AutoSIMDeviceConfig deviceConfig : config.devices) { DevicesConnectionFactory factory = new DevicesConnectionFactory(deviceConfig, environments); environments.registerDeviceFactory(deviceConfig.name, factory); factories.put(deviceConfig.name, factory); } }