/* Return on Cancelation or shutdown */
if (monitor.isCanceled() || fShuttingDown)
return Status.CANCEL_STATUS;
/* Load Conditional Get for the URL */
IConditionalGet conditionalGet = fConditionalGetDAO.load(feedLink);
/* Define Properties for Connection */
Map<Object, Object> properties = new HashMap<Object, Object>();
properties.put(IConnectionPropertyConstants.CON_TIMEOUT, FEED_CON_TIMEOUT);
/* Add Conditional GET Headers if present */
if (conditionalGet != null) {
String ifModifiedSince = conditionalGet.getIfModifiedSince();
if (ifModifiedSince != null)
properties.put(IConnectionPropertyConstants.IF_MODIFIED_SINCE, ifModifiedSince);
String ifNoneMatch = conditionalGet.getIfNoneMatch();
if (ifNoneMatch != null)
properties.put(IConnectionPropertyConstants.IF_NONE_MATCH, ifNoneMatch);
}
/* Load the Feed */
final Pair<IFeed, IConditionalGet> pairResult = Owl.getConnectionService().reload(feedLink, monitor, properties);
/* Return on Cancelation or Shutdown */
if (monitor.isCanceled() || fShuttingDown)
return Status.CANCEL_STATUS;
/* Update ConditionalGet Entity */
boolean conditionalGetIsNull = (conditionalGet == null);
conditionalGet = updateConditionalGet(feedLink, conditionalGet, pairResult.getSecond());
boolean deleteConditionalGet = (!conditionalGetIsNull && conditionalGet == null);
/* Return on Cancelation or Shutdown */
if (monitor.isCanceled() || fShuttingDown)
return Status.CANCEL_STATUS;
/* Load the Favicon directly afterwards if required */
if (!InternalOwl.PERF_TESTING && OwlUI.getFavicon(bookmark) == null) {
try {
byte[] faviconBytes = null;
/* First try using the Homepage of the Feed */
URI homepage = pairResult.getFirst().getHomepage();
if (homepage != null && StringUtils.isSet(homepage.toString()))
faviconBytes = Owl.getConnectionService().getFeedIcon(homepage);
/* Then try with Feed address itself */
if (faviconBytes == null)
faviconBytes = Owl.getConnectionService().getFeedIcon(feedLink);
/* Store locally */
if (!monitor.isCanceled() && !fShuttingDown)
OwlUI.storeImage(bookmark.getId(), faviconBytes, OwlUI.BOOKMARK, 16, 16);
} catch (UnknownFeedException e) {
Activator.getDefault().getLog().log(e.getStatus());
}
}
/* Return on Cancelation or Shutdown */
if (monitor.isCanceled() || fShuttingDown)
return Status.CANCEL_STATUS;
/* Merge and Save Feed */
if (!InternalOwl.TESTING) {
final IConditionalGet finalConditionalGet = conditionalGet;
final boolean finalDeleteConditionalGet = deleteConditionalGet;
fSaveFeedQueue.schedule(new TaskAdapter() {
public IStatus run(IProgressMonitor monitor) {
/* Return on Cancelation or Shutdown */