2 * Copyright (c) 2014, 2015 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
9 package org.opendaylight.controller.config.yang.config.distributed_datastore_provider;
11 import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
12 import org.opendaylight.controller.cluster.datastore.compat.LegacyDOMStoreAdapter;
13 import org.opendaylight.controller.config.api.DependencyResolver;
14 import org.opendaylight.controller.config.api.ModuleIdentifier;
15 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
16 import org.osgi.framework.BundleContext;
19 public class DistributedOperationalDataStoreProviderModule
20 extends AbstractDistributedOperationalDataStoreProviderModule {
21 private BundleContext bundleContext;
23 public DistributedOperationalDataStoreProviderModule(final ModuleIdentifier identifier,
24 final DependencyResolver dependencyResolver) {
25 super(identifier, dependencyResolver);
28 public DistributedOperationalDataStoreProviderModule(final ModuleIdentifier identifier,
29 final DependencyResolver dependencyResolver,final DistributedOperationalDataStoreProviderModule oldModule,
30 final AutoCloseable oldInstance) {
31 super(identifier, dependencyResolver, oldModule, oldInstance);
35 public void customValidation() {
36 // add custom validation form module attributes here.
40 public boolean canReuseInstance(final AbstractDistributedOperationalDataStoreProviderModule oldModule) {
45 public java.lang.AutoCloseable createInstance() {
46 // The DistributedOperDataStore is provided via blueprint so wait for and return it here for
47 // backwards compatibility
48 WaitingServiceTracker<DistributedDataStoreInterface> tracker = WaitingServiceTracker.create(
49 DistributedDataStoreInterface.class, bundleContext, "(type=distributed-operational)");
50 DistributedDataStoreInterface delegate = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
51 return new LegacyDOMStoreAdapter(delegate) {
59 public void setBundleContext(final BundleContext bundleContext) {
60 this.bundleContext = bundleContext;