2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.config.manager.impl;
10 import java.util.Collection;
11 import java.util.List;
13 import javax.management.ObjectName;
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;
22 * Defines contract between {@link ConfigTransactionControllerImpl} (producer)
23 * and {@link ConfigRegistryImpl} (consumer).
25 interface ConfigTransactionControllerInternal extends
26 ConfigTransactionControllerImplMXBean, AutoCloseable {
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.
36 void copyExistingModulesAndProcessFactoryDiff(Collection<ModuleInternalInfo> entries, List<ModuleFactory> lastListOfFactories);
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.
44 * @throws {@link RuntimeException} if validation fails. It is safe to run
45 * this method in future
48 CommitInfo validateBeforeCommitAndLockTransaction()
49 throws ValidationException;
52 * Call {@link org.opendaylight.controller.config.spi.Module#getInstance()}
53 * on all beans in transaction. This method can be only called once.
55 * @throws {@link RuntimeException} commit fails, indicates bug in config
57 * @return ordered list of module identifiers that respects dependency
60 List<ModuleIdentifier> secondPhaseCommit();
63 * @return ObjectName of this transaction controller
65 ObjectName getControllerObjectName();
68 * @return true iif transaction was committed or aborted.
72 List<ModuleFactory> getCurrentlyRegisteredFactories();
74 BundleContext getModuleFactoryBundleContext(String factoryName);
76 ServiceReferenceWritableRegistry getWritableRegistry();
78 TransactionIdentifier getTransactionIdentifier();