BUG-509: Move DataTree concepts into separate package
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / md / sal / dom / store / impl / tree / DataTree.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.md.sal.dom.store.impl.tree;
9
10 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
11
12 /**
13  * Interface representing a data tree which can be modified in an MVCC fashion.
14  */
15 public interface DataTree {
16         /**
17          * Take a read-only point-in-time snapshot of the tree.
18          *
19          * @return Data tree snapshot.
20          */
21         DataTreeSnapshot takeSnapshot();
22
23         /**
24          * Make the data tree use a new schema context. The context will be used
25          * only by subsequent operations.
26          *
27          * @param newSchemaContext new SchemaContext
28          * @throws IllegalArgumentException if the new context is incompatible
29          */
30     void setSchemaContext(SchemaContext newSchemaContext);
31
32     /**
33      * Validate whether a particular modification can be applied to the data tree.
34      */
35     void validate(DataTreeModification modification) throws DataPreconditionFailedException;
36
37     /**
38      * Prepare a modification for commit.
39      *
40      * @param modification
41      * @return candidate data tree
42      */
43     DataTreeCandidate prepare(DataTreeModification modification);
44
45     /**
46      * Commit a data tree candidate.
47      *
48      * @param candidate data tree candidate
49      */
50     void commit(DataTreeCandidate candidate);
51 }