/** * Puts the specified key and value into the data map in the node referenced by the specified Fqn. * * @param ctx invocation context * @return the value being overwritten, if any, otherwise a null. */ public Object perform(InvocationContext ctx) { if (trace) log.trace("Perform('" + globalTransaction + "', '" + fqn + "', k='" + key + "', v='" + value + "')"); NodeSPI n = ctx.lookUpNode(fqn); if (n == null) throw new NodeNotExistsException("Node " + fqn + " does not exist!"); if (notifier.shouldNotifyOnNodeModified()) { notifier.notifyNodeModified(fqn, true, NodeModifiedEvent.ModificationType.PUT_DATA, n.getDataDirect(), ctx); } Object oldValue = n.putDirect(key, value); if (trace) log.trace("Old value is " + oldValue + ", dataLoaded=" + n.isDataLoaded()); if (notifier.shouldNotifyOnNodeModified()) { Map newData = Collections.singletonMap(key, value); notifier.notifyNodeModified(fqn, false, NodeModifiedEvent.ModificationType.PUT_DATA, newData, ctx); } return oldValue; }
if (n != null && !n.isDataLoaded())
private boolean childrenLoaded(NodeSPI<?, ?> node) throws Exception { if (!node.isChildrenLoaded() && loader.getChildrenNames(node.getFqn()) != null) return false; for (NodeSPI child : node.getChildrenDirect()) { if (!child.isDataLoaded()) { return false; } if (child.getChildrenDirect().size() > 0) { if (!childrenLoaded(child)) { return false; } } else if (!loaderNoChildren(child.getFqn())) { return false; } } return true; }
if (((n = dataContainer.peek(fqn, true, false)) != null) && n.isDataLoaded() && loader.exists(fqn))