Package org.apache.jackrabbit.oak.spi.state

Examples of org.apache.jackrabbit.oak.spi.state.NodeState


    }

    @Override
    public NodeState getChildNode(String name) {
        checkArgument(!checkNotNull(name).isEmpty());
        NodeState state = nodes.get(name);
        if (state != null) {
            return state;
        } else {
            return MISSING_NODE;
        }
View Full Code Here


        Map<String, NodeState> newNodes =
                new HashMap<String, NodeState>(nodes);
        for (ChildNodeEntry entry : base.getChildNodeEntries()) {
            String name = entry.getName();
            NodeState before = entry.getNodeState();
            NodeState after = newNodes.remove(name);
            if (after == null) {
                if (!diff.childNodeDeleted(name, before)) {
                    return false;
                }
            } else if (after != before) {
View Full Code Here

        };
    }

    @Override
    public long count(NodeState indexMeta, Set<String> values, int max) {
        NodeState index = indexMeta.getChildNode(INDEX_CONTENT_NODE_NAME);
        long count = 0;
        if (values == null) {
            PropertyState ec = indexMeta.getProperty(ENTRY_COUNT_PROPERTY_NAME);
            if (ec != null) {
                return ec.getValue(Type.LONG);
            }
            count = index.getChildNodeCount(max);
            // "is not null" queries typically read more data
            count *= 10;
        } else if (values.size() == 1) {
            NodeState k = index.getChildNode(values.iterator().next());
            if (k.exists()) {
                count = k.getProperty("entry").count();
            } else {
                count = 0;
            }
        } else {
            count = values.size();
View Full Code Here

        SegmentNodeState before = null;
        ModifiedNodeState after = null;
        if (state instanceof ModifiedNodeState) {
            after = (ModifiedNodeState) state;
            NodeState base = after.getBaseState();
            if (store.isInstance(base, SegmentNodeState.class)) {
                before = (SegmentNodeState) base;
            }
        }
View Full Code Here

    }

    @Override
    public NodeState getChildNode(String name) {
        // checkArgument(!checkNotNull(name).isEmpty());  // TODO: should be caught earlier
        NodeState child = nodes.get(name);
        if (child == null) {
            child = base.getChildNode(name);
        }
        return child;
    }
View Full Code Here

            }
        }

        for (Map.Entry<String, NodeState> entry : nodes.entrySet()) {
            String name = entry.getKey();
            NodeState before = base.getChildNode(name);
            NodeState after = entry.getValue();
            if (!after.exists()) {
                if (before.exists() && !diff.childNodeDeleted(name, before)) {
                    return false;
                }
            } else if (!before.exists()) {
                if (!diff.childNodeAdded(name, after)) {
                    return false;
                }
            } else if (before != after // TODO: fastEquals?
                    && !diff.childNodeChanged(name, before, after)) {
                return false;
            }
        }

        return this.base.compareAgainstBaseState(base, new NodeStateDiff() {
            @Override
            public boolean propertyAdded(PropertyState after) {
                return properties.containsKey(after.getName())
                        || diff.propertyAdded(after);
            }
            @Override
            public boolean propertyChanged(
                    PropertyState before, PropertyState after) {
View Full Code Here

                ParseException e2 = getSyntaxError("could not convert node type name " + nodeTypeName);
                e2.initCause(e);
                throw e2;
            }
        }
        NodeState type = types.getChildNode(nodeTypeName);
        if (!type.exists()) {
            throw getSyntaxError("unknown node type");
        }

        String selectorName = nodeTypeName;
        if (readIf("AS")) {
View Full Code Here

     * @return The permissions for this tree.
     */
    private TreePermission getTreePermission() {
        if (treePermission == null
                || rootPermission != rootBuilder.treePermission) {
            NodeState base = builder.getBaseState();
            if (parent == null) {
                ImmutableTree baseTree = new ImmutableTree(base, new TreeTypeProviderImpl(acContext));
                treePermission = permissionProvider.get().getTreePermission(baseTree, TreePermission.EMPTY);
                rootPermission = treePermission;
            } else {
View Full Code Here

                addAll(orderedChildNames, node.getChildNodeNames());
            }

            int index = 0;
            for (String childName : orderedChildNames) {
                NodeState ace = node.getChildNode(childName);
                if (isACE.apply(ace)) {
                    AcEntry entry = new AcEntry(ace, accessControlledPath, index);
                    List<AcEntry> list = entries.get(entry.principalName);
                    if (list == null) {
                        list = new ArrayList<AcEntry>();
View Full Code Here

        }
    }

    @Override
    public NodeState getChildNode(@Nonnull String name) {
        NodeState child = state.getChildNode(checkNotNull(name));
        if (child.exists() && !treePermission.canReadAll()) {
            ChildNodeEntry entry = new MemoryChildNodeEntry(name, child);
            return new WrapChildEntryFunction().apply(entry).getNodeState();
        } else {
            return child;
        }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.state.NodeState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.