use of org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry in project jackrabbit-oak by apache.
the class ContentMirrorStoreStrategy method query.
public Iterable<String> query(final Filter filter, final String indexName, final NodeState indexMeta, final String indexStorageNodeName, final Iterable<String> values) {
final NodeState index = indexMeta.getChildNode(indexStorageNodeName);
return new Iterable<String>() {
@Override
public Iterator<String> iterator() {
PathIterator it = new PathIterator(filter, indexName, "");
if (values == null) {
it.setPathContainsValue(true);
it.enqueue(getChildNodeEntries(index).iterator());
} else {
for (String p : values) {
NodeState property = index.getChildNode(p);
if (property.exists()) {
// we have an entry for this value, so use it
it.enqueue(Iterators.singletonIterator(new MemoryChildNodeEntry("", property)));
}
}
}
return it;
}
};
}
use of org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry in project jackrabbit-oak by apache.
the class QueueingHandler method aggregate.
private AggregationResult aggregate(String name, NodeState node, IdentifierTracker childTracker) {
int aggregationLevel = 0;
if (aggregator != null) {
aggregationLevel = aggregator.aggregate(root, parents, new MemoryChildNodeEntry(name, node));
}
if (aggregationLevel <= 0) {
// no aggregation
return new AggregationResult(name, childTracker, getPrimaryType(node), getMixinTypes(node), pathTracker);
} else {
QueueingHandler handler = this;
IdentifierTracker tracker = childTracker;
String primaryType = null;
Iterable<String> mixinTypes = null;
PathTracker pathTracker = null;
String childName = null;
for (int i = 0; i < aggregationLevel; i++) {
if (i > 0) {
name = childName + "/" + name;
}
tracker = handler.identifierTracker;
primaryType = handler.parentType;
mixinTypes = handler.parentMixins;
pathTracker = handler.pathTracker;
childName = handler.name;
handler = handler.parent;
}
return new AggregationResult(name, tracker, primaryType, mixinTypes, pathTracker);
}
}
use of org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry in project jackrabbit-oak by apache.
the class Aggregate method collectAggregatesForDirectMatchers.
private static void collectAggregatesForDirectMatchers(NodeState nodeState, List<Matcher> matchers, ResultCollector collector) {
Map<String, ChildNodeEntry> children = Maps.newHashMap();
//Collect potentially matching child nodestates based on matcher name
for (Matcher m : matchers) {
String nodeName = m.getNodeName();
NodeState child = nodeState.getChildNode(nodeName);
if (child.exists()) {
children.put(nodeName, new MemoryChildNodeEntry(nodeName, child));
}
}
matchChildren(matchers, collector, children.values());
}
use of org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry in project jackrabbit-oak by apache.
the class JackrabbitNodeState method getChildNodeEntries.
@Nonnull
@Override
public Iterable<MemoryChildNodeEntry> getChildNodeEntries() {
List<MemoryChildNodeEntry> entries = newArrayListWithCapacity(nodes.size());
for (Map.Entry<String, NodeId> entry : nodes.entrySet()) {
String name = entry.getKey();
final NodeState child = createChildNodeState(entry.getValue(), name);
if (child != null) {
entries.add(new MemoryChildNodeEntry(name, child));
}
}
return entries;
}
Aggregations