Package org.apache.roller.pojos

Examples of org.apache.roller.pojos.WeblogResource


    }
   
   
    public class WeblogResourceComparator implements Comparator {
        public int compare(Object o1, Object o2) {
            WeblogResource r1 = (WeblogResource)o1;
            WeblogResource r2 = (WeblogResource)o2;
           
            // consider directories so they go to the top of the list
            if(r1.isDirectory() && r2.isDirectory()) {
                // if we have 2 directories then just go by name
                return r1.getPath().compareTo(r2.getPath());
            } else if(r1.isDirectory()) {
                // directories go before files
                return -1;
            } else if(r2.isDirectory()) {
                // directories go before files
                return 1;
            } else {
                // if we have 2 files then just go by name
                return r1.getPath().compareTo(r2.getPath());
            }
        }
View Full Code Here


                // if we have 2 files then just go by name
                return r1.getPath().compareTo(r2.getPath());
            }
        }
        public boolean equals(Object o1, Object o2) {
            WeblogResource r1 = (WeblogResource)o1;
            WeblogResource r2 = (WeblogResource)o2;
           
            // need to be same type to be equals, i.e both files or directories
            if((r1.isDirectory() && !r2.isDirectory()) ||
                    (r1.isFile() && !r2.isFile())) {
                return false;
            }
           
            // after that it's just a matter of comparing paths
            return r1.getPath().equals(r2.getPath());
        }
View Full Code Here

       
        // if not from theme then see if resource is in weblog's upload dir
        if(resourceStream == null) {
            try {
                FileManager fileMgr = RollerFactory.getRoller().getFileManager();
                WeblogResource resource = fileMgr.getFile(weblog,
                        resourceRequest.getResourcePath());
                resourceLastMod = resource.getLastModified();
                resourceStream = resource.getInputStream();
            } catch (Exception ex) {
                // still not found? then we don't have it, 404.
                log.debug("Unable to get resource", ex);
                response.sendError(HttpServletResponse.SC_NOT_FOUND);
                return;
View Full Code Here

                    // "default" values
                    WebsiteData website = rreq.getWebsite();

                    // load selected file
                    FileManager fMgr = RollerFactory.getRoller().getFileManager();
                    WeblogResource f = fMgr.getFile(website, form.getImportFileName());

                    //ArchiveParser archiveParser =
                        //new ArchiveParser(RollerFactory.getRoller(), rreq.getWebsite(), f);
                    String parseMessages = null; // archiveParser.parse();
View Full Code Here

       
        // if not from theme then see if resource is in weblog's upload dir
        if(resourceStream == null) {
            try {
                FileManager fileMgr = RollerFactory.getRoller().getFileManager();
                WeblogResource resource = fileMgr.getFile(weblog,
                        resourceRequest.getResourcePath());
                resourceLastMod = resource.getLastModified();
                resourceStream = resource.getInputStream();
            } catch (Exception ex) {
                // still not found? then we don't have it, 404.
                log.debug("Unable to get resource", ex);
                response.sendError(HttpServletResponse.SC_NOT_FOUND);
                return;
View Full Code Here

            throw new FilePathException("Invalid path ["+path+"], "+
                    "path is not a directory.");
        }
       
        // everything looks good, list contents
        WeblogResource dir = new WeblogResourceFile(weblog, path, dirFile);
       
        return dir.getChildren();
    }
View Full Code Here

                link.setType("text/html");
                feed.setAlternateLinks(Collections.singletonList(link));
               
                SortedSet sortedSet = new TreeSet(new Comparator() {
                    public int compare(Object o1, Object o2) {
                        WeblogResource f1 = (WeblogResource)o1;
                        WeblogResource f2 = (WeblogResource)o2;
                        if (f1.getLastModified() < f2.getLastModified()) return 1;
                        else if (f1.getLastModified() == f2.getLastModified()) return 0;
                        else return -1;
                    }
                    public boolean equals(Object obj) {
                        return false;
                    }              
View Full Code Here

                    // Try saving file
                    FileInputStream fis = new FileInputStream(tempFile);
                    fmgr.saveFile(website, fileName, contentType, tempFile.length(), fis);
                    fis.close();
                   
                    WeblogResource resource = fmgr.getFile(website, fileName);
                    return createAtomResourceEntry(website, resource);

                } catch (IOException e) {
                    String msg = "ERROR reading posted file";
                    mLogger.error(msg,e);
View Full Code Here

TOP

Related Classes of org.apache.roller.pojos.WeblogResource

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.