2 * Copyright (c) 2015 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
8 package org.opendaylight.controller.cluster.datastore;
10 import java.util.Collection;
11 import java.util.Collections;
12 import javax.annotation.concurrent.NotThreadSafe;
13 import org.opendaylight.controller.md.sal.dom.spi.AbstractDOMDataTreeChangeListenerRegistration;
14 import org.opendaylight.controller.sal.core.spi.data.AbstractDOMStoreTreeChangePublisher;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
17 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
18 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
23 final class ShardDataTreeChangePublisher extends AbstractDOMStoreTreeChangePublisher {
24 private static final Logger LOG = LoggerFactory.getLogger(ShardDataTreeChangePublisher.class);
26 void publishChanges(final DataTreeCandidate candidate) {
27 processCandidateTree(candidate);
31 protected void notifyListeners(final Collection<AbstractDOMDataTreeChangeListenerRegistration<?>> registrations,
32 final YangInstanceIdentifier path, final DataTreeCandidateNode node) {
33 final Collection<DataTreeCandidate> changes = Collections.<DataTreeCandidate>singleton(
34 DataTreeCandidates.newDataTreeCandidate(path, node));
36 for (AbstractDOMDataTreeChangeListenerRegistration<?> reg : registrations) {
37 reg.getInstance().onDataTreeChanged(changes);
42 protected void registrationRemoved(final AbstractDOMDataTreeChangeListenerRegistration<?> registration) {
43 LOG.debug("Registration {} removed", registration);