@Override public final QName parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) { return YangConstants.operationInputQName(StmtContextUtils.getRootModuleQName(ctx)); }
@Override public final QName parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) { return YangConstants.operationOutputQName(StmtContextUtils.getRootModuleQName(ctx)); }
<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 = requireNonNull(codec); this.delegate = requireNonNull(delegate); inputQname = YangConstants.operationInputQName(BindingReflections.getQNameModule(type)).intern(); }
private ListenableFuture<RpcResult<?>> transformFuture(final SchemaPath rpc, final ListenableFuture<DOMRpcResult> domFuture, final BindingNormalizedNodeCodecRegistry resultCodec) { return Futures.transform(domFuture, input -> { final NormalizedNode<?, ?> domData = input.getResult(); final DataObject bindingResult; if (domData != null) { final SchemaPath rpcOutput = rpc.createChild(YangConstants.operationOutputQName( rpc.getLastComponent().getModule())); bindingResult = resultCodec.fromNormalizedNodeRpcData(rpcOutput, (ContainerNode) domData); } else { bindingResult = null; } return RpcResultUtil.rpcResultFromDOM(input.getErrors(), bindingResult); }, MoreExecutors.directExecutor()); } }
ActionAdapter(final BindingToNormalizedNodeCodec codec, final DOMActionService delegate, final Class<? extends Action<?, ?, ?>> type) { super(codec, delegate); this.type = requireNonNull(type); this.schemaPath = getCodec().getActionPath(type); this.inputName = NodeIdentifier.create(operationInputQName(schemaPath.getLastComponent().getModule())); }
@Override public <O extends DataObject, P extends InstanceIdentifier<O>, T extends org.opendaylight.yangtools.yang.binding.Action<P, ?, ?>, S extends T> ObjectRegistration<S> registerImplementation(final Class<T> actionInterface, final S implementation, final LogicalDatastoreType datastore, final Set<DataTreeIdentifier<O>> validNodes) { final SchemaPath path = getCodec().getActionPath(actionInterface); final ObjectRegistration<DOMActionImplementation> reg = getDelegate().registerActionImplementation( new Impl(getCodec(), NodeIdentifier.create(YangConstants.operationOutputQName(path.getLastComponent().getModule())), actionInterface, implementation), ImmutableSet.of()); return new AbstractObjectRegistration<S>(implementation) { @Override protected void removeRegistration() { reg.close(); } }; }
/** * Lazily translates supplied Binding action output into NormalizedNode data. * * @param action Binding action class * @param output Binding action output * @return NormalizedNode representation of action output */ @Beta default @NonNull BindingLazyContainerNode<RpcOutput> toLazyNormalizedNodeActionOutput( @NonNull final Class<? extends Action<?, ?, ?>> action, @NonNull final RpcOutput output) { return toLazyNormalizedNodeActionOutput(action, new NodeIdentifier(YangConstants.operationInputQName(BindingReflections.getQNameModule(action))), output); }
/** * Lazily translates supplied Binding action input into NormalizedNode data. * * @param action Binding action class * @param input Binding action input * @return NormalizedNode representation of action input * @throws NullPointerException if any of the arguments is null */ @Beta default @NonNull BindingLazyContainerNode<RpcInput> toLazyNormalizedNodeActionInput( @NonNull final Class<? extends Action<?, ?, ?>> action, @NonNull final RpcInput input) { return toLazyNormalizedNodeActionInput(action, new NodeIdentifier(YangConstants.operationInputQName(BindingReflections.getQNameModule(action))), input); }
/** * Translates supplied Binding action output into NormalizedNode data. * * @param output Binding action output * @return NormalizedNode representation of action output */ @Beta default @NonNull ContainerNode toNormalizedNodeActionOutput( @NonNull final Class<? extends Action<?, ?, ?>> action, @NonNull final RpcOutput output) { return toLazyNormalizedNodeActionOutput(action, new NodeIdentifier(YangConstants.operationInputQName(BindingReflections.getQNameModule(action))), output) .getDelegate(); } }
/** * Translates supplied Binding action input into NormalizedNode data. * * @param action Binding action class * @param input Binding action input * @return NormalizedNode representation of action input * @throws NullPointerException if any of the arguments is null */ @Beta default @NonNull ContainerNode toNormalizedNodeActionInput( @NonNull final Class<? extends Action<?, ?, ?>> action, @NonNull final RpcInput input) { return toLazyNormalizedNodeActionInput(action, new NodeIdentifier(YangConstants.operationInputQName(BindingReflections.getQNameModule(action))), input) .getDelegate(); }