Add Action and RpcOutput interfaces
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 18 Jun 2018 20:21:56 +0000 (22:21 +0200)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 19 Jun 2024 00:41:23 +0000 (10:41 +1000)
This patch adds the binding interface prototype for actions.
Codegen will attach to specializations of this interface for
concrete generated types.

JIRA: MDSAL-300
Change-Id: I2fc97df50033b0d2d8f96b8281a82999a6b62869
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Action.java [new file with mode: 0644]
binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/RpcInput.java
binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/RpcOutput.java [new file with mode: 0644]

diff --git a/binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Action.java b/binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/Action.java
new file mode 100644 (file)
index 0000000..861101d
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2018 Pantheon Technologies, s.r.o. 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.yangtools.yang.binding;
+
+import com.google.common.annotations.Beta;
+import com.google.common.util.concurrent.FluentFuture;
+import javax.annotation.CheckReturnValue;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+/**
+ * Interface extended by all interfaces generated for a YANG {@code action}.
+ *
+ * @author Robert Varga
+ */
+@Beta
+@FunctionalInterface
+@NonNullByDefault
+public interface Action<P extends DataObject, I extends RpcInput, O extends RpcOutput> {
+    /**
+     * Invoke the action.
+     *
+     * @param path Invocation path
+     * @param input Input argument
+     * @return Future result of invocation
+     * @throws NullPointerException if any of the arguments are null
+     */
+    @CheckReturnValue
+    FluentFuture<RpcResult<O>> invoke(InstanceIdentifier<P> path, I input);
+}
index 11b95bdea51492e298b2e5d688223529c879592f..a79663d53f32efe1ce6aac5f4901536295042f5b 100644 (file)
@@ -7,6 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.binding;
 
+/**
+ * Marker interface for all interfaces generated for {@code input} statement within an {@code action} or an {@code rpc}
+ * statement.
+ */
 public interface RpcInput extends DataContainer {
 
 }
diff --git a/binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/RpcOutput.java b/binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/RpcOutput.java
new file mode 100644 (file)
index 0000000..502807e
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2018 Pantheon Technologies, s.r.o. 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.yangtools.yang.binding;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * Marker interface for all interfaces generated for {@code output} statement within an {@code action} or an {@code rpc}
+ * statement.
+ *
+ * @author Robert Varga
+ */
+@Beta
+public interface RpcOutput extends DataContainer {
+
+}