2 * Copyright (c) 2016 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.lispflowmapping.implementation.mdsal;
10 import org.opendaylight.mdsal.binding.api.DataBroker;
11 import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
12 import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
13 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
14 import org.opendaylight.yangtools.concepts.Registration;
15 import org.opendaylight.yangtools.yang.binding.DataObject;
16 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
19 * The superclass for the different MD-SAL data change event listeners.
22 public abstract class AbstractDataListener<T extends DataObject> implements DataTreeChangeListener<T> {
23 private DataBroker broker;
24 private InstanceIdentifier<T> path;
25 private Registration configRegistration;
26 private Registration operRegistration;
28 void registerDataChangeListener() {
29 configRegistration = broker.registerTreeChangeListener(
30 DataTreeIdentifier.of(LogicalDatastoreType.CONFIGURATION, path), this);
31 operRegistration = broker.registerTreeChangeListener(
32 DataTreeIdentifier.of(LogicalDatastoreType.OPERATIONAL, path), this);
35 public void closeDataChangeListener() {
36 configRegistration.close();
37 operRegistration.close();
40 void setBroker(DataBroker broker) {
44 void setPath(InstanceIdentifier<T> path) {