Initial code drop of yang model driven configuration system
[controller.git] / opendaylight / config / config-manager / src / main / java / org / opendaylight / controller / config / manager / impl / ConfigTransactionControllerInternal.java
1 /*
2  * Copyright (c) 2013 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.config.manager.impl;
9
10 import java.util.List;
11
12 import javax.management.InstanceAlreadyExistsException;
13 import javax.management.ObjectName;
14
15 import org.opendaylight.controller.config.api.ModuleIdentifier;
16 import org.opendaylight.controller.config.api.ValidationException;
17
18 /**
19  * Defines contract between {@link ConfigTransactionControllerImpl} (producer)
20  * and {@link ConfigRegistryImpl} (consumer).
21  */
22 interface ConfigTransactionControllerInternal extends
23         ConfigTransactionControllerImplMXBean {
24
25     /**
26      * Copy already committed module to current transaction.
27      */
28     void copyExistingModule(ModuleInternalInfo oldConfigBeanInfo)
29             throws InstanceAlreadyExistsException;
30
31     /**
32      * Call {@link org.opendaylight.controller.config.spi.Module#validate()} on
33      * all beans in transaction. Lock transaction after successful validation.
34      * This method can be called multiple times if validation fails, but cannot
35      * be called after it did not throw exception.
36      *
37      * @throws {@link RuntimeException} if validation fails. It is safe to run
38      *         this method in future
39      * @return CommitInfo
40      */
41     CommitInfo validateBeforeCommitAndLockTransaction()
42             throws ValidationException;
43
44     /**
45      * Call {@link org.opendaylight.controller.config.spi.Module#getInstance()}
46      * on all beans in transaction. This method can be only called once.
47      *
48      * @throws {@link RuntimeException} commit fails, indicates bug in config
49      *         bean
50      * @return ordered list of module identifiers that respects dependency
51      *         order.
52      */
53     List<ModuleIdentifier> secondPhaseCommit();
54
55     /**
56      * @return ObjectName of this transaction controller
57      */
58     ObjectName getControllerObjectName();
59
60     /**
61      * @return true iif transaction was committed or aborted.
62      */
63     boolean isClosed();
64
65 }