Add filtering capability to config.ini in order to reference logging bridge version.
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / osgi / YangStoreServiceTracker.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.netconf.confignetconfconnector.osgi;
10
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;
15
16 class YangStoreServiceTracker extends ServiceTracker<YangStoreService, YangStoreService> {
17     private final YangStoreTrackerListener listener;
18
19     YangStoreServiceTracker(BundleContext context, final YangStoreTrackerListener listener) {
20         super(context, YangStoreService.class, null);
21         this.listener = listener;
22     }
23
24     @Override
25     public synchronized YangStoreService addingService(final ServiceReference<YangStoreService> reference) {
26         final YangStoreService yangStoreService = super.addingService(reference);
27         listener.onYangStoreAdded(yangStoreService);
28         return yangStoreService;
29     }
30
31     @Override
32     public synchronized void removedService(final ServiceReference<YangStoreService> reference,
33             final YangStoreService service) {
34         listener.onYangStoreRemoved();
35     }
36
37     static interface YangStoreTrackerListener {
38         void onYangStoreAdded(YangStoreService yangStoreService);
39         void onYangStoreRemoved();
40     }
41 }