Package org.apache.jackrabbit.oak.plugins.nodetype

Examples of org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager


        return false;
    }

    private static boolean registerCugNodeTypes(@Nonnull final Root root) {
        try {
            ReadOnlyNodeTypeManager ntMgr = new ReadOnlyNodeTypeManager() {
                @Override
                protected Tree getTypes() {
                    return root.getTree(NodeTypeConstants.NODE_TYPES_PATH);
                }
            };
            if (!ntMgr.hasNodeType(NT_REP_CUG_POLICY)) {
                InputStream stream = CugConfiguration.class.getResourceAsStream("cug_nodetypes.cnd");
                try {
                    NodeTypeRegistry.register(root, stream, "cug node types");
                    return true;
                } finally {
View Full Code Here


            Tree pwdTree = root.getTree(user.getPath()).getChild(UserConstants.REP_PWD);
            assertTrue(pwdTree.exists());
            assertTrue(TreeUtil.isNodeType(pwdTree, UserConstants.NT_REP_PASSWORD, root.getTree(NodeTypeConstants.NODE_TYPES_PATH)));

            ReadOnlyNodeTypeManager ntMgr = ReadOnlyNodeTypeManager.getInstance(root, getNamePathMapper());
            assertTrue(ntMgr.getDefinition(pwdTree.getParent(), pwdTree).isProtected());

            PropertyState property = pwdTree.getProperty(UserConstants.REP_PASSWORD_LAST_MODIFIED);
            assertNotNull(property);
            assertEquals(Type.LONG, property.getType());
            assertTrue(property.getValue(Type.LONG, 0) > 0);
View Full Code Here

        Tree parent = propertyLocation.getParent().getTree();
        if (parent == null) {
            log.debug("Unable to determine definition of authorizable property at " + propertyLocation.getPath());
            return null;
        }
        ReadOnlyNodeTypeManager nodeTypeManager = authorizable.getUserManager().getNodeTypeManager();
        PropertyDefinition def = nodeTypeManager.getDefinition(parent, property, true);
        if (def.isProtected() || (authorizablePath.equals(parent.getPath())
                && !def.getDeclaringNodeType().isNodeType(UserConstants.NT_REP_AUTHORIZABLE))) {
            return null;
        } // else: non-protected property somewhere in the subtree of the user tree.
View Full Code Here

        return property;
    }

    private void checkProtectedProperty(Tree parent, PropertyState property) throws RepositoryException {
        ReadOnlyNodeTypeManager nodeTypeManager = authorizable.getUserManager().getNodeTypeManager();
        PropertyDefinition def = nodeTypeManager.getDefinition(parent, property, false);
        if (def.isProtected()) {
            throw new ConstraintViolationException(
                    "Attempt to set an protected property " + property.getName());
        }
    }
View Full Code Here

        AccessControlConfiguration acConfig = securityProvider.getAccessControlConfiguration();
        RestrictionProvider restrictionProvider = acConfig.getRestrictionProvider(NamePathMapper.DEFAULT);

        Map<String, Privilege> privileges = getPrivileges(before, securityProvider.getPrivilegeConfiguration());
        ReadOnlyNodeTypeManager ntMgr = ReadOnlyNodeTypeManager.getInstance(before);

        return new AccessControlValidator(rootBefore, rootAfter, privileges, restrictionProvider, ntMgr);
    }
View Full Code Here

                system.getChildNode(NodeTypeConstants.JCR_NODE_TYPES);
        if (types == null) {
            return;
        }

        NodeTypeManager manager = new ReadOnlyNodeTypeManager() {
            @Override @CheckForNull
            protected Tree getTypes() {
                return new ReadOnlyTree(types);
            }
        };

        BooleanQuery bq = new BooleanQuery();
        NodeType type = manager.getNodeType(name);
        bq.add(createNodeTypeQuery(type), Occur.SHOULD);
        NodeTypeIterator iterator = type.getSubtypes();
        while (iterator.hasNext()) {
            bq.add(createNodeTypeQuery(iterator.nextNodeType()), Occur.SHOULD);
        }
View Full Code Here

    }

    private Iterable<NodeType> getNodeTypes() throws RepositoryException {
        if (nodeTypes == null) {
            List<NodeType> types = new ArrayList<NodeType>();
            NodeTypeManager manager = new ReadOnlyNodeTypeManager() {
                @Override @CheckForNull
                protected Tree getTypes() {
                    return getTree(NodeTypeConstants.NODE_TYPES_PATH);
                }
            };
            NodeType type = manager.getNodeType(nodeTypeName);
            types.add(type);

            NodeTypeIterator it = type.getSubtypes();
            while (it.hasNext()) {
                types.add(it.nextNodeType());
View Full Code Here

        return filter.getNodeType() != null
                && !filter.getNodeType().equals(NT_BASE);
    }

    private static Iterable<String> resolveNodeType(NodeState root, String nodeType) {
        ReadOnlyNodeTypeManager ntMgr = new NTManager(root);
        Set<String> ntNames = Sets.newHashSet();
        try {
            NodeType nt = ntMgr.getNodeType(nodeType);
            for (NodeTypeIterator types = nt.getSubtypes(); types.hasNext();) {
                ntNames.add(types.nextNodeType().getName());
            }
            ntNames.add(nodeType);
        } catch (RepositoryException e) {
View Full Code Here

        Map<String, PrivilegeDefinition> privilegeDefinitions = reader.readDefinitions();

        AccessControlConfiguration acConfig = securityProvider.getAccessControlConfiguration();
        RestrictionProvider restrictionProvider = acConfig.getRestrictionProvider(NamePathMapper.DEFAULT);

        ReadOnlyNodeTypeManager ntMgr = ReadOnlyNodeTypeManager.getInstance(before);

        return new AccessControlValidator(rootBefore, rootAfter, privilegeDefinitions, restrictionProvider, ntMgr);
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager

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.