Bug 868: Removed use of CompositeNode Binding Codecs.
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / config / yang / md / sal / binding / impl / RuntimeMappingModule.java
index 0ad043489269df0f6443e37f8aa20d0f60fbccca..c228244800bda2810139fe93e3e7e20cf90c2452 100644 (file)
@@ -9,21 +9,18 @@ package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
 import com.google.common.base.Preconditions;
 import java.util.Hashtable;
-import javassist.ClassPool;
 import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
 import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
 import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
-import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
-import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 
 /**
-*
-*/
+ *
+**/
 public final class RuntimeMappingModule extends AbstractRuntimeMappingModule {
 
     private BundleContext bundleContext;
@@ -54,40 +51,17 @@ public final class RuntimeMappingModule extends AbstractRuntimeMappingModule {
     @Override
     public java.lang.AutoCloseable createInstance() {
         final GeneratedClassLoadingStrategy classLoading = getGlobalClassLoadingStrategy();
-        final BindingIndependentMappingService legacyMapping = getGlobalLegacyMappingService(classLoading);
         BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(SingletonHolder.JAVASSIST));
-        BindingToNormalizedNodeCodec instance = new BindingToNormalizedNodeCodec(classLoading, legacyMapping, codecRegistry);
+        BindingToNormalizedNodeCodec instance = new BindingToNormalizedNodeCodec(classLoading, codecRegistry);
         bundleContext.registerService(SchemaContextListener.class, instance, new Hashtable<String,String>());
         return instance;
     }
 
-    private BindingIndependentMappingService getGlobalLegacyMappingService(final GeneratedClassLoadingStrategy classLoading) {
-        BindingIndependentMappingService potential = tryToReuseGlobalMappingServiceInstance();
-        if(potential == null) {
-            potential =  new RuntimeGeneratedMappingServiceImpl(ClassPool.getDefault(),classLoading);
-            bundleContext.registerService(SchemaContextListener.class, (SchemaContextListener) potential, new Hashtable<String,String>());
-        }
-        return potential;
-    }
-
     private GeneratedClassLoadingStrategy getGlobalClassLoadingStrategy() {
         ServiceReference<GeneratedClassLoadingStrategy> ref = bundleContext.getServiceReference(GeneratedClassLoadingStrategy.class);
         return bundleContext.getService(ref);
     }
 
-    private BindingIndependentMappingService tryToReuseGlobalMappingServiceInstance() {
-        ServiceReference<BindingIndependentMappingService> serviceRef = getBundleContext().getServiceReference(BindingIndependentMappingService.class);
-        if(serviceRef == null) {
-            return null;
-        }
-        return bundleContext.getService(serviceRef);
-
-    }
-
-    private BundleContext getBundleContext() {
-        return bundleContext;
-    }
-
     public void setBundleContext(final BundleContext bundleContext) {
         this.bundleContext = bundleContext;
     }