Package org.wiztools.commons.feed

Source Code of org.wiztools.commons.feed.RomeFeedExecuter

package org.wiztools.commons.feed;

import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import org.apache.log4j.Logger;

/**
*
* @author subhash
*/
public class RomeFeedExecuter extends AbstractFeedExecuter {

    private static final Logger LOG = Logger.getLogger(RomeFeedExecuter.class);

    public Feed getFeed(URL url) throws FeedException, IOException {
        Feed f = null;
        final SyndFeedInput input = new SyndFeedInput();
        try {
            final SyndFeed romeFeed = input.build(
                    new XmlReader(HttpUtil.getConnectionStream(url, options)));
            f = new Feed();
            f.setTitle(romeFeed.getTitle());
            String link = romeFeed.getLink();
            if (link != null) {
                f.setUrl(new URL(link));
            }

            List<SyndEntry> romeEntryList = romeFeed.getEntries();

            List<FeedEntry> l = RomeUtil.getEntries(romeEntryList);

            f.setEntries(l);

        } catch (com.sun.syndication.io.FeedException ex) {
            throw new FeedException(ex);
        }
        return f;
    }
}
TOP

Related Classes of org.wiztools.commons.feed.RomeFeedExecuter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.