agentland.info.news.newsWall
Class NewsModelAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.resource.ManagedAgent
                                      |
                                      +--agentland.info.news.newsWall.NewsModelAgent
All Implemented Interfaces:
Agent, Good, Managed, MetagluePrimitives, NewsModel, Observer, Remote, Serializable, Spy

public class NewsModelAgent
extends ManagedAgent
implements NewsModel, Observer

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
protected  news.models.NewsStoryModel model
           
static String SERVER_URL
          Identifies hardwired address of server's web files for client.
protected  Vector stories
           
protected  TranslatorEngine storiesByCategory
           
protected  TranslatorEngine storiesBySource
           
 
Fields inherited from class agentland.resource.ManagedAgent
rm, society
 
Fields inherited from class agentland.util.GoodAgent
alert, notifier
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
NewsModelAgent()
           
 
Method Summary
protected  void addNewStory(news.models.Story story)
           
 Collection getCategories()
           
 Vector getCurrentStories()
           
 String getServerURL()
          Returns the URL of the server that the stories are being fetched from -- this should eventually be embedded in Story object, I think.
 Collection getSources()
           
protected  void initNews()
           
 void retrieveNews()
          Retrieves all stories from the server and updates the local collection of stories.
 void update(Observable observable, Object arg)
          This method receives updates from the data structure representing the incoming news stories.
 void updateStoriesFromServerSource()
          Triggers the update process.
protected  void updateStoriesUI()
          Sends out a notification to all interested parties letting them know that new news items have become available.
 
Methods inherited from class agentland.resource.ManagedAgent
connect, getAlert, getNeed, isAvailable, isAvailable, reliesOn, reliesOn, replace, replace, request, request, request, requestAgent, requestAgent, resources, resourcesByAgentID, setNeed, tiedTo, yank, yank, yank
 
Methods inherited from class agentland.util.GoodAgent
addSpy, addSpy, alert, alertString, beep, error, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, buildEHAFor, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getOldLogs, getProperties, getProxyHandlerClass, getSociety, installAPH, log, log, lookupClass, reliesOn, reliesOnSynch, removeAPHFromCatalog, removeFrozen, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, toString, whereAreYou
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface agentland.resource.Managed
getNeed, replace, replace, resources, yank, yank
 
Methods inherited from interface agentland.util.Good
getHistory, getHistoryElement, resetHistory
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, getOldLogs, shutdown, startup, whereAreYou
 
Methods inherited from interface agentland.util.Spy
tell
 

Field Detail

storiesByCategory

protected TranslatorEngine storiesByCategory

storiesBySource

protected TranslatorEngine storiesBySource

stories

protected Vector stories

SERVER_URL

public static String SERVER_URL
Identifies hardwired address of server's web files for client.

model

protected news.models.NewsStoryModel model
Constructor Detail

NewsModelAgent

public NewsModelAgent()
               throws RemoteException
Method Detail

getCurrentStories

public Vector getCurrentStories()
                         throws RemoteException
Specified by:
getCurrentStories in interface NewsModel

getSources

public Collection getSources()
                      throws RemoteException
Specified by:
getSources in interface NewsModel

getCategories

public Collection getCategories()
                         throws RemoteException
Specified by:
getCategories in interface NewsModel

getServerURL

public String getServerURL()
                    throws RemoteException
Returns the URL of the server that the stories are being fetched from -- this should eventually be embedded in Story object, I think.
Specified by:
getServerURL in interface NewsModel

initNews

protected void initNews()

update

public void update(Observable observable,
                   Object arg)
This method receives updates from the data structure representing the incoming news stories. It should send out notifications to all UIs to let them know they should update their view.
Specified by:
update in interface Observer

retrieveNews

public void retrieveNews()
Retrieves all stories from the server and updates the local collection of stories. It then sorts stories in chronological order.

addNewStory

protected void addNewStory(news.models.Story story)

updateStoriesFromServerSource

public void updateStoriesFromServerSource()
Triggers the update process. If new stories have arrived, the update method will be called automatically.

updateStoriesUI

protected void updateStoriesUI()
Sends out a notification to all interested parties letting them know that new news items have become available.