/*
 * Created on Aug 15, 2005
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package uwl.rss.provider;

import java.net.URL;

import com.sap.tc.logging.Category;
import com.sap.tc.logging.Location;
import com.sap.tc.logging.Severity;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;

/**
 * @author I802897
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class RssBean {
	private static final Location loc = Location.getLocation(RssBean.class);

	private String title;
	private String rssUrl;
	private boolean bdisabled;

	public RssBean(String rssUrl, String title, boolean bdisabled) {
		this.title = title;
		this.rssUrl = rssUrl;
		this.bdisabled = bdisabled;
	}
	/**
	 * @return
	 */
	public String getRssUrl() {
		return rssUrl;
	}

	/**
	 * @return
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @param string
	 */
	public void setRssUrl(String string) {
		rssUrl = string;
	}

	/**
	 * @param string
	 */
	public void setTitle(String string) {
		title = string;
	}
	
	public SyndFeed getRssFeed() {
		SyndFeed feed = null;
		try {
			URL feedUrl = new URL(rssUrl);
			SyndFeedInput input = new SyndFeedInput();
			feed = input.build(new XmlReader(feedUrl));
		}
		catch(Throwable ex){
			Category.APPLICATIONS.logThrowable(Severity.FATAL,
												loc,
												(Object)"getRssFeed()",
												new Object[]{this},
												"Error getting Rss Feed from Url:" + rssUrl,
												ex);
		}
		return feed;
	}
	/**
	 * @return
	 */
	public boolean isDisabled() {
		return bdisabled;
	}

	/**
	 * @param b
	 */
	public void setDisabled(boolean b) {
		bdisabled = b;
	}

}
