Eliminate BindingToNormalizedNodeCodecFactory.getOrCreateInstance()
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / md / sal / binding / impl / BindingToNormalizedNodeCodecFactory.java
index f1ae5cb1c58eb86f8aa384cbfa4232cf580b70f4..665201480e19497bc42f844ff08636f0618ccf27 100644 (file)
@@ -10,11 +10,11 @@ package org.opendaylight.controller.md.sal.binding.impl;
 import java.util.Dictionary;
 import java.util.Hashtable;
 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
-import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
+import org.opendaylight.mdsal.binding.dom.codec.gen.impl.StreamWriterGenerator;
+import org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry;
+import org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.sal.binding.generator.api.ClassLoadingStrategy;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
@@ -25,32 +25,14 @@ import org.osgi.framework.ServiceRegistration;
  * @author Thomas Pantelis
  */
 public class BindingToNormalizedNodeCodecFactory {
-    /**
-     * This method is deprecated in favor of newInstance/registerInstance.
-     *
-     * @param classLoadingStrategy
-     * @param schemaService
-     * @return BindingToNormalizedNodeCodec instance
-     */
-    @Deprecated
-    public static BindingToNormalizedNodeCodec getOrCreateInstance(ClassLoadingStrategy classLoadingStrategy,
-                            SchemaService schemaService) {
-        BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(
-                StreamWriterGenerator.create(SingletonHolder.JAVASSIST));
-        BindingToNormalizedNodeCodec instance = new BindingToNormalizedNodeCodec(
-                               classLoadingStrategy, codecRegistry, true);
-        schemaService.registerSchemaContextListener(instance);
-        return instance;
-    }
-
     /**
      * Creates a new BindingToNormalizedNodeCodec instance.
      *
      * @param classLoadingStrategy
      * @return the BindingToNormalizedNodeCodec instance
      */
-    public static BindingToNormalizedNodeCodec newInstance(ClassLoadingStrategy classLoadingStrategy) {
-        BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(
+    public static BindingToNormalizedNodeCodec newInstance(final ClassLoadingStrategy classLoadingStrategy) {
+        final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(
                 StreamWriterGenerator.create(SingletonHolder.JAVASSIST));
         return new BindingToNormalizedNodeCodec(classLoadingStrategy, codecRegistry, true);
     }
@@ -62,8 +44,8 @@ public class BindingToNormalizedNodeCodecFactory {
      * @param schemaService the SchemaService.
      * @return the ListenerRegistration
      */
-    public static ListenerRegistration<SchemaContextListener> registerInstance(BindingToNormalizedNodeCodec instance,
-            SchemaService schemaService) {
+    public static ListenerRegistration<SchemaContextListener> registerInstance(final BindingToNormalizedNodeCodec instance,
+            final DOMSchemaService schemaService) {
         return schemaService.registerSchemaContextListener(instance);
     }
 
@@ -78,9 +60,9 @@ public class BindingToNormalizedNodeCodecFactory {
      * @param bundleContext the BundleContext
      * @return ServiceRegistration instance
      */
-    public static ServiceRegistration<BindingToNormalizedNodeCodec> registerOSGiService(BindingToNormalizedNodeCodec instance,
-            BundleContext bundleContext) {
-        Dictionary<String, String> props = new Hashtable<>();
+    public static ServiceRegistration<BindingToNormalizedNodeCodec> registerOSGiService(final BindingToNormalizedNodeCodec instance,
+            final BundleContext bundleContext) {
+        final Dictionary<String, String> props = new Hashtable<>();
 
         // Set the appropriate service properties so the corresponding CSS module is restarted if this
         // blueprint container is restarted