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
9 package org.opendaylight.netconf.topology.singleton.impl.actors;
11 import akka.actor.Props;
12 import akka.actor.UntypedActor;
13 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
14 import org.opendaylight.netconf.topology.singleton.messages.transactions.ReadActorMessage;
17 * ReadTransactionActor is an interface to device's {@link DOMDataReadOnlyTransaction} for cluster nodes.
19 public class ReadTransactionActor extends UntypedActor {
21 private final ReadAdapter readAdapter;
23 private ReadTransactionActor(final DOMDataReadOnlyTransaction tx) {
24 readAdapter = new ReadAdapter(tx);
28 * Creates new actor Props.
30 * @param tx delegate device read transaction
33 static Props props(final DOMDataReadOnlyTransaction tx) {
34 return Props.create(ReadTransactionActor.class, () -> new ReadTransactionActor(tx));
38 public void onReceive(final Object message) throws Throwable {
39 if (message instanceof ReadActorMessage) {
40 readAdapter.handle(message, sender(), self());