/** * Returns a special FQN for keys of a node. */ private Fqn keys(Fqn name) { return Fqn.fromRelativeElements(name, KEYS); }
public static Fqn getInternalFqn(Fqn region) { return Fqn.fromRelativeElements(region, Internal.NODE); }
/** * Returns a special FQN for key of a node. */ private Fqn key(Fqn name, Object key) { return Fqn.fromRelativeElements(name, KEYS, nullMask(key)); }
/** * @param dataOwner owner of a data set * @return a backup root for a given data owner */ public Fqn getBackupRoot(Address dataOwner) { return Fqn.fromRelativeElements(BUDDY_BACKUP_SUBTREE_FQN, getGroupNameFromAddress(dataOwner)); }
/** * Returns the backup root of a dead data owner * * @param dataOwner owner of data * @return Fqn of dead data owner's root */ public Fqn getDeadBackupRoot(Address dataOwner) { return Fqn.fromRelativeElements(BUDDY_BACKUP_SUBTREE_FQN, getGroupNameFromAddress(dataOwner) + ":DEAD"); }
@Override public NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent, Map<K, V> data) { return createNode(Fqn.fromRelativeElements(parent.getFqn(), childName), parent, data); }
@Override public NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent) { return createNode(Fqn.fromRelativeElements(parent.getFqn(), childName), parent); }
public static void sendEvictNotification(Cache cache, Fqn region, Object member, Object key, Option option) { setInvocationOption(cache, option); Fqn f = Fqn.fromRelativeElements(region, Internal.NODE, member == null ? Internal.LOCAL : member, key); cache.put(f, ITEM, DUMMY); }
public static void sendEvictAllNotification(Cache cache, Fqn region, Object member, Option option) { setInvocationOption(cache, option); Fqn f = Fqn.fromRelativeElements(region, Internal.NODE, member == null ? Internal.LOCAL : member); cache.put(f, ITEM, DUMMY); } }
public Set<Node<K, V>> getChildren() { assertValid(); if (spi == null) return Collections.emptySet(); Set<Node<K, V>> children = new HashSet<Node<K, V>>(); for (Object c : spi.getChildrenNames(getFqn())) { Node<K, V> n = spi.getNode(Fqn.fromRelativeElements(getFqn(), c)); if (n != null) children.add(n); } return Collections.unmodifiableSet(children); }
@Override public Object visitMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable { result.add(command.getFqn()); // now if this is a "move" operation, then we also have another Fqn - Object le = command.getFqn().getLastElement(); Fqn parent = command.getTo(); result.add(Fqn.fromRelativeElements(parent, le)); return null; } }
public NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent) { UnversionedNode<K, V> internal = createInternalNode(childName, Fqn.fromRelativeElements(parent.getFqn(), childName), parent, null); return initializeNodeInvocationDelegate(internal); }
public Node<K, V> getChild(Object name) { assertValid(); return spi.getNode(Fqn.fromRelativeElements(getFqn(), name)); }
public NodeSPI<K, V> createNode(Object childName, NodeSPI<K, V> parent, Map<K, V> data) { UnversionedNode<K, V> internal = createInternalNode(childName, Fqn.fromRelativeElements(parent.getFqn(), childName), parent, data); return initializeNodeInvocationDelegate(internal); }
public void rollback() { move(Fqn.fromRelativeElements(to, fqn.getLastElement()), fqn.getParent(), true, null); } }
public boolean removeChild(Object childName) { assertValid(); return spi.removeNode(Fqn.fromRelativeElements(getFqn(), childName)); }
private void adjustFqn(NodeSPI node, Fqn newBase) { Fqn newFqn = Fqn.fromRelativeElements(newBase, node.getFqn().getLastElement()); node.setFqn(newFqn); }
/** * Adds the Fqn of the node as well as all children and childrens children to the list. */ protected void greedyGetFqns(List<Fqn> list, NodeSPI<?, ?> n, Fqn newBase) { list.add(n.getFqn()); Fqn newFqn = Fqn.fromRelativeElements(newBase, n.getFqn().getLastElement()); list.add(newFqn); for (NodeSPI child : n.getChildrenDirect()) { greedyGetFqns(list, child, newFqn); } }
/** * Converts a database entry to an Fqn. */ private Fqn makeKeyObject(DatabaseEntry entry) { Fqn name = Fqn.ROOT; TupleInput tupleInput = TupleBinding.entryToInput(entry); while (tupleInput.available() > 0) { String part = tupleInput.readString(); name = Fqn.fromRelativeElements(name, part); } return name; }
@Override protected Object handleMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable { Object returnValue = invokeNextInterceptor(ctx, command); if (inTransaction()) { return returnValue; } Fqn newNodeFqn = Fqn.fromRelativeElements(command.getTo(), command.getFqn().getLastElement()); recursiveMove(command.getFqn(), newNodeFqn); loader.remove(command.getFqn()); return returnValue; }