- @Override
- public synchronized void onYangStoreAdded(YangStoreService yangStoreService) {
- checkState(configRegistryLookup == null, "More than one onYangStoreAdded received");
- configRegistryLookup = new ConfigRegistryLookupThread(yangStoreService);
- configRegistryLookup.start();
+ SchemaContextProvider schemaContextProvider = reference.getBundle().getBundleContext().getService(reference);
+
+ YangStoreService yangStoreService = new YangStoreService(schemaContextProvider, context);
+ configRegistryLookup = new ConfigRegistryLookupThread(yangStoreService);
+ configRegistryLookup.start();
+ return configRegistryLookup;
+ }
+
+ @Override
+ public void modifiedService(ServiceReference<SchemaContextProvider> reference, ConfigRegistryLookupThread configRegistryLookup) {
+ LOG.debug("Got modifiedService(SchemaContextProvider) event");
+ configRegistryLookup.yangStoreService.refresh();
+
+ }
+
+ @Override
+ public void removedService(ServiceReference<SchemaContextProvider> reference, ConfigRegistryLookupThread configRegistryLookup) {
+ configRegistryLookup.interrupt();
+ if (osgiRegistration != null) {
+ osgiRegistration.unregister();
+ }
+ osgiRegistration = null;
+ Activator.this.configRegistryLookup = null;
+ }
+ };
+
+ ServiceTracker<SchemaContextProvider, ConfigRegistryLookupThread> listenerTracker = new ServiceTracker<>(context, SchemaContextProvider.class, customizer);
+ listenerTracker.open();