*/
package org.opendaylight.controller.config.yang.md.sal.binding.impl;
+import java.util.Hashtable;
import java.util.Map.Entry;
import java.util.Set;
import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
import org.opendaylight.yangtools.yang.data.impl.codec.CodecRegistry;
import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
+import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
RuntimeGeneratedMappingServiceImpl service = new RuntimeGeneratedMappingServiceImpl();
service.setPool(SingletonHolder.CLASS_POOL);
service.init();
+ bundleContext.registerService(SchemaServiceListener.class, service, new Hashtable<String,String>());
return service;
}
if(serviceRef == null) {
return null;
}
- return new RuntimeGeneratedMappingServiceProxy(getBundleContext(),serviceRef);
+
+ BindingIndependentMappingService delegate = bundleContext.getService(serviceRef);
+ if (delegate == null) {
+ return null;
+ }
+ return new RuntimeGeneratedMappingServiceProxy(getBundleContext(),serviceRef,delegate);
}
private BundleContext getBundleContext() {
private BundleContext bundleContext;
public RuntimeGeneratedMappingServiceProxy(BundleContext bundleContext,
- ServiceReference<BindingIndependentMappingService> serviceRef) {
- this.bundleContext = bundleContext;
- this.reference = serviceRef;
- this.delegate = bundleContext.getService(serviceRef);
+ ServiceReference<BindingIndependentMappingService> serviceRef,
+ BindingIndependentMappingService delegate) {
+ this.bundleContext = Preconditions.checkNotNull(bundleContext);
+ this.reference = Preconditions.checkNotNull(serviceRef);
+ this.delegate = Preconditions.checkNotNull(delegate);
}
public CodecRegistry getCodecRegistry() {