-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-
-public class BindingDOMRpcImplementationAdapter implements DOMRpcImplementation {
-
- private static final Cache<Class<?>, RpcServiceInvoker> SERVICE_INVOKERS
- = CacheBuilder.newBuilder().weakKeys().build();
-
- private final BindingNormalizedNodeCodecRegistry codec;
- private final RpcServiceInvoker invoker;
- private final RpcService delegate;
- private final QName inputQname;
-
- public <T extends RpcService> BindingDOMRpcImplementationAdapter(final BindingNormalizedNodeCodecRegistry codec,
- final Class<T> type, final Map<SchemaPath, Method> localNameToMethod, final T delegate) {
- try {
- this.invoker = SERVICE_INVOKERS.get(type, () -> {
- final Map<QName, Method> map = new HashMap<>();
- for (Entry<SchemaPath, Method> e : localNameToMethod.entrySet()) {
- map.put(e.getKey().getLastComponent(), e.getValue());
- }
-
- return RpcServiceInvoker.from(map);
- });
- } catch (ExecutionException e) {
- throw new IllegalArgumentException("Failed to create invokers for type " + type, e);
- }
-
- this.codec = Preconditions.checkNotNull(codec);
- this.delegate = Preconditions.checkNotNull(delegate);
- inputQname = QName.create(BindingReflections.getQNameModule(type), "input").intern();
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
+
+final class BindingDOMRpcImplementationAdapter extends AbstractDOMRpcImplementationAdapter {
+ private final @NonNull Rpc<?, ?> delegate;
+ private final @NonNull QName rpcName;
+ private final @NonNull QName inputName;
+
+ BindingDOMRpcImplementationAdapter(final AdapterContext adapterContext, final Rpc<?, ?> delegate,
+ final QName rpcName) {
+ super(adapterContext);
+ this.delegate = requireNonNull(delegate);
+ this.rpcName = requireNonNull(rpcName);
+ inputName = YangConstants.operationInputQName(rpcName.getModule()).intern();