increase code quality in tools api/testutils by using infrautils' parent
[serviceutils.git] / api / src / main / java / org / opendaylight / genius / tools / mdsal / listener / AbstractSyncDataTreeChangeListener.java
1 /*
2  * Copyright (c) 2018 Ericsson S.A. 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 package org.opendaylight.genius.tools.mdsal.listener;
9
10 import java.util.Collection;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
13 import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
14 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
15 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
16 import org.opendaylight.infrautils.metrics.MetricProvider;
17 import org.opendaylight.yangtools.yang.binding.DataObject;
18 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
19
20 /**
21  * Abstract class providing some common functionality to specific listeners. This should be the most common parent
22  * class for any listener that does not need to be either cluster-aware (see
23  * {@link AbstractClusteredSyncDataTreeChangeListener}) or to process notifications asynchronously
24  * (see {@link AbstractAsyncDataTreeChangeListener}) or even both characteristics (see
25  * {@link AbstractClusteredAsyncDataTreeChangeListener}).
26  *
27  * @param <T> type of the data object the listener is registered to.
28  *
29  * @author David Suárez (david.suarez.fuentes@gmail.com)
30  */
31 public abstract class AbstractSyncDataTreeChangeListener<T extends DataObject> extends
32         AbstractDataTreeChangeListener<T> {
33
34     public AbstractSyncDataTreeChangeListener(DataBroker dataBroker, DataTreeIdentifier<T> dataTreeIdentifier) {
35         super(dataBroker, dataTreeIdentifier);
36     }
37
38     public AbstractSyncDataTreeChangeListener(DataBroker dataBroker, LogicalDatastoreType datastoreType,
39                                               InstanceIdentifier<T> instanceIdentifier) {
40         super(dataBroker, datastoreType, instanceIdentifier);
41     }
42
43     public AbstractSyncDataTreeChangeListener(DataBroker dataBroker, LogicalDatastoreType datastoreType,
44                                               InstanceIdentifier<T> instanceIdentifier,
45                                               MetricProvider metricProvider) {
46         super(dataBroker, datastoreType, instanceIdentifier, metricProvider);
47     }
48
49     @Override
50     public final void onDataTreeChanged(@Nonnull Collection<DataTreeModification<T>> collection) {
51         super.onDataTreeChanged(collection, getDataStoreMetrics());
52     }
53 }