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.controller.md.sal.binding.api.DataBroker;
11 import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
12 import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
13 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
14 import org.opendaylight.yangtools.concepts.ListenerRegistration;
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 ListenerRegistration<DataTreeChangeListener<T>> registration;
27 public void registerDataChangeListener() {
28 final DataTreeIdentifier<T> dataTreeIdentifier = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION,
31 registration = broker.registerDataTreeChangeListener(dataTreeIdentifier, this);
34 public void closeDataChangeListener() {
38 public void setBroker(DataBroker broker) {
42 void setPath(InstanceIdentifier<T> path) {