@NotNull @Override public Iterable<? extends ChildNodeEntry> getChildNodeEntries() { return modified.getChildNodeEntries(); }
@NotNull @Override public Iterable<? extends ChildNodeEntry> getChildNodeEntries() { return modified.getChildNodeEntries(); }
@NotNull Iterable<? extends ChildNodeEntry> getChildNodeEntries(@NotNull final NodeState index) { return index.getChildNodeEntries(); }
@NotNull @Override public Iterable<? extends ChildNodeEntry> getChildNodeEntries() { return Iterables.transform(delegate.getChildNodeEntries(), new Function<ChildNodeEntry, ChildNodeEntry>() { @Nullable @Override public ChildNodeEntry apply(ChildNodeEntry input) { return new MemoryChildNodeEntry(input.getName(), decorate(input.getName(), input.getNodeState())); } }); }
public void reset() { itQueue.clear(); nameQueue.clear(); itQueue.add(root.getChildNodeEntries().iterator()); }
private static Stream<NodeState> getIndexingData(NodeState indexDefinition, String path) { Iterable<String> pathElements = PathUtils.elements(path); return StreamSupport.stream(indexDefinition.getChildNodeEntries().spliterator(), false) .filter(NodeCounter::isDataNodeName) .map(ChildNodeEntry::getNodeState) .map(n -> child(n, pathElements)) .filter(Objects::nonNull) .filter(NodeState::exists); }
private static Stream<NodeState> getIndexingData(NodeState indexDefinition, String path) { Iterable<String> pathElements = PathUtils.elements(path); return StreamSupport.stream(indexDefinition.getChildNodeEntries().spliterator(), false) .filter(NodeCounter::isDataNodeName) .map(ChildNodeEntry::getNodeState) .map(n -> child(n, pathElements)) .filter(Objects::nonNull) .filter(NodeState::exists); }
@Override public Iterable<NodeState> children(NodeState root) { return Iterables.transform(root.getChildNodeEntries(), ChildNodeEntry::getNodeState); } };
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; }
@Test public void testGetChildNodeEntries() { List<String> names = new ArrayList<String>(); for (ChildNodeEntry entry : state.getChildNodeEntries()) { names.add(entry.getName()); } Collections.sort(names); assertEquals(Arrays.asList("x", "y", "z"), names); }
@Override public boolean childNodeAdded(String name, NodeState after) { if (CONFLICT.equals(name)) { for (ChildNodeEntry conflict : after.getChildNodeEntries()) { resolveConflict(ConflictType.fromName(conflict.getName()), conflict.getNodeState()); } target.getChildNode(CONFLICT).remove(); } return true; }
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; }
public int clean(NodeBuilder builder, long lastIndexedTo) { int removalCount = 0; NodeState baseState = builder.getBaseState(); for (ChildNodeEntry e : baseState.getChildNodeEntries()) { long entryCreationTime = e.getNodeState().getLong(PROP_CREATED); if (entryCovered(entryCreationTime, lastIndexedTo)) { builder.child(e.getName()).remove(); removalCount++; } } return removalCount; }
@Test public void childNodeEntryForMountIsComposite() { ChildNodeEntry libsNode = Iterables.find(store.getRoot().getChildNodeEntries(), new Predicate<ChildNodeEntry>() { @Override public boolean apply(ChildNodeEntry input) { return input.getName().equals("libs"); } }); assertThat("root.libs(childCount)", libsNode.getNodeState().getChildNodeCount(10), equalTo(3l)); }
@Override protected void collectCheckpoints(TabularDataSupport tab) throws OpenDataException { for (ChildNodeEntry cne : store.getCheckpoints().getChildNodeEntries()) { String id = cne.getName(); NodeState checkpoint = cne.getNodeState(); String created = getDate(checkpoint, "created"); String expires = getDate(checkpoint, "timestamp"); tab.put(id, toCompositeData(id, created, expires, store.checkpointInfo(id))); } }
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); } }