ddabbc6c030f3f8ef098d207b2b250f737288ddc
[controller.git] / opendaylight / md-sal / sal-dom-spi / src / main / java / org / opendaylight / controller / sal / core / spi / data / DOMStoreWriteTransaction.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.core.spi.data;
9
10 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
11 import org.opendaylight.yangtools.concepts.Path;
12 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14
15 public interface DOMStoreWriteTransaction extends DOMStoreTransaction {
16
17     /**
18      * Store a provided data at specified path. This acts as a add / replace
19      * operation, which is to say that whole subtree will be replaced by
20      * specified path.
21      *
22      * If you need add or merge of current object with specified use
23      * {@link #merge(LogicalDatastoreType, Path, Object)}
24      *
25      *
26      * @param path
27      * @param data
28      *            Data object to be written
29      *
30      * @throws IllegalStateException
31      *             if the client code already sealed transaction and invoked
32      *             {@link #ready()}
33      */
34     void write(InstanceIdentifier path, NormalizedNode<?, ?> data);
35
36     /**
37      * Store a provided data at specified path. This acts as a add / replace
38      * operation, which is to say that whole subtree will be replaced by
39      * specified path.
40      *
41      * If you need add or merge of current object with specified use
42      * {@link #merge(LogicalDatastoreType, Path, Object)}
43      *
44      *
45      * @param path
46      * @param data
47      *            Data object to be written
48      *
49      * @throws IllegalStateException
50      *             if the client code already sealed transaction and invoked
51      *             {@link #ready()}
52      */
53     void merge(InstanceIdentifier path, NormalizedNode<?, ?> data);
54
55     /**
56      *
57      * Deletes data and whole subtree located at provided path.
58      *
59      * @param path
60      *            Path to delete
61      * @throws IllegalStateException
62      *             if the client code already sealed transaction and invoked
63      *             {@link #ready()}
64      */
65     void delete(InstanceIdentifier path);
66
67     /**
68      *
69      * Seals transaction, and returns three-phase commit cohort associated
70      * with this transaction and DOM Store to be coordinated by coordinator.
71      *
72      * @return Three Phase Commit Cohort instance for this transaction.
73      */
74     DOMStoreThreePhaseCommitCohort ready();
75
76 }