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.openflowplugin.droptest;
10 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
11 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
12 import org.opendaylight.yangtools.concepts.Registration;
13 import org.opendaylight.yangtools.yang.binding.NotificationListener;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 @SuppressWarnings("all")
18 public class DropTestProvider implements AutoCloseable {
19 private final static Logger LOG = LoggerFactory.getLogger(DropTestProvider.class);
21 private DataProviderService _dataService;
22 private NotificationProviderService _notificationService;
23 private Registration listenerRegistration;
24 private final DropTestCommiter commiter = new DropTestCommiter(this);
26 public DropTestStats getStats() {
27 return this.commiter.getStats();
30 public void clearStats() {
31 this.commiter.clearStats();
34 public DataProviderService getDataService() {
35 return this._dataService;
38 public void setDataService(final DataProviderService dataService) {
39 this._dataService = dataService;
43 public NotificationProviderService getNotificationService() {
44 return this._notificationService;
47 public void setNotificationService(final NotificationProviderService notificationService) {
48 this._notificationService = notificationService;
52 this.listenerRegistration = this.getNotificationService().registerNotificationListener(commiter);
53 LOG.debug("DropTestProvider Started.");
58 LOG.debug("DropTestProvider stopped.");
59 if (this.listenerRegistration != null) {
60 this.listenerRegistration.close();
62 } catch (Exception e) {