Class RomeAdapter

java.lang.Object
org.jasig.portlet.newsreader.adapter.AbstractNewsAdapter
org.jasig.portlet.newsreader.adapter.RomeAdapter
All Implemented Interfaces:
INewsAdapter
Direct Known Subclasses:
RomeAdapterFullStory

public class RomeAdapter extends AbstractNewsAdapter
RomeAdapter is a NewsAdapter for standard RSS and ATOM feeds available online via http or https.

Note: This class can process and feed supported by ROME https://rome.dev.java.net/.

Since:
5.1.1
Author:
Anthony Colebourne
  • Field Details

    • log

      protected final org.slf4j.Logger log
    • PREFERENCE_TITLE_POLICY

      public static final String PREFERENCE_TITLE_POLICY
      Constant PREFERENCE_TITLE_POLICY="titlePolicy"
      See Also:
    • PREFERENCE_DESCRIPTION_POLICY

      public static final String PREFERENCE_DESCRIPTION_POLICY
      Constant PREFERENCE_DESCRIPTION_POLICY="descriptionPolicy"
      See Also:
    • DEFAULT_ANTISAMY_POLICY

      public static final String DEFAULT_ANTISAMY_POLICY
      Constant DEFAULT_ANTISAMY_POLICY="antisamy-textonly"
      See Also:
  • Constructor Details

    • RomeAdapter

      public RomeAdapter()
  • Method Details

    • getHttpClient

      public org.apache.http.impl.client.CloseableHttpClient getHttpClient()

      Getter for the field httpClient.

      Returns:
      a CloseableHttpClient object
    • setHttpClient

      public void setHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient)

      Setter for the field httpClient.

      Parameters:
      httpClient - a CloseableHttpClient object
    • setProxyHost

      public void setProxyHost(String proxyHost)

      Setter for the field proxyHost.

      Parameters:
      proxyHost - a String object
    • setProxyPort

      public void setProxyPort(String proxyPort)

      Setter for the field proxyPort.

      Parameters:
      proxyPort - a String object
    • getConnectionTimeout

      public int getConnectionTimeout()

      Getter for the field connectionTimeout.

      Returns:
      a int
    • setConnectionTimeout

      public void setConnectionTimeout(int connectionTimeout)

      Setter for the field connectionTimeout.

      Parameters:
      connectionTimeout - a int
    • getReadTimeout

      public int getReadTimeout()

      Getter for the field readTimeout.

      Returns:
      a int
    • setReadTimeout

      public void setReadTimeout(int readTimeout)

      Setter for the field readTimeout.

      Parameters:
      readTimeout - a int
    • getConnectionManagerTimeout

      public long getConnectionManagerTimeout()

      Getter for the field connectionManagerTimeout.

      Returns:
      a long
    • setConnectionManagerTimeout

      public void setConnectionManagerTimeout(long connectionManagerTimeout)

      Setter for the field connectionManagerTimeout.

      Parameters:
      connectionManagerTimeout - a long
    • getTimesToRetry

      public int getTimesToRetry()

      Getter for the field timesToRetry.

      Returns:
      a int
    • setTimesToRetry

      public void setTimesToRetry(int timesToRetry)

      Setter for the field timesToRetry.

      Parameters:
      timesToRetry - a int
    • setProcessor

      public void setProcessor(RomeNewsProcessorImpl processor)

      Setter for the field processor.

      Parameters:
      processor - a RomeNewsProcessorImpl object
    • setCacheKeyPrefix

      public void setCacheKeyPrefix(String prefix)
      Cache prefix to support multiple instances of this class using the same cache.
      Parameters:
      prefix - Unique prefix for cache entries for this particular instance
    • init

      public void init() throws Exception

      init.

      Throws:
      Exception - if any.
    • getPolicyPref

      protected String[] getPolicyPref(String... policyKey)

      getPolicyPref.

      Parameters:
      policyKey - a String object
      Returns:
      an array of String objects
    • getSyndFeed

      public PaginatingNewsFeed getSyndFeed(NewsConfiguration config, int page, int maxStories) throws NewsException

      getSyndFeed.

      Parameters:
      config - a NewsConfiguration object
      page - a int
      maxStories - a int
      Returns:
      a PaginatingNewsFeed object
      Throws:
      NewsException - if any.
    • getSyndFeed

      protected PaginatingNewsFeed getSyndFeed(String url, String titlePolicy, String descriptionPolicy, int maxStories) throws NewsException
      Retrieve the entire feed using HTTPClient and clean using AntiSamy, build an SyndFeed object using ROME.
      Parameters:
      url - String of the feed to be retrieved
      titlePolicy - String the cleaning policy for the title
      descriptionPolicy - String the cleaning policy for the description
      maxStories - limit number of news items
      Returns:
      SyndFeed Feed object
      Throws:
      NewsException - if any.
    • setCache

      public void setCache(net.sf.ehcache.Cache cache)

      Setter for the field cache.

      Parameters:
      cache - a Cache object