+
+ /**
+ * This method is called via blueprint to register a BindingToNormalizedNodeCodec instance with the OSGI
+ * service registry. This is done in code instead of directly via blueprint because the BindingToNormalizedNodeCodec
+ * instance must be advertised with the actual class for backwards compatibility with CSS modules and blueprint
+ * will try to create a proxy wrapper which is problematic with BindingToNormalizedNodeCodec because it's final
+ * and has final methods which can't be proxied.
+ *
+ * @param instance the BindingToNormalizedNodeCodec instance
+ * @param bundleContext the BundleContext
+ * @return ServiceRegistration instance
+ */
+ public static ServiceRegistration<BindingToNormalizedNodeCodec> registerOSGiService(BindingToNormalizedNodeCodec instance,
+ BundleContext bundleContext) {
+ Dictionary<String, String> props = new Hashtable<>();
+
+ // Set the appropriate service properties so the corresponding CSS module is restarted if this
+ // blueprint container is restarted
+ props.put("config-module-namespace", "urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl");
+ props.put("config-module-name", "runtime-generated-mapping");
+ props.put("config-instance-name", "runtime-mapping-singleton");
+ return bundleContext.registerService(BindingToNormalizedNodeCodec.class, instance, props );
+ }