Class SyndicationFeed


  • public class SyndicationFeed
    extends Object
    Invoke ROME library to assemble a generic model of a syndication for the given list of Items and scope. Consults configuration for the metadata bindings to feed elements. Uses ROME's output drivers to return any of the implemented formats, e.g. RSS 1.0, RSS 2.0, ATOM 1.0. The feed generator and OpenSearch call on this class so feed contents are uniform for both.
    Author:
    Larry Stone
    • Constructor Detail

      • SyndicationFeed

        public SyndicationFeed​(String ui)
        Constructor.
        Parameters:
        ui - either "xmlui" or "jspui"
    • Method Detail

      • getDescriptionSelectors

        public static String[] getDescriptionSelectors()
        Returns list of metadata selectors used to compose the description element
        Returns:
        selector list - format 'schema.element[.qualifier]'
      • populate

        public void populate​(javax.servlet.http.HttpServletRequest request,
                             Context context,
                             IndexableObject dso,
                             List<IndexableObject> items,
                             Map<String,​String> labels)
        Fills in the feed and entry-level metadata from DSpace objects.
        Parameters:
        request - request
        context - context
        dso - the scope
        items - array of objects
        labels - label map
      • setType

        public void setType​(String feedType)
        Sets the feed type for XML delivery, e.g. "rss_1.0", "atom_1.0" Must match one of ROME's configured generators, see rome.properties (currently rss_1.0, rss_2.0, atom_1.0, atom_0.3)
        Parameters:
        feedType - feed type
      • outputW3CDom

        public Document outputW3CDom()
                              throws com.rometools.rome.io.FeedException
        Returns:
        the feed we built as DOM Document
        Throws:
        com.rometools.rome.io.FeedException - if feed error
      • outputString

        public String outputString()
                            throws com.rometools.rome.io.FeedException
        Returns:
        the feed we built as serialized XML string
        Throws:
        com.rometools.rome.io.FeedException - if feed error
      • output

        public void output​(Writer writer)
                    throws com.rometools.rome.io.FeedException,
                           IOException
        send the output to designated Writer
        Parameters:
        writer - Writer
        Throws:
        com.rometools.rome.io.FeedException - if feed error
        IOException - if IO error
      • addModule

        public void addModule​(com.rometools.rome.feed.module.Module m)
        Add a ROME plugin module (e.g. for OpenSearch) at the feed level.
        Parameters:
        m - module
      • getDefaultedConfiguration

        protected static String getDefaultedConfiguration​(String key,
                                                          String dfl)
      • urlOfBitstream

        protected String urlOfBitstream​(javax.servlet.http.HttpServletRequest request,
                                        Bitstream logo)
      • resolveURL

        protected String resolveURL​(javax.servlet.http.HttpServletRequest request,
                                    DSpaceObject dso)
        Return a url to the DSpace object, either use the official handle for the item or build a url based upon the current server. If the dspaceobject is null then a local url to the repository is generated.
        Parameters:
        request - current servlet request
        dso - The object to reference, null if to the repository.
        Returns:
        URL