Package org.apache.slide.lock

Examples of org.apache.slide.lock.Lock


  }

  private Content getContentHelper(MacroEvent event) {
     Security security = new ACLSecurityImpl(event.getNamespace(),
                                             event.getNamespace().getConfig());
     Lock lock = new LockImpl(event.getNamespace(),
                              event.getNamespace().getConfig(),
                              security);
     Structure structure = new StructureImpl(event.getNamespace(),
                              event.getNamespace().getConfig(),
                              security,
View Full Code Here


       
        res.setContentType("text/html; charset=\"UTF-8\"");
       
        // 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("/"))
            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;
            permissionsList = null;
            locksList = null;
            try {
                NodeRevisionDescriptors revisionDescriptors =
                    content.retrieve(slideToken, currentResource);
                // Retrieve latest revision descriptor
                currentDescriptor =
                    content.retrieve(slideToken, revisionDescriptors);
            } catch (SlideException e) {
                // Silent exception : Objects without any revision are
                // considered collections, and do not have any attributes
                // Any security based exception will be trapped here
                // Any locking based exception will be trapped here
            }
           
            try {
                permissionsList =
                    security.enumeratePermissions(slideToken, currentResource);
                locksList = lock.enumerateLocks(slideToken, currentResource, false);
            } catch (SlideException e) {
                // Any security based exception will be trapped here
                // Any locking based exception will be trapped here
            }
           
View Full Code Here

     * @throws   ObjectNotFoundException
     */
    private XMLValue computeLockDiscovery(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String servletPath) throws ServiceAccessException, LinkedObjectNotFoundException, ObjectNotFoundException, LockTokenNotFoundException {
       
        XMLValue xmlValue = new XMLValue();
        Lock lock = nsaToken.getLockHelper();
        NodeLock objectLockToken = null;
        Enumeration lockTokens = lock.enumerateLocks(readonlySlideToken(), revisionDescriptors.getUri(), true);
        Set addedLockIDs = new HashSet();
        while (lockTokens.hasMoreElements()) {
            objectLockToken = (NodeLock) lockTokens.nextElement();
            if (revisionDescriptors.getUri().equals(objectLockToken.getObjectUri()) ||
                objectLockToken.isInheritable()
View Full Code Here

        if (contextPath == null)
            contextPath = "";
       
        // get the helpers
        Content content = token.getContentHelper();
        Lock lock = token.getLockHelper();
        Security security = token.getSecurityHelper();
        Structure structure = token.getStructureHelper();

        SlideToken slideToken = WebdavUtils.getSlideToken(req);
        String resourcePath =
            WebdavUtils.getRelativePath(
                req, (WebdavServletConfig)getServletConfig());
        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(servletWriter);
       
        // Render the page header
        writer.print("<html>\r\n");
        writer.print("<head>\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 = ((WebdavServletConfig)getServletConfig()).getScope();
        if (parentDirectory.substring(scope.length()).lastIndexOf("/") >= 0) {
            String parent = name.substring(0, name.lastIndexOf("/"));
            writer.print("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">\r\n");
            writer.print("<a href=\"");
            writer.print(WebdavUtils.encodeURL(contextPath));
            if (parent.equals(""))
                parent = "/";
            writer.print(parent);
            writer.print("\">");
            writer.print(Messages.format
                             ("org.apache.slide.webdav.GetMethod.parent", parent));
            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());
           
        } 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;
           
            permissionsList = null;
            locksList = null;
           
            try {
               
                NodeRevisionDescriptors revisionDescriptors =
                    content.retrieve(slideToken, currentResource);
                // Retrieve latest revision descriptor
                currentDescriptor =
                    content.retrieve(slideToken, revisionDescriptors);
               
            } catch (SlideException e) {
               
                // Silent exception : Objects without any revision are
                // considered collections, and do not have any attributes
               
                // Any security based exception will be trapped here
               
                // Any locking based exception will be trapped here
               
            }
           
            try {
               
                permissionsList =
                    security.enumeratePermissions(slideToken, currentResource);
                locksList = lock.enumerateLocks(slideToken, currentResource);
               
            } catch (SlideException e) {
               
                // Any security based exception will be trapped here
               
View Full Code Here

        if (contextPath == null)
            contextPath = "";
       
        // get the helpers
        Content content = token.getContentHelper();
        Lock lock = token.getLockHelper();
        Security security = token.getSecurityHelper();
        Structure structure = token.getStructureHelper();

        SlideToken slideToken = WebdavUtils.getSlideToken(req);
        String resourcePath =
            WebdavUtils.getRelativePath(
                req, (WebdavServletConfig)getServletConfig());
        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(servletWriter);
       
        // Render the page header
        writer.print("<html>\r\n");
        writer.print("<head>\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("<H1> This my servlet and not the default one </H1>\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);
        }
        int slash = parentDirectory.lastIndexOf("/");
        if (slash >= 0) {
            String parent = name.substring(0, slash);
            writer.print("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">\r\n");
            writer.print("<a href=\"");
            writer.print(WebdavUtils.encodeURL(contextPath));
            if (parent.equals(""))
                parent = "/";
            writer.print(parent);
            writer.print("\">");
            writer.print(Messages.format
                             ("org.apache.slide.webdav.GetMethod.parent", parent));
            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());
           
        } 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;
           
            permissionsList = null;
            locksList = null;
           
            try {
               
                NodeRevisionDescriptors revisionDescriptors =
                    content.retrieve(slideToken, currentResource);
                // Retrieve latest revision descriptor
                currentDescriptor =
                    content.retrieve(slideToken, revisionDescriptors);
               
            } catch (SlideException e) {
               
                // Silent exception : Objects without any revision are
                // considered collections, and do not have any attributes
               
                // Any security based exception will be trapped here
               
                // Any locking based exception will be trapped here
               
            }
           
            try {
               
                permissionsList =
                    security.enumeratePermissions(slideToken, currentResource);
                locksList = lock.enumerateLocks(slideToken, currentResource);
               
            } catch (SlideException e) {
               
                // Any security based exception will be trapped here
               
View Full Code Here

        if (contextPath == null)
            contextPath = "";
       
        // get the helpers
        Content content = token.getContentHelper();
        Lock lock = token.getLockHelper();
        Security security = token.getSecurityHelper();
        Structure structure = token.getStructureHelper();

        SlideToken slideToken = WebdavUtils.getSlideToken(req);
        String resourcePath =
            WebdavUtils.getRelativePath(
                req, (WebdavServletConfig)getServletConfig());
        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(servletWriter);
       
        // Render the page header
        writer.print("<html>\r\n");
        writer.print("<head>\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("<H1> This my servlet and not the default one </H1>\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);
        }
        int slash = parentDirectory.lastIndexOf("/");
        if (slash >= 0) {
            String parent = name.substring(0, slash);
            writer.print("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">\r\n");
            writer.print("<a href=\"");
            writer.print(WebdavUtils.encodeURL(contextPath));
            if (parent.equals(""))
                parent = "/";
            writer.print(parent);
            writer.print("\">");
            writer.print(Messages.format
                             ("org.apache.slide.webdav.GetMethod.parent", parent));
            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;
           
            permissionsList = null;
            locksList = null;
           
            try {
               
                NodeRevisionDescriptors revisionDescriptors =
                    content.retrieve(slideToken, currentResource);
                // Retrieve latest revision descriptor
                currentDescriptor =
                    content.retrieve(slideToken, revisionDescriptors);
               
            } catch (SlideException e) {
               
                // Silent exception : Objects without any revision are
                // considered collections, and do not have any attributes
               
                // Any security based exception will be trapped here
               
                // Any locking based exception will be trapped here
               
            }
           
            try {
               
                permissionsList =
                    security.enumeratePermissions(slideToken, currentResource);
                locksList = lock.enumerateLocks(slideToken, currentResource, false);
               
            } catch (SlideException e) {
               
                // Any security based exception will be trapped here
               
View Full Code Here

        if (contextPath == null)
            contextPath = "";
       
        // get the helpers
        Content content = token.getContentHelper();
        Lock lock = token.getLockHelper();
        Security security = token.getSecurityHelper();
        Structure structure = token.getStructureHelper();

        SlideToken slideToken = WebdavUtils.getSlideToken(req);
        String resourcePath =
            WebdavUtils.getRelativePath(
                req, (WebdavServletConfig)getServletConfig());
        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(servletWriter);
       
        // Render the page header
        writer.print("<html>\r\n");
        writer.print("<head>\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 = ((WebdavServletConfig)getServletConfig()).getScope();
        if (parentDirectory.substring(scope.length()).lastIndexOf("/") >= 0) {
            String parent = name.substring(0, name.lastIndexOf("/"));
            writer.print("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">\r\n");
            writer.print("<a href=\"");
            writer.print(WebdavUtils.encodeURL(contextPath));
            if (parent.equals(""))
                parent = "/";
            writer.print(parent);
            writer.print("\">");
            writer.print(Messages.format
                             ("org.apache.slide.webdav.GetMethod.parent", parent));
            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;
           
            permissionsList = null;
            locksList = null;
           
            try {
               
                NodeRevisionDescriptors revisionDescriptors =
                    content.retrieve(slideToken, currentResource);
                // Retrieve latest revision descriptor
                currentDescriptor =
                    content.retrieve(slideToken, revisionDescriptors);
               
            } catch (SlideException e) {
               
                // Silent exception : Objects without any revision are
                // considered collections, and do not have any attributes
               
                // Any security based exception will be trapped here
               
                // Any locking based exception will be trapped here
               
            }
           
            try {
               
                permissionsList =
                    security.enumeratePermissions(slideToken, currentResource);
                locksList = lock.enumerateLocks(slideToken, currentResource, false);
               
            } catch (SlideException e) {
               
                // Any security based exception will be trapped here
               
View Full Code Here

        if (contextPath == null)
            contextPath = "";
       
        // get the helpers
        Content content = token.getContentHelper();
        Lock lock = token.getLockHelper();
        Security security = token.getSecurityHelper();
        Structure structure = token.getStructureHelper();

        SlideToken slideToken = WebdavUtils.getSlideToken(req);
        String resourcePath =
            WebdavUtils.getRelativePath(
                req, (WebdavServletConfig)getServletConfig());
        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(servletWriter);
       
        // Render the page header
        writer.print("<html>\r\n");
        writer.print("<head>\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 = ((WebdavServletConfig)getServletConfig()).getScope();
        if (parentDirectory.substring(scope.length()).lastIndexOf("/") >= 0) {
            String parent = name.substring(0, name.lastIndexOf("/"));
            writer.print("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">\r\n");
            writer.print("<a href=\"");
            writer.print(WebdavUtils.encodeURL(contextPath));
            if (parent.equals(""))
                parent = "/";
            writer.print(parent);
            writer.print("\">");
            writer.print(Messages.format
                             ("org.apache.slide.webdav.GetMethod.parent", parent));
            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());
           
        } 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;
           
            permissionsList = null;
            locksList = null;
           
            try {
               
                NodeRevisionDescriptors revisionDescriptors =
                    content.retrieve(slideToken, currentResource);
                // Retrieve latest revision descriptor
                currentDescriptor =
                    content.retrieve(slideToken, revisionDescriptors);
               
            } catch (SlideException e) {
               
                // Silent exception : Objects without any revision are
                // considered collections, and do not have any attributes
               
                // Any security based exception will be trapped here
               
                // Any locking based exception will be trapped here
               
            }
           
            try {
               
                permissionsList =
                    security.enumeratePermissions(slideToken, currentResource);
                locksList = lock.enumerateLocks(slideToken, currentResource);
               
            } catch (SlideException e) {
               
                // Any security based exception will be trapped here
               
View Full Code Here

        if (contextPath == null)
            contextPath = "";
       
        // get the helpers
        Content content = token.getContentHelper();
        Lock lock = token.getLockHelper();
        Security security = token.getSecurityHelper();
        Structure structure = token.getStructureHelper();

        SlideToken slideToken = WebdavMethod.createSlideToken(req);
        String resourcePath = WebdavMethod.getRelativePath(req);
        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(servletWriter);
       
        // Render the page header
        writer.print("<html>\r\n");
        writer.print("<head>\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);
        }
        int slash = parentDirectory.lastIndexOf("/");
        if (slash >= 0) {
            String parent = name.substring(0, slash);
            writer.print("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">\r\n");
            writer.print("<a href=\"");
            writer.print(URLUtil.URLEncode(contextPath, "UTF8"));
            if (parent.equals(""))
                parent = "/";
            writer.print(parent);
            writer.print("\">");
            writer.print(Messages.format
                             ("org.apache.slide.webdav.GetMethod.parent", parent));
            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());
           
        } 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;
           
            permissionsList = null;
            locksList = null;
           
            try {
               
                NodeRevisionDescriptors revisionDescriptors =
                    content.retrieve(slideToken, currentResource);
                // Retrieve latest revision descriptor
                currentDescriptor =
                    content.retrieve(slideToken, revisionDescriptors);
               
            } catch (SlideException e) {
               
                // Silent exception : Objects without any revision are
                // considered collections, and do not have any attributes
               
                // Any security based exception will be trapped here
               
                // Any locking based exception will be trapped here
               
            }
           
            try {
               
                permissionsList =
                    security.enumeratePermissions(slideToken, currentResource);
                locksList = lock.enumerateLocks(slideToken, currentResource);
               
            } catch (SlideException e) {
               
                // Any security based exception will be trapped here
               
View Full Code Here

        if (contextPath == null)
            contextPath = "";
       
        // 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("/"))
            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.encodeURL(contextPath, "UTF-8"));
            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;
            permissionsList = null;
            locksList = null;
            try {
                NodeRevisionDescriptors revisionDescriptors =
                    content.retrieve(slideToken, currentResource);
                // Retrieve latest revision descriptor
                currentDescriptor =
                    content.retrieve(slideToken, revisionDescriptors);
            } catch (SlideException e) {
                // Silent exception : Objects without any revision are
                // considered collections, and do not have any attributes
                // Any security based exception will be trapped here
                // Any locking based exception will be trapped here
            }
           
            try {
                permissionsList =
                    security.enumeratePermissions(slideToken, currentResource);
                locksList = lock.enumerateLocks(slideToken, currentResource, false);
            } catch (SlideException e) {
                // Any security based exception will be trapped here
                // Any locking based exception will be trapped here
            }
           
View Full Code Here

TOP

Related Classes of org.apache.slide.lock.Lock

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.