0b898ede3c1ed656d014476032156eb1e25cef90
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ShardDataChangeListenerPublisherActorProxy.java
1 /*
2  * Copyright (c) 2016 Brocade Communications 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.ActorContext;
11 import javax.annotation.concurrent.NotThreadSafe;
12 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
13 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
14 import org.opendaylight.controller.md.sal.dom.store.impl.DataChangeListenerRegistration;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17
18 /**
19  * Implementation of ShardDataChangeListenerPublisher that offloads the generation and publication
20  * of data change notifications to an actor.
21  *
22  * @author Thomas Pantelis
23  */
24 @NotThreadSafe
25 class ShardDataChangeListenerPublisherActorProxy extends AbstractShardDataTreeNotificationPublisherActorProxy
26         implements ShardDataChangeListenerPublisher {
27
28     private final ShardDataChangeListenerPublisher delegatePublisher = new DefaultShardDataChangeListenerPublisher();
29
30     ShardDataChangeListenerPublisherActorProxy(ActorContext actorContext, String actorName) {
31         super(actorContext, actorName);
32     }
33
34     private ShardDataChangeListenerPublisherActorProxy(ShardDataChangeListenerPublisherActorProxy other) {
35         super(other);
36     }
37
38     @Override
39     public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> DataChangeListenerRegistration<L> registerDataChangeListener(
40             YangInstanceIdentifier path, L listener, DataChangeScope scope) {
41         return delegatePublisher.registerDataChangeListener(path, listener, scope);
42     }
43
44     @Override
45     public ShardDataChangeListenerPublisher newInstance() {
46         return new ShardDataChangeListenerPublisherActorProxy(this);
47     }
48
49     @Override
50     protected ShardDataTreeNotificationPublisher getDelegatePublisher() {
51         return delegatePublisher;
52     }
53 }

©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.