Binding2 runtime - API #5 21/58321/4
authorMartin Ciglan <martin.ciglan@pantheon.tech>
Tue, 23 May 2017 09:15:50 +0000 (11:15 +0200)
committerMartin Ciglan <martin.ciglan@pantheon.tech>
Tue, 6 Jun 2017 17:15:50 +0000 (17:15 +0000)
- Rpc, Action, ListAction API support
- Javadocs provided

Change-Id: I8250bf00579c5743be50d3fcf8296fddb3be1d69
Signed-off-by: Martin Ciglan <martin.ciglan@pantheon.tech>
(cherry picked from commit b7a4eb412bac92b57eb4fe15d441976369330030)

binding2/mdsal-binding2-api/src/main/java/org/opendaylight/mdsal/binding/javav2/api/RpcActionConsumerRegistry.java [new file with mode: 0644]
binding2/mdsal-binding2-api/src/main/java/org/opendaylight/mdsal/binding/javav2/api/RpcActionProviderService.java [new file with mode: 0644]

diff --git a/binding2/mdsal-binding2-api/src/main/java/org/opendaylight/mdsal/binding/javav2/api/RpcActionConsumerRegistry.java b/binding2/mdsal-binding2-api/src/main/java/org/opendaylight/mdsal/binding/javav2/api/RpcActionConsumerRegistry.java
new file mode 100644 (file)
index 0000000..8da31d3
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2017 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.mdsal.binding.javav2.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.mdsal.binding.javav2.spec.base.Action;
+import org.opendaylight.mdsal.binding.javav2.spec.base.ListAction;
+import org.opendaylight.mdsal.binding.javav2.spec.base.Rpc;
+
+/**
+ * Provides access to registered Remote Procedure Call (RPC) and Action service implementations.
+ * RPCs and Actions are defined in YANG models.
+ *
+ * <p>
+ * RPC/Action implementations are registered using the {@link RpcActionProviderService}.
+ */
+@Beta
+public interface RpcActionConsumerRegistry extends BindingService {
+
+    /**
+     * Returns an implementation of a requested RPC service.
+     *
+     * <p>
+     * The returned instance is not an actual implementation of the RPC service interface, but a
+     * proxy implementation of the interface that forwards to an actual implementation, if any.
+     *
+     * @param serviceInterface given service interface
+     * @param <T> interface type
+     * @return returns proxy for the requested RPC
+     */
+    <T extends Rpc> T getRpcService(Class<T> serviceInterface);
+
+    /**
+     * Returns an implementation of a requested Action service.
+     *
+     * <p>
+     * The returned instance is not an actual implementation of the Action service interface, but a
+     * proxy implementation of the interface that forwards to an actual implementation, if any.
+     *
+     * @param serviceInterface given service interface
+     * @param <T> interface type
+     * @return returns proxy for the requested Action
+     */
+    <T extends Action> T getActionService(Class<T> serviceInterface);
+
+    /**
+     * Returns an implementation of a requested ListAction service.
+     *
+     * <p>
+     * The returned instance is not an actual implementation of the ListAction service interface, but a
+     * proxy implementation of the interface that forwards to an actual implementation, if any.
+     *
+     * @param serviceInterface given service interface
+     * @param <T> interface type
+     * @return returns proxy for the requested ListAction
+     */
+    <T extends ListAction> T getListActionService(Class<T> serviceInterface);
+
+}
diff --git a/binding2/mdsal-binding2-api/src/main/java/org/opendaylight/mdsal/binding/javav2/api/RpcActionProviderService.java b/binding2/mdsal-binding2-api/src/main/java/org/opendaylight/mdsal/binding/javav2/api/RpcActionProviderService.java
new file mode 100644 (file)
index 0000000..0db2632
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2017 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.mdsal.binding.javav2.api;
+
+import com.google.common.annotations.Beta;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.javav2.spec.base.Action;
+import org.opendaylight.mdsal.binding.javav2.spec.base.InstanceIdentifier;
+import org.opendaylight.mdsal.binding.javav2.spec.base.KeyedInstanceIdentifier;
+import org.opendaylight.mdsal.binding.javav2.spec.base.ListAction;
+import org.opendaylight.mdsal.binding.javav2.spec.base.Rpc;
+import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
+
+/**
+ * Provides ability to register Remote Procedure Call (RPC) and Action service implementations.
+ * The RPCs and Actions are defined in YANG models.
+ */
+@Beta
+public interface RpcActionProviderService {
+
+    /**
+     * Returns class representing registration of global RPC.
+     * @param type RPC binding generated interface
+     * @param implementation RPC binding implementation
+     * @param <S> service class type
+     * @param <T> service implementation type
+     * @return returns class representing a RPC registration
+     */
+    <S extends Rpc, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
+        T implementation);
+
+    /**
+     * Returns class representing registration of global RPC for supported paths.
+     * @param type RPC binding generated interface
+     * @param implementation RPC binding implementation
+     * @param paths set of supported paths
+     * @param <S> service class type
+     * @param <T> service implementation type
+     * @return returns class representing a RPC registration
+     */
+    <S extends Rpc, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
+        T implementation, Set<InstanceIdentifier<?>> paths);
+
+    /**
+     * Returns class representing registration of Action.
+     * @param type Action binding generated interface
+     * @param parent parent node for Action connected to
+     * @param implementation Action binding implementation
+     * @param <S> service class type
+     * @param <P> parent type
+     * @param <T> service implementation type
+     * @return returns class representing a Action registration
+     */
+    <S extends Action, T extends S, P extends TreeNode> ObjectRegistration<T> registerActionImplementation(
+        Class<S> type, InstanceIdentifier<P> parent, T implementation);
+
+    /**
+     * Returns class representing registration of ListAction.
+     * @param type ListAction binding generated interface
+     * @param parent parent node for ListAction connected to
+     * @param implementation ListAction binding implementation
+     * @param <S> service class type
+     * @param <P> parent type
+     * @param <K> key type
+     * @param <T> service implementation type
+     * @return returns class representing a ListAction registration
+     */
+    <S extends ListAction, T extends S, P extends TreeNode, K> ObjectRegistration<T> registerListActionImplementation(
+            Class<S> type, KeyedInstanceIdentifier<P, K> parent, T implementation);
+}