@Override public CheckedFuture<Boolean, ReadFailedException> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) { return delegate().exists(store, path); }
@Override public CheckedFuture<Boolean, ReadFailedException> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) { return tx.getTransaction().exists(store, path); }
@Override public CheckedFuture<Boolean, ReadFailedException> exists(final LogicalDatastoreType store, final YangInstanceIdentifier path) { return delegate().exists(store, path); }
private void checkItemDoesNotExists(final DOMDataReadWriteTransaction rWTransaction,final LogicalDatastoreType store, final YangInstanceIdentifier path) { final ListenableFuture<Boolean> futureDatastoreData = rWTransaction.exists(store, path); try { if (futureDatastoreData.get()) { final String errMsg = "Post Configuration via Restconf was not executed because data already exists"; LOG.trace(errMsg + ":{}", path); rWTransaction.cancel(); throw new RestconfDocumentedException("Data already exists for path: " + path, ErrorType.PROTOCOL, ErrorTag.DATA_EXISTS); } } catch (InterruptedException | ExecutionException e) { LOG.warn("It wasn't possible to get data loaded from datastore at path " + path, e); } }
@Override public CheckedFuture<Boolean, ReadFailedException> exists( LogicalDatastoreType logicalDatastoreType, YangInstanceIdentifier yangInstanceIdentifier) { if (AuthzServiceImpl.isAuthorized(logicalDatastoreType, yangInstanceIdentifier, ActionType.Exists)) { return domDataReadWriteTransaction.exists(logicalDatastoreType, yangInstanceIdentifier); } ReadFailedException e = new ReadFailedException("Authorization Failed"); return Futures.immediateFailedCheckedFuture(e); }
@Override protected final void ensureParentsByMerge(final LogicalDatastoreType store, final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalizedPath, final InstanceIdentifier<?> path) { List<PathArgument> currentArguments = new ArrayList<>(); DataNormalizationOperation<?> currentOp = getCodec().getDataNormalizer().getRootOperation(); Iterator<PathArgument> iterator = normalizedPath.getPathArguments().iterator(); while (iterator.hasNext()) { PathArgument currentArg = iterator.next(); try { currentOp = currentOp.getChild(currentArg); } catch (DataNormalizationException e) { throw new IllegalArgumentException(String.format("Invalid child encountered in path %s", path), e); } currentArguments.add(currentArg); org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier currentPath = org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.create( currentArguments); final Boolean exists; try { exists = getDelegate().exists(store, currentPath).checkedGet(); } catch (ReadFailedException e) { LOG.error("Failed to read pre-existing data from store {} path {}", store, currentPath, e); throw new IllegalStateException("Failed to read pre-existing data", e); } if (!exists && iterator.hasNext()) { getDelegate().merge(store, currentPath, currentOp.createDefault(currentArg)); } } }