Merge branch 'mdsal-trace' from controller
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / main / java / org / opendaylight / mdsal / dom / store / inmemory / InMemoryShardDataModificationCursor.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.mdsal.dom.store.inmemory;
10
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.mdsal.dom.spi.shard.AbstractDataModificationCursor;
13 import org.opendaylight.mdsal.dom.spi.shard.WriteCursorStrategy;
14
15 class InMemoryShardDataModificationCursor extends AbstractDataModificationCursor<ShardDataModification> {
16
17     private InmemoryDOMDataTreeShardWriteTransaction parent;
18
19     InMemoryShardDataModificationCursor(final ShardDataModification root,
20                                         final InmemoryDOMDataTreeShardWriteTransaction parent) {
21         super(root);
22         this.parent = Preconditions.checkNotNull(parent);
23     }
24
25     @Override
26     protected WriteCursorStrategy getRootOperation(final ShardDataModification root) {
27         return root.createOperation(null);
28     }
29
30     @Override
31     public void close() {
32         parent.cursorClosed();
33     }
34
35 }