Search in sources :

Example 1 with YangStoreContext

use of org.opendaylight.controller.config.facade.xml.osgi.YangStoreContext in project controller by opendaylight.

the class ConfigSubsystemFacade method getConfigMapping.

public Config getConfigMapping() {
    final YangStoreContext snapshot = yangStoreService.getCurrentSnapshot();
    Map<String, Map<String, ModuleConfig>> factories = transformMbeToModuleConfigs(snapshot.getModuleMXBeanEntryMap());
    Map<String, Map<Optional<Revision>, IdentityMapping>> identitiesMap = transformIdentities(snapshot.getModules());
    return new Config(factories, identitiesMap, snapshot.getEnumResolver());
}
Also used : YangStoreContext(org.opendaylight.controller.config.facade.xml.osgi.YangStoreContext) Revision(org.opendaylight.yangtools.yang.common.Revision) 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) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with YangStoreContext

use of org.opendaylight.controller.config.facade.xml.osgi.YangStoreContext in project controller by opendaylight.

the class ConfigSubsystemFacade method get.

public Element get(final Document document) throws DocumentedException {
    final ObjectName testTransaction = transactionProvider.getOrCreateReadTransaction();
    final ConfigTransactionClient txClient = configRegistryClient.getConfigTransactionClient(testTransaction);
    try {
        // Runtime beans are not parts of transactions and have to be queried against
        // the central registry
        final Set<ObjectName> runtimeBeans = configRegistryClient.lookupRuntimeBeans();
        final Set<ObjectName> configBeans = Datastore.getInstanceQueryStrategy(Datastore.running, transactionProvider).queryInstances(configRegistryClient);
        final Map<String, Map<String, ModuleRuntime>> moduleRuntimes = createModuleRuntimes(configRegistryClient, yangStoreService.getModuleMXBeanEntryMap());
        final YangStoreContext yangStoreSnapshot = yangStoreService.getCurrentSnapshot();
        final Map<String, Map<String, ModuleConfig>> moduleConfigs = transformMbeToModuleConfigs(txClient, yangStoreSnapshot.getModuleMXBeanEntryMap());
        final org.opendaylight.controller.config.facade.xml.runtime.Runtime runtime = new Runtime(moduleRuntimes, moduleConfigs);
        return runtime.toXml(runtimeBeans, configBeans, document, yangStoreSnapshot.getEnumResolver());
    } finally {
        transactionProvider.closeReadTransaction();
    }
}
Also used : YangStoreContext(org.opendaylight.controller.config.facade.xml.osgi.YangStoreContext) ObjectName(javax.management.ObjectName) Runtime(org.opendaylight.controller.config.facade.xml.runtime.Runtime) InstanceRuntime(org.opendaylight.controller.config.facade.xml.runtime.InstanceRuntime) ModuleRuntime(org.opendaylight.controller.config.facade.xml.runtime.ModuleRuntime) Runtime(org.opendaylight.controller.config.facade.xml.runtime.Runtime) ConfigTransactionClient(org.opendaylight.controller.config.util.ConfigTransactionClient) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)2 Map (java.util.Map)2 YangStoreContext (org.opendaylight.controller.config.facade.xml.osgi.YangStoreContext)2 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 InstanceRuntime (org.opendaylight.controller.config.facade.xml.runtime.InstanceRuntime)1 ModuleRuntime (org.opendaylight.controller.config.facade.xml.runtime.ModuleRuntime)1 Runtime (org.opendaylight.controller.config.facade.xml.runtime.Runtime)1 ConfigTransactionClient (org.opendaylight.controller.config.util.ConfigTransactionClient)1 Revision (org.opendaylight.yangtools.yang.common.Revision)1