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.base.Preconditions;
12 import com.google.common.collect.ImmutableMap;
14 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
18 * Writable node that is located at a boundary to a subshard.
21 public class WriteableSubshardBoundaryNode extends WriteableModificationNode {
23 private final ForeignShardModificationContext boundary;
25 WriteableSubshardBoundaryNode(final ForeignShardModificationContext boundary) {
26 this.boundary = Preconditions.checkNotNull(boundary);
29 public static WriteableSubshardBoundaryNode from(final ForeignShardModificationContext value) {
30 return new WriteableSubshardBoundaryNode(value);
34 public PathArgument getIdentifier() {
35 return boundary.getIdentifier().getRootIdentifier().getLastPathArgument();
39 public WriteCursorStrategy createOperation(final DOMDataTreeWriteCursor parentCursor) {
40 return new DelegatingWriteCursorStrategy() {
47 protected DelegatingWriteCursorStrategy childStrategy() {
48 return new DelegatingWriteCursorStrategy() {
50 protected DOMDataTreeWriteCursor delegate() {
51 return boundary.getCursor();
57 protected DOMDataTreeWriteCursor delegate() {
58 return boundary.getCursor();
64 public WriteableModificationNode getChild(final PathArgument node) {
65 // Another level of nesting should be taken care of by underlying cursor.
70 public void markDeleted() {
71 // FIXME: Should we delete all data or disconnect?
75 public Map<PathArgument, WriteableModificationNode> getChildrenWithSubshards() {
76 return ImmutableMap.of();