BUG-2288: remove DOMNotificationListenerRegistration 27/14827/1
authorRobert Varga <rovarga@cisco.com>
Wed, 4 Feb 2015 14:18:37 +0000 (15:18 +0100)
committerRobert Varga <rovarga@cisco.com>
Wed, 4 Feb 2015 14:19:55 +0000 (15:19 +0100)
This type is just a capture, and it fails to forward the type of the
listener properly for users. Remove it and be more consistent with the
design of other classes.

Change-Id: Ib8c3db54fc599d6ca194d1667e1a48a98e455180
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationListenerRegistration.java [deleted file]
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationService.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/AbstractDOMNotificationListenerRegistration.java [deleted file]
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMNotificationService.java

diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationListenerRegistration.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationListenerRegistration.java
deleted file mode 100644 (file)
index 4dccad2..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2014 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.controller.md.sal.dom.api;
-
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-
-/**
- * A registration of a {@link DOMNotificationListener}. Invoking {@link #close()} will prevent further
- * delivery of events to the listener.
- */
-public interface DOMNotificationListenerRegistration extends ListenerRegistration<DOMNotificationListener> {
-
-}
index 6bce9c447add70d54e85168045a0e10ee3a24bab..4b9f8ca7fc6eb6455e91ffa6072fea9ec8e1d7cf 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.md.sal.dom.api;
 
 import java.util.Collection;
 import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 /**
@@ -30,7 +31,7 @@ public interface DOMNotificationService {
      *         null or a SchemaPath which does not represent a valid {@link DOMNotification} type.
      * @throws NullPointerException if either of the arguments is null
      */
-    DOMNotificationListenerRegistration registerNotificationListener(@Nonnull DOMNotificationListener listener, @Nonnull Collection<SchemaPath> types);
+    <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(@Nonnull T listener, @Nonnull Collection<SchemaPath> types);
 
     /**
      * Register a {@link DOMNotificationListener} to receive a set of notifications. As with
@@ -47,5 +48,5 @@ public interface DOMNotificationService {
      * @throws NullPointerException if listener is null
      */
     // FIXME: Java 8: provide a default implementation of this method.
-    DOMNotificationListenerRegistration registerNotificationListener(@Nonnull DOMNotificationListener listener, SchemaPath... types);
+    <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(@Nonnull T listener, SchemaPath... types);
 }
diff --git a/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/AbstractDOMNotificationListenerRegistration.java b/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/AbstractDOMNotificationListenerRegistration.java
deleted file mode 100644 (file)
index 2934b0d..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2014 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.controller.md.sal.dom.spi;
-
-import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener;
-import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListenerRegistration;
-import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
-
-/**
- * Utility base class for {@link DOMNotificationListenerRegistration}
- * implementations.
- */
-public abstract class AbstractDOMNotificationListenerRegistration extends AbstractListenerRegistration<DOMNotificationListener> implements DOMNotificationListenerRegistration {
-    /**
-     * Default constructor. Subclasses need to invoke it from their
-     * constructor(s).
-     *
-     * @param listener {@link DOMNotificationListener} instance which is
-     *                 being held by this registration. May not be null.
-     */
-    protected AbstractDOMNotificationListenerRegistration(final @Nonnull DOMNotificationListener listener) {
-        super(listener);
-    }
-}
index 5199a3893bf64c101ee3528b6ebff18f65193d78..b40c428b6b7078d428a8e7772bda9cb2cfb9d05e 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.controller.md.sal.dom.spi;
 import com.google.common.collect.ForwardingObject;
 import java.util.Collection;
 import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener;
-import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListenerRegistration;
 import org.opendaylight.controller.md.sal.dom.api.DOMNotificationService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 /**
@@ -23,13 +23,13 @@ public abstract class ForwardingDOMNotificationService extends ForwardingObject
     protected abstract DOMNotificationService delegate();
 
     @Override
-    public DOMNotificationListenerRegistration registerNotificationListener(final DOMNotificationListener listener,
+    public <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(final T listener,
             final Collection<SchemaPath> types) {
         return delegate().registerNotificationListener(listener, types);
     }
 
     @Override
-    public DOMNotificationListenerRegistration registerNotificationListener(final DOMNotificationListener listener,
+    public <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(final T listener,
             final SchemaPath... types) {
         return delegate().registerNotificationListener(listener, types);
     }