Remove old AbstractDataListener 11/38811/1
authorLorand Jakab <lojakab@cisco.com>
Thu, 12 May 2016 16:43:36 +0000 (19:43 +0300)
committerLorand Jakab <lojakab@cisco.com>
Thu, 12 May 2016 16:43:36 +0000 (19:43 +0300)
We don't want to keep around unused code (especially not when it's using
deprecated interfaces).

Change-Id: I28c7bc768b13673415039255c37b852b50bacb1d
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/AbstractDataListener.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/AuthenticationKeyDataListener.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/MappingDataListener.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/NewAbstractDataListener.java [deleted file]

index 31319ec3d7a9ff21b7f87d5e6e69d1fcca978629..97ac5550e7cc32aa666c14482f1b78a033663f70 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -8,25 +8,27 @@
 package org.opendaylight.lispflowmapping.implementation.mdsal;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * The superclass for the different MD-SAL data change event listeners.
  *
- * @author Lorand Jakab
- *
  */
-public abstract class AbstractDataListener implements DataChangeListener {
+public abstract class AbstractDataListener<T extends DataObject> implements DataTreeChangeListener<T> {
     private DataBroker broker;
-    private InstanceIdentifier<?> path;
-    private ListenerRegistration<DataChangeListener> registration;
+    private InstanceIdentifier<T> path;
+    private ListenerRegistration<DataTreeChangeListener<T>> registration;
 
     public void registerDataChangeListener() {
-        registration = broker.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION,
-                path, this, DataBroker.DataChangeScope.SUBTREE);
+        final DataTreeIdentifier<T> dataTreeIdentifier = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION,
+                path);
+
+        registration = broker.registerDataTreeChangeListener(dataTreeIdentifier, this);
     }
 
     public void closeDataChangeListener() {
@@ -37,7 +39,8 @@ public abstract class AbstractDataListener implements DataChangeListener {
         this.broker = broker;
     }
 
-    void setPath(InstanceIdentifier<?> path) {
+    void setPath(InstanceIdentifier<T> path) {
         this.path = path;
     }
+
 }
index 0025594046b4abde8a3863ae9c9c2ae70face5f8..5ff9336a2eedca657fcaa6c136a7dc25eab13f82 100644 (file)
@@ -26,7 +26,7 @@ import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.Mod
  * @author Lorand Jakab
  *
  */
-public class AuthenticationKeyDataListener extends NewAbstractDataListener<AuthenticationKey> {
+public class AuthenticationKeyDataListener extends AbstractDataListener<AuthenticationKey> {
     private static final Logger LOG = LoggerFactory.getLogger(AuthenticationKeyDataListener.class);
     private IMappingSystem mapSystem;
 
index b58212833d42bd549bc1fb6643b7d7f96652599d..f7a0f73691130e8ef735d9c319ead3a1153bd421 100644 (file)
@@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
  * @author Florin Coras
  *
  */
-public class MappingDataListener extends NewAbstractDataListener<Mapping> {
+public class MappingDataListener extends AbstractDataListener<Mapping> {
     private static final Logger LOG = LoggerFactory.getLogger(MappingDataListener.class);
     private IMappingSystem mapSystem;
     private NotificationPublishService notificationPublishService;
diff --git a/mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/NewAbstractDataListener.java b/mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/NewAbstractDataListener.java
deleted file mode 100644 (file)
index 8a84ae0..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.lispflowmapping.implementation.mdsal;
-
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
-import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * The superclass for the different MD-SAL data change event listeners.
- *
- */
-public abstract class NewAbstractDataListener<T extends DataObject> implements DataTreeChangeListener<T> {
-    private DataBroker broker;
-    private InstanceIdentifier<T> path;
-    private ListenerRegistration<DataTreeChangeListener<T>> registration;
-
-    public void registerDataChangeListener() {
-        final DataTreeIdentifier<T> dataTreeIdentifier = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION,
-                path);
-
-        registration = broker.registerDataTreeChangeListener(dataTreeIdentifier, this);
-    }
-
-    public void closeDataChangeListener() {
-        registration.close();
-    }
-
-    public void setBroker(DataBroker broker) {
-        this.broker = broker;
-    }
-
-    void setPath(InstanceIdentifier<T> path) {
-        this.path = path;
-    }
-
-}