2 * Copyright (c) 2017 Pantheon Technologies, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.access.commands;
10 import akka.actor.ActorRef;
11 import java.io.IOException;
12 import java.io.ObjectInput;
13 import java.io.ObjectOutput;
14 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
15 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeDataOutput;
16 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeInputOutput;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
20 * Abstract base class for serialization proxies associated with {@link AbstractReadTransactionRequest}s. It implements
21 * the initial (Boron) serialization format.
23 * @author Robert Varga
25 * @param <T> Message type
27 abstract class AbstractReadPathTransactionRequestProxyV1<T extends AbstractReadPathTransactionRequest<T>>
28 extends AbstractReadTransactionRequestProxyV1<T> {
29 private static final long serialVersionUID = 1L;
30 private YangInstanceIdentifier path;
32 protected AbstractReadPathTransactionRequestProxyV1() {
36 AbstractReadPathTransactionRequestProxyV1(final T request) {
38 path = request.getPath();
42 public final void writeExternal(final ObjectOutput out) throws IOException {
43 super.writeExternal(out);
44 try (NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(out)) {
45 nnout.writeYangInstanceIdentifier(path);
50 public final void readExternal(final ObjectInput in) throws ClassNotFoundException, IOException {
51 super.readExternal(in);
52 path = NormalizedNodeInputOutput.newDataInput(in).readYangInstanceIdentifier();
56 protected final T createReadRequest(final TransactionIdentifier target, final long sequence,
57 final ActorRef replyTo, final boolean snapshotOnly) {
58 return createReadPathRequest(target, sequence, replyTo, path, snapshotOnly);
61 abstract T createReadPathRequest(TransactionIdentifier target, long sequence, ActorRef replyTo,
62 YangInstanceIdentifier requestPath, boolean snapshotOnly);