BUG-7608: Add ActionServiceMetadata and ActionProviderBean
[controller.git] / opendaylight / blueprint / src / main / java / org / opendaylight / controller / blueprint / ext / ActionServiceMetadata.java
1 /*
2  * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.blueprint.ext;
9
10 import java.util.function.Predicate;
11 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
12 import org.opendaylight.controller.md.sal.dom.broker.spi.rpc.RpcRoutingStrategy;
13
14 /**
15  * Factory metadata corresponding to the "action-service" element. It waits for a DOM promise of registration
16  * to appear in the {@link DOMRpcService} and then acquires a dynamic proxy via RpcProviderRegistry.
17  *
18  * @author Robert Varga
19  */
20 final class ActionServiceMetadata extends AbstractInvokableServiceMetadata {
21     /*
22      * Implementation note:
23      *
24      * This implementation assumes Binding V1 semantics for actions, which means actions are packaged along with RPCs
25      * into a single interface. This has interesting implications on working with RpcServiceMetadata, which only
26      * handles the RPC side of the contract.
27      *
28      * Further interesting interactions stem from the fact that in DOM world each action is a separate entity, so the
29      * interface contract can let some actions to be invoked, while failing for others. This is a shortcoming of the
30      * Binding Specification and will be addressed in Binding V2 -- where each action is its own interface.
31      */
32     ActionServiceMetadata(final String id, final String interfaceName) {
33         super(id, interfaceName);
34     }
35
36     @Override
37     Predicate<RpcRoutingStrategy> rpcFilter() {
38         // FIXME: BUG-7608: action-service is a no-op for now
39         // return RpcRoutingStrategy::isContextBasedRouted;
40         return (strategy) -> false;
41     }
42 }