Migrate mdsal-dom-api to JDT annotations
[mdsal.git] / dom / mdsal-dom-api / src / main / java / org / opendaylight / mdsal / dom / api / DOMRpcAvailabilityListener.java
index 307ce6b95c94f042d999261c255b57a43f7e0c04..137205db5c2763ca55e2c6718599cc6c63692d0f 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.mdsal.dom.api;
 
 import java.util.Collection;
 import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * An {@link EventListener} used to track RPC implementations becoming (un)available
@@ -21,12 +21,25 @@ public interface DOMRpcAvailabilityListener extends EventListener {
      *
      * @param rpcs RPC types newly available
      */
-    void onRpcAvailable(@Nonnull Collection<DOMRpcIdentifier> rpcs);
+    void onRpcAvailable(@NonNull Collection<DOMRpcIdentifier> rpcs);
 
     /**
      * Method invoked whenever an RPC type becomes unavailable.
      *
      * @param rpcs RPC types which became unavailable
      */
-    void onRpcUnavailable(@Nonnull Collection<DOMRpcIdentifier> rpcs);
+    void onRpcUnavailable(@NonNull Collection<DOMRpcIdentifier> rpcs);
+
+    /**
+     * Implementation filtering method. This method is useful for forwarding RPC implementations,
+     * which need to ensure they do not re-announce their own implementations. Without this method
+     * a forwarder which registers an implementation would be notified of its own implementation,
+     * potentially re-exporting it as local -- hence creating a forwarding loop.
+     *
+     * @param impl RPC implementation being registered
+     * @return False if the implementation should not be reported, defaults to true.
+     */
+    default boolean acceptsImplementation(final DOMRpcImplementation impl) {
+        return true;
+    }
 }