2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
12 import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
13 import org.osgi.framework.BundleContext;
16 * @deprecated Replaced by blueprint wiring
19 public final class RuntimeMappingModule extends AbstractRuntimeMappingModule {
20 private BundleContext bundleContext;
22 public RuntimeMappingModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
23 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
24 super(identifier, dependencyResolver);
27 public RuntimeMappingModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
28 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
29 final RuntimeMappingModule oldModule, final java.lang.AutoCloseable oldInstance) {
30 super(identifier, dependencyResolver, oldModule, oldInstance);
34 public void validate() {
36 Preconditions.checkNotNull(bundleContext);
37 // Add custom validation for module attributes here.
41 public boolean canReuseInstance(final AbstractRuntimeMappingModule oldModule) {
46 public AutoCloseable createInstance() {
47 // We need to return the concrete BindingToNormalizedNodeCodec instance for backwards compatibility
48 // for CSS users that inject the binding-dom-mapping-service.
49 final WaitingServiceTracker<BindingToNormalizedNodeCodec> tracker =
50 WaitingServiceTracker.create(BindingToNormalizedNodeCodec.class, bundleContext);
51 final BindingToNormalizedNodeCodec service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
53 // Ideally we would close the ServiceTracker via the returned AutoCloseable but then we'd have to
54 // proxy the BindingToNormalizedNodeCodec instance which is problematic. It's OK to close the
55 // ServiceTracker here.
60 public void setBundleContext(final BundleContext bundleContext) {
61 this.bundleContext = bundleContext;