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