bb66594ac942ec4700c4f30a3c3b6e2a69fd44a1
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / impl / HashMapDataStoreTransaction.java
1 /*
2  * Copyright (c) 2014 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 package org.opendaylight.controller.sal.dom.broker.impl;
9
10 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
11 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
12 import org.opendaylight.yangtools.yang.common.RpcResult;
13 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
14 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
15
16 public class HashMapDataStoreTransaction implements
17         DataCommitTransaction<InstanceIdentifier, CompositeNode> {
18     private final DataModification<InstanceIdentifier, CompositeNode> modification;
19     private final HashMapDataStore datastore;
20
21     HashMapDataStoreTransaction(
22             final DataModification<InstanceIdentifier, CompositeNode> modify,
23             final HashMapDataStore store) {
24         modification = modify;
25         datastore = store;
26     }
27
28     @Override
29     public RpcResult<Void> finish() throws IllegalStateException {
30         return datastore.finish(this);
31     }
32
33     @Override
34     public DataModification<InstanceIdentifier, CompositeNode> getModification() {
35         return this.modification;
36     }
37
38     @Override
39     public RpcResult<Void> rollback() throws IllegalStateException {
40         return datastore.rollback(this);
41     }
42 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.