|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ciagent.CIAgent | +--infofilter.NewsReaderAgent
The NewsReaderAgent
class implements an agent can read
one or more news articles from an NNTP host.
Field Summary | |
(package private) java.util.Vector |
articles
|
(package private) NewsArticle |
currentArt
|
(package private) java.net.Socket |
news
|
(package private) java.lang.String |
newsGroup
|
(package private) java.util.Vector |
newsGroups
|
(package private) java.lang.String |
newsHost
|
(package private) boolean |
newsHostConnectionOK
|
(package private) java.io.BufferedReader |
newsIn
|
(package private) java.io.PrintWriter |
newsOut
|
(package private) int |
numArticles
|
Fields inherited from class ciagent.CIAgent |
agentPlatform,
children,
DEFAULT_ASYNCTIME,
DEFAULT_SLEEPTIME,
name,
parent,
traceLevel |
Constructor Summary | |
NewsReaderAgent()
Creates a NewsReaderAgent object. |
|
NewsReaderAgent(java.lang.String name)
Creates a NewsReaderAgent object with the given name. |
Method Summary | |
(package private) void |
closeNewsHost()
Closes the connection to the NNTP news host. |
void |
connectToNewsHost(java.lang.String newsHost)
Creates a socket connection to an NNTP news server. |
protected void |
downloadNewsGroup(java.util.Vector args)
Connects to the news host, reads the news group, and closes the connection with the news host. |
java.util.Vector |
getArticles()
Retrieves the articles. |
java.lang.String |
getNewsGroup()
Retrieves the news group from this agent. |
java.lang.String |
getNewsHost()
Retrieves the news host from this agent. |
int |
getNumArticles()
Retrieves the number of articles to be read by this agent. |
java.lang.String |
getTaskDescription()
Retrieves the task description. |
void |
initialize()
Initializes the agent by setting the sleep time to 5 seconds. |
protected NewsArticle |
parseHeader(java.lang.String id)
Parses the article header and retrieves the subject line. |
void |
process()
Does nothing. |
void |
processCIAgentEvent(CIAgentEvent event)
Processes a CIAgentEvent object (trace, downloadNewsGroup). |
void |
processTimerPop()
Does nothing. |
void |
readNewsGroup(java.lang.String newsGroup)
Reads an entire news group. |
void |
readSingleArticle(java.lang.String id)
Reads a single article from the opened NNTP server. |
protected void |
sendArticleToListeners(NewsArticle art)
Sends an article that was read from the news server to anyone listening for it. |
void |
setNewsGroup(java.lang.String newsGroup)
Sets the news group to the given string. |
void |
setNewsHost(java.lang.String newsHost)
Sets the news host to the given string. |
void |
setNumArticles(int numArticles)
Sets the maximum number of articles read by this agent. |
void |
stop()
Stops the agent processing. |
Methods inherited from class java.lang.Object |
|
Field Detail |
java.lang.String newsHost
java.lang.String newsGroup
java.net.Socket news
java.io.PrintWriter newsOut
java.io.BufferedReader newsIn
boolean newsHostConnectionOK
int numArticles
java.util.Vector articles
NewsArticle currentArt
java.util.Vector newsGroups
Constructor Detail |
public NewsReaderAgent()
NewsReaderAgent
object.public NewsReaderAgent(java.lang.String name)
NewsReaderAgent
object with the given name.name
- the String object that contains the agent nameMethod Detail |
public void setNewsHost(java.lang.String newsHost)
newsHost
- the String object that contains the news hostpublic java.lang.String getNewsHost()
public void setNewsGroup(java.lang.String newsGroup)
newsGroup
- the String object that contains the news grouppublic java.lang.String getNewsGroup()
public void setNumArticles(int numArticles)
numArticles
- the integer value for the number of articlespublic int getNumArticles()
public java.util.Vector getArticles()
public void initialize()
public java.lang.String getTaskDescription()
public void process()
public void stop()
public void processTimerPop()
public void processCIAgentEvent(CIAgentEvent event)
event
- the CIAgentEvent object to be processedprotected void sendArticleToListeners(NewsArticle art)
art
- the NewsArticle object to be sentprotected void downloadNewsGroup(java.util.Vector args)
args
- the Vector that contains the news host and news group stringspublic void connectToNewsHost(java.lang.String newsHost)
newsHost
- the String object that contains the news hostvoid closeNewsHost()
public void readNewsGroup(java.lang.String newsGroup)
newsGroup
- the String object that contains the news group to be readpublic void readSingleArticle(java.lang.String id)
id
- the String object that contains the id of the article to be readprotected NewsArticle parseHeader(java.lang.String id)
id
- the String object that contains the id of the article
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |