37ccf60dbd7b171d0d4e74b7dc59122fe5cf1960
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / sharding / DistributedShardModificationCursor.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.controller.cluster.sharding;
10
11 import org.opendaylight.mdsal.dom.spi.shard.AbstractDataModificationCursor;
12 import org.opendaylight.mdsal.dom.spi.shard.WriteCursorStrategy;
13
14 /**
15  * Internal cursor implementation consisting of WriteCursorStrategies which forwards writes to foreign modifications
16  * if any.
17  */
18 public class DistributedShardModificationCursor extends AbstractDataModificationCursor<DistributedShardModification> {
19
20     private ShardProxyTransaction parent;
21
22     public DistributedShardModificationCursor(final DistributedShardModification root,
23                                               final ShardProxyTransaction parent) {
24         super(root);
25         this.parent = parent;
26     }
27
28     @Override
29     protected WriteCursorStrategy getRootOperation(final DistributedShardModification root) {
30         return root.createOperation(null);
31     }
32
33     @Override
34     public void close() {
35         parent.cursorClosed();
36     }
37 }