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
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongGetter for the fieldconnectionManagerTimeout.intGetter for the fieldconnectionTimeout.org.apache.http.impl.client.CloseableHttpClientGetter for the fieldhttpClient.protected String[]getPolicyPref(String... policyKey) getPolicyPref.intGetter for the fieldreadTimeout.protected PaginatingNewsFeedgetSyndFeed(String url, String titlePolicy, String descriptionPolicy, int maxStories) Retrieve the entire feed using HTTPClient and clean using AntiSamy, build an SyndFeed object using ROME.getSyndFeed(NewsConfiguration config, int page, int maxStories) getSyndFeed.intGetter for the fieldtimesToRetry.voidinit()init.voidsetCache(net.sf.ehcache.Cache cache) Setter for the fieldcache.voidsetCacheKeyPrefix(String prefix) Cache prefix to support multiple instances of this class using the same cache.voidsetConnectionManagerTimeout(long connectionManagerTimeout) Setter for the fieldconnectionManagerTimeout.voidsetConnectionTimeout(int connectionTimeout) Setter for the fieldconnectionTimeout.voidsetHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient) Setter for the fieldhttpClient.voidsetProcessor(RomeNewsProcessorImpl processor) Setter for the fieldprocessor.voidsetProxyHost(String proxyHost) Setter for the fieldproxyHost.voidsetProxyPort(String proxyPort) Setter for the fieldproxyPort.voidsetReadTimeout(int readTimeout) Setter for the fieldreadTimeout.voidsetTimesToRetry(int timesToRetry) Setter for the fieldtimesToRetry.Methods inherited from class org.jasig.portlet.newsreader.adapter.AbstractNewsAdapter
getClassName, getDescriptionKey, getNameKey
-
Field Details
-
log
protected final org.slf4j.Logger log -
PREFERENCE_TITLE_POLICY
ConstantPREFERENCE_TITLE_POLICY="titlePolicy"- See Also:
-
PREFERENCE_DESCRIPTION_POLICY
ConstantPREFERENCE_DESCRIPTION_POLICY="descriptionPolicy"- See Also:
-
DEFAULT_ANTISAMY_POLICY
ConstantDEFAULT_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
CloseableHttpClientobject
-
setHttpClient
public void setHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient) Setter for the field
httpClient.- Parameters:
httpClient- aCloseableHttpClientobject
-
setProxyHost
Setter for the field
proxyHost.- Parameters:
proxyHost- aStringobject
-
setProxyPort
Setter for the field
proxyPort.- Parameters:
proxyPort- aStringobject
-
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
Setter for the field
processor.- Parameters:
processor- aRomeNewsProcessorImplobject
-
setCacheKeyPrefix
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
init.
- Throws:
Exception- if any.
-
getPolicyPref
getPolicyPref.
-
getSyndFeed
public PaginatingNewsFeed getSyndFeed(NewsConfiguration config, int page, int maxStories) throws NewsException getSyndFeed.
- Parameters:
config- aNewsConfigurationobjectpage- a intmaxStories- a int- Returns:
- a
PaginatingNewsFeedobject - 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 retrievedtitlePolicy- String the cleaning policy for the titledescriptionPolicy- String the cleaning policy for the descriptionmaxStories- 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- aCacheobject
-