Package org.apache.slide.structure

Examples of org.apache.slide.structure.Structure


     */
    public XMLValue computeCurrentuserPrivilegeSet(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String servletPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
        XMLValue xmlValue = new XMLValue();
       
        NamespaceConfig config = nsaToken.getNamespaceConfig();
        Structure structure = nsaToken.getStructureHelper();
        ObjectNode object =  structure.retrieve(sToken, revisionDescriptors.getUri());
       
        // check read-own-permissions permission
        Security security = nsaToken.getSecurityHelper();
        security.checkCredentials(sToken, object, config.getReadOwnPermissionsAction());
       
View Full Code Here


    public XMLValue computeAcl(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String servletPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, LockTokenNotFoundException, JDOMException {
       
        XMLValue xmlValue = new XMLValue();
       
        NamespaceConfig config = nsaToken.getNamespaceConfig();
        Structure structure = nsaToken.getStructureHelper();
        ObjectNode objectNode =  structure.retrieve(sToken, revisionDescriptors.getUri());
       
        // check read-acl permission
        Security security = nsaToken.getSecurityHelper();
        security.checkCredentials(sToken, objectNode, config.getReadPermissionsAction());
       
View Full Code Here

       
        // get the helpers
        Content content = nat.getContentHelper();
        Lock lock = nat.getLockHelper();
        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("/"))
View Full Code Here

       
        String usersPath = nat.getNamespaceConfig().getUsersPath();
        String userUri = usersPath + "/" + username;
       
        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
        Structure structure = nat.getStructureHelper();
        Content content = nat.getContentHelper();
       
        try {
           
            nat.begin();
           
            ObjectNode user = new SubjectNode();
            structure.create(slideToken,user,userUri);
           
            // create the user descriptor
            NodeRevisionDescriptor descriptor = new NodeRevisionDescriptor();
            descriptor.setCreationDate(new Date());
            descriptor.setLastModified(new Date());
View Full Code Here

       
        String groupsPath = nat.getNamespaceConfig().getGroupsPath();
        String groupUri = groupsPath + "/" + groupname;
       
        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
        Structure structure = nat.getStructureHelper();
        Content content = nat.getContentHelper();
       
        try {
            nat.begin();
           
            ObjectNode group = new SubjectNode();
            structure.create(slideToken,group,groupUri);
           
            NodeRevisionDescriptor descriptor = new NodeRevisionDescriptor();
            descriptor.setCreationDate(new Date());
            descriptor.setLastModified(new Date());
           
View Full Code Here

       
        String rolesPath = nat.getNamespaceConfig().getRolesPath();
        String roleUri = rolesPath + "/" + rolename;
       
        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
        Structure structure = nat.getStructureHelper();
        Content content = nat.getContentHelper();
       
        try {
            nat.begin();
           
            ObjectNode role = new SubjectNode();
            structure.create(slideToken,role,roleUri);
           
            NodeRevisionDescriptor descriptor = new NodeRevisionDescriptor();
            descriptor.setCreationDate(new Date());
            descriptor.setLastModified(new Date());
           
View Full Code Here

                                 String caller,
                                 String objectUri,
                                 String subjectUri) throws Exception {
       
        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
        Structure structure = nat.getStructureHelper();
        Content content = nat.getContentHelper();
       
        try {
           
            // check if the subject exists
            structure.retrieve(slideToken,subjectUri);
           
            NodeRevisionDescriptors descriptors = content.retrieve(slideToken,objectUri);
            NodeRevisionDescriptor descriptor = content.retrieve(slideToken,descriptors);
            NodeProperty property = descriptor.getProperty("group-member-set","DAV:");
           
View Full Code Here

        UriHandler wrpathHandler =
            WorkingresourcePathHandler.getResolvedWorkingresourcePathHandler( nsName, uh );
        Content content = nsaToken.getContentHelper();
        String wrpath = wrpathHandler.toString();
       
        Structure structure = nsaToken.getStructureHelper();
        String uniqueUri = structure.generateUniqueUri(sToken, wrpath);

        if (uniqueUri != null) {
            result = new UriHandler(uniqueUri);
        } else {
            NodeRevisionDescriptors wrpathNrds =
View Full Code Here

        UriHandler hpathHandler =
            HistoryPathHandler.getResolvedHistoryPathHandler( nsName, uh );
        Content content = nsaToken.getContentHelper();
        String hpath = hpathHandler.toString();
       
        Structure structure = nsaToken.getStructureHelper();
        String uniqueUri = structure.generateUniqueUri(sToken, hpath);

        if (uniqueUri != null) {
            if (UriHandler.useHistoryCollectionHack) {
                // XXX this is a bit silly: first compose it, now analyze it...
                String nextHnStr = uniqueUri.substring(uniqueUri.lastIndexOf('/') + 1);
                // XXX start with (at least) 10 to
                // assure no resources are created directly in history folder
                long nextHnLong = Long.parseLong(nextHnStr) + 10;
                nextHnStr = String.valueOf(nextHnLong);

                // make hpath/1/2/3 out of 1234
                StringBuffer pathBuffer = new StringBuffer(hpath);
                for (int i = 0; i < nextHnStr.length() - 1; i++) {
                    pathBuffer.append('/');
                    pathBuffer.append(nextHnStr.charAt(i));
                    // as we have no information how this number may look like we will have to assure the full
                    // path is created
                    String dir = pathBuffer.toString();
                    try {
                        structure.retrieve(sToken, dir);
                    } catch (ObjectNotFoundException onfe) {
                        try {
                            structure.create(sToken, new SubjectNode(), dir);
                            content.create(sToken, dir, new NodeRevisionDescriptor(0), null);
                        } catch (ObjectAlreadyExistsException oae) {
                            Domain.warn("Object " + dir + " already exists.");
                        } catch (RevisionAlreadyExistException rae) {
                            Domain.warn("Revision " + dir + " already exists.");
                        }
                    }
                }

                // make hpath/1/2/3/h4 out of 1234
                pathBuffer.append("/h").append(nextHnStr.charAt(nextHnStr.length() - 1));
                String fullPath = pathBuffer.toString();
               
                return new UriHandler(fullPath);
               
            } else {
                return new UriHandler(uniqueUri);
            }
        } else {

            NodeRevisionDescriptors hpathNrds = content.retrieve(sToken, hpath);
            NodeRevisionDescriptor hpathNrd = content.retrieve(sToken, hpathNrds);
            NodeProperty nextHnProp = hpathNrd.getProperty(I_NEXT_HISTORY_NAME, NamespaceCache.SLIDE_URI);

            if (UriHandler.useHistoryCollectionHack) {

                if (nextHnProp == null || nextHnProp.getValue() == null) {
                    // XXX start with historyCollectionHackChildren to assure no
                    // resources are created directly in history folder
                    nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME, "10", NamespaceCache.SLIDE_URI);
                    nextHnProp.setKind(NodeProperty.Kind.PROTECTED);
                    hpathNrd.setProperty(nextHnProp);
                }

                String nextHnStr = (String) nextHnProp.getValue();
                long nextHnLong = Long.parseLong(nextHnStr);

                if (nextHnLong % 10 == 0) {
                    // create parent collection
                    long dirNum = nextHnLong / 10;
                    char dirChar[] = Long.toString(dirNum).toCharArray();
                    StringBuffer buf = new StringBuffer();
                    for (int i = 0; i < dirChar.length - 1; i++) {
                        buf.append(dirChar[i]);
                        buf.append('/');
                    }
                    buf.append(dirChar[dirChar.length - 1]);
                    String dirPath = hpath + "/" + buf.toString();

                    try {
                        structure.create(sToken, new SubjectNode(), dirPath);
                        //content.create(sToken,dirPath,true);
                        //NodeRevisionDescriptors dnrds =
                        // structure.retrieve(stoken,dirPath);
                        content.create(sToken, dirPath, new NodeRevisionDescriptor(0), null);
                    } catch (ObjectAlreadyExistsException oae) {
View Full Code Here

       
        String usersPath = nat.getNamespaceConfig().getUsersPath();
        String userUri = usersPath + "/" + username;
       
        SlideToken slideToken = new SlideTokenImpl(new CredentialsToken(caller));
        Structure structure = nat.getStructureHelper();
        Content content = nat.getContentHelper();
       
        try {
           
            nat.begin();
           
            ObjectNode user = new SubjectNode();
            structure.create(slideToken,user,userUri);
           
            // create the user descriptor
            NodeRevisionDescriptor descriptor = new NodeRevisionDescriptor();
            descriptor.setCreationDate(new Date());
            descriptor.setLastModified(new Date());
View Full Code Here

TOP

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

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.