mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
initial pubsubhubbub support (#44)
This commit is contained in:
@@ -7,18 +7,28 @@ import javax.ejb.Stateless;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.commafeed.backend.dao.FeedDAO;
|
||||
import com.commafeed.backend.model.Feed;
|
||||
import com.commafeed.backend.model.FeedEntry;
|
||||
import com.commafeed.backend.model.FeedPushInfo;
|
||||
import com.commafeed.backend.pubsubhubbub.SubscriptionHandler;
|
||||
import com.commafeed.backend.services.FeedUpdateService;
|
||||
|
||||
@Stateless
|
||||
public class FeedRefreshUpdater {
|
||||
|
||||
protected static Logger log = LoggerFactory
|
||||
.getLogger(FeedRefreshUpdater.class);
|
||||
|
||||
@Inject
|
||||
FeedUpdateService feedUpdateService;
|
||||
|
||||
@Inject
|
||||
SubscriptionHandler handler;
|
||||
|
||||
@Inject
|
||||
FeedDAO feedDAO;
|
||||
|
||||
@@ -28,6 +38,14 @@ public class FeedRefreshUpdater {
|
||||
feedUpdateService.updateEntries(feed, entries);
|
||||
}
|
||||
feedDAO.update(feed);
|
||||
handlePubSub(feed);
|
||||
}
|
||||
|
||||
private void handlePubSub(Feed feed) {
|
||||
FeedPushInfo info = feed.getPushInfo();
|
||||
if (info != null && info.isActive() == false) {
|
||||
handler.subscribe(feed);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user