use of org.opendaylight.controller.config.facade.xml.mapping.config.ServiceRegistryWrapper in project controller by opendaylight.
the class ConfigSubsystemFacade method getConfiguration.
public Element getConfiguration(final Document document, final Datastore source, final Optional<String> maybeNamespace) {
final ConfigTransactionClient registryClient;
// in case of candidate, get current transaction representing candidate
if (source == Datastore.running) {
final ObjectName readTx = transactionProvider.getOrCreateReadTransaction();
registryClient = configRegistryClient.getConfigTransactionClient(readTx);
} else {
registryClient = configRegistryClient.getConfigTransactionClient(transactionProvider.getOrCreateTransaction());
}
try {
Element dataElement = XmlUtil.createElement(document, XmlMappingConstants.DATA_KEY, Optional.<String>absent());
final Set<ObjectName> instances = Datastore.getInstanceQueryStrategy(source, this.transactionProvider).queryInstances(configRegistryClient);
final Config configMapping = new Config(transformMbeToModuleConfigs(yangStoreService.getModuleMXBeanEntryMap()), yangStoreService.getEnumResolver());
ServiceRegistryWrapper serviceTracker = new ServiceRegistryWrapper(registryClient);
dataElement = configMapping.toXml(instances, maybeNamespace, document, dataElement, serviceTracker);
return dataElement;
} finally {
if (source == Datastore.running) {
transactionProvider.closeReadTransaction();
}
}
}
Aggregations