Package com.sun.syndication.propono.atom.server

Examples of com.sun.syndication.propono.atom.server.AtomException


            }
            log.debug("Not authorized to delete entry");
            log.debug("Exiting via exception");
           
        } catch (WebloggerException ex) {
            throw new AtomException("ERROR deleting entry",ex);
        }
        throw new AtomNotAuthorizedException("Not authorized to delete entry");
    }
View Full Code Here


    public RollerAtomService(User user, String atomURL) throws WebloggerException, AtomException {
        Weblogger roller = WebloggerFactory.getWeblogger();
        List perms = null;
       
        if (!WebloggerRuntimeConfig.getBooleanProperty("webservices.enableAtomPub")) {
          throw new AtomException("AtomPub not enabled for this Roller installation");
        }
       
        try {
            perms = roller.getUserManager().getWeblogPermissions(user);
        } catch (WebloggerException re) {
            throw new AtomException("Getting user's weblogs", re);
        }
        List uploadAccepts = new ArrayList();
        try {
            uploadAccepts = getAcceptedContentTypeRange();
        } catch (WebloggerException re) {
            throw new AtomException("Getting site's accept range", re);
        }
        if (perms != null) {
            for (Iterator iter = perms.iterator(); iter.hasNext();) {
                WeblogPermission perm = (WeblogPermission) iter.next();
                Weblog weblog = perm.getWeblog();
                Workspace workspace = null;
                try {

                    // Create workspace to represent weblog
                    workspace = new Workspace(Utilities.removeHTML(perm.getWeblog().getName()), "text");
                    addWorkspace(workspace);

                    // Create collection for entries within that workspace
                    Collection entryCol = new Collection("Weblog Entries", "text", atomURL + "/" + weblog.getHandle() + "/entries");
                    entryCol.addAccept("application/atom+xml;type=entry");

                    // Add fixed categories using scheme that points to
                    // weblog because categories are weblog specific
                    weblog = perm.getWeblog();
                    Categories cats = new Categories();
                    cats.setFixed(true);
                    cats.setScheme(getWeblogCategoryScheme(weblog));
                    List rollerCats = roller.getWeblogEntryManager().getWeblogCategories(weblog, false);
                    for (Iterator it = rollerCats.iterator(); it.hasNext();) {
                        WeblogCategory rollerCat = (WeblogCategory) it.next();
                        Category cat = new Category();
                        cat.setTerm(rollerCat.getPath().substring(1));
                        cat.setLabel(rollerCat.getName());
                        cats.addCategory(cat);
                    }
                    entryCol.addCategories(cats);

                    // Add tags as free-form categories using scheme that points
                    // to site because tags can be considered site-wide
                    Categories tags = new Categories();
                    tags.setFixed(false);
                    entryCol.addCategories(tags);

                    workspace.addCollection(entryCol);
                } catch (Exception e) {
                    throw new AtomException("Creating weblog entry collection for service doc", e);
                }

                // And add one media collection for each of weblog's upload directories
                try {
                    MediaFileManager mgr = roller.getMediaFileManager();
                    List<MediaFileDirectory> dirs = mgr.getMediaFileDirectories(weblog);
                    for (MediaFileDirectory dir : dirs) {
                        Collection uploadSubCol = new Collection(
                            "Media Files: " + dir.getPath(), "text",
                            atomURL + "/" + weblog.getHandle() + "/resources/" + dir.getPath());
                        uploadSubCol.setAccepts(uploadAccepts);
                        workspace.addCollection(uploadSubCol);
                    }

                } catch (Exception e) {
                    throw new AtomException("Creating weblog entry collection for service doc", e);
                }
            }
        }
    }
View Full Code Here

    public AtomService getAtomService(AtomRequest areq) throws AtomException {
        try {
            return new RollerAtomService(user, atomURL);
        } catch (WebloggerException ex) {
            log.error("Unable to create Service Document", ex);
            throw new AtomException("ERROR creating Service Document", ex);
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.syndication.propono.atom.server.AtomException

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.