2 * Copyright (c) 2016 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.mdsal.dom.spi.shard;
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ForwardingObject;
12 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
18 * Delegating implementation of a {@link WriteCursorStrategy}.
20 * @deprecated This interface is scheduled for removal in the next major release.
22 @Deprecated(forRemoval = true)
24 public abstract class DelegatingWriteCursorStrategy extends ForwardingObject implements WriteCursorStrategy {
27 protected abstract DOMDataTreeWriteCursor delegate();
30 * Returns strategy to be used on child nodes. Default implementation is to reuse same instance.
32 * @return Strategy to be used for child nodes.
34 protected DelegatingWriteCursorStrategy childStrategy() {
39 public WriteCursorStrategy enter(final PathArgument arg) {
40 delegate().enter(arg);
41 return childStrategy();
45 public void delete(final PathArgument arg) {
46 delegate().delete(arg);
50 public void merge(final PathArgument arg, final NormalizedNode<?, ?> data) {
51 delegate().merge(arg, data);
55 public void write(final PathArgument arg, final NormalizedNode<?, ?> data) {
56 delegate().write(arg, data);
60 public void mergeToCurrent(final NormalizedNodeContainer<?, ?, ?> data) {
61 for (NormalizedNode<?, ?> child : data.getValue()) {
62 delegate().merge(child.getIdentifier(), child);
67 public void writeToCurrent(final NormalizedNodeContainer<?, ?, ?> data) {
68 for (NormalizedNode<?, ?> child : data.getValue()) {
69 delegate().write(child.getIdentifier(), child);
74 * Operation performed to exit current logical level, default implementation calls
75 * {@link DOMDataTreeWriteCursor#exit()} on underlaying cursor.
78 * Subclasses may override this to customize exit strategy.