public final class ConfigurableHttpCalendarAdapter<T> extends AbstractCalendarAdapter implements ICalendarAdapter
ICalendarAdapter that uses Commons HttpClient for retrieving CalendarEventSets.
This bean requires an EhCache Cache be provided. This bean also depends on instances
of 3 different interfaces (default implementation listed in parenthesis):
IUrlCreator (default configuration: DefaultUrlCreatorImpl)
ICredentialsExtractor (default: DefaultCredentialsExtractorImpl)
IContentProcessor (default: ICalendarContentProcessorImpl)
CalendarEventSets from a variety of different end points,
for example an RSS feed behind basic auth, a CalendarKey implementation behind a shared secret,
or behind CAS.| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.logging.Log |
log |
| Constructor and Description |
|---|
ConfigurableHttpCalendarAdapter() |
| Modifier and Type | Method and Description |
|---|---|
CalendarEventSet |
getEvents(CalendarConfiguration calendarConfiguration,
org.joda.time.Interval interval,
javax.portlet.PortletRequest request)
Workflow for this implementation:
consult the configured
IUrlCreator for the url to request
consult the cache to see if the fetch via HTTP is necessary (if not return the cached
events)
if the fetch is necessary, consult the ICredentialsExtractor for necessary Credentials
Invoke retrieveCalendarHttp
Pass the returned InputStream into the configured IContentProcessor
Return the CalendarEventSets
(non-Javadoc) |
protected String |
getIntervalSpecificCacheKey(String baseKey,
org.joda.time.Interval interval) |
protected InputStream |
retrieveCalendarHttp(String url,
org.apache.commons.httpclient.Credentials credentials)
Uses Commons HttpClient to retrieve the specified url (optionally with the provided
Credentials. |
void |
setCache(net.sf.ehcache.Cache cache) |
void |
setCacheKeyGenerator(ICacheKeyGenerator cacheKeyGenerator) |
void |
setCacheKeyPrefix(String cacheKeyPrefix) |
void |
setContentProcessor(IContentProcessor contentProcessor) |
void |
setCredentialsExtractor(ICredentialsExtractor credentialsExtractor) |
void |
setUrlCreator(IUrlCreator urlCreator) |
getDescriptionKey, getLink, getParameters, getTitleKey, insertCalendarEventSetIntoCache, insertCalendarEventSetIntoCache, setDescriptionKey, setParameters, setTitleKeyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDescriptionKey, getLink, getParameters, getTitleKeypublic void setCache(net.sf.ehcache.Cache cache)
cache - the cache to setpublic void setUrlCreator(IUrlCreator urlCreator)
urlCreator - the urlCreator to setpublic void setCredentialsExtractor(ICredentialsExtractor credentialsExtractor)
credentialsExtractor - the credentialsExtractor to setpublic void setContentProcessor(IContentProcessor contentProcessor)
contentProcessor - the contentProcessor to setpublic void setCacheKeyPrefix(String cacheKeyPrefix)
cacheKeyPrefix - the cacheKeyPrefix to setpublic void setCacheKeyGenerator(ICacheKeyGenerator cacheKeyGenerator)
public CalendarEventSet getEvents(CalendarConfiguration calendarConfiguration, org.joda.time.Interval interval, javax.portlet.PortletRequest request) throws CalendarException
IUrlCreator for the url to request
ICredentialsExtractor for necessary Credentials
InputStream into the configured IContentProcessor
CalendarEventSets
getEvents in interface ICalendarAdaptercalendarConfiguration - calendar configuration for which to retrieve eventsinterval - time period for which to retrieve eventsrequest - user's portlet requestCalendarExceptionICalendarAdapter.getEvents(org.jasig.portlet.calendar.CalendarConfiguration,
org.joda.time.Interval, javax.portlet.PortletRequest)protected String getIntervalSpecificCacheKey(String baseKey, org.joda.time.Interval interval)
protected InputStream retrieveCalendarHttp(String url, org.apache.commons.httpclient.Credentials credentials) throws CalendarException
Credentials. The response body is returned as an InputStream.url - URL of the calendar to be retrievedcredentials - Credentials to use with the request, if necessary (null is ok if
credentials not required)CalendarException - wraps all potential Exception typesCopyright © 2019 Apereo. All rights reserved.