public class ConfigTransactionControllerImpl extends Object implements ConfigTransactionControllerImplMXBean, org.opendaylight.yangtools.concepts.Identifiable<TransactionIdentifier>
Constructor and Description |
---|
ConfigTransactionControllerImpl(org.opendaylight.controller.config.manager.impl.ConfigTransactionLookupRegistry txLookupRegistry,
long parentVersion,
BindingContextProvider bindingContextProvider,
long currentVersion,
Map<String,Map.Entry<ModuleFactory,org.osgi.framework.BundleContext>> currentlyRegisteredFactories,
MBeanServer transactionsMBeanServer,
MBeanServer configMBeanServer,
boolean blankTransaction,
SearchableServiceReferenceWritableRegistry writableSRRegistry) |
Modifier and Type | Method and Description |
---|---|
void |
abortConfig()
Destroy current transaction.
|
void |
checkConfigBeanExists(ObjectName objectName)
Check that object name corresponds with existing module.
|
void |
checkServiceReferenceExists(ObjectName objectName) |
void |
close() |
void |
copyExistingModulesAndProcessFactoryDiff(Collection<ModuleInternalInfo> existingModules,
List<ModuleFactory> lastListOfFactories)
1, Copy already committed modules to current transaction.
|
ObjectName |
createModule(String factoryName,
String instanceName)
Create new configuration bean.
|
void |
destroyModule(ObjectName objectName)
Destroy existing module.
|
Set<String> |
getAvailableModuleFactoryQNames()
Get the qNames of all ModuleFactory instances in the system.
|
Set<String> |
getAvailableModuleNames()
Get the names of all available modules.
|
ObjectName |
getControllerObjectName()
Gets the objectName of this transaction controller.
|
List<ModuleFactory> |
getCurrentlyRegisteredFactories() |
TransactionIdentifier |
getIdentifier() |
org.osgi.framework.BundleContext |
getModuleFactoryBundleContext(String factoryName) |
TransactionIdentifier |
getName() |
long |
getParentVersion()
Get version of config registry when this transaction was created.
|
String |
getServiceInterfaceName(String namespace,
String localName)
Get the name of the service interface.
|
Map<String,Map<String,ObjectName>> |
getServiceMapping()
Get mapping of services to reference names and module object names.
|
ObjectName |
getServiceReference(String serviceInterfaceQName,
String refName)
Get the reference to that service.
|
TransactionIdentifier |
getTransactionIdentifier() |
String |
getTransactionName()
Get the name of the transaction.
|
long |
getVersion()
Get version of current transaction.
|
SearchableServiceReferenceWritableRegistry |
getWritableRegistry() |
boolean |
isClosed()
Check if the transaction was committed or aborted.
|
ObjectName |
lookupConfigBean(String moduleName,
String instanceName)
Find read module.
|
ObjectName |
lookupConfigBeanByServiceInterfaceName(String serviceInterfaceQName,
String refName)
Lookup object name by fully qualified service interface name and service
reference name.
|
Set<ObjectName> |
lookupConfigBeans()
Find all modules.
|
Set<ObjectName> |
lookupConfigBeans(String moduleName)
Find modules with given module name.
|
Set<ObjectName> |
lookupConfigBeans(String moduleName,
String instanceName)
Find read modules.
|
Set<ObjectName> |
lookupRuntimeBeans()
Find all runtime beans.
|
Set<ObjectName> |
lookupRuntimeBeans(String moduleName,
String instanceName)
Find all runtime of specified module.
|
Set<String> |
lookupServiceInterfaceNames(ObjectName objectName)
Find all available service interface names of a module.
|
Map<String,ObjectName> |
lookupServiceReferencesByServiceInterfaceName(String serviceInterfaceQName)
Get current mapping between reference names and module object names for given
service interface name.
|
void |
reCreateModule(ObjectName objectName)
Re-creates an existing module configuration bean.
|
void |
removeAllServiceReferences()
Remove all service references.
|
void |
removeServiceReference(String serviceInterfaceName,
String refName)
Remove service reference.
|
boolean |
removeServiceReferences(ObjectName objectName)
Remove all service references attached to given module.
|
ObjectName |
saveServiceReference(String serviceInterfaceName,
String refName,
ObjectName moduleON)
Create or update reference name to objectName.
|
List<ModuleIdentifier> |
secondPhaseCommit()
Call
Module.getInstance() on
all beans in transaction. |
String |
toString() |
CommitInfo |
validateBeforeCommitAndLockTransaction()
If this method passes validation, it will grab
TransactionStatus.secondPhaseCommitStarted lock. |
void |
validateConfig()
This method can be called multiple times, has no side effects.
|
public ConfigTransactionControllerImpl(org.opendaylight.controller.config.manager.impl.ConfigTransactionLookupRegistry txLookupRegistry, long parentVersion, BindingContextProvider bindingContextProvider, long currentVersion, Map<String,Map.Entry<ModuleFactory,org.osgi.framework.BundleContext>> currentlyRegisteredFactories, MBeanServer transactionsMBeanServer, MBeanServer configMBeanServer, boolean blankTransaction, SearchableServiceReferenceWritableRegistry writableSRRegistry)
public void copyExistingModulesAndProcessFactoryDiff(Collection<ModuleInternalInfo> existingModules, List<ModuleFactory> lastListOfFactories)
.ModuleFactory#getDefaultModules(org.opendaylight.controller
.config .api.DependencyResolverFactory, BundleContext)
and remove modules belonging to removed factories.existingModules
- entrieslastListOfFactories
- list of factoriespublic ObjectName createModule(String factoryName, String instanceName) throws InstanceAlreadyExistsException
ConfigTransactionController
createModule
in interface ConfigTransactionController
factoryName
- name of the moduleinstanceName
- name of the instanceInstanceAlreadyExistsException
- if given ifcName and instanceName is already registeredpublic void reCreateModule(ObjectName objectName) throws InstanceNotFoundException
ConfigTransactionController
reCreateModule
in interface ConfigTransactionController
objectName
- can be either read-only module name that can be obtained using
LookupRegistry.lookupConfigBean(String, String)
or
writable module name that must contain current transaction name.InstanceNotFoundException
- if module is not foundpublic void destroyModule(ObjectName objectName) throws InstanceNotFoundException
ConfigTransactionController
destroyModule
in interface ConfigTransactionController
objectName
- can be either read-only module name that can be obtained using
LookupRegistry.lookupConfigBean(String, String)
or
writable module name that must contain current transaction name.InstanceNotFoundException
- if module is not foundpublic long getParentVersion()
ConfigTransactionControllerImplMXBean
getParentVersion
in interface ConfigTransactionControllerImplMXBean
public long getVersion()
ConfigTransactionControllerImplMXBean
getVersion
in interface ConfigTransactionControllerImplMXBean
public void validateConfig() throws ValidationException
ConfigTransactionController
validateConfig
in interface ConfigTransactionController
ValidationException
- if validation failspublic CommitInfo validateBeforeCommitAndLockTransaction() throws ValidationException
TransactionStatus.secondPhaseCommitStarted
lock. This lock will
prevent calling @{link #validateBeforeCommitAndLockTransaction}, effectively
only allowing to call secondPhaseCommit()
after successful return of
this method.ValidationException
public List<ModuleIdentifier> secondPhaseCommit()
Module.getInstance()
on
all beans in transaction. This method can be only called once.public void abortConfig()
ConfigTransactionController
abortConfig
in interface ConfigTransactionController
public void close()
public ObjectName getControllerObjectName()
public String getTransactionName()
ConfigTransactionController
getTransactionName
in interface ConfigTransactionController
public Set<ObjectName> lookupConfigBeans()
lookupConfigBeans
in interface LookupRegistry
public Set<ObjectName> lookupConfigBeans(String moduleName)
lookupConfigBeans
in interface LookupRegistry
moduleName
- name of modulepublic Set<ObjectName> lookupConfigBeans(String moduleName, String instanceName)
lookupConfigBeans
in interface LookupRegistry
moduleName
- exact match for searched module name, can contain '*' to match all
values.instanceName
- exact match for searched instance name, can contain '*' to match
all values.public ObjectName lookupConfigBean(String moduleName, String instanceName) throws InstanceNotFoundException
lookupConfigBean
in interface LookupRegistry
moduleName
- exact match for searched module name, can contain '*' to match all
values.instanceName
- exact match for searched instance name, can contain '*' to match
all values.InstanceNotFoundException
- if search did not find exactly one instancepublic void checkConfigBeanExists(ObjectName objectName) throws InstanceNotFoundException
checkConfigBeanExists
in interface LookupRegistry
InstanceNotFoundException
- if search did not find exactly one instancepublic Set<ObjectName> lookupRuntimeBeans()
lookupRuntimeBeans
in interface LookupRegistry
public Set<ObjectName> lookupRuntimeBeans(String moduleName, String instanceName)
lookupRuntimeBeans
in interface LookupRegistry
moduleName
- of beaninstanceName
- of beanpublic Set<String> getAvailableModuleNames()
getAvailableModuleNames
in interface ConfigTransactionController
ModuleFactory.getImplementationName()
public boolean isClosed()
public TransactionIdentifier getName()
public List<ModuleFactory> getCurrentlyRegisteredFactories()
public TransactionIdentifier getIdentifier()
getIdentifier
in interface org.opendaylight.yangtools.concepts.Identifiable<TransactionIdentifier>
public org.osgi.framework.BundleContext getModuleFactoryBundleContext(String factoryName)
public ObjectName lookupConfigBeanByServiceInterfaceName(String serviceInterfaceQName, String refName)
ServiceReferenceReadableRegistry
lookupConfigBeanByServiceInterfaceName
in interface ServiceReferenceReadableRegistry
serviceInterfaceQName
- service interface namerefName
- service reference name supplied in
.api .ConfigTransactionController#saveServiceReference(String, String, javax.management.ObjectName)
public Map<String,Map<String,ObjectName>> getServiceMapping()
ServiceReferenceReadableRegistry
getServiceMapping
in interface ServiceReferenceReadableRegistry
public Map<String,ObjectName> lookupServiceReferencesByServiceInterfaceName(String serviceInterfaceQName)
ServiceReferenceReadableRegistry
lookupServiceReferencesByServiceInterfaceName
in interface ServiceReferenceReadableRegistry
serviceInterfaceQName
- service interface namepublic Set<String> lookupServiceInterfaceNames(ObjectName objectName) throws InstanceNotFoundException
ServiceReferenceReadableRegistry
lookupServiceInterfaceNames
in interface ServiceReferenceReadableRegistry
objectName
- module object nameInstanceNotFoundException
- if search did not find exactly one instancepublic String getServiceInterfaceName(String namespace, String localName)
ServiceReferenceReadableRegistry
getServiceInterfaceName
in interface ServiceReferenceReadableRegistry
namespace
- service interface namespacelocalName
- service interface local namepublic ObjectName saveServiceReference(String serviceInterfaceName, String refName, ObjectName moduleON) throws InstanceNotFoundException
ServiceReferenceWritableRegistry
saveServiceReference
in interface ServiceReferenceWritableRegistry
InstanceNotFoundException
- if search did not find exactly one instancepublic void removeServiceReference(String serviceInterfaceName, String refName) throws InstanceNotFoundException
ServiceReferenceWritableRegistry
removeServiceReference
in interface ServiceReferenceWritableRegistry
InstanceNotFoundException
public void removeAllServiceReferences()
ServiceReferenceWritableRegistry
removeAllServiceReferences
in interface ServiceReferenceWritableRegistry
public boolean removeServiceReferences(ObjectName objectName) throws InstanceNotFoundException
ServiceReferenceWritableRegistry
removeServiceReferences
in interface ServiceReferenceWritableRegistry
InstanceNotFoundException
public SearchableServiceReferenceWritableRegistry getWritableRegistry()
public TransactionIdentifier getTransactionIdentifier()
public Set<String> getAvailableModuleFactoryQNames()
LookupRegistry
getAvailableModuleFactoryQNames
in interface LookupRegistry
public void checkServiceReferenceExists(ObjectName objectName) throws InstanceNotFoundException
checkServiceReferenceExists
in interface ServiceReferenceReadableRegistry
InstanceNotFoundException
public ObjectName getServiceReference(String serviceInterfaceQName, String refName) throws InstanceNotFoundException
ServiceReferenceReadableRegistry
getServiceReference
in interface ServiceReferenceReadableRegistry
.config .api.ServiceReferenceWritableRegistry#saveServiceReference(String,
String, javax.management.ObjectName)
InstanceNotFoundException
Copyright © 2019 OpenDaylight. All rights reserved.