agentland.device.intelliCD
Class SQLProcessor

java.lang.Object
  |
  +--agentland.device.intelliCD.SQLProcessor
Direct Known Subclasses:
CDProcessor, LiquidAudioProcessor, SoftwareProcessor

public abstract class SQLProcessor
extends Object

The generic interface for loading the disc data from the database.


Field Summary
protected  String curLocation
           
 
Constructor Summary
SQLProcessor(Player p)
          Creates the SQLProcessor, given an agent for handling requests.
 
Method Summary
 SongContainer buildContainer(ResultSet rs)
           
 Song buildSong(ResultSet rs, SongContainer sc)
          Creates a song from a ResultSet.
 void cleanContainer(SongContainer c)
          Cleanup procedure to remove nulls from the collection.
protected  String containerQuery(int coll_id)
           
abstract  String getType()
          Fetches the type of data being accessed.
 void process(Connection cnxn, SCollection coll, String where)
          Uses the given SQL Connection to retrieve any containers that are desired, and will return them to the collection using any of a number of SCollection methods.
protected  String songQuery(int coll_id)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

curLocation

protected String curLocation
Constructor Detail

SQLProcessor

public SQLProcessor(Player p)
Creates the SQLProcessor, given an agent for handling requests. The agent will be installed into the processed songs.
Parameters:
p - The agent used for playing songs This gets added to the song.
Method Detail

getType

public abstract String getType()
Fetches the type of data being accessed. This is used to get the right information out of the database.

buildSong

public Song buildSong(ResultSet rs,
                      SongContainer sc)
               throws SQLException
Creates a song from a ResultSet. This should be used by subclasses to make a song of the correct type. This method should not modify the result set at all. It must only call get...() methods to retrieve values. This method should add the created song into the song container, through whatever method is appropriate.
Parameters:
rs - A ResultSet holding a row of a song.
sc - The SongContainer to add this song into.
Returns:
the song corresponding to the ResultSet.

buildContainer

public SongContainer buildContainer(ResultSet rs)
                             throws SQLException

containerQuery

protected String containerQuery(int coll_id)

songQuery

protected String songQuery(int coll_id)

process

public void process(Connection cnxn,
                    SCollection coll,
                    String where)
Uses the given SQL Connection to retrieve any containers that are desired, and will return them to the collection using any of a number of SCollection methods. This simply runs queries on the database, and adds song collections to the SCollection.
Parameters:
cnxn - the database connection to use.
coll - a SCollection value
where - table to use to find collections process.
See Also:
SCollection, Connection

cleanContainer

public void cleanContainer(SongContainer c)
Cleanup procedure to remove nulls from the collection.