use of org.opendaylight.controller.config.util.ConfigTransactionClient in project controller by opendaylight.
the class TransactionProvider method abortTransaction.
public synchronized void abortTransaction() {
LOG.debug("Aborting current transaction");
Optional<ObjectName> taON = getTransaction();
Preconditions.checkState(taON.isPresent(), NO_TRANSACTION_FOUND_FOR_SESSION + sessionIdForReporting);
ConfigTransactionClient transactionClient = configRegistryClient.getConfigTransactionClient(taON.get());
transactionClient.abortConfig();
allOpenedTransactions.remove(candidateTx);
candidateTx = null;
}
use of org.opendaylight.controller.config.util.ConfigTransactionClient in project controller by opendaylight.
the class TransactionProvider method closeReadTransaction.
public synchronized void closeReadTransaction() {
LOG.debug("Closing read transaction");
Optional<ObjectName> taON = getReadTransaction();
Preconditions.checkState(taON.isPresent(), NO_TRANSACTION_FOUND_FOR_SESSION + sessionIdForReporting);
ConfigTransactionClient transactionClient = configRegistryClient.getConfigTransactionClient(taON.get());
transactionClient.abortConfig();
allOpenedTransactions.remove(readTx);
readTx = null;
}
use of org.opendaylight.controller.config.util.ConfigTransactionClient in project controller by opendaylight.
the class TransactionProvider method validateTransaction.
public void validateTransaction() throws ValidationException {
Optional<ObjectName> taON = getTransaction();
Preconditions.checkState(taON.isPresent(), NO_TRANSACTION_FOUND_FOR_SESSION + sessionIdForReporting);
ConfigTransactionClient transactionClient = configRegistryClient.getConfigTransactionClient(taON.get());
transactionClient.validateConfig();
}
use of org.opendaylight.controller.config.util.ConfigTransactionClient in project controller by opendaylight.
the class SimpleConfigurationTest method testValidationUsingJMXClient.
@Test
public void testValidationUsingJMXClient() throws Exception {
ConfigTransactionClient transaction = configRegistryClient.createTransaction();
testValidation(transaction);
}
use of org.opendaylight.controller.config.util.ConfigTransactionClient 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