@Override public String apply(ChildNodeEntry input) { return input.getName(); } });
@Override public ChildNodeEntry next() { if (!hasNext()) { throw new NoSuchElementException(); } ChildNodeEntry entry = current.next(); previousName = entry.getName(); currentRemaining--; return entry; }
public void add(ChildNodeEntry rootIndexDef, Mount mount, NodeState indexDef) { IndexCombination combination = combinations.get(rootIndexDef.getName()); if ( combination == null ) { combination = new IndexCombination(rootIndexDef); combinations.put(rootIndexDef.getName(), combination); } combination.addEntry(mount, indexDef); }
@Override public ChildNodeEntry next() { if (!hasNext()) { throw new NoSuchElementException(); } ChildNodeEntry entry = current.next(); previousName = entry.getName(); currentRemaining--; return entry; }
private static boolean isDataNodeName(ChildNodeEntry childNodeEntry) { String name = childNodeEntry.getName(); return NodeCounterEditor.DATA_NODE_NAME.equals(name) || (name.startsWith(":") && name.endsWith("-" + Multiplexers.stripStartingColon(NodeCounterEditor.DATA_NODE_NAME))); }
@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); }
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 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; }
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; }
@Override public List<String> call() { List<String> names = Lists.newArrayList(); NodeState n = store.getRoot().getChildNode("node"); for (ChildNodeEntry entry : n.getChildNodeEntries()) { names.add(entry.getName()); } return names; } });
private void traverse(NodeState node, String path) { for (ChildNodeEntry child : node.getChildNodeEntries()) { traverse(child.getNodeState(), PathUtils.concat(path, child.getName())); } } }