- SchemaContextProvider schemaContextProvider = reference.getBundle().getBundleContext().getService(reference);
- final YangStoreService yangStoreService = new YangStoreService(schemaContextProvider);
- yangStoreServiceServiceRegistration = context.registerService(YangStoreService.class, yangStoreService, new Hashtable<String, Object>());
- configRegistryLookup = new ConfigRegistryLookupThread(yangStoreService);
- configRegistryLookup.start();
+ final SchemaContextProvider schemaContextProvider = reference.getBundle().getBundleContext()
+ .getService(reference);
+ final Object sourceProvider = Preconditions.checkNotNull(
+ reference.getProperty(SchemaSourceProvider.class.getName()), "Source provider not found");
+ Preconditions.checkArgument(sourceProvider instanceof SchemaSourceProvider);
+
+ // TODO avoid cast
+ final YangStoreService yangStoreService = new YangStoreService(schemaContextProvider,
+ (SchemaSourceProvider<YangTextSchemaSource>) sourceProvider);
+
+ final BindingRuntimeContext runtimeContext = (BindingRuntimeContext) reference
+ .getProperty(BindingRuntimeContext.class.getName());
+ LOG.debug("BindingRuntimeContext retrieved as {}", runtimeContext);
+ if (runtimeContext != null) {
+ yangStoreService.refresh(runtimeContext);
+ }
+
+ YangStoreActivator.this.yangStoreServiceServiceRegistration = context
+ .registerService(YangStoreService.class, yangStoreService, new Hashtable<>());
+ YangStoreActivator.this.configRegistryLookup = new ConfigRegistryLookupThread(yangStoreService);
+ YangStoreActivator.this.configRegistryLookup.start();