Fix warnings/javadocs in sal-distributed-datastore
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ForwardingDataTreeChangeListener.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.datastore;
9
10 import akka.actor.ActorRef;
11 import akka.actor.ActorSelection;
12 import com.google.common.base.Preconditions;
13 import java.util.Collection;
14 import org.opendaylight.controller.cluster.datastore.messages.DataTreeChanged;
15 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
16 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
17
18 /**
19  * Internal implementation of a {@link DOMDataTreeChangeListener} which
20  * encapsulates received notifications into a {@link DataTreeChanged}
21  * message and forwards them towards the client's {@link DataTreeChangeListenerActor}.
22  */
23 final class ForwardingDataTreeChangeListener implements DOMDataTreeChangeListener {
24     private final ActorSelection actor;
25
26     ForwardingDataTreeChangeListener(final ActorSelection actor) {
27         this.actor = Preconditions.checkNotNull(actor, "actor should not be null");
28     }
29
30     @Override
31     public void onDataTreeChanged(Collection<DataTreeCandidate> changes) {
32         actor.tell(new DataTreeChanged(changes), ActorRef.noSender());
33     }
34 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.