Search in sources :

Example 6 with ConfigTransactionClient

use of org.opendaylight.controller.config.util.ConfigTransactionClient in project controller by opendaylight.

the class ConfigSubsystemFacade method set.

private void set(final ConfigExecution configExecution) throws DocumentedException {
    ObjectName taON = transactionProvider.getOrCreateTransaction();
    // default strategy = replace wipes config
    if (configExecution.getDefaultStrategy() == EditStrategyType.replace) {
        transactionProvider.wipeTransaction();
    }
    ConfigTransactionClient ta = configRegistryClient.getConfigTransactionClient(taON);
    handleMisssingInstancesOnTransaction(ta, configExecution);
    setServicesOnTransaction(ta, configExecution);
    setOnTransaction(ta, configExecution);
}
Also used : ConfigTransactionClient(org.opendaylight.controller.config.util.ConfigTransactionClient) ObjectName(javax.management.ObjectName)

Example 7 with ConfigTransactionClient

use of org.opendaylight.controller.config.util.ConfigTransactionClient in project controller by opendaylight.

the class CandidateDatastoreQueryStrategy method queryInstances.

@Override
public Set<ObjectName> queryInstances(final ConfigRegistryClient configRegistryClient) {
    ObjectName on = transactionProvider.getOrCreateTransaction();
    ConfigTransactionClient proxy = configRegistryClient.getConfigTransactionClient(on);
    return proxy.lookupConfigBeans();
}
Also used : ConfigTransactionClient(org.opendaylight.controller.config.util.ConfigTransactionClient) ObjectName(javax.management.ObjectName)

Example 8 with ConfigTransactionClient

use of org.opendaylight.controller.config.util.ConfigTransactionClient in project controller by opendaylight.

the class ConfigSubsystemFacade method test.

private void test(final ConfigExecution execution, final EditStrategyType editStrategyType) throws ValidationException, DocumentedException {
    ObjectName taON = transactionProvider.getTestTransaction();
    try {
        // default strategy = replace wipes config
        if (editStrategyType == EditStrategyType.replace) {
            transactionProvider.wipeTestTransaction(taON);
        }
        ConfigTransactionClient ta = configRegistryClient.getConfigTransactionClient(taON);
        handleMisssingInstancesOnTransaction(ta, execution);
        setServicesOnTransaction(ta, execution);
        setOnTransaction(ta, execution);
        transactionProvider.validateTestTransaction(taON);
    } finally {
        transactionProvider.abortTestTransaction(taON);
    }
}
Also used : ConfigTransactionClient(org.opendaylight.controller.config.util.ConfigTransactionClient) ObjectName(javax.management.ObjectName)

Example 9 with ConfigTransactionClient

use of org.opendaylight.controller.config.util.ConfigTransactionClient 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)

Example 10 with ConfigTransactionClient

use of org.opendaylight.controller.config.util.ConfigTransactionClient in project controller by opendaylight.

the class RunningDatastoreQueryStrategy method queryInstances.

@Override
public Set<ObjectName> queryInstances(final ConfigRegistryClient configRegistryClient) {
    ObjectName on = transactionProvider.getOrCreateReadTransaction();
    ConfigTransactionClient proxy = configRegistryClient.getConfigTransactionClient(on);
    return proxy.lookupConfigBeans();
}
Also used : ConfigTransactionClient(org.opendaylight.controller.config.util.ConfigTransactionClient) ObjectName(javax.management.ObjectName)

Aggregations

ConfigTransactionClient (org.opendaylight.controller.config.util.ConfigTransactionClient)13 ObjectName (javax.management.ObjectName)10 HashMap (java.util.HashMap)1 Map (java.util.Map)1 InstanceNotFoundException (javax.management.InstanceNotFoundException)1 Test (org.junit.Test)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 YangStoreContext (org.opendaylight.controller.config.facade.xml.osgi.YangStoreContext)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 AbstractConfigTest (org.opendaylight.controller.config.manager.impl.AbstractConfigTest)1 XmlElement (org.opendaylight.controller.config.util.xml.XmlElement)1 Element (org.w3c.dom.Element)1