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