Search in sources :

Example 1 with InstanceConfig

use of org.opendaylight.controller.config.facade.xml.mapping.config.InstanceConfig in project controller by opendaylight.

the class ConfigSubsystemFacade method transformMbeToModuleConfigs.

public Map<String, /* Namespace from yang file */
Map<String, /* Name of module entry from yang file */
ModuleConfig>> transformMbeToModuleConfigs(final BeanReader reader, final Map<String, /* Namespace from yang file */
Map<String, /* Name of module entry from yang file */
ModuleMXBeanEntry>> mbeanentries) {
    Map<String, Map<String, ModuleConfig>> namespaceToModuleNameToModuleConfig = new HashMap<>();
    for (Map.Entry<String, Map<String, ModuleMXBeanEntry>> namespaceToModuleToMbe : mbeanentries.entrySet()) {
        for (Map.Entry<String, ModuleMXBeanEntry> moduleNameToMbe : namespaceToModuleToMbe.getValue().entrySet()) {
            String moduleName = moduleNameToMbe.getKey();
            ModuleMXBeanEntry moduleMXBeanEntry = moduleNameToMbe.getValue();
            ModuleConfig moduleConfig = new ModuleConfig(moduleName, new InstanceConfig(reader, moduleMXBeanEntry.getAttributes(), moduleMXBeanEntry.getNullableDummyContainerName()));
            Map<String, ModuleConfig> moduleNameToModuleConfig = namespaceToModuleNameToModuleConfig.computeIfAbsent(namespaceToModuleToMbe.getKey(), k -> new HashMap<>());
            moduleNameToModuleConfig.put(moduleName, moduleConfig);
        }
    }
    return namespaceToModuleNameToModuleConfig;
}
Also used : InstanceConfig(org.opendaylight.controller.config.facade.xml.mapping.config.InstanceConfig) HashMap(java.util.HashMap) ModuleMXBeanEntry(org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry) ModuleConfig(org.opendaylight.controller.config.facade.xml.mapping.config.ModuleConfig) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with InstanceConfig

use of org.opendaylight.controller.config.facade.xml.mapping.config.InstanceConfig in project controller by opendaylight.

the class ConfigSubsystemFacade method createModuleRuntimes.

private Map<String, Map<String, ModuleRuntime>> createModuleRuntimes(final ConfigRegistryClient client, final Map<String, Map<String, ModuleMXBeanEntry>> mbeanentries) {
    Map<String, Map<String, ModuleRuntime>> retVal = new HashMap<>();
    for (Map.Entry<String, Map<String, ModuleMXBeanEntry>> namespaceToModuleEntry : mbeanentries.entrySet()) {
        Map<String, ModuleRuntime> innerMap = new HashMap<>();
        Map<String, ModuleMXBeanEntry> entriesFromNamespace = namespaceToModuleEntry.getValue();
        for (Map.Entry<String, ModuleMXBeanEntry> moduleToMXEntry : entriesFromNamespace.entrySet()) {
            ModuleMXBeanEntry mbe = moduleToMXEntry.getValue();
            Map<RuntimeBeanEntry, InstanceConfig> cache = new HashMap<>();
            RuntimeBeanEntry root = null;
            for (RuntimeBeanEntry rbe : mbe.getRuntimeBeans()) {
                cache.put(rbe, new InstanceConfig(client, rbe.getYangPropertiesToTypesMap(), mbe.getNullableDummyContainerName()));
                if (rbe.isRoot()) {
                    root = rbe;
                }
            }
            if (root == null) {
                continue;
            }
            InstanceRuntime rootInstanceRuntime = createInstanceRuntime(root, cache);
            ModuleRuntime moduleRuntime = new ModuleRuntime(rootInstanceRuntime);
            innerMap.put(moduleToMXEntry.getKey(), moduleRuntime);
        }
        retVal.put(namespaceToModuleEntry.getKey(), innerMap);
    }
    return retVal;
}
Also used : InstanceRuntime(org.opendaylight.controller.config.facade.xml.runtime.InstanceRuntime) HashMap(java.util.HashMap) RuntimeBeanEntry(org.opendaylight.controller.config.yangjmxgenerator.RuntimeBeanEntry) InstanceConfig(org.opendaylight.controller.config.facade.xml.mapping.config.InstanceConfig) ModuleMXBeanEntry(org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry) ModuleRuntime(org.opendaylight.controller.config.facade.xml.runtime.ModuleRuntime) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)2 Map (java.util.Map)2 InstanceConfig (org.opendaylight.controller.config.facade.xml.mapping.config.InstanceConfig)2 ModuleMXBeanEntry (org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry)2 ModuleConfig (org.opendaylight.controller.config.facade.xml.mapping.config.ModuleConfig)1 InstanceRuntime (org.opendaylight.controller.config.facade.xml.runtime.InstanceRuntime)1 ModuleRuntime (org.opendaylight.controller.config.facade.xml.runtime.ModuleRuntime)1 RuntimeBeanEntry (org.opendaylight.controller.config.yangjmxgenerator.RuntimeBeanEntry)1