2 * Copyright (c) 2014 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
9 package org.opendaylight.controller.cluster.datastore;
11 import akka.actor.ActorRef;
12 import akka.actor.ActorSelection;
13 import com.google.common.base.Preconditions;
14 import org.opendaylight.controller.cluster.datastore.messages.DataChanged;
15 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
16 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
18 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
19 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
22 * DataChangeListenerProxy represents a single remote DataChangeListener
24 public class DataChangeListenerProxy implements AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>{
25 private final ActorSelection dataChangeListenerActor;
26 private final SchemaContext schemaContext;
28 public DataChangeListenerProxy(SchemaContext schemaContext, ActorSelection dataChangeListenerActor) {
29 this.dataChangeListenerActor = Preconditions.checkNotNull(dataChangeListenerActor, "dataChangeListenerActor should not be null");
30 this.schemaContext = schemaContext;
33 @Override public void onDataChanged(
34 AsyncDataChangeEvent<YangInstanceIdentifier, NormalizedNode<?, ?>> change) {
35 dataChangeListenerActor.tell(new DataChanged(schemaContext, change), ActorRef.noSender());