|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cutunes.server.RequestHandler
RequestHandler specifies the format of the incoming XML-RPC messages. All messages requires some sort of access to the database, but all database logic has been separated into the DatabaseController class. The four methods below define the API used to communicate between the client and server, making for a very simple and easy to understand API.
Constructor Summary | |
RequestHandler()
Constructor gets an instance of the DatabaseController. |
Method Summary | |
boolean |
bulkLoadSongs(int userID,
boolean sendAllSongs,
java.util.Date lastSync,
java.lang.String version,
java.util.Vector songGroup)
This method received the user's song information over XML-RPC and adds it to the database. |
int |
countForArtist(java.lang.String query,
java.lang.String version)
Get the total playcounts for an artist query |
java.util.Vector |
getArtistsLike(java.lang.String artist,
java.lang.String version)
Gets artists similar to a specified artist |
java.util.Vector |
getArtistsOfUser(int userID,
int myUserID,
int limit,
java.lang.String version)
Get the top artists of a user that another user also has |
java.sql.Timestamp |
getLastSync(int userID,
java.lang.String version)
Queries database to get the time of the user's last sync. |
java.util.Vector |
getSongsForArtist(java.lang.String artist,
int userID,
int numItems,
java.lang.String version)
Get songs of an artist that a user has |
java.lang.Integer |
getUserID(java.lang.String username,
java.lang.String password,
java.lang.String version)
getUserID() performs basic login checks and returns the given user's unique ID number. |
java.util.Vector |
getUserIDFor(java.lang.String query,
java.lang.String version)
Get a userID, and name for a given query. |
boolean |
loadPlaylists(int userID,
boolean sendAllSongs,
java.util.Date lastSync,
java.lang.String version,
java.util.Vector playlistGroup)
Load playlist data -- currently not used, because we dont have a way to store playlists in the database yet |
void |
logPlaylist(java.lang.String query,
int userID,
java.lang.String version)
Log a user creating a playlist from a query |
boolean |
setLastSync(int userID,
java.lang.String version)
Sets the user's last sync time to the current time. |
boolean |
updateForFirstSync(int userID,
java.lang.String version)
The first time the user syncs we should update their this week play counts in a specific way |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RequestHandler()
Method Detail |
public java.lang.Integer getUserID(java.lang.String username, java.lang.String password, java.lang.String version)
username
- String usernamepassword
- String passwordversion
- String identifying version of client software
public java.sql.Timestamp getLastSync(int userID, java.lang.String version)
userID
- Unique ID of userversion
- String identifying version of client software
public boolean setLastSync(int userID, java.lang.String version)
userID
- Unique ID of userversion
- String identifying version of client software
public boolean updateForFirstSync(int userID, java.lang.String version)
userID
- Unique ID of userversion
- String identifying version of client software
public boolean bulkLoadSongs(int userID, boolean sendAllSongs, java.util.Date lastSync, java.lang.String version, java.util.Vector songGroup)
The songsFile contains all the track information to put in the songs table of the database (this includes track name, album, artist, etc). This information is always loaded into the database using MySQLs bulk load function, even if it already exists in the table (in which case it is ignored).
The hasSongsFile contains all the information about the playcount and last play date of a specified song for a given user. It is written and bulk loaded only if the sendAllSongs boolean is true (which indicates this is a user's first sync). Otherwise this information is loaded using the DatabaseController's updateHasSong function (which updates weekly playcounts according to a specified algorithm).
userID
- Unique ID identifying usersendAllSongs
- Boolean variable is true if this is a user's first
sync, in which case the has_song table data is bulk
loadedlastSync
- The time of the user's last syncversion
- String identifying version of client softwaresongGroup
- Vector of SongData objects
public boolean loadPlaylists(int userID, boolean sendAllSongs, java.util.Date lastSync, java.lang.String version, java.util.Vector playlistGroup)
userID
- sendAllSongs
- lastSync
- version
- playlistGroup
-
public java.util.Vector getArtistsLike(java.lang.String artist, java.lang.String version)
artist
- version
-
public java.util.Vector getSongsForArtist(java.lang.String artist, int userID, int numItems, java.lang.String version)
artist
- userID
- numItems
- version
-
public java.util.Vector getArtistsOfUser(int userID, int myUserID, int limit, java.lang.String version)
userID
- myUserID
- limit
- version
-
public java.util.Vector getUserIDFor(java.lang.String query, java.lang.String version)
query
- version
-
public int countForArtist(java.lang.String query, java.lang.String version)
query
- version
-
public void logPlaylist(java.lang.String query, int userID, java.lang.String version)
query
- userID
- version
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |