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;
18 * @deprecated Replaced by blueprint wiring
21 public final class RuntimeMappingModule extends AbstractRuntimeMappingModule {
22 private BundleContext bundleContext;
24 public RuntimeMappingModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
25 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
26 super(identifier, dependencyResolver);
29 public RuntimeMappingModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
30 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
31 final RuntimeMappingModule oldModule, final java.lang.AutoCloseable oldInstance) {
32 super(identifier, dependencyResolver, oldModule, oldInstance);
36 public void validate() {
38 Preconditions.checkNotNull(bundleContext);
39 // Add custom validation for module attributes here.
43 public boolean canReuseInstance(final AbstractRuntimeMappingModule oldModule) {
48 public AutoCloseable createInstance() {
49 // We need to return the concrete BindingToNormalizedNodeCodec instance for backwards compatibility
50 // for CSS users that inject the binding-dom-mapping-service.
51 final WaitingServiceTracker<BindingToNormalizedNodeCodec> tracker =
52 WaitingServiceTracker.create(BindingToNormalizedNodeCodec.class, bundleContext);
53 final BindingToNormalizedNodeCodec service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
55 // Ideally we would close the ServiceTracker via the returned AutoCloseable but then we'd have to
56 // proxy the BindingToNormalizedNodeCodec instance which is problematic. It's OK to close the
57 // ServiceTracker here.
62 public void setBundleContext(final BundleContext bundleContext) {
63 this.bundleContext = bundleContext;