Bug 116 - Revisit SanityTest
[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.Collection;
11 import java.util.List;
12
13 import javax.management.ObjectName;
14
15 import org.opendaylight.controller.config.api.ModuleIdentifier;
16 import org.opendaylight.controller.config.api.ValidationException;
17 import org.opendaylight.controller.config.spi.ModuleFactory;
18 import org.osgi.framework.BundleContext;
19
20 /**
21  * Defines contract between {@link ConfigTransactionControllerImpl} (producer)
22  * and {@link ConfigRegistryImpl} (consumer).
23  */
24 interface ConfigTransactionControllerInternal extends
25         ConfigTransactionControllerImplMXBean {
26
27
28
29     /**
30      * 1, Copy already committed modules to current transaction.
31      * 2, Diff: compute added and removed factories from last run, then create new modules using
32      * {@link org.opendaylight.controller.config.spi.ModuleFactory#getDefaultModules(org.opendaylight.controller.config.api.DependencyResolverFactory)}
33      * and remove modules belonging to removed factories.
34      */
35     void copyExistingModulesAndProcessFactoryDiff(Collection<ModuleInternalInfo> entries, List<ModuleFactory> lastListOfFactories);
36
37     /**
38      * Call {@link org.opendaylight.controller.config.spi.Module#validate()} on
39      * all beans in transaction. Lock transaction after successful validation.
40      * This method can be called multiple times if validation fails, but cannot
41      * be called after it did not throw exception.
42      *
43      * @throws {@link RuntimeException} if validation fails. It is safe to run
44      *         this method in future
45      * @return CommitInfo
46      */
47     CommitInfo validateBeforeCommitAndLockTransaction()
48             throws ValidationException;
49
50     /**
51      * Call {@link org.opendaylight.controller.config.spi.Module#getInstance()}
52      * on all beans in transaction. This method can be only called once.
53      *
54      * @throws {@link RuntimeException} commit fails, indicates bug in config
55      *         bean
56      * @return ordered list of module identifiers that respects dependency
57      *         order.
58      */
59     List<ModuleIdentifier> secondPhaseCommit();
60
61     /**
62      * @return ObjectName of this transaction controller
63      */
64     ObjectName getControllerObjectName();
65
66     /**
67      * @return true iif transaction was committed or aborted.
68      */
69     boolean isClosed();
70
71     List<ModuleFactory> getCurrentlyRegisteredFactories();
72
73     BundleContext getModuleFactoryBundleContext(String factoryName);
74 }