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.store.inmemory;
10 import com.google.common.annotations.VisibleForTesting;
11 import com.google.common.base.Preconditions;
12 import com.google.common.collect.ImmutableMap;
14 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
16 import org.opendaylight.yangtools.yang.data.api.schema.tree.CursorAwareDataTreeSnapshot;
18 final class ShardDataModificationFactory {
19 private final Map<DOMDataTreeIdentifier, ForeignShardModificationContext> childShards;
20 private final Map<PathArgument, WriteableModificationNode> children;
21 private final DOMDataTreeIdentifier root;
23 ShardDataModificationFactory(final DOMDataTreeIdentifier root,
24 final Map<PathArgument, WriteableModificationNode> children,
25 final Map<DOMDataTreeIdentifier, ForeignShardModificationContext> childShards) {
26 this.root = Preconditions.checkNotNull(root);
27 this.children = ImmutableMap.copyOf(children);
28 this.childShards = ImmutableMap.copyOf(childShards);
32 Map<PathArgument, WriteableModificationNode> getChildren() {
37 Map<DOMDataTreeIdentifier, ForeignShardModificationContext> getChildShards() {
41 ShardDataModification createModification(final CursorAwareDataTreeSnapshot snapshot) {
42 return new ShardDataModification(new ShardRootModificationContext(root, snapshot), children, childShards);