Refactor DOM{Action,Rpc}Implementation
[mdsal.git] / dom / mdsal-dom-api / src / main / java / org / opendaylight / mdsal / dom / api / DOMActionService.java
1 /*
2  * Copyright (c) 2018 Pantheon Technologies, s.r.o. 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.mdsal.dom.api;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
12 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
13 import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNode;
14 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
15
16 /**
17  * A {@link DOMService} which allows clients to invoke Actions. The conceptual model of this service is that
18  * of a dynamic router, where the set of available Action services can change dynamically.
19  */
20 @NonNullByDefault
21 public interface DOMActionService extends DOMService<DOMActionService, DOMActionService.Extension> {
22     /**
23      * Marker interface for extensions of {@link DOMActionService}.
24      */
25     interface Extension extends DOMService.Extension<DOMActionService, Extension> {
26         // Marker interface
27     }
28
29     /**
30      * Initiate invocation of an Action. This method is guaranteed to not block on any external resources.
31      *
32      * @param type Absolute schema node identifier of the action to be invoked. This path refers to an effective action
33      *             instantiated on top of the conceptual {@link StoreTreeNode}.
34      * @param path {@link DOMDataTreeIdentifier} of parent data node which action attached to.
35      * @param input Input argument
36      * @return A {@link ListenableFuture} which completes with the result of invocation
37      * @throws NullPointerException if any of the arguments is null
38      * @throws IllegalArgumentException if {@code path} is empty
39      */
40     ListenableFuture<? extends DOMRpcResult> invokeAction(Absolute type, DOMDataTreeIdentifier path,
41             ContainerNode input);
42 }