Package org.apache.jackrabbit.oak.api

Examples of org.apache.jackrabbit.oak.api.Tree


    @CheckForNull
    private Tree getPrincipalRoot(@Nonnull String principalName) {
        if (principalTreeMap.containsKey(principalName)) {
            return principalTreeMap.get(principalName);
        } else {
            Tree principalRoot = PermissionUtil.getPrincipalRoot(permissionsTree, principalName);
            if (!principalRoot.exists()) {
                principalRoot = null;
            }
            principalTreeMap.put(principalName, principalRoot);
            return principalRoot;
        }
View Full Code Here


        }
    }

    @Override
    public void load(@Nonnull Collection<PermissionEntry> entries, @Nonnull String principalName, @Nonnull String path) {
        Tree principalRoot = getPrincipalRoot(principalName);
        if (principalRoot == null) {
            return;
        }
        String name = PermissionUtil.getEntryName(path);
        if (principalRoot.hasChild(name)) {
            Tree child = principalRoot.getChild(name);
            if (PermissionUtil.checkACLPath(child, path)) {
                loadPermissionEntries(path, entries, child, restrictionProvider);
            } else {
                // check for child node
                for (Tree node : child.getChildren()) {
                    if (PermissionUtil.checkACLPath(node, path)) {
                        loadPermissionEntries(path, entries, node, restrictionProvider);
                    }
                }
            }
View Full Code Here

        }
    }

    @Override
    public void load(@Nonnull Map<String, Collection<PermissionEntry>> entries, @Nonnull String principalName) {
        Tree principalRoot = getPrincipalRoot(principalName);
        if (principalRoot != null) {
            for (Tree entryTree : principalRoot.getChildren()) {
                loadPermissionEntries(entryTree, entries, restrictionProvider);
            }
        }
    }
View Full Code Here

        return getPrincipalRoot(principalName) != null;
    }

    @Override
    public long getNumEntries(@Nonnull String principalName) {
        Tree tree = getPrincipalRoot(principalName);
        return tree == null ? 0 : PermissionUtil.getNumPermissions(tree);
    }
View Full Code Here

        return tree == null ? 0 : PermissionUtil.getNumPermissions(tree);
    }

    @Override
    public long getModCount(@Nonnull String principalName) {
        Tree principalRoot = getPrincipalRoot(principalName);
        if (principalRoot != null) {
            PropertyState ps = principalRoot.getProperty(PermissionConstants.REP_MOD_COUNT);
            if (ps != null) {
                return ps.getValue(Type.LONG);
            }
        }
        return 0;
View Full Code Here

    @Override
    @Nonnull
    public PrincipalPermissionEntries load(@Nonnull String principalName) {
        PrincipalPermissionEntries ret = new PrincipalPermissionEntries(principalName);
        Tree principalRoot = getPrincipalRoot(principalName);
        if (principalRoot != null) {
            for (Tree entryTree : principalRoot.getChildren()) {
                loadPermissionEntries(entryTree, ret.getEntries(), restrictionProvider);
            }
            PropertyState ps = principalRoot.getProperty(PermissionConstants.REP_MOD_COUNT);
            ret.setModCount(ps == null ? -1 : ps.getValue(Type.LONG));
        }
        return ret;
    }
View Full Code Here

    //-----------------------------------------------< AccessControlManager >---
    @Nonnull
    @Override
    public AccessControlPolicy[] getPolicies(@Nullable String absPath) throws RepositoryException {
        String oakPath = getOakPath(absPath);
        Tree tree = getTree(oakPath, Permissions.READ_ACCESS_CONTROL, true);
        AccessControlPolicy policy = createACL(oakPath, tree, false);

        List<AccessControlPolicy> policies = new ArrayList<AccessControlPolicy>(2);
        if (policy != null) {
            policies.add(policy);
View Full Code Here

    @Nonnull
    @Override
    public AccessControlPolicy[] getEffectivePolicies(@Nullable String absPath) throws RepositoryException {
        String oakPath = getOakPath(absPath);
        Tree tree = getTree(oakPath, Permissions.READ_ACCESS_CONTROL, true);

        Root r = getRoot().getContentSession().getLatestRoot();
        tree = r.getTree(tree.getPath());

        List<AccessControlPolicy> effective = new ArrayList<AccessControlPolicy>();
        AccessControlPolicy policy = createACL(oakPath, tree, true);
        if (policy != null) {
            effective.add(policy);
        }
        if (oakPath != null) {
            String parentPath = Text.getRelativeParent(oakPath, 1);
            while (!parentPath.isEmpty()) {
                Tree t = r.getTree(parentPath);
                AccessControlPolicy plc = createACL(parentPath, t, true);
                if (plc != null) {
                    effective.add(plc);
                }
                parentPath = (PathUtils.denotesRoot(parentPath)) ? "" : Text.getRelativeParent(parentPath, 1);
View Full Code Here

    @Nonnull
    @Override
    public AccessControlPolicyIterator getApplicablePolicies(@Nullable String absPath) throws RepositoryException {
        String oakPath = getOakPath(absPath);
        Tree tree = getTree(oakPath, Permissions.READ_ACCESS_CONTROL, true);

        AccessControlPolicy policy = null;
        Tree aclTree = getAclTree(oakPath, tree);
        if (aclTree == null) {
            if (tree.hasChild(Util.getAclName(oakPath))) {
                // policy child node without tree being access controlled
                log.warn("Colliding policy child without node being access controllable ({}).", absPath);
            } else {
View Full Code Here

                String msg = "Failed to register custom privilege: Definition uses reserved namespace: " + name;
                throw new CommitFailedException("Privilege", 1, msg);
            }

            // validate the definition
            Tree tree = new ImmutableTree(ImmutableTree.ParentProvider.UNSUPPORTED, name, after);
            validateDefinition(tree);
        }

        // privilege definitions may not have child nodes (or another type of nodes
        // that is not handled by this validator anyway).
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.api.Tree

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.