2 * Copyright (c) 2015 Brocade Communications 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.utils;
10 import org.opendaylight.controller.cluster.datastore.messages.BatchedModifications;
11 import org.opendaylight.controller.cluster.datastore.modification.DeleteModification;
12 import org.opendaylight.controller.cluster.datastore.modification.MergeModification;
13 import org.opendaylight.controller.cluster.datastore.modification.WriteModification;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
18 * Base class for a DataTreeModificationCursor that publishes to BatchedModifications instance(s).
20 * @author Thomas Pantelis
22 public abstract class AbstractBatchedModificationsCursor extends AbstractDataTreeModificationCursor {
23 protected abstract BatchedModifications getModifications();
26 public void delete(final PathArgument child) {
27 getModifications().addModification(new DeleteModification(next(child)));
31 public void merge(final PathArgument child, final NormalizedNode<?, ?> data) {
32 getModifications().addModification(new MergeModification(next(child), data));
36 public void write(final PathArgument child, final NormalizedNode<?, ?> data) {
37 getModifications().addModification(new WriteModification(next(child), data));