Search in sources :

Example 1 with Matcher

use of org.apache.jackrabbit.oak.plugins.document.bundlor.Matcher in project jackrabbit-oak by apache.

the class DocumentNodeState method getChildNodeDoc.

//------------------------------< internal >--------------------------------
@CheckForNull
private AbstractDocumentNodeState getChildNodeDoc(String childNodeName) {
    AbstractDocumentNodeState secondaryState = getSecondaryNodeState();
    if (secondaryState != null) {
        NodeState result = secondaryState.getChildNode(childNodeName);
        //else return null
        if (result.exists()) {
            return (AbstractDocumentNodeState) result;
        }
        return null;
    }
    Matcher child = bundlingContext.matcher.next(childNodeName);
    if (child.isMatch()) {
        if (bundlingContext.hasChildNode(child.getMatchedPath())) {
            return createBundledState(childNodeName, child);
        } else {
            return null;
        }
    }
    return store.getNode(concat(getPath(), childNodeName), lastRevision);
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) EmptyNodeState(org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState) Matcher(org.apache.jackrabbit.oak.plugins.document.bundlor.Matcher) CheckForNull(javax.annotation.CheckForNull)

Example 2 with Matcher

use of org.apache.jackrabbit.oak.plugins.document.bundlor.Matcher in project jackrabbit-oak by apache.

the class DocumentNodeState method createBundlingContext.

private static BundlingContext createBundlingContext(Map<String, PropertyState> properties, boolean hasNonBundledChildren) {
    PropertyState bundlorConfig = properties.get(DocumentBundlor.META_PROP_PATTERN);
    Matcher matcher = Matcher.NON_MATCHING;
    boolean hasBundledChildren = false;
    if (bundlorConfig != null) {
        matcher = DocumentBundlor.from(bundlorConfig).createMatcher();
        hasBundledChildren = hasBundledProperty(properties, matcher, DocumentBundlor.META_PROP_BUNDLED_CHILD);
    }
    return new BundlingContext(matcher, properties, hasBundledChildren, hasNonBundledChildren);
}
Also used : Matcher(org.apache.jackrabbit.oak.plugins.document.bundlor.Matcher) PropertyState(org.apache.jackrabbit.oak.api.PropertyState)

Aggregations

Matcher (org.apache.jackrabbit.oak.plugins.document.bundlor.Matcher)2 CheckForNull (javax.annotation.CheckForNull)1 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)1 EmptyNodeState (org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState)1 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)1