@Override void doSeal() { modification.ready(); } }
@Override public synchronized void ready() { delegate.ready(); }
@Override public synchronized void ready() { delegate.ready(); }
/** * @deprecated This method violates DataTree containment and will be removed. */ @VisibleForTesting @Deprecated public DataTreeCandidate commit(final DataTreeModification modification) throws DataValidationFailedException { modification.ready(); dataTree.validate(modification); DataTreeCandidate candidate = dataTree.prepare(modification); dataTree.commit(candidate); return candidate; }
@Override public void ready() { try { delegate.ready(); } catch (SchemaValidationFailedException e) { DataTreeModification newModification = dataTree.takeSnapshot().newModification(); delegate.applyToCursor(new PruningDataTreeModificationCursor(newModification, this)); delegate = newModification; delegate.ready(); } }
private void commit(final DataTreeModification modification) throws DataValidationFailedException { modification.ready(); datastore.validate(modification); datastore.commit(datastore.prepare(modification)); } }
@Override ShardDataTreeCohort finishTransaction(final ReadWriteShardDataTreeTransaction transaction) { final DataTreeModification snapshot = transaction.getSnapshot(); snapshot.ready(); return createReadyCohort(transaction.getId(), snapshot); }
@Override public DOMStoreThreePhaseCommitCohort ready() { @SuppressWarnings("unchecked") final TransactionReadyPrototype<T> wasReady = READY_UPDATER.getAndSet(this, null); checkState(wasReady != null, "Transaction %s is no longer open", getIdentifier()); LOG.debug("Store transaction: {} : Ready", getIdentifier()); final DataTreeModification tree = mutableTree; TREE_UPDATER.lazySet(this, null); tree.ready(); return wasReady.transactionReady(this, tree); }
private NormalizedNodeAggregator combine() throws DataValidationFailedException { final DataTreeModification mod = dataTree.takeSnapshot().newModification(); for (final Optional<NormalizedNode<?,?>> node : nodes) { if (node.isPresent()) { mod.merge(rootIdentifier, node.get()); } } mod.ready(); dataTree.validate(mod); final DataTreeCandidate candidate = dataTree.prepare(mod); dataTree.commit(candidate); return this; }
private void applyReplicatedCandidate(final Identifier identifier, final DataTreeCandidate foreign) throws DataValidationFailedException { LOG.debug("{}: Applying foreign transaction {}", logContext, identifier); final DataTreeModification mod = dataTree.takeSnapshot().newModification(); DataTreeCandidates.applyToModification(mod, foreign); mod.ready(); LOG.trace("{}: Applying foreign modification {}", logContext, mod); dataTree.validate(mod); final DataTreeCandidate candidate = dataTree.prepare(mod); dataTree.commit(candidate); notifyListeners(candidate); }
private DataTreeContext prepareCandidateContext(final DataTreeModification dataTreeModification) throws ValidationFailedException { // Seal the modification (required to perform validate) dataTreeModification.ready(); // Check if modification can be applied to data tree try { dataTree.validate(dataTreeModification); } catch (DataValidationFailedException e) { throw new ValidationFailedException(e); } return contextFactory.create(dataTree.prepare(dataTreeModification)); }
@SuppressWarnings("checkstyle:IllegalCatch") @Override public DOMStoreThreePhaseCommitCohort ready() { @SuppressWarnings("unchecked") final TransactionReadyPrototype<T> wasReady = READY_UPDATER.getAndSet(this, null); checkState(wasReady != null, "Transaction %s is no longer open", getIdentifier()); LOG.debug("Store transaction: {} : Ready", getIdentifier()); final DataTreeModification tree = mutableTree; TREE_UPDATER.lazySet(this, null); try { tree.ready(); return wasReady.transactionReady(this, tree, null); } catch (RuntimeException e) { LOG.debug("Store transaction: {}: unexpected failure when readying", getIdentifier(), e); return wasReady.transactionReady(this, tree, e); } }
@Override @SuppressWarnings("checkstyle:IllegalCatch") public DOMStoreThreePhaseCommitCohort ready() { @SuppressWarnings("unchecked") final TransactionReadyPrototype<T> wasReady = READY_UPDATER.getAndSet(this, null); checkState(wasReady != null, "Transaction %s is no longer open", getIdentifier()); LOG.debug("Store transaction: {} : Ready", getIdentifier()); final DataTreeModification tree = mutableTree; TREE_UPDATER.lazySet(this, null); try { tree.ready(); return wasReady.transactionReady(this, tree, null); } catch (RuntimeException e) { LOG.debug("Store transaction: {}: unexpected failure when readying", getIdentifier(), e); return wasReady.transactionReady(this, tree, e); } }
@Override public DataTree create(final DataTreeConfiguration treeConfig, final SchemaContext initialSchemaContext, final NormalizedNodeContainer<?, ?, ?> initialRoot) throws DataValidationFailedException { final DataTree ret = create(treeConfig, initialSchemaContext, false); final DataTreeModification mod = ret.takeSnapshot().newModification(); mod.write(YangInstanceIdentifier.EMPTY, initialRoot); mod.ready(); ret.validate(mod); final DataTreeCandidate candidate = ret.prepare(mod); ret.commit(candidate); return ret; }
@Override public DataTree create(final DataTreeConfiguration treeConfig, final SchemaContext initialSchemaContext, final NormalizedNodeContainer<?, ?, ?> initialRoot) throws DataValidationFailedException { final DataTree ret = create(treeConfig, initialSchemaContext, false); final DataTreeModification mod = ret.takeSnapshot().newModification(); mod.write(YangInstanceIdentifier.EMPTY, initialRoot); mod.ready(); ret.validate(mod); final DataTreeCandidate candidate = ret.prepare(mod); ret.commit(candidate); return ret; }
private DataTreeCandidate applyChanges(final Collection<DataTreeCandidate> changes) { final DataTreeModification modification = dataTree.takeSnapshot().newModification(); for (final DataTreeCandidate change : changes) { DataTreeCandidates.applyToModification(modification, change); } modification.ready(); try { dataTree.validate(modification); } catch (final DataValidationFailedException e) { LOG.error("Validation failed for built modification", e); throw new RuntimeException("Notification validation failed", e); } // strip nodes we do not need since this listener doesn't have to be registered at the root of the DataTree DataTreeCandidateNode modifiedChild = dataTree.prepare(modification).getRootNode(); for (final PathArgument pathArgument : listenerPath.getPathArguments()) { modifiedChild = modifiedChild.getModifiedChild(pathArgument); } if (modifiedChild == null) { modifiedChild = DataTreeCandidateNodes.empty(listenerPath.getLastPathArgument()); } return DataTreeCandidates.newDataTreeCandidate(listenerPath, modifiedChild); } }