Package org.apache.jackrabbit.api.jsr283.retention

Examples of org.apache.jackrabbit.api.jsr283.retention.RetentionPolicy


*/
public class RetentionPolicyTest extends AbstractRetentionTest {

    public void testSetInvalidRetentionPolicy() {
        try {
            RetentionPolicy invalidRPolicy = new RetentionPolicy() {
                public String getName() throws RepositoryException {
                    return "anyName";
                }
            };
            retentionMgr.setRetentionPolicy(testNodePath, invalidRPolicy);
View Full Code Here


        }
    }

    private void addRetentionPolicy(Path nodePath, PropertyImpl p) throws RepositoryException {
        synchronized (retentionMap) {
            RetentionPolicy rp = new RetentionPolicyImpl(p.getString(), ((PropertyId) p.getId()).getParentId(), session);
            retentionMap.put(nodePath, rp);
            retentionCnt++;
        }
    }
View Full Code Here

            throw new IllegalStateException("Not initialized.");
        }
        if (retentionCnt <= 0) {
            return false;
        }
        RetentionPolicy rp = null;
        PathMap.Element element = retentionMap.map(nodePath, true);
        if (element != null) {
            rp = (RetentionPolicy) element.get();
        }
        if (rp == null && checkParent ) {
View Full Code Here

            PathNotFoundException, AccessDeniedException, RepositoryException {

        NodeImpl n = (NodeImpl) session.getNode(absPath);
        session.getAccessManager().checkPermission(session.getQPath(absPath), Permission.RETENTION_MNGMT);

        RetentionPolicy rPolicy = null;
        if (n.isNodeType(REP_RETENTION_MANAGEABLE) && n.hasProperty(REP_RETENTION_POLICY)) {
            String jcrName = n.getProperty(REP_RETENTION_POLICY).getString();
            rPolicy = new RetentionPolicyImpl(jcrName, n.getNodeId(), session);
        }
       
View Full Code Here

        this.acRootPath = session.getJCRPath(acRootPath);
    }

    ACLTemplate getACL(Principal principal) throws RepositoryException {
        if (!session.getPrincipalManager().hasPrincipal(principal.getName())) {
            throw new AccessControlException("Unknown principal.");
        }
        String nPath = getPathToAcNode(principal);
        if (session.nodeExists(nPath)) {
            return (ACLTemplate) getPolicies(nPath)[0];
        } else {
View Full Code Here

    /**
     * @see AccessControlEditor#editAccessControlPolicies(Principal)
     */
    public AccessControlPolicy[] editAccessControlPolicies(Principal principal) throws RepositoryException {
        if (!session.getPrincipalManager().hasPrincipal(principal.getName())) {
            throw new AccessControlException("Unknown principal.");
        }
        String nPath = getPathToAcNode(principal);
        if (!session.nodeExists(nPath)) {
            createAcNode(nPath);
        }
View Full Code Here

                }
            }
        }
        // node either not access-controlled or the passed policy didn't apply
        // to the node at 'nodePath' -> throw exception.no policy was removed
        throw new AccessControlException("Policy " + policy + " does not apply to " + nodePath);
    }
View Full Code Here

     */
    private void checkProtectsNode(String nodePath) throws RepositoryException {
        if (session.nodeExists(nodePath)) {
            NodeImpl n = (NodeImpl) session.getNode(nodePath);
            if (n.isNodeType(NT_REP_ACL) || n.isNodeType(NT_REP_ACE)) {
                throw new AccessControlException("Node " + nodePath + " defines ACL or ACE.");
            }
        }
    }
View Full Code Here

     * @throws AccessControlException
     */
    private void checkValidPolicy(String nodePath, AccessControlPolicy policy)
            throws AccessControlException {
        if (policy == null || !(policy instanceof ACLTemplate)) {
            throw new AccessControlException("Attempt to set/remove invalid policy " + policy);
        }
        ACLTemplate acl = (ACLTemplate) policy;
        if (!nodePath.equals(acl.getPath())) {
            throw new AccessControlException("Policy " + policy + " is not applicable or does not apply to the node at " + nodePath);
        }
    }
View Full Code Here

    private Principal getPrincipal(String pathToACNode) throws RepositoryException {
        String name = Text.unescapeIllegalJcrChars(Text.getName(pathToACNode));
        PrincipalManager pMgr = session.getPrincipalManager();
        if (!pMgr.hasPrincipal(name)) {
            throw new AccessControlException("Unknown principal.");
        }
        return pMgr.getPrincipal(name);
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.api.jsr283.retention.RetentionPolicy

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.