Package org.apache.slide.structure

Examples of org.apache.slide.structure.ObjectNode


       
        NodeRevisionDescriptor nrd = null;
        NodeRevisionDescriptors nrds = null;
        ResourceKind resourceKind = null;
        String versionHistoryUri = null;
        ObjectNode collectionNode = structure.retrieve(slideToken, resourcePath);
        Enumeration children = structure.getChildren(slideToken, collectionNode);
        while (children.hasMoreElements()) {
           
            ObjectNode child = (ObjectNode)children.nextElement();
            if (child.hasChildren()) {
                execute(child.getUri(), multistatusElm, depth-1);
            }
            else {
                nrds = content.retrieve(slideToken, child.getUri());
                nrd = content.retrieve(slideToken, nrds);
                resourceKind = AbstractResourceKind.determineResourceKind(token, child.getUri(), nrd);
                versionHistoryUri = null;
               
                if (resourceKind instanceof VersionControlled) {
                    versionHistoryUri = getHistoryUriOfVCR(nrd);
                }
               
                if (versionHistoryUri != null) {
                    boolean found = false;
                    Iterator iterator = versionHistorySet.iterator();
                    String currentHistoryUri = null;
                    while ( !found && iterator.hasNext() ) {
                        currentHistoryUri = ((Element)iterator.next()).getText();
                        if (currentHistoryUri != null) {
                            currentHistoryUri = WebdavUtils.getSlidePath(currentHistoryUri, contextPath);
                        }
                        found = versionHistoryUri.equals(currentHistoryUri);
                    }
                    if (found) {
                        multistatusElm.addContent(getResponseElement(slideToken, child.getUri(), nrd.getRevisionNumber(), requestedProperties));
                    }
                }
            }
        }
    }
View Full Code Here


        if (nodeStore.cacheResults()) {
            Object tempObject = objectsCache.get(uri.toString());
            if (tempObject != null) {
                return ((ObjectNode) tempObject).cloneObject();
            } else {
                ObjectNode objectNode = nodeStore.retrieveObject(uri);
                objectNode.validate(uri.toString());
                objectsCache.put(uri.toString(), objectNode.cloneObject());
                return objectNode;
            }
        } else {
            return super.retrieveObject(uri);
        }
View Full Code Here

            } catch (ClassNotFoundException e) {
                // Class loading failed : The requested class was not found
                // We throw an exception and interrupt the loading of the file.
                throw new UnknownObjectClassException(className);
            }
            ObjectNode object = null;
            try {
                // Get a new instance of the class
                object = (ObjectNode) objectClass.newInstance();
            } catch(InstantiationException e) {
                // Instantiation failed for some reason
View Full Code Here

        responseElement.addContent(statusElement);

        Enumeration childrenEnum = null;
        try {
            if ( isCollection(resourcePath) && (depth > 0) ) {
                ObjectNode currentNode = structure.retrieve(slideToken, resourcePath);
                childrenEnum = structure.getChildren(slideToken, currentNode);
            }

            checkPreconditions(updateSourcePath, updateLabelName, resourcePath);
View Full Code Here

     * @exception ServiceAccessException Error accessing the Descriptors Store
     * @exception ObjectNotFoundException The object to retrieve was not found
     */
    public ObjectNode retrieveObject(Uri uri)
        throws ServiceAccessException, ObjectNotFoundException {
        ObjectNode objectNode = null;
        if (isForceStoreEnlistment(uri)) {
            enlist(nodeStore);
            try {
                objectNode = nodeStore.retrieveObject(uri);
            catch (ServiceAccessException e) {
                delist(nodeStore, false);
                throw e;
            } catch (ObjectNotFoundException e) {
                // Note : Failed reads aren't considered fatal (ie, the
                // transaction won't be always rolledback when committed)
                delist(nodeStore);
                throw e;
            } catch (Throwable t) {
                delist(nodeStore, false);
                // Wrap everything else in a ServiceAccessException
                throw new ServiceAccessException(nodeStore, t);
            }
            delist(nodeStore);
        } else {
            try {
                objectNode = nodeStore.retrieveObject(uri);
            } catch (ServiceAccessException e) {
                throw e;
            } catch (ObjectNotFoundException e) {
                throw e;
            } catch (Throwable t) {
                // Wrap everything else in a ServiceAccessException
                throw new ServiceAccessException(nodeStore, t);
            }
        }
        objectNode.validate(uri.toString());
        return objectNode;
    }
View Full Code Here

        LinkedObjectNotFoundException, ServiceAccessException, ObjectLockedException {
       
        String originalUri = strUri;
        strUri = redirectUri( originalUri ); // security token null - is ignored anyway
       
        ObjectNode associatedObject =
            structureHelper.retrieve(token, strUri, false);
       
        // Checking security and locking
        securityHelper.checkCredentials
            (token, associatedObject,
View Full Code Here

       
        boolean granted = false;
        boolean denied = false;
        boolean rootObjectReached = false;
       
        ObjectNode courObject = object;
       
        Uri subjectUri = namespace.getUri(subject.getUri());
        Uri actionUri = namespace.getUri(action.getUri());
       
        // check if allready granded
       
        while (!granted && !denied && !rootObjectReached) {
           
            Uri courUri = namespace.getUri(courObject.getUri());
            Enumeration permissions = courUri.getStore()
                .enumeratePermissions(courUri);
           
            while (!granted && !denied && permissions.hasMoreElements()) {
               
                boolean oldGranted = granted;
                boolean oldDenied = denied;
               
                NodePermission permission =
                    (NodePermission) permissions.nextElement();
                String permissionSubject = permission.getSubjectUri();

                if (permissionSubject == SubjectNode.SELF_URI) {
                    boolean check;
                    check = object.getUri().equals(subjectUri.toString());
                    if (permission.isInheritable()) {
                        String subjectUriString = subjectUri.toString();
                        if(!subjectUriString.endsWith("/"))
                            subjectUriString = subjectUriString + "/";
                       
                        check |= object.getUri().startsWith(subjectUriString);
                    }
                   
                    // Self permission
                    granted = (!permission.isNegative())
                        && (check)
                        && (actionUri.toString()
                                .startsWith(permission.getActionUri()));
                    denied = (permission.isNegative())
                        && (check)
                        && (actionUri.toString()
                                .startsWith(permission.getActionUri()));
                   
                } else if (permission.isInheritable()
                           || permission.getObjectUri().equals(object.getUri())) {
                   
                    if (permissionSubject.startsWith("/") || permissionSubject == SubjectNode.ALL_URI) {
                       
                        // Node permission
                        String permSubj = permission.getSubjectUri();
                        String permActn = permission.getActionUri();
                        boolean match = false;
                        if (permSubj == SubjectNode.ALL_URI) {
                            match = true;
                        }
                        else {
                            if(!permSubj.endsWith("/"))
                                permSubj = permSubj + "/";
                            match = subjectUri.toString().
                                equals(permission.getSubjectUri()) ||
                                subjectUri.toString().startsWith(permSubj);
                        }
                        if (permActn == ActionNode.ALL_URI) {
                            match &= true;
                        }
                        else {
                            match &= actionUri.toString().
                                startsWith(permActn);
                        }
                       
                        granted = (!permission.isNegative()) && match;
                        denied = permission.isNegative() && match;
                       
                    } else if (permissionSubject.startsWith("+")) {
                       
                        // Permission group which needs to be expanded
                        Uri permissionSubjectUri =
                            namespace.getUri(permissionSubject.substring(1));
                        ObjectNode group;
                        try {
                            group = permissionSubjectUri.getStore().retrieveObject(permissionSubjectUri);
                        } catch (ObjectNotFoundException onfe) {
                            namespace.getLogger().log(
                                "Gracefully ignoring permission of dangling subject " + permissionSubjectUri,
                                onfe,
                                LOG_CHANNEL,
                                Logger.WARNING);
                            // as a fix of bug #27018, gracefully ignore permissions having dangling subjects
                            continue;
                        }
                        // if the node is a GroupNode, expand it out to
                        // normal permissions
                        if (group instanceof
                            org.apache.slide.structure.GroupNode ) {
                            if (group.hasChildren()) {
                                Enumeration groupMembers =
                                    group.enumerateChildren();
                                // parse thru the children of the group and
                                // check permissions on each
                                while (groupMembers.hasMoreElements()) {
                                   
                                    oldGranted = granted;
                                    oldDenied = denied;
                                   
                                    Uri childUri =
                                        namespace.getUri
                                        ((String) groupMembers.nextElement());
                                    ObjectNode childNode;
                                    try {
                                        childNode = childUri.getStore().retrieveObject(childUri);
                                    } catch (ObjectNotFoundException onfe) {
                                        namespace.getLogger().log(
                                            "Gracefully ignoring permission of dangling subject "
                                                + childUri,
                                            onfe,
                                            LOG_CHANNEL,
                                            Logger.WARNING);
                                        // as a fix of bug #27018, gracefully ignore permissions having dangling subjects
                                        continue;
                                    }
                                    String childSubjectUri = childNode
                                        instanceof LinkNode ?
                                        ((LinkNode) childNode)
                                        .getLinkedUri() :
                                        childNode.getUri() ;
                                   
                                    String testUri;
                                    if(!childSubjectUri.endsWith("/"))
                                        testUri = childSubjectUri+"/";
                                    else
View Full Code Here

         NodeRevisionNumber revisionNumber)
        throws ObjectNotFoundException, AccessDeniedException,
        LinkedObjectNotFoundException, ServiceAccessException,
        RevisionDescriptorNotFoundException, ObjectLockedException {
       
        ObjectNode associatedObject = structureHelper.retrieve
            (token, revisionDescriptors.getUri(), false);
       
        // Checking security and locking
        securityHelper.checkCredentials
            (token, associatedObject,
View Full Code Here

        throws ObjectNotFoundException, AccessDeniedException,
        LinkedObjectNotFoundException, ServiceAccessException,
        RevisionNotFoundException, RevisionContentNotFoundException,
        ObjectLockedException {
       
        ObjectNode associatedObject =
            structureHelper.retrieve(token, strUri, false);
       
        // Checking security and locking
        securityHelper.checkCredentials
            (token, associatedObject,
View Full Code Here

     * @exception ServiceAccessException Error accessing the Descriptors Store
     * @exception ObjectNotFoundException The object to update was not found
     */
    public void storeObject(Uri uri, ObjectNode object)
        throws ServiceAccessException, ObjectNotFoundException {
        ObjectNode tempObject = object.cloneObject();
        tempObject.validate(uri.toString());
        enlist(nodeStore);
        try {
            nodeStore.storeObject(uri, tempObject);
        } catch (ServiceAccessException e) {
            delist(nodeStore, false);
View Full Code Here

TOP

Related Classes of org.apache.slide.structure.ObjectNode

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.