Class SyndicationFeed

java.lang.Object
org.dspace.app.util.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
  • Field Details

    • log

      protected final org.apache.logging.log4j.Logger log
    • MSG_UNTITLED

      public static final String MSG_UNTITLED
      i18n key values
      See Also:
    • MSG_LOGO_TITLE

      public static final String MSG_LOGO_TITLE
      See Also:
    • MSG_FEED_TITLE

      public static final String MSG_FEED_TITLE
      See Also:
    • MSG_FEED_DESCRIPTION

      public static final String MSG_FEED_DESCRIPTION
      See Also:
    • MSG_METADATA

      public static final String MSG_METADATA
      See Also:
    • defaultTitleField

      protected String defaultTitleField
    • defaultDescriptionField

      protected String defaultDescriptionField
    • defaultAuthorField

      protected String defaultAuthorField
    • defaultDateField

      protected String defaultDateField
    • defaultExternalMedia

      protected String defaultExternalMedia
    • titleField

      protected String titleField
    • dateField

      protected String dateField
    • authorField

      protected String authorField
    • externalSourceField

      protected String externalSourceField
    • dcCreatorField

      protected String dcCreatorField
    • dcDateField

      protected String dcDateField
    • dcDescriptionField

      protected String dcDescriptionField
    • podcastableMIMETypes

      protected String[] podcastableMIMETypes
    • feed

      protected com.rometools.rome.feed.synd.SyndFeed feed
    • request

      protected jakarta.servlet.http.HttpServletRequest request
    • collectionService

      protected CollectionService collectionService
    • communityService

      protected CommunityService communityService
    • itemService

      protected ItemService itemService
    • baseURL

      protected String baseURL
  • Constructor Details

    • SyndicationFeed

      public SyndicationFeed()
  • Method Details

    • populate

      public void populate(jakarta.servlet.http.HttpServletRequest request, Context context, IndexableObject dso, List<IndexableObject> items)
      Fills in the feed and entry-level metadata from DSpace objects.
      Parameters:
      request - request
      context - context
      dso - the scope
      items - array of objects
    • 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(jakarta.servlet.http.HttpServletRequest request, Bitstream logo)
    • resolveURL

      protected String resolveURL(jakarta.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
    • localize

      protected String localize(Map<String,String> labels, String s)
    • getOneDC

      protected String getOneDC(Item item, String field)