+
+ @SuppressWarnings("unchecked")
+ public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerProxyListener(
+ final YangInstanceIdentifier shardLookup,
+ final YangInstanceIdentifier insideShard,
+ final org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener delegate) {
+
+ requireNonNull(shardLookup, "shardLookup should not be null");
+ requireNonNull(insideShard, "insideShard should not be null");
+ requireNonNull(delegate, "delegate should not be null");
+
+ final String shardName = actorUtils.getShardStrategyFactory().getStrategy(shardLookup).findShard(shardLookup);
+ LOG.debug("Registering tree listener: {} for tree: {} shard: {}, path inside shard: {}",
+ delegate,shardLookup, shardName, insideShard);
+
+ final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> listenerRegistrationProxy =
+ new DataTreeChangeListenerProxy<>(actorUtils,
+ // wrap this in the ClusteredDOMDataTreeChangeLister interface
+ // since we always want clustered registration
+ (ClusteredDOMDataTreeChangeListener) delegate::onDataTreeChanged, insideShard);
+ listenerRegistrationProxy.init(shardName);
+
+ return (ListenerRegistration<L>) listenerRegistrationProxy;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerShardConfigListener(
+ final YangInstanceIdentifier internalPath,
+ final DOMDataTreeChangeListener delegate) {
+ requireNonNull(delegate, "delegate should not be null");
+
+ LOG.debug("Registering a listener for the configuration shard: {}", internalPath);
+
+ final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy =
+ new DataTreeChangeListenerProxy<>(actorUtils, delegate, internalPath);
+ proxy.init(ClusterUtils.PREFIX_CONFIG_SHARD_ID);
+
+ return (ListenerRegistration<L>) proxy;
+ }
+