public boolean removeChild(Object childName) { //NodeSPI n = node.getChildDirect(childName); Fqn childFqn = Fqn.fromRelativeElements(getFqn(), childName); /*if (n != null) {*/ getChildrenRemovedSet().add(childFqn); if (childrenAdded != null) childrenAdded.remove(childFqn); setFlag(CHILDREN_MODIFIED_IN_WORKSPACE); return node.getChildDirect(childName) != null; /*} else { return false; }*/ }
@Override public NodeSPI<K, V> getChildDirect(Fqn fqn) { if (fqn.size() == 1) { return getChildDirect(fqn.getLastElement()); } else { NodeSPI<K, V> currentNode = delegate; for (int i = 0; i < fqn.size(); i++) { Object nextChildName = fqn.get(i); currentNode = currentNode.getChildDirect(nextChildName); if (currentNode == null) return null; } return currentNode; } }
public NodeSPI peek(Fqn fqn, boolean includeDeletedNodes, boolean includeInvalidNodes) { if (trace) { log.trace("peek " + fqn + ", includeDeletedNodes:" + includeDeletedNodes + ", includeInvalidNodes:" + includeInvalidNodes); } if (fqn == null || fqn.size() == 0) return getRoot(); NodeSPI n = getRoot(); int fqnSize = fqn.size(); for (int i = 0; i < fqnSize; i++) { Object obj = fqn.get(i); n = n.getChildDirect(obj); if (n == null) { return null; } else if (!includeDeletedNodes && n.isDeleted()) { return null; } else if (!includeInvalidNodes && !n.isValid()) { return null; } } return n; }
currentNode = currentNode.getChildDirect(childName);
private Object handlePutCommand(InvocationContext ctx, DataCommand command, boolean zeroAcquisitionTimeout) throws Throwable { if ((ctx.isLockingSuppressed()) || configuration.getIsolationLevel() == IsolationLevel.NONE) { if (trace) log.trace("Suppressing locking, creating nodes if necessary"); int treeNodeSize = command.getFqn().size(); NodeSPI n = dataContainer.getRoot(); for (int i = 0; i < treeNodeSize; i++) { Object childName = command.getFqn().get(i); Fqn childFqn = Fqn.fromElements(childName); NodeSPI childNode = n.getChildDirect(childFqn); if (childNode == null) childNode = n.addChildDirect(childFqn); LockUtil.manageReverseRemove(ctx, childNode, true, null, commandsFactory); n = childNode; } } else { lockManager.lockPessimistically(ctx, command.getFqn(), WRITE, true, zeroAcquisitionTimeout, false, true, null, false); } return invokeNextInterceptor(ctx, command); }
NodeSPI childNode = underlyingNode.getChildDirect(child.getLastElement()); if (childNode != null) childNode.setValid(false, true);
NodeSPI currentNode = workspaceNode.getNode().getChildDirect(childName);