Search in sources :

Example 1 with MemoryChildNodeEntry

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;
        }
    };
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) MemoryChildNodeEntry(org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry)

Example 2 with MemoryChildNodeEntry

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);
    }
}
Also used : PathTracker(org.apache.jackrabbit.oak.namepath.PathTracker) MemoryChildNodeEntry(org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry) IdentifierTracker(org.apache.jackrabbit.oak.plugins.identifier.IdentifierTracker)

Example 3 with MemoryChildNodeEntry

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());
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) ChildNodeEntry(org.apache.jackrabbit.oak.spi.state.ChildNodeEntry) MemoryChildNodeEntry(org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry) MemoryChildNodeEntry(org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry)

Example 4 with MemoryChildNodeEntry

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;
}
Also used : EmptyNodeState(org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState) NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) AbstractNodeState(org.apache.jackrabbit.oak.spi.state.AbstractNodeState) NodeId(org.apache.jackrabbit.core.id.NodeId) MemoryChildNodeEntry(org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry) Map(java.util.Map) Maps.newHashMap(com.google.common.collect.Maps.newHashMap) ImmutableMap(com.google.common.collect.ImmutableMap) Maps.newLinkedHashMap(com.google.common.collect.Maps.newLinkedHashMap) LinkedHashMap(java.util.LinkedHashMap) Nonnull(javax.annotation.Nonnull)

Aggregations

MemoryChildNodeEntry (org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry)4 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)3 ImmutableMap (com.google.common.collect.ImmutableMap)1 Maps.newHashMap (com.google.common.collect.Maps.newHashMap)1 Maps.newLinkedHashMap (com.google.common.collect.Maps.newLinkedHashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Nonnull (javax.annotation.Nonnull)1 NodeId (org.apache.jackrabbit.core.id.NodeId)1 PathTracker (org.apache.jackrabbit.oak.namepath.PathTracker)1 IdentifierTracker (org.apache.jackrabbit.oak.plugins.identifier.IdentifierTracker)1 EmptyNodeState (org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState)1 AbstractNodeState (org.apache.jackrabbit.oak.spi.state.AbstractNodeState)1 ChildNodeEntry (org.apache.jackrabbit.oak.spi.state.ChildNodeEntry)1