Search in sources :

Example 1 with ServiceRegistryWrapper

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();
        }
    }
}
Also used : ModuleConfig(org.opendaylight.controller.config.facade.xml.mapping.config.ModuleConfig) Config(org.opendaylight.controller.config.facade.xml.mapping.config.Config) InstanceConfig(org.opendaylight.controller.config.facade.xml.mapping.config.InstanceConfig) Element(org.w3c.dom.Element) XmlElement(org.opendaylight.controller.config.util.xml.XmlElement) ConfigTransactionClient(org.opendaylight.controller.config.util.ConfigTransactionClient) ServiceRegistryWrapper(org.opendaylight.controller.config.facade.xml.mapping.config.ServiceRegistryWrapper) ObjectName(javax.management.ObjectName)

Aggregations

ObjectName (javax.management.ObjectName)1 Config (org.opendaylight.controller.config.facade.xml.mapping.config.Config)1 InstanceConfig (org.opendaylight.controller.config.facade.xml.mapping.config.InstanceConfig)1 ModuleConfig (org.opendaylight.controller.config.facade.xml.mapping.config.ModuleConfig)1 ServiceRegistryWrapper (org.opendaylight.controller.config.facade.xml.mapping.config.ServiceRegistryWrapper)1 ConfigTransactionClient (org.opendaylight.controller.config.util.ConfigTransactionClient)1 XmlElement (org.opendaylight.controller.config.util.xml.XmlElement)1 Element (org.w3c.dom.Element)1