Package org.apache.jackrabbit.oak.core

Examples of org.apache.jackrabbit.oak.core.ReadOnlyTree


        return null;
    }

    @Override
    public Validator childNodeDeleted(String name, NodeState before) throws CommitFailedException {
        NodeUtil nodeBefore = new NodeUtil(new ReadOnlyTree(parentBefore, name, before));
        if (nodeBefore.hasPrimaryNodeTypeName(JcrConstants.NT_NODETYPE)) {
            if (isBuiltInNodeType(name)) {
                throw new CommitFailedException(new ConstraintViolationException("Attempt to unregister a built-in node type"));
            }
        }
View Full Code Here


    @Override
    public Validator childNodeAdded(String name, NodeState after) throws CommitFailedException {
        try {
            getParentType().checkAddChildNode(name, getNodeType(after));

            ReadOnlyTree addedTree = new ReadOnlyTree(parent, name, after);
            EffectiveNodeType addedType = ntm.getEffectiveNodeType(addedTree);
            addedType.checkMandatoryItems(addedTree);
            return new TypeValidator(ntm, new ReadOnlyTree(parent, name, after), mapper);
        } catch (RepositoryException e) {
            throw new CommitFailedException("Cannot add node '" + name + "' at " + parent.getPath(), e);
        } catch (IllegalStateException e) {
            throw new CommitFailedException("Cannot add node '" + name + "' at " + parent.getPath(), e);
        }
View Full Code Here

        }
    }

    @Override
    public Validator childNodeChanged(String name, NodeState before, NodeState after) throws CommitFailedException {
        return new TypeValidator(ntm, new ReadOnlyTree(parent, name, after), mapper);
    }
View Full Code Here

            try {
                if (isVersionable == null) {
                    // this is not 100% correct, because t.getPath() will
                    // not return the correct path for nodeAfter, but is
                    // sufficient to check if it is versionable
                    Tree t = new ReadOnlyTree(nodeAfter.getNodeState());
                    isVersionable = vMgr.isVersionable(t);
                }
                return isVersionable;
            } catch (RepositoryException e) {
                throw new UncheckedRepositoryException(e);
View Full Code Here

    @Override
    public Validator getRootValidator(NodeState before, NodeState after) {
        Validator validator = new RegistrationValidator(
                ReadOnlyNodeTypeManager.getInstance(before),
                ReadOnlyNodeTypeManager.getInstance(after),
                new ReadOnlyTree(before), new ReadOnlyTree(after));
        return new SubtreeValidator(validator, JcrConstants.JCR_SYSTEM, NodeTypeConstants.JCR_NODE_TYPES);
    }
View Full Code Here

    }

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

    }

    @Nonnull
    @Override
    protected Root getWorkspaceRoot() {
        return new SimpleRoot(new ReadOnlyTree(workspaceRoot.getNodeState()));
    }
View Full Code Here

    public Validator getRootValidator(NodeState before, NodeState after) {
        Subject subject = Subject.getSubject(AccessController.getContext());
        Set<Principal> principals = (subject != null) ? subject.getPrincipals() : Collections.<Principal>emptySet();
        CompiledPermissions permissions = acConfiguration.getPermissionProvider(NamePathMapper.DEFAULT).getCompiledPermissions(/*TODO*/null, principals);

        NodeUtil rootBefore = new NodeUtil(new ReadOnlyTree(before));
        NodeUtil rootAfter = new NodeUtil(new ReadOnlyTree(after));
        return new PermissionValidator(rootBefore, rootAfter, permissions, this);
    }
View Full Code Here

    //--------------------------------------------------< ValidatorProvider >---
    @Nonnull
    @Override
    public Validator getRootValidator(NodeState before, NodeState after) {
        Tree treeBefore = new ReadOnlyTree(before);
        NodeUtil rootBefore = new NodeUtil(treeBefore);
        NodeUtil rootAfter = new NodeUtil(new ReadOnlyTree(after));

        PrivilegeDefinitionReader reader = securityProvider.getPrivilegeConfiguration().getPrivilegeDefinitionReader(treeBefore);
        Map<String, PrivilegeDefinition> privilegeDefinitions = reader.readDefinitions();

        AccessControlConfiguration acConfig = securityProvider.getAccessControlConfiguration();
View Full Code Here

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

        // primary node type name must be rep:privilege
        Tree tree = new ReadOnlyTree(null, name, after);
        PropertyState primaryType = tree.getProperty(JcrConstants.JCR_PRIMARYTYPE);
        if (primaryType == null || !NT_REP_PRIVILEGE.equals(primaryType.getValue(Type.STRING))) {
            throw new CommitFailedException("Privilege definition must have primary node type set to rep:privilege");
        }

        // additional validation of the definition
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.core.ReadOnlyTree

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.