2 * Copyright (c) 2013 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.netconf.confignetconfconnector.osgi;
11 import org.opendaylight.controller.config.yang.store.api.YangStoreService;
12 import org.osgi.framework.BundleContext;
13 import org.osgi.framework.ServiceReference;
14 import org.osgi.util.tracker.ServiceTracker;
16 class YangStoreServiceTracker extends ServiceTracker<YangStoreService, YangStoreService> {
17 private final YangStoreTrackerListener listener;
19 YangStoreServiceTracker(BundleContext context, final YangStoreTrackerListener listener) {
20 super(context, YangStoreService.class, null);
21 this.listener = listener;
25 public synchronized YangStoreService addingService(final ServiceReference<YangStoreService> reference) {
26 final YangStoreService yangStoreService = super.addingService(reference);
27 listener.onYangStoreAdded(yangStoreService);
28 return yangStoreService;
32 public synchronized void removedService(final ServiceReference<YangStoreService> reference,
33 final YangStoreService service) {
34 listener.onYangStoreRemoved();
37 static interface YangStoreTrackerListener {
38 void onYangStoreAdded(YangStoreService yangStoreService);
39 void onYangStoreRemoved();