2 * Copyright (c) 2016 Cisco Systems, Inc. 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 com.google.common.annotations.Beta;
12 import com.google.common.base.MoreObjects.ToStringHelper;
13 import com.google.common.base.Preconditions;
14 import javax.annotation.Nonnull;
15 import org.opendaylight.controller.cluster.access.ABIVersion;
16 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
20 * Abstract base class for {@link TransactionRequest}s accessing data as visible in the isolated context of a particular
21 * transaction. The path of the data being accessed is returned via {@link #getPath()}.
23 * This class is visible outside of this package for the purpose of allowing common instanceof checks
24 * and simplified codepaths.
26 * @author Robert Varga
28 * @param <T> Message type
31 public abstract class AbstractReadTransactionRequest<T extends AbstractReadTransactionRequest<T>> extends TransactionRequest<T> {
32 private static final long serialVersionUID = 1L;
33 private final YangInstanceIdentifier path;
35 AbstractReadTransactionRequest(final TransactionIdentifier identifier, final ActorRef replyTo,
36 final YangInstanceIdentifier path) {
37 super(identifier, replyTo);
38 this.path = Preconditions.checkNotNull(path);
41 AbstractReadTransactionRequest(final T request, final ABIVersion version) {
42 super(request, version);
43 this.path = request.getPath();
46 public final @Nonnull YangInstanceIdentifier getPath() {
51 protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
52 return super.addToStringAttributes(toStringHelper).add("path", path);
56 protected abstract AbstractReadTransactionRequestProxyV1<T> externalizableProxy(final ABIVersion version);