import javax.annotation.Nonnull;
import javax.annotation.concurrent.GuardedBy;
import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient;
-import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
+import org.opendaylight.controller.cluster.datastore.AbstractDataStore;
import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
import org.opendaylight.mdsal.dom.api.DOMDataTreeShard;
private final Map<DOMDataTreeIdentifier, ChildShardContext> childShards = new HashMap<>();
@GuardedBy("this")
private final List<ShardProxyProducer> producers = new ArrayList<>();
- private final DistributedDataStore distributedDataStore;
- DistributedShardFrontend(final DistributedDataStore distributedDataStore,
+ private final DistributedShardChangePublisher publisher;
+
+ DistributedShardFrontend(final AbstractDataStore distributedDataStore,
final DataStoreClient client,
final DOMDataTreeIdentifier shardRoot) {
- this.distributedDataStore = Preconditions.checkNotNull(distributedDataStore);
this.client = Preconditions.checkNotNull(client);
this.shardRoot = Preconditions.checkNotNull(shardRoot);
+
+ publisher = new DistributedShardChangePublisher(client, Preconditions.checkNotNull(distributedDataStore),
+ shardRoot, childShards);
}
@Override
public synchronized DOMDataTreeShardProducer createProducer(final Collection<DOMDataTreeIdentifier> paths) {
for (final DOMDataTreeIdentifier prodPrefix : paths) {
- Preconditions.checkArgument(paths.contains(prodPrefix), "Prefix %s is not contained under shard root",
+ Preconditions.checkArgument(shardRoot.contains(prodPrefix), "Prefix %s is not contained under shard root",
prodPrefix, paths);
}
@Override
public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
final YangInstanceIdentifier treeId, final L listener) {
- throw new UnsupportedOperationException("Listener registration not supported");
+ return publisher.registerTreeChangeListener(treeId, listener);
}
-
}