2 * Copyright (c) 2015 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.controller.md.sal.dom.api;
10 import java.util.Collection;
11 import java.util.EventListener;
12 import org.eclipse.jdt.annotation.NonNull;
15 * An {@link EventListener} used to track RPC implementations becoming (un)available a {@link DOMRpcService}. Note that
16 * the reported {@link DOMRpcIdentifier}s form an identifier space shared between RFC7950 actions and RFC6020 RPCs,
17 * the former being also known as 'Routed RPCs'.
20 * Interpretation of DOMRpcIdentifiers has to be evaluated in the context of one of these types, which need to be
21 * determined by matching {@link DOMRpcIdentifier#getType()} against a
22 * {@link org.opendaylight.yangtools.yang.model.api.SchemaContext}, which determines actual semantics of
23 * {@link DOMRpcIdentifier#getContextReference()}. Corresponding SchemaNode is required to be a known sub-interface
24 * of {@link org.opendaylight.yangtools.yang.model.api.OperationDefinition}.
27 * For RFC6020 RPCs, reported context reference is always non-null and empty. It indicates an RPC implementation has
28 * been registered and invocations can be reasonably (with obvious distributed system caveats coming from asynchronous
29 * events) expected to succeed.
32 * For RFC7950 actions with a non-empty context-reference, the indication is the same as for RFC6020 RPCs.
35 * For RFC7950 actions with an empty context-reference, the indication is that the corresponding actions are
36 * potentially available, but are subject to dynamic lifecycle of their context references. This includes two primary
39 * <li>dynamic action instantiation (when a device connects)</li>
40 * <li>dynamic action translation, such as transforming one action into another</li>
42 * First use case will provide further availability events with non-empty context references as they become available,
43 * which can be safely ignored if the listener is interested in pure invocation-type integration.
46 * Second use case will not be providing further events, but rather will attempt to map any incoming invocation onto
47 * some other RPC or action, or similar, which can separately fail. If a sub-request fails, such implementations are
48 * required do report {@link DOMRpcImplementationNotAvailableException} as the invocation result, with the underlying
49 * failure being linked as a cause.
51 * @deprecated Use {@link org.opendaylight.mdsal.dom.api.DOMRpcAvailabilityListener} instead.
53 @Deprecated(forRemoval = true)
54 public interface DOMRpcAvailabilityListener extends EventListener {
56 * Method invoked whenever an RPC type becomes available.
58 * @param rpcs RPC types newly available
60 void onRpcAvailable(@NonNull Collection<DOMRpcIdentifier> rpcs);
63 * Method invoked whenever an RPC type becomes unavailable.
65 * @param rpcs RPC types which became unavailable
67 void onRpcUnavailable(@NonNull Collection<DOMRpcIdentifier> rpcs);
70 * Implementation filtering method. This method is useful for forwarding RPC implementations,
71 * which need to ensure they do not re-announce their own implementations. Without this method
72 * a forwarder which registers an implementation would be notified of its own implementation,
73 * potentially re-exporting it as local -- hence creating a forwarding loop.
75 * @param impl RPC implementation being registered
76 * @return False if the implementation should not be reported, defaults to true.
78 default boolean acceptsImplementation(final DOMRpcImplementation impl) {