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