agentland.device.intelliCD
Class CollectionHandlerAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.device.intelliCD.CollectionHandlerAgent
All Implemented Interfaces:
Agent, CollectionHandler, Good, MetagluePrimitives, Remote, Serializable, Spy
Direct Known Subclasses:
SongListHandlerAgent

public class CollectionHandlerAgent
extends GoodAgent
implements CollectionHandler

This class is a unification of the existing DiscChangerHandler and Mp3CollectionHandler agents to deal with a unified Collection (which could contain Mp3s, CDs, or whatever we like) We should probably place the SQL stuff elsewhere, maybe letting the individual SongContainers decide what to put where. But that's a major rewrite for another day.

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Field Summary
protected  ManagedConnection cnxn
           
protected  SongContainer collection
           
 
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
CollectionHandlerAgent()
           
 
Method Summary
 void add(Object o)
           
 void add(SongContainerElement sce)
           
 boolean clear()
           
 SongContainer getCollection()
           
 void informAll(IntelliCDEvent e)
           
protected  void init()
           
 boolean remove(SongContainerElement el)
           
 void setCollection(SongContainer dc)
           
 void setConnection(ManagedConnection c)
           
 void setContainerAuthor(SongContainer d, String author)
           
 void setContainerTitle(SongContainer d, String title)
           
 void setSongAuthor(Song s, String author)
           
 void setSongDuration(Song s, int d)
           
 void setSongDuration(Song s, String d)
           
 void setSongTitle(Song s, String title)
           
protected  void updateContainer(SongContainer d, String title, String author)
           
protected  void updateSong(Song s, String title, String author, int duration)
           
 
Methods inherited from class agentland.util.GoodAgent
addSpy, addSpy, alert, alertString, beep, error, getAlert, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getProperties, getSociety, log, log, lookupClass, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOn, reliesOn, reliesOnSynch, removeFrozen, replaceExceptionHandler, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, 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, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface agentland.util.Good
getHistory, getHistoryElement, resetHistory
 
Methods inherited from interface metaglue.Agent
addMonitor, alive, getAgentID, getMetaglueAgentID, shutdown, startup, whereAreYou
 
Methods inherited from interface agentland.util.Spy
tell
 

Field Detail

collection

protected SongContainer collection

cnxn

protected ManagedConnection cnxn
Constructor Detail

CollectionHandlerAgent

public CollectionHandlerAgent()
                       throws RemoteException
Method Detail

init

protected void init()

setCollection

public void setCollection(SongContainer dc)
Specified by:
setCollection in interface CollectionHandler

setConnection

public void setConnection(ManagedConnection c)
Specified by:
setConnection in interface CollectionHandler

getCollection

public SongContainer getCollection()
Specified by:
getCollection in interface CollectionHandler

updateContainer

protected void updateContainer(SongContainer d,
                               String title,
                               String author)

setContainerTitle

public void setContainerTitle(SongContainer d,
                              String title)
Specified by:
setContainerTitle in interface CollectionHandler

setContainerAuthor

public void setContainerAuthor(SongContainer d,
                               String author)
Specified by:
setContainerAuthor in interface CollectionHandler

updateSong

protected void updateSong(Song s,
                          String title,
                          String author,
                          int duration)

setSongTitle

public void setSongTitle(Song s,
                         String title)
Specified by:
setSongTitle in interface CollectionHandler

setSongAuthor

public void setSongAuthor(Song s,
                          String author)
Specified by:
setSongAuthor in interface CollectionHandler

setSongDuration

public void setSongDuration(Song s,
                            int d)
Specified by:
setSongDuration in interface CollectionHandler

setSongDuration

public void setSongDuration(Song s,
                            String d)
                     throws NumberFormatException
Specified by:
setSongDuration in interface CollectionHandler

informAll

public void informAll(IntelliCDEvent e)

add

public void add(SongContainerElement sce)
Specified by:
add in interface CollectionHandler

add

public void add(Object o)
Specified by:
add in interface CollectionHandler

clear

public boolean clear()
Specified by:
clear in interface CollectionHandler

remove

public boolean remove(SongContainerElement el)
Specified by:
remove in interface CollectionHandler