Package org.apache.slide.structure

Examples of org.apache.slide.structure.ObjectNode


                performLabelOperation(resourcePath);
            }
            else if (depth > 0) {
               
                // process children recursivly
                ObjectNode currentNode = structure.retrieve(slideToken, resourcePath);
                Enumeration childrenEnum = structure.getChildren(slideToken, currentNode);
                if (childrenEnum != null) {
                    while (childrenEnum.hasMoreElements()) {
                        labelResource(((ObjectNode)childrenEnum.nextElement()).getUri(), depth-1, nestedSlideException);
                    }
View Full Code Here


        // 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);
View Full Code Here

                    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

        (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();
                while (children.hasMoreElements()) {
                    ObjectNode tempObject =
                        (ObjectNode) children.nextElement();
                    childrenStack.push(tempObject);
                }
            }
        }
View Full Code Here

            if (macroParameters.getParameter(Macro.PARENT_BINDINGS) != null) {
                Map parentBindings = (Map)macroParameters.getParameter(Macro.PARENT_BINDINGS);
                Iterator i = parentBindings.entrySet().iterator();
                while (i.hasNext()) {
                    Map.Entry me = (Map.Entry)i.next();
                    ObjectNode parentNode = structure.retrieve( slideToken, (String)me.getKey() );
                    ObjectNode destinationNode = structure.retrieve( slideToken, destinationUri );
                    String segment = (String)me.getValue();
                    structure.addBinding( slideToken, parentNode, segment, destinationNode );
                }
            }
        }
View Full Code Here

        Security security = nat.getSecurityHelper();
        Structure structure = nat.getStructureHelper();
       
        SlideToken slideToken = WebdavUtils.getSlideToken(req);
        String resourcePath = WebdavUtils.getRelativePath(req, config);
        ObjectNode object = structure.retrieve(slideToken, resourcePath);
        String name = object.getUri();
       
        // Number of characters to trim from the beginnings of filenames
        int trim = name.length();
        if (!name.endsWith("/"))
            trim += 1;
        if (name.equals("/"))
            trim = 1;
       
        PrintWriter writer = new PrintWriter(res.getWriter());
       
        // Render the page header
        writer.print("<html>\r\n");
        writer.print("<head>\r\n");
        writer.print("<meta http-equiv=\"Content-type\" content=\"text/html; charset=UTF-8\" >\r\n");
        writer.print("</meta>\r\n");
        writer.print("<title>");
        writer.print
            (Messages.format
                 ("org.apache.slide.webdav.GetMethod.directorylistingfor",
                  name));
        writer.print("</title>\r\n</head>\r\n");
        writer.print("<body bgcolor=\"white\">\r\n");
        writer.print("<table width=\"90%\" cellspacing=\"0\"" +
                         " cellpadding=\"5\" align=\"center\">\r\n");
       
        // Render the in-page title
        writer.print("<tr><td colspan=\"3\"><font size=\"+2\">\r\n<strong>");
        writer.print
            (Messages.format
                 ("org.apache.slide.webdav.GetMethod.directorylistingfor",
                  name));
        writer.print("</strong>\r\n</font></td></tr>\r\n");
       
        // Render the link to our parent (if required)
        String parentDirectory = name;
        if (parentDirectory.endsWith("/")) {
            parentDirectory =
                parentDirectory.substring(0, parentDirectory.length() - 1);
        }
        String scope = config.getScope();
        parentDirectory = parentDirectory.substring(scope.length());
        if (parentDirectory.lastIndexOf("/") >= 0) {
            parentDirectory = parentDirectory.substring(0, parentDirectory.lastIndexOf("/"));
            writer.print("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">\r\n");
            writer.print("<a href=\"");
            writer.print(WebdavUtils.getAbsolutePath("", req, config));
            if (parentDirectory.equals(""))
                parentDirectory = "/";
            writer.print(parentDirectory);   // I18N chars
            writer.print("\">");
            writer.print(Messages.format
                             ("org.apache.slide.webdav.GetMethod.parent",
                              parentDirectory));
            writer.print("</a>\r\n");
            writer.print("</td></tr>\r\n");
        }
       
        Enumeration permissionsList = null;
        Enumeration locksList = null;
        try {
            permissionsList =
                security.enumeratePermissions(slideToken, object.getUri());
            locksList = lock.enumerateLocks(slideToken, object.getUri(), false);
        } catch (SlideException e) {
            // Any security based exception will be trapped here
            // Any locking based exception will be trapped here
        }
       
        // Displaying ACL info
        if (org.apache.slide.util.Configuration.useIntegratedSecurity()) {
            displayPermissions(permissionsList, writer, false);
        }
       
        // Displaying lock info
        displayLocks(locksList, writer, false);
       
        writer.print("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">");
        writer.print("&nbsp;");
        writer.print("</td></tr>\r\n");
       
        // Render the column headings
        writer.print("<tr bgcolor=\"#cccccc\">\r\n");
        writer.print("<td align=\"left\" colspan=\"3\">");
        writer.print("<font size=\"+1\"><strong>");
        writer.print(Messages.message
                         ("org.apache.slide.webdav.GetMethod.filename"));
        writer.print("</strong></font></td>\r\n");
        writer.print("<td align=\"center\"><font size=\"+1\"><strong>");
        writer.print(Messages.message
                         ("org.apache.slide.webdav.GetMethod.size"));
        writer.print("</strong></font></td>\r\n");
        writer.print("<td align=\"right\"><font size=\"+1\"><strong>");
        writer.print(Messages.message
                         ("org.apache.slide.webdav.GetMethod.lastModified"));
        writer.print("</strong></font></td>\r\n");
        writer.print("</tr>\r\n");
       
        Enumeration resources = object.enumerateChildren();
        boolean shade = false;
       
        while (resources.hasMoreElements()) {
            String currentResource = (String) resources.nextElement();
            NodeRevisionDescriptor currentDescriptor = null;
View Full Code Here

                }
            }
        }
        if (isCollection(sourceUri)) {
            UriHandler destinationUriHandler = UriHandler.getUriHandler(destinationUri);
            ObjectNode destinationParentNode =
                structure.retrieve(stoken, destinationUriHandler.getParentUriHandler().toString());
            ObjectNode sourceNode =
                structure.retrieve(stoken, sourceUri);
            if (isDescendant(destinationParentNode, sourceNode)) {
                return new ViolatedPrecondition(C_CYCLE_ALLOWED, WebdavStatus.SC_FORBIDDEN);
            }
        }
View Full Code Here

        pool = new HashSet ();
       
        String resourceUri = searchToken.getSlideContext().getSlidePath (scope.getHref());
       
        // Get the object from Data.
        ObjectNode resource = null;
       
        try {
            resource = structure.retrieve (slideToken, resourceUri);
            parseOneObject (resource, 0);
        }
View Full Code Here

       
        Enumeration children = null;
        children = structure.getChildren (slideToken, object);
       
        while (children.hasMoreElements()) {
            ObjectNode cur = (ObjectNode)children.nextElement();
            parseOneObject (cur, currentDepth + 1);
        }
       
        ComparableResource item =
            new ComparableResourceImpl (object, searchToken, scope, propertyProvider);
View Full Code Here

                }
            }
           
            // Checking if the resource at the URI isn't a lock-null
            // resource, in which case we must attempt to delete it
            ObjectNode node = structure.retrieve(slideToken, requestUri);
           
            if (isLockNull(revisionDescriptor)) {
                content.remove(slideToken, requestUri, revisionDescriptor);
                content.remove(slideToken, revisionDescriptors);
                structure.remove(slideToken, node);
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.