Package org.apache.slide.common

Examples of org.apache.slide.common.Uri


        Security security = nsaToken.getSecurityHelper();
        security.checkCredentials(sToken, object, config.getReadOwnPermissionsAction());
       
        try {
            String actionsPath = config.getActionsPath();
            Uri actionsPathUri = nsaToken.getUri(sToken, actionsPath);
            ObjectNode actionsPathNode = actionsPathUri.getStore().retrieveObject(actionsPathUri);
            Enumeration actions = actionsPathNode.enumerateChildren();
            while (actions.hasMoreElements()) {
                ActionNode aNode = ActionNode.getActionNode((String)actions.nextElement());
                if (security.hasPermission(sToken, object, aNode)) {
                    xmlValue.add(createPrivilege(aNode.getPath().lastSegment()));
View Full Code Here


                ? (XMLValue)v
                : new XMLValue((String)v);
        }
        else {
            XMLValue xmlValue = new XMLValue();
            Uri principalUri = nsaToken.getUri(sToken, revisionDescriptors.getUri());
            SubjectNode principalNode = (SubjectNode)principalUri.getStore().retrieveObject(principalUri);
            Enumeration roles = ((ACLSecurityImpl)nsaToken.getSecurityHelper()).getGroupMembership(sToken, principalNode);     
            while (roles.hasMoreElements()) {
                String rolePath = (String)roles.nextElement();
    // FIXME wihtout servletPath??
                String roleHref = contextPath+rolePath;
View Full Code Here

        throws ServiceAccessException, ObjectIsAlreadyLockedException,
        AccessDeniedException, ObjectNotFoundException {
       
        ObjectIsAlreadyLockedException nestedException =
            new ObjectIsAlreadyLockedException(lockToken.getObjectUri());
        Uri objectUri = namespace.getUri(slideToken, lockToken.getObjectUri(), true);
        boolean canLock =
            !isLockedInternal(slideToken, lockToken, true, nestedException);
       
        // Then we try to lock the subject.
        // If the User doesn't have enough priviledges to accomplish this
        // action, we will get a SecurityException which will in turn be
        // thrown by this function.
        if (canLock) {
            ObjectNode lockedObject = objectUri.getStore()
                .retrieveObject(objectUri);
            securityHelper
                .checkCredentials(slideToken, lockedObject,
                                  namespaceConfig.getLockObjectAction());
            objectUri.getStore().putLock(objectUri, lockToken);
        } else {
            throw nestedException;
        }
       
    }
View Full Code Here

        } catch (ObjectNotFoundException e) {
            return false;
        }
       
        // all checks successful, so try to actually remove the lock
        Uri lockedUri = namespace.getUri(slideToken, lockToken.getObjectUri(),
                                         true);
        lockedUri.getStore().removeLock(lockedUri, lockToken);
        return true;
    }
View Full Code Here

     */
    public void renew(SlideToken slideToken, NodeLock lockToken,
                      Date newExpirationDate)
        throws ServiceAccessException, LockTokenNotFoundException {
        lockToken.setExpirationDate(newExpirationDate);
        Uri lockedUri = namespace.getUri(slideToken, lockToken.getObjectUri());
        lockedUri.getStore().renewLock(lockedUri, lockToken);
    }
View Full Code Here

        throws ServiceAccessException, AccessDeniedException,
        LockTokenNotFoundException, ObjectNotFoundException {
       
        // We retrieve the enumeration of locks which have been put on the
        // subject.
        Uri subjectUri = namespace.getUri(slideToken, subject.getUri());
        Enumeration locks = subjectUri.getStore()
            .enumerateLocks(subjectUri);
        // Then, try to kill each individual lock.
        while (locks.hasMoreElements()) {
            securityHelper
                .checkCredentials(slideToken, subject,
                                  namespaceConfig.getKillLockAction());
            subjectUri.getStore()
                .killLock(subjectUri, (NodeLock) locks.nextElement());
        }
       
    }
View Full Code Here

                                      boolean inherited)
        throws ServiceAccessException, ObjectNotFoundException,
        LockTokenNotFoundException {
       
        // We retrieve the LockStore service from the namespace.
        Uri subjectUri = namespace.getUri(slideToken, objectUri);
       
        Enumeration scopes = null;
        if (inherited) {
            // traverse the namespace up to the root node, and add any locks
            // found in the process
            scopes = subjectUri.getScopes();
        } else {
            // only return the locks that explicitly and directly lock the
            // given subject
            Vector scopeVector = new Vector();
            scopeVector.add(subjectUri.toString());
            scopes = scopeVector.elements();
        }
        Vector locksVector = new Vector();
        while (scopes.hasMoreElements()) {
            String currentScope = (String) scopes.nextElement();
            Uri currentScopeUri =
                namespace.getUri(slideToken, currentScope);
            Enumeration currentLocks =
                currentScopeUri.getStore().enumerateLocks(currentScopeUri);
            while (currentLocks.hasMoreElements()) {
                NodeLock currentLockToken =
                    (NodeLock) currentLocks.nextElement();
                if (currentLockToken.hasExpired()) {
                    // FIXME: do cleanup of locks someplace else
                    try {
                        currentScopeUri.getStore()
                            .removeLock(currentScopeUri, currentLockToken);
                    }
                    catch (LockTokenNotFoundException ex) {
                        // ignore
                    }
View Full Code Here

                else {
                    return;
                }
            }
           
            Uri objectUri = namespace.getUri(token, object.getUri());
            ObjectNode realObject = objectUri.getStore()
                .retrieveObject(objectUri);
            try {
                checkLock(token, realObject, (SubjectNode)securityHelper.getPrincipal(token), action);
                token.cacheLock(object, action, false);
            }
View Full Code Here

     * @param    listener            an UnlockListener
     * @throws   SlideException
     */
    public void clearExpiredLocks( SlideToken slideToken, String objectUri, UnlockListener listener ) throws SlideException {
       
        Uri uri =
            namespace.getUri(slideToken, objectUri);
        Enumeration currentLocks =
            uri.getStore().enumerateLocks(uri);
        while (currentLocks.hasMoreElements()) {
            NodeLock currentLockToken =
                (NodeLock) currentLocks.nextElement();
            if (currentLockToken.hasExpired()) {
                try {
                    uri.getStore().removeLock(uri, currentLockToken);
                    if( listener != null )
                        listener.afterUnlock( objectUri );
                }
                catch (LockTokenNotFoundException ex) {
                    // ignore
View Full Code Here

    private boolean isLockedInternal
        (SlideToken slideToken, NodeLock token,
         boolean tryToLock, ObjectIsAlreadyLockedException nestedException)
        throws ServiceAccessException, ObjectNotFoundException {
       
        Uri objectUri = namespace.getUri(slideToken, token.getObjectUri(), false);
        ObjectNode initialObject = objectUri.getStore()
            .retrieveObject(objectUri);
        Enumeration scopes = objectUri.getScopes();
       
        // At the end of the test, this boolean's value is true if we can
        // actually put the lock on the desired subject.
        boolean isLocked = false;
       
        // We parse all of the scopes which encompass the subject we want
        // to lock.
        // First, we parse all the parents of the subject.
        while (!isLocked && scopes.hasMoreElements()) {
            String currentScope = (String) scopes.nextElement();
            Uri currentScopeUri = namespace.getUri(slideToken, currentScope, false);
            Enumeration locks = currentScopeUri.getStore()
                .enumerateLocks(currentScopeUri);
           
            while (locks.hasMoreElements()) {
                NodeLock currentLockToken = (NodeLock) locks.nextElement();
                if (!isCompatible(slideToken, token, currentLockToken,
                                  tryToLock)) {
                    isLocked = true;
                    if (nestedException != null) {
                        nestedException.addException
                            (new ObjectLockedException
                                 (currentScopeUri.toString()));
                    }
                }
            }
        }
       
        // Then, if the desired scope is inheritable, we parse the
        // locked subject's children to see if any of them has been
        // locked with an incompatible lock.
        if (token.isInheritable()) {
            Stack childrenStack = new Stack();
            childrenStack.push(initialObject);
            while (!isLocked && !childrenStack.empty()) {
                ObjectNode currentObject = (ObjectNode) childrenStack.pop();
                Uri currentObjectUri =
                    namespace.getUri(slideToken, currentObject.getUri(), false);
                // We test the compatibility of the child
                Enumeration locks = currentObjectUri.getStore()
                    .enumerateLocks(currentObjectUri);
               
                while (locks.hasMoreElements()) {
                    NodeLock currentLockToken = (NodeLock) locks.nextElement();
                    if (!isCompatible(slideToken, token,
                                      currentLockToken, tryToLock)) {
                        isLocked = true;
                        if (nestedException != null) {
                            nestedException.addException
                                (new ObjectLockedException
                                     (currentObjectUri.toString()));
                        }
                    }
                }
               
                // We get the children and add them to the Stack.
               
                Vector childrenVector = new Vector();
                Enumeration childrenUri = currentObject.enumerateChildren();
                while (childrenUri.hasMoreElements()) {
                    String childUri = (String) childrenUri.nextElement();
                    Uri tempUri = namespace.getUri(slideToken, childUri, false);
                    ObjectNode child = tempUri.getStore()
                        .retrieveObject(tempUri);
                    childrenVector.addElement(child);
                }
               
                Enumeration children = childrenVector.elements();
View Full Code Here

TOP

Related Classes of org.apache.slide.common.Uri

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.