@Override public Iterable<DocumentNodeState> children(DocumentNodeState root) { return Iterables.transform(() -> root.getBundledChildren(), ce -> (DocumentNodeState)ce.getNodeState()); } }.preOrderTraversal(this)
@Override protected NodeState getNext() { if (!fillStack()) { return null; } return stack.peekFirst().next().getNodeState(); }
@Override protected NodeState getNext() { if (!fillStack()) { return null; } return stack.peekFirst().next().getNodeState(); }
@Override public boolean apply(@Nullable ChildNodeEntry input) { return input != null && input.getNodeState().exists(); } }
private Set<String> getAllNodeTypeNames() { Set<String> modifiedTypes = new HashSet<>(); for ( ChildNodeEntry child : nodeTypes.getChildNodeEntries() ) { modifiedTypes.add(child.getNodeState().getName(JcrConstants.JCR_NODETYPENAME)); } return modifiedTypes; }
@Nullable @Override public Checkpoint apply(@Nullable ChildNodeEntry input) { return Checkpoint.createFromSegmentNode(input.getName(), input.getNodeState()); } }));
@Nullable @Override public ChildNodeEntry apply(@Nullable final ChildNodeEntry childNodeEntry) { if (childNodeEntry != null) { final String name = childNodeEntry.getName(); final NodeState nodeState = decorate(name, childNodeEntry.getNodeState()); if (nodeState.exists()) { return new MemoryChildNodeEntry(name, nodeState); } } return null; } }
private void collectIndexNodePaths(NodeState nodeState, String parentPath, Collection<String> paths) { NodeState state = nodeState.getChildNode(INDEX_DEFINITIONS_NAME); for (ChildNodeEntry entry : state.getChildNodeEntries()) { if (definitionPredicate.test(entry.getNodeState())) { paths.add(createIndexNodePath(parentPath, entry.getName())); } } }
private void traverse(NodeState node, int depth, @NotNull String path) { updateContext(context, depth, nodeCount.incrementAndGet(), path); if (depth < this.depth) { node.getChildNodeEntries().forEach(cse -> { String childPath = concat(path, cse.getName()); traverse(cse.getNodeState(), depth + 1, childPath); }); } }
private static Map<String, Analyzer> collectAnalyzers(NodeState defn) { Map<String, Analyzer> analyzerMap = newHashMap(); NodeStateAnalyzerFactory factory = new NodeStateAnalyzerFactory(VERSION); NodeState analyzersTree = defn.getChildNode(LuceneIndexConstants.ANALYZERS); for (ChildNodeEntry cne : analyzersTree.getChildNodeEntries()) { Analyzer a = factory.createInstance(cne.getNodeState()); analyzerMap.put(cne.getName(), a); } if (getOptionalValue(analyzersTree, INDEX_ORIGINAL_TERM, false) && !analyzerMap.containsKey(ANL_DEFAULT)) { analyzerMap.put(ANL_DEFAULT, new OakAnalyzer(VERSION, true)); } return ImmutableMap.copyOf(analyzerMap); }
@Override public long getOldestCheckpointCreationTimestamp() { long minTimestamp = Long.MAX_VALUE; for (ChildNodeEntry cne : store.getCheckpoints().getChildNodeEntries()) { NodeState checkpoint = cne.getNodeState(); PropertyState p = checkpoint.getProperty("created"); if (p != null) { minTimestamp = Math.min(minTimestamp, p.getValue(Type.LONG)); } } return (minTimestamp==Long.MAX_VALUE)?0:minTimestamp; }
public static BundledTypesRegistry from(NodeState configParentState){ Map<String, DocumentBundlor> bundlors = Maps.newHashMap(); for (ChildNodeEntry e : configParentState.getChildNodeEntries()){ NodeState config = e.getNodeState(); if (config.getBoolean(DocumentBundlor.PROP_DISABLED)){ continue; } bundlors.put(e.getName(), DocumentBundlor.from(config)); } return new BundledTypesRegistry(bundlors); }
private static void collectIndexNodePaths(NodeState nodeState, String parentPath, Collection<String> paths) { NodeState state = nodeState.getChildNode(INDEX_DEFINITIONS_NAME); for (ChildNodeEntry entry : state.getChildNodeEntries()) { if (isSolrIndexNode(entry.getNodeState())) { String indexNodePath = createIndexNodePath(parentPath, entry.getName()); log.debug("found Solr index node at {}", indexNodePath); paths.add(indexNodePath); } } }
private static List<ChildTypeDef> parseNamedChildNodeDefs(NodeState root, NodeState parentType, TypePredicate parentTypePredicate) { List<ChildTypeDef> defs = new ArrayList<ChildTypeDef>(); NodeState namedChildNodeDefinitions = parentType.getChildNode(REP_NAMED_CHILD_NODE_DEFINITIONS); for (ChildNodeEntry childName : namedChildNodeDefinitions.getChildNodeEntries()) { for (String childType : filterChildren(childName.getNodeState(), NO_SNS_PROPERTY)) { TypePredicate childTypePredicate = new TypePredicate(root, childType); defs.add(new ChildTypeDef(parentTypePredicate, childName.getName(), childTypePredicate)); } } return defs; }
@NotNull @Override public NodeState getChildNode(@NotNull String name) { NodeState child = state.getChildNode(name); if (child.exists() && !treePermission.canReadAll()) { ChildNodeEntry entry = new MemoryChildNodeEntry(name, child); return new WrapChildEntryFunction().apply(entry).getNodeState(); } else { return child; } }
@Nonnull @Override public NodeState getChildNode(@Nonnull String name) { NodeState child = state.getChildNode(name); if (child.exists() && !treePermission.canReadAll()) { ChildNodeEntry entry = new MemoryChildNodeEntry(name, child); return new WrapChildEntryFunction().apply(entry).getNodeState(); } else { return child; } }
private static List<ChildTypeDef> parseNamedChildNodeDefs(NodeState root, NodeState parentType, TypePredicate parentTypePredicate) { List<ChildTypeDef> defs = new ArrayList<ChildTypeDef>(); NodeState namedChildNodeDefinitions = parentType.getChildNode(REP_NAMED_CHILD_NODE_DEFINITIONS); for (ChildNodeEntry childName : namedChildNodeDefinitions.getChildNodeEntries()) { for (String childType : filterChildren(childName.getNodeState(), NO_SNS_PROPERTY)) { TypePredicate childTypePredicate = new TypePredicate(root, childType); defs.add(new ChildTypeDef(parentTypePredicate, childName.getName(), childTypePredicate)); } } return defs; }
private int deleteChildNodes(NodeState node, String path) throws CommitFailedException { int currentSize = 0; for (ChildNodeEntry cne : node.getChildNodeEntries()) { String name = cne.getName(); String childPath = PathUtils.concat(path, name); currentSize += delete(cne.getNodeState(), childPath); if (save(childPath, currentSize, false)) { currentSize = 0; } } return currentSize; }
private static void traverse(NodeState node) { for (ChildNodeEntry childNodeEntry : node.getChildNodeEntries()) { traverse(childNodeEntry.getNodeState()); } }
private static void checkGeneration(NodeState node, GCGeneration gcGeneration) { assertTrue(node instanceof SegmentNodeState); assertEquals(gcGeneration, ((SegmentNodeState) node).getRecordId().getSegmentId().getGcGeneration()); for (ChildNodeEntry cne : node.getChildNodeEntries()) { checkGeneration(cne.getNodeState(), gcGeneration); } }