| 1 19 20 package org.jperdian.rss2; 21 22 import java.net.URL ; 23 24 import org.jperdian.rss2.dom.RssChannel; 25 26 32 33 public class RssClient { 34 35 private RssParser myParser = new RssParser(); 36 private URL myURL = null; 37 private String myKeywords = ""; 38 private String myTitle = ""; 39 40 45 public RssClient(URL url) { 46 this(url, "", ""); 47 } 48 49 58 public RssClient(URL url, String keywords, String title) { 59 this.setURL(url); 60 this.setKeywords(keywords); 61 this.setTitle(title); 62 } 63 64 73 public final RssChannel getData() throws RssException { 74 RssChannel channel = new RssChannel(this); 75 channel.setClient(this); 76 this.loadData(channel); 77 return channel; 78 } 79 80 83 public void loadData(RssChannel channel) throws RssException { 84 this.getParser().parse(this.getURL(), channel); 85 channel.setDataLoaded(true); 86 channel.setLastUpdate(System.currentTimeMillis()); 87 } 88 89 90 94 97 protected RssParser getParser() { 98 return this.myParser; 99 } 100 101 104 protected void setURL(URL url) { 105 this.myURL = url; 106 } 107 108 111 public URL getURL() { 112 return this.myURL; 113 } 114 115 118 protected void setKeywords(String keywords) { 119 this.myKeywords = keywords; 120 } 121 122 125 public String getKeywords() { 126 return this.myKeywords; 127 } 128 129 132 protected void setTitle(String title) { 133 this.myTitle = title; 134 } 135 136 139 public String getTitle() { 140 return this.myTitle; 141 } 142 143 } | Popular Tags |