From: Tom Pantelis Date: Wed, 22 Jun 2016 20:01:49 +0000 (-0400) Subject: Remove global BindingToNormalizedNodeCodec instance X-Git-Tag: release/boron~54 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=1bec49d0736bfd9baad39d7fcdf80a1daac73386;hp=1bec49d0736bfd9baad39d7fcdf80a1daac73386 Remove global BindingToNormalizedNodeCodec instance The BindingToNormalizedNodeCodec was made a global static instance for backwards compatibility for CSS users that inject the binding-dom-mapping-service identity which defines the provided service as the concrete BindingToNormalizedNodeCodec class instead of an interface. Therefore the global static instance was created via blueprint and advertised via its interfaces and was obtained via the static reference by the RuntimeMappingModule for use by CSS users. The RuntimeMappingModule must return an instance of BindingToNormalizedNodeCodec in order to provide the binding-dom-mapping-service so obtaining the blueprint advertised OSGi service via its interfaces and casting to BindingToNormalizedNodeCodec failed b/c Aries creates a service proxy which loses the fact that it's a BindingToNormalizedNodeCodec instance. However the global BindingToNormalizedNodeCodec instance is not clean and is problematic for supporting blueprint container restarts. Aries supports concrete class proxies so I added an additional service export for the BindingToNormalizedNodeCodec class in the binding-broker blueprint XML. In addition, the blueprint XML now calls a new method, "newInstance", on the BindingToNormalizedNodeCodecFactory to create a new instance and calls a new method, "registerInstance", to register it with the SchemaService. The returned ListenerRegistration instance is put into a bean so it can be closed on destroy. The RuntimeMappingModule now obtains the BindingToNormalizedNodeCodec instance from the OSGi registry as the other blueprint-bridged CSS modules do. This eliminates the need for the global instance. Change-Id: I969ad5470967a81b37078393701c69d1898086cd Signed-off-by: Tom Pantelis ---