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
8 package org.opendaylight.controller.netconf.monitoring.osgi;
10 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService;
11 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory;
12 import org.osgi.framework.BundleActivator;
13 import org.osgi.framework.BundleContext;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 public class NetconfMonitoringActivator implements BundleActivator {
19 private static final Logger logger = LoggerFactory.getLogger(NetconfMonitoringActivator.class);
21 private NetconfMonitoringServiceTracker monitor;
24 public void start(final BundleContext context) throws Exception {
25 monitor = new NetconfMonitoringServiceTracker(context);
31 public void stop(final BundleContext context) throws Exception {
35 } catch (Exception e) {
36 logger.warn("Ignoring exception while closing {}", monitor, e);
41 public static class NetconfMonitoringOperationServiceFactory implements NetconfOperationServiceFactory {
42 private final NetconfMonitoringOperationService operationService;
44 public NetconfMonitoringOperationServiceFactory(NetconfMonitoringOperationService operationService) {
45 this.operationService = operationService;
49 public NetconfOperationService createService(String netconfSessionIdForReporting) {
50 return operationService;