Package org.apache.jackrabbit.oak.plugins.tree

Examples of org.apache.jackrabbit.oak.plugins.tree.ImmutableTree


            throws RepositoryException {
        if (!node.hasProperty(JCR_UUID)) {
            // quick check without looking at type hierarchy
            return false;
        }
        ImmutableTree tree = new ImmutableTree(node.getNodeState());
        return ntMgr.isNodeType(tree, MIX_REFERENCEABLE);
    }
View Full Code Here


            throws RepositoryException {
        // ignore hidden tree
        if (childName.startsWith(":")) {
            return IGNORE;
        }
        ImmutableTree parentTree = new ImmutableTree(parent.getNodeState());
        NodeState childState;
        if (NT_FROZENNODE.equals(child.getName(JCR_PRIMARYTYPE))) {
            // need to translate into a regular node to get proper OPV value
            NodeBuilder builder = new MemoryNodeBuilder(EmptyNodeState.EMPTY_NODE);
            builder.setProperty(JCR_PRIMARYTYPE, child.getName(JCR_FROZENPRIMARYTYPE), Type.NAME);
            builder.setProperty(JCR_MIXINTYPES, child.getNames(JCR_MIXINTYPES), Type.NAMES);
            childState = builder.getNodeState();
        } else {
            childState = child.getNodeState();
        }
        ImmutableTree childTree = new ImmutableTree(
                parentTree, childName, childState);
        return ntMgr.getDefinition(parentTree, childTree).getOnParentVersion();
    }
View Full Code Here

            throws RepositoryException {
        if (property.getName().charAt(0) == ':') {
            // FIXME: handle child order properly
            return OnParentVersionAction.COPY;
        } else {
            return ntMgr.getDefinition(new ImmutableTree(node.getNodeState()),
                    property, false).getOnParentVersion();
        }
    }
View Full Code Here

    }

    @Nonnull
    @Override
    protected Tree getVersionStorage() {
        return new ImmutableTree(versionStorageNode.getNodeState());
    }
View Full Code Here

            this.builder = parent.builder.child(name);
            this.path = PathUtils.concat(parent.path, name);
        }

        private boolean isVersionable(ReadWriteVersionManager versionManager) {
            Tree tree = new ImmutableTree(ImmutableTree.ParentProvider.UNSUPPORTED, PathUtils.getName(path), builder.getNodeState());
            return versionManager.isVersionable(tree);
        }
View Full Code Here

    }

    private Validator visibleValidator(@Nonnull ImmutableTree source,
                                       @Nonnull ImmutableTree dest) {
        // TODO improve: avoid calculating the 'before' permissions in case the current parent permissions already point to the correct tree.
        ImmutableTree parent = moveCtx.rootBefore.getTree("/");
        TreePermission tp = getPermissionProvider().getTreePermission(parent, TreePermission.EMPTY);
        for (String n : source.getPath().split("/")) {
            tp = tp.getChildPermission(n, parent.getChild(n).getNodeState());
        }
        Validator validator = createValidator(source, dest, tp, this);
        return new VisibleValidator(validator, true, false);
    }
View Full Code Here

        private boolean processAdd(ImmutableTree child, MoveAwarePermissionValidator validator) throws CommitFailedException {
            // FIXME: respect and properly handle move-operations in the subtree
            String sourcePath = moveTracker.getSourcePath(child.getPath());
            if (sourcePath != null) {
                ImmutableTree source = rootBefore.getTree(sourcePath);
                if (source.exists()) {
                    // check permissions for adding the moved node at the target location.
                    validator.checkPermissions(child, false, Permissions.ADD_NODE | Permissions.NODE_TYPE_MANAGEMENT);
                    checkPermissions(source, Permissions.REMOVE_NODE);
                    return diff(source, child, validator);
                }
View Full Code Here

        private boolean processDelete(ImmutableTree child, MoveAwarePermissionValidator validator) throws CommitFailedException {
            // FIXME: respect and properly handle move-operations in the subtree
            String destPath = moveTracker.getDestPath(child.getPath());
            if (destPath != null) {
                ImmutableTree dest = rootAfter.getTree(destPath);
                if (dest.exists()) {
                    // check permissions for removing that node.
                    validator.checkPermissions(child, true, Permissions.REMOVE_NODE);
                    checkPermissions(dest, Permissions.ADD_NODE|Permissions.NODE_TYPE_MANAGEMENT);
                    return diff(child, dest, validator);
                }
View Full Code Here

            }
        }
        reverse.setProperty(REP_PREFIXES, mappings.keySet(), STRINGS);
        reverse.setProperty(REP_URIS, mappings.values(), STRINGS);

        this.namespaces = new ImmutableTree(forward.getNodeState());
        this.nsdata = new ImmutableTree(reverse.getNodeState());
    }
View Full Code Here

public final class ImmutableRoot implements Root {

    private final ImmutableTree rootTree;

    public ImmutableRoot(@Nonnull NodeState rootState) {
        this(new ImmutableTree(rootState));
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.tree.ImmutableTree

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.