org.lyra.Database
Class Comptroller

java.lang.Object
  extended by org.lyra.Database.Comptroller

public class Comptroller
extends java.lang.Object

The Comptroller class deals with the details and intricacies of dealing with the database itself. While the database module is in itself is public this provides a middle layer preventing mass code changes in case of database engine or a change in standards.

In addition to the above, it was decided that all functions against the database would be restricted to one thread at a time. While many database engines can handle read operations and write operations at a time, SQLite tends to lock up. So by forcing a one thread, we allow transactions and other operations to not be interrupted.

Version:
1.0.5, %Revision, 174%, %LastChangedDate, 27/10/12 3:33PM%
Author:
Martin Foster

Field Summary
(package private)  Interface Db
           
private static java.lang.String DEF_LANGUAGE
           
private static java.lang.String PSEUDONULL
           
 
Constructor Summary
Comptroller(Interface db)
          A secondary constructor for the class itself.
 
Method Summary
 boolean deleteHost(java.lang.String ident)
          Removes a host from the database.
 void deleteHosts()
          Removes all hosts from the database.
 void deletePlaylistLocal(java.lang.String name)
          Removes a local playlist from the local host database.
 void deleteSongs(java.util.Set<java.lang.String> deletes)
          Method which deals with the removing superfluous rows from the song library.
 void fetchGlobal(java.util.Map<java.lang.String,java.lang.String> prop)
          The Global properties file contains all information necessary to configure and control the look and feel of the application itself.
 java.util.Map<java.lang.String,java.lang.String> fetchLanguage()
          The language files carries all of the information necessary to support international languages without a code rewrite.
 java.util.List<java.util.Map<java.lang.String,java.lang.String>> getHostComplete()
          Returns a complete listing of all hosts stored in the database in a key/pair structure.
 int getHostCount()
          Returns a list of host entries that exist within the database.
 java.util.Map<java.lang.String,java.lang.String> getHostDetails()
          Method called to return host details when there is only one host element to find in the database.
 java.util.Map<java.lang.String,java.lang.String> getHostDetails(java.lang.String ident)
          This variant will return a singular host based on its identifier.
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getHostLibrary()
          While it may be more memory hungry to fetch the entire library in one hit.
 java.util.List<java.lang.String> getHostList()
          Returns a List of strings containing every identifier for a host currently in the database.
 java.lang.String getHostSingle()
          Will fetch the filename of the assumed singular host in the database.
 java.util.Map<java.lang.String,java.lang.String> getHostSong(java.lang.String file)
          Will fetch information for one unique song.
 java.util.Map<java.lang.String,java.lang.Integer> getHostStatistics()
          There is no direct and easy method to extract multiple rows and place their values into a Map element.
 java.lang.String getHostVersion()
          Extracts the version information from the version view.
 java.lang.String[][] getOrganiserAlbum(java.util.Map<java.lang.String,java.lang.String> filter, java.lang.String nil, java.lang.String unknown)
          Fetches album listing in complete from.
 java.lang.String[][] getOrganiserArtist(java.util.Map<java.lang.String,java.lang.String> filter, java.lang.String nil, java.lang.String unknown)
          Fetches artist listing in complete from.
private  java.lang.String[][] getOrganiserFiltered(java.util.Map<java.lang.String,java.lang.String> filter, java.lang.String column, java.lang.String nil, java.lang.String unknown)
          Fetches general information in complete from.
 java.lang.String[][] getOrganiserGenre(java.util.Map<java.lang.String,java.lang.String> filter, java.lang.String nil, java.lang.String unknown)
          Fetches genre listing in complete from.
 java.util.List<java.lang.String> getOrganiserPlaylists()
          Will return a listing of all local playlists currently stored on the local side.
 java.lang.String[][] getOrganiserSongs(java.util.Map<java.lang.String,java.lang.String> filter)
          Fetches song information in complete from.
 java.lang.String[][] getOrganiserSongs(java.lang.String fields, java.lang.String criteria)
          Fetches song information in complete from.
 java.util.Map<java.lang.String,java.lang.String> getOrganiserStatus(java.util.Map<java.lang.String,java.lang.String> filter)
          Lets the database do all of the calculations and heavy work associated with generating the status bar information.
 java.util.Map<java.lang.String,java.lang.String> getOrganiserStatus(java.lang.String fields, java.lang.String criteria)
          Lets the database do all of the calculations and heavy work associated with generating the status bar information.
 java.util.List<java.lang.String> getPlaylistDecade()
          Will return a listing of all decades from the database.
 java.util.List<java.lang.String> getPlaylistDecade(java.lang.String decade)
          Returns a list of all songs associated with a certain decade.
 java.util.List<java.lang.String> getPlaylistFAlbum()
          Returns a list of all songs associated with the favourite albums in the database.
 java.util.List<java.lang.String> getPlaylistFArtist()
          Returns a list of all songs associated with the favourite artists in the database.
 java.util.List<java.lang.String> getPlaylistFGenre()
          Returns a list of all songs associated with the favourite Genres in the database.
 java.util.List<java.lang.String> getPlaylistFRating()
          Returns a list songs that have received a rating in order of precedence.
 java.util.List<java.lang.String> getPlaylistFSong()
          Returns a list of all songs associated with the favourite songs in the database.
 java.util.Set<java.lang.String> getPlaylistLocal()
          Will return a listing of all local playlists currently stored on the local side.
 java.util.List<java.lang.String> getPlaylistLocal(java.lang.String name)
          This will make use of a local playlist name in order to return its contents.
 java.lang.String getProgLanguage(java.lang.String code)
          There can be multiple language support for the application as a result it becomes necessary to track and attach various language files as necessary.
 void getSongAlbum(java.util.List<java.lang.String> store, java.util.Map<java.lang.String,java.lang.String> filter)
          Will append songs from a specific album to an existing list.
 void getSongAlbum(java.util.List<java.lang.String> store, java.lang.String album)
          Will append songs from a specific album to an existing list.
private  java.lang.String[] getSongArray(java.util.Map<java.lang.String,java.lang.String> filter)
          Generates the necessary array to pass on for the query.
 java.lang.String getSongArt(java.lang.String file)
          Extracts the Album Art cover information from the database.
 java.lang.String getSongArt(java.lang.String artist, java.lang.String album)
          Extracts the Album Art cover information from the database.
 void getSongArtist(java.util.List<java.lang.String> store, java.util.Map<java.lang.String,java.lang.String> filter)
          Will append songs from a specific artist to an existing list.
 void getSongArtist(java.util.List<java.lang.String> store, java.lang.String artist)
          Will append songs from a specific artist to an existing list.
private  java.lang.String getSongFilter(java.util.Map<java.lang.String,java.lang.String> filter)
          Generates the string that will be pass on in order to generate the appropriate query to the database.
 void getSongGenre(java.util.List<java.lang.String> store, java.util.Map<java.lang.String,java.lang.String> filter)
          Will append songs from a specific genre to an existing list.
 void getSongGenre(java.util.List<java.lang.String> store, java.lang.String genre)
          Will append songs from a specific genre to an existing list.
 java.util.Map<java.lang.String,java.lang.String> getStatDatasetGeneral(java.lang.String element, java.lang.String speriod, java.lang.String eperiod, java.lang.String limit)
          Method called to return results based on what the user has decided in the generation of his statistical charts.
 java.util.Map<java.lang.String,java.lang.String> getStatDatasetSong(java.lang.String speriod, java.lang.String eperiod, java.lang.String limit, java.lang.Boolean rating, java.lang.String joiner)
          Method called to return results based on what the user has decided in the generation of his statistical charts.
 int getStatTimescale(java.lang.String period)
          Returns the amount of days a certain period range will encompass.
 java.lang.String getSystemVersion()
          Extracts the version information from the version view.
 void insertAudit(java.lang.String action, java.lang.String... filenames)
          Inserts an entry into the audit table for the database.
 boolean insertCache(java.lang.String album, java.lang.String dest)
          Album art is a component of the player which requires external information.
 boolean insertCache(java.lang.String artist, java.lang.String album, java.lang.String dest)
          Album art is a component of the player which requires external information.
 boolean insertHost(java.lang.String identifier, java.lang.String host, java.lang.String port, java.lang.String password, java.lang.String filename, java.lang.String pathname, java.lang.String arguments)
          Inserts a Host into the database.
 void insertPlaylistLocal(java.lang.String name)
          In order to insert songs into the playlist it becomes necessary to first create a holding entry in the appropriate table.
 void insertPlaylistSong(java.lang.String playlist, java.util.List<java.util.Map<java.lang.String,java.lang.String>> current)
          Will insert all of the currently listed songs for the current playlist into this table.
 void insertSongs(java.util.List<java.util.Map<java.lang.String,java.lang.String>> inserts)
          Deals with mass insertions that can be associated with the the synch process of the database with the server.
 boolean resetCache(java.lang.String artist, java.lang.String album)
          Album art is a component of the player which requires external information.
 boolean updateHostDefault(java.lang.String host)
          This method will update the default host entry, to be used when selecting from a list of multiple hosts.
 void updateHostStatistics(java.util.Set<java.lang.String> keys, java.util.Map<java.lang.String,java.lang.String> values)
          Statistics are a major component of how we do business.
 void updatePrompt()
          This update can only be done one way, since the interface that uses it will only disable the prompt.
 void updateSettings(java.util.Map<java.lang.String,java.lang.String> settings)
          Will update the settings to include new state information.
 void updateSettings(java.util.Map<java.lang.String,java.lang.String> settings, java.lang.String filter)
          Will update the settings to include new state information.
 void updateSongRating(java.lang.String file, java.lang.String rating)
          Ratings are the only element of a song displayed that can be changed due to the source of the songs themselves.
 void updateSongs(java.util.List<java.util.Map<java.lang.String,java.lang.String>> updates)
          This method is a variant of the insertSongs method handling the intricacies of updates versus inserts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Db

Interface Db

DEF_LANGUAGE

private static final java.lang.String DEF_LANGUAGE
See Also:
Constant Field Values

PSEUDONULL

private static final java.lang.String PSEUDONULL
See Also:
Constant Field Values
Constructor Detail

Comptroller

public Comptroller(Interface db)
A secondary constructor for the class itself. This one requires an initialised Database.Interface class to proceed.

Parameters:
db - Database handle to manage the connections.
Method Detail

fetchLanguage

public java.util.Map<java.lang.String,java.lang.String> fetchLanguage()
The language files carries all of the information necessary to support international languages without a code rewrite.

Returns:
Returns the fully generated HashMap with language elements.

fetchGlobal

public void fetchGlobal(java.util.Map<java.lang.String,java.lang.String> prop)
The Global properties file contains all information necessary to configure and control the look and feel of the application itself.

Parameters:
prop - HashMap containing the existing properties to use.

getSystemVersion

public java.lang.String getSystemVersion()
Extracts the version information from the version view.

Returns:
String containing version info.

getHostVersion

public java.lang.String getHostVersion()
Extracts the version information from the version view.

Returns:
String containing version info.

getHostCount

public int getHostCount()
Returns a list of host entries that exist within the database. Used to determine what action to take at program startup.

Returns:
Integer containing number of clients.

getHostComplete

public java.util.List<java.util.Map<java.lang.String,java.lang.String>> getHostComplete()
Returns a complete listing of all hosts stored in the database in a key/pair structure.

Returns:
List of Maps containing host keys and details.

getHostDetails

public java.util.Map<java.lang.String,java.lang.String> getHostDetails()
Method called to return host details when there is only one host element to find in the database.

Returns:
Map containing host keys and details.

getHostDetails

public java.util.Map<java.lang.String,java.lang.String> getHostDetails(java.lang.String ident)
This variant will return a singular host based on its identifier.

Parameters:
ident - String identifier marking this element as unique.
Returns:
Map containing host keys and details.

getHostLibrary

public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getHostLibrary()
While it may be more memory hungry to fetch the entire library in one hit. This method cuts down on overall steps and execution time.

Returns:
Map using File as the primary key containing the song details.

getHostList

public java.util.List<java.lang.String> getHostList()
Returns a List of strings containing every identifier for a host currently in the database. This permits the user to then select a host for connection.

Returns:
Ordered list containing identifiers.

getHostSingle

public java.lang.String getHostSingle()
Will fetch the filename of the assumed singular host in the database. This assumption should only be made after confirming the amount of hosts actually available.

Returns:
String containing filename.

getHostSong

public java.util.Map<java.lang.String,java.lang.String> getHostSong(java.lang.String file)
Will fetch information for one unique song. Returns all database elements as a HasMap/

Parameters:
file - Filename of the song itself.
Returns:
Map containing rows keys and values.

getHostStatistics

public java.util.Map<java.lang.String,java.lang.Integer> getHostStatistics()
There is no direct and easy method to extract multiple rows and place their values into a Map element. This method will fake the operation and return the element completely generated containing statistics on the database as recorded last in order to determine the need for a sync operation. Elements returns are:
  • artists: number of artists
  • songs: number of songs
  • db_playtime: sum of all song times in the database
  • db_update: last database update in UNIX time

Returns:
Map element.

getProgLanguage

public java.lang.String getProgLanguage(java.lang.String code)
There can be multiple language support for the application as a result it becomes necessary to track and attach various language files as necessary.

Parameters:
code - Language code matching the ISO 639-1 name space.
Returns:
String containing location of the database.

getOrganiserAlbum

public java.lang.String[][] getOrganiserAlbum(java.util.Map<java.lang.String,java.lang.String> filter,
                                              java.lang.String nil,
                                              java.lang.String unknown)
Fetches album listing in complete from. Variants exist specifically to deal when filtering is permitted.

Parameters:
filter - Map containing the elements to filter.
nil - String for NIL filtering.
unknown - String for NULL elements.
Returns:
Multiple level array of strings containing all the information.

getOrganiserArtist

public java.lang.String[][] getOrganiserArtist(java.util.Map<java.lang.String,java.lang.String> filter,
                                               java.lang.String nil,
                                               java.lang.String unknown)
Fetches artist listing in complete from. Variants exist specifically to deal when filtering is permitted.

Parameters:
filter - Map containing the elements to filter.
nil - String for NIL filtering.
unknown - String for NULL elements.
Returns:
Multiple level array of strings containing all the information.

getOrganiserGenre

public java.lang.String[][] getOrganiserGenre(java.util.Map<java.lang.String,java.lang.String> filter,
                                              java.lang.String nil,
                                              java.lang.String unknown)
Fetches genre listing in complete from. Variants exist specifically to deal when filtering is permitted.

Parameters:
filter - Map containing the elements to filter.
nil - String for NIL filtering.
unknown - String for NULL elements.
Returns:
Multiple level array of strings containing all the information.

getOrganiserFiltered

private java.lang.String[][] getOrganiserFiltered(java.util.Map<java.lang.String,java.lang.String> filter,
                                                  java.lang.String column,
                                                  java.lang.String nil,
                                                  java.lang.String unknown)
Fetches general information in complete from. This will do the actual filtering without affecting any other element.

Parameters:
filter - Map containing the elements to filter.
column - Table to conduct the search on.
nil - String for NIL filtering.
unknown - String for NULL elements.
Returns:
Multiple level array of strings containing all the information.

getOrganiserSongs

public java.lang.String[][] getOrganiserSongs(java.util.Map<java.lang.String,java.lang.String> filter)
Fetches song information in complete from. Variants exist specifically to deal when filtering is permitted. This element is different from single row management due to the fact that we have to account for all columns.

Parameters:
filter - Map containing the elements to filter.
Returns:
Multiple level array of strings containing all the information.

getOrganiserSongs

public java.lang.String[][] getOrganiserSongs(java.lang.String fields,
                                              java.lang.String criteria)
Fetches song information in complete from. This variant is called by the search capability and will extract all matches.

Parameters:
fields - String containing fields to search from.
criteria - String containing search criteria.
Returns:
Multiple level array of strings containing all the information.

getOrganiserPlaylists

public java.util.List<java.lang.String> getOrganiserPlaylists()
Will return a listing of all local playlists currently stored on the local side. These do not include any smart lists that are generated automatically.

Returns:
List of strings containing playlist titles.

getOrganiserStatus

public java.util.Map<java.lang.String,java.lang.String> getOrganiserStatus(java.util.Map<java.lang.String,java.lang.String> filter)
Lets the database do all of the calculations and heavy work associated with generating the status bar information.

Parameters:
filter - Map containing the elements to filter.
Returns:
String Map which contains status information.

getOrganiserStatus

public java.util.Map<java.lang.String,java.lang.String> getOrganiserStatus(java.lang.String fields,
                                                                           java.lang.String criteria)
Lets the database do all of the calculations and heavy work associated with generating the status bar information.

Parameters:
fields - String containing fields to search from.
criteria - String co.ntaining search criteria.
Returns:
Map containing the summary results.

getPlaylistLocal

public java.util.Set<java.lang.String> getPlaylistLocal()
Will return a listing of all local playlists currently stored on the local side. These do not include any smart lists that are generated automatically.

Returns:
Set of strings containing playlist titles.

getPlaylistLocal

public java.util.List<java.lang.String> getPlaylistLocal(java.lang.String name)
This will make use of a local playlist name in order to return its contents. That in turn will normally be used to add the songs to to current playlist.

Parameters:
name - String name of the playlist.
Returns:
List of strings containing songs file.

getPlaylistDecade

public java.util.List<java.lang.String> getPlaylistDecade()
Will return a listing of all decades from the database. This falls under the smart lists, since its a generated value and require database lookups.

Returns:
List containing all decades

getPlaylistDecade

public java.util.List<java.lang.String> getPlaylistDecade(java.lang.String decade)
Returns a list of all songs associated with a certain decade. This permits a transference to the host for playback.

Parameters:
decade - String containing decade.
Returns:
List of all filenames.

getPlaylistFArtist

public java.util.List<java.lang.String> getPlaylistFArtist()
Returns a list of all songs associated with the favourite artists in the database. This is based on the auditing levels.

Returns:
List of all extracted filenames.

getPlaylistFAlbum

public java.util.List<java.lang.String> getPlaylistFAlbum()
Returns a list of all songs associated with the favourite albums in the database. This is based on the auditing levels.

Returns:
List of all extracted filenames.

getPlaylistFGenre

public java.util.List<java.lang.String> getPlaylistFGenre()
Returns a list of all songs associated with the favourite Genres in the database. This is based on the auditing levels.

Returns:
List of all extracted filenames.

getPlaylistFSong

public java.util.List<java.lang.String> getPlaylistFSong()
Returns a list of all songs associated with the favourite songs in the database. This is based on the auditing levels.

Returns:
List of all extracted filenames.

getPlaylistFRating

public java.util.List<java.lang.String> getPlaylistFRating()
Returns a list songs that have received a rating in order of precedence.

Returns:
List of all extracted filenames.

deletePlaylistLocal

public void deletePlaylistLocal(java.lang.String name)
Removes a local playlist from the local host database. Does not remove the songs associated with said playlist.

Parameters:
name - String name of the playlist.

insertPlaylistLocal

public void insertPlaylistLocal(java.lang.String name)
In order to insert songs into the playlist it becomes necessary to first create a holding entry in the appropriate table.

Parameters:
name - String name of the playlist.

insertPlaylistSong

public void insertPlaylistSong(java.lang.String playlist,
                               java.util.List<java.util.Map<java.lang.String,java.lang.String>> current)
Will insert all of the currently listed songs for the current playlist into this table. The linking should then connect the Playlist and Song database together.

Parameters:
playlist - String containing playlist name;
current - List of HashMaps containing contents of current playlist;

getSongFilter

private java.lang.String getSongFilter(java.util.Map<java.lang.String,java.lang.String> filter)
Generates the string that will be pass on in order to generate the appropriate query to the database.

Parameters:
filter - Map containing all elements to add into the filter
Returns:
String containing the filter.

getSongArray

private java.lang.String[] getSongArray(java.util.Map<java.lang.String,java.lang.String> filter)
Generates the necessary array to pass on for the query.

Parameters:
filter - Map containing all elements to add into the filter.
Returns:
String array containing results.

getSongAlbum

public void getSongAlbum(java.util.List<java.lang.String> store,
                         java.lang.String album)
Will append songs from a specific album to an existing list. This can in turn be used to add them to current play lists. This element will sort using the Track element, so that the album is returned properly in the sequence intended.

Parameters:
store - Collections list containing songs.
album - String containing album search key.

getSongAlbum

public void getSongAlbum(java.util.List<java.lang.String> store,
                         java.util.Map<java.lang.String,java.lang.String> filter)
Will append songs from a specific album to an existing list. This can in turn be used to add them to current play lists. This element will sort using the Track element, so that the album is returned properly in the sequence intended.

Parameters:
store - Collections list containing songs.
filter - Map containing filter elements.

getSongArt

public java.lang.String getSongArt(java.lang.String artist,
                                   java.lang.String album)
Extracts the Album Art cover information from the database. If this information exists, a cached version will be employed.

Parameters:
artist - String containing artist name.
album - String containing album name.
Returns:
String containing album art name cache.

getSongArt

public java.lang.String getSongArt(java.lang.String file)
Extracts the Album Art cover information from the database. If this information exists, a cached version will be employed.

Parameters:
file - String containing file location.
Returns:
String containing album art name cache.

getSongArtist

public void getSongArtist(java.util.List<java.lang.String> store,
                          java.lang.String artist)
Will append songs from a specific artist to an existing list. This can in turn be used to add them to current play lists. In this case we will sort by two criteria which are the Album and Track. Sorting by Title can sometimes lead to the same song being played multiple times and this will not only prevent that but allow a collection to be played in their entirety based on album.

Parameters:
store - Collections list containing songs.
artist - String containing artist search key.

getSongArtist

public void getSongArtist(java.util.List<java.lang.String> store,
                          java.util.Map<java.lang.String,java.lang.String> filter)
Will append songs from a specific artist to an existing list. This can in turn be used to add them to current play lists. In this case we will sort by two criteria which are the Album and Track. Sorting by Title can sometimes lead to the same song being played multiple times and this will not only prevent that but allow a collection to be played in their entirety based on album.

Parameters:
store - Collections list containing songs.
filter - Map containing filtering elements.

getSongGenre

public void getSongGenre(java.util.List<java.lang.String> store,
                         java.lang.String genre)
Will append songs from a specific genre to an existing list. This can in turn be used to add them to current play lists. We will sort these elements by Title since no other criteria will really work.

Parameters:
store - Collections list containing songs.
genre - String containing genre search key.

getSongGenre

public void getSongGenre(java.util.List<java.lang.String> store,
                         java.util.Map<java.lang.String,java.lang.String> filter)
Will append songs from a specific genre to an existing list. This can in turn be used to add them to current play lists. We will sort these elements by Title since no other criteria will really work.

Parameters:
store - Collections list containing songs.
filter - Map containing filter elements.

getStatTimescale

public int getStatTimescale(java.lang.String period)
Returns the amount of days a certain period range will encompass. This in turn allows us to go back a series of ranges without complicated calculations.

Parameters:
period - String containing the search period.
Returns:
Integer containing the search period in days.

getStatDatasetGeneral

public java.util.Map<java.lang.String,java.lang.String> getStatDatasetGeneral(java.lang.String element,
                                                                              java.lang.String speriod,
                                                                              java.lang.String eperiod,
                                                                              java.lang.String limit)
Method called to return results based on what the user has decided in the generation of his statistical charts.

Parameters:
element - String containing the row we are looking to search.
speriod - String containing start range for the date search.
eperiod - String containing end range for the date search.
limit - String containing the limit of rows to extract.
Returns:
Map containing data set.

getStatDatasetSong

public java.util.Map<java.lang.String,java.lang.String> getStatDatasetSong(java.lang.String speriod,
                                                                           java.lang.String eperiod,
                                                                           java.lang.String limit,
                                                                           java.lang.Boolean rating,
                                                                           java.lang.String joiner)
Method called to return results based on what the user has decided in the generation of his statistical charts.

Parameters:
speriod - String containing start range for the date search.
eperiod - String containing end range for the date search.
limit - String containing the limit of rows to extract.
rating - Boolean determining how to order the songs.
joiner - String containing joining statement between title and artist.
Returns:
Map containing data set.

insertAudit

public void insertAudit(java.lang.String action,
                        java.lang.String... filenames)
Inserts an entry into the audit table for the database.

Parameters:
action - String containing action identifier.
filenames - Filenames of the songs affected.

insertCache

public boolean insertCache(java.lang.String artist,
                           java.lang.String album,
                           java.lang.String dest)
Album art is a component of the player which requires external information. This update entry allows us to track the base filename.

Parameters:
artist - String containing the artist name.
album - String containing the album name.
dest - Destination album art image filename.
Returns:
boolean indicating success of operation.

insertCache

public boolean insertCache(java.lang.String album,
                           java.lang.String dest)
Album art is a component of the player which requires external information. This update entry allows us to track the base filename.

Parameters:
album - String containing the album name.
dest - Destination album art image filename.
Returns:
boolean indicating success of operation.

resetCache

public boolean resetCache(java.lang.String artist,
                          java.lang.String album)
Album art is a component of the player which requires external information. This update will revert the cache to an empty value.

Parameters:
artist - String containing the artist name.
album - String containing the album name.
Returns:
boolean indicating success of operation.

insertHost

public boolean insertHost(java.lang.String identifier,
                          java.lang.String host,
                          java.lang.String port,
                          java.lang.String password,
                          java.lang.String filename,
                          java.lang.String pathname,
                          java.lang.String arguments)
Inserts a Host into the database. Typically used during initial use to establish a base host for use.

Parameters:
identifier - String identifier for the host.
host - String containing host name or IP address.
port - String containing port number.
password - String containing password if necessary.
filename - String containing filename entry.
pathname - String containing pathname to daemon.
arguments - String containing arguments to pass onto daemon.
Returns:
boolean indicating success in operation

updateHostDefault

public boolean updateHostDefault(java.lang.String host)
This method will update the default host entry, to be used when selecting from a list of multiple hosts.

Parameters:
host - Host identifier in selecting a new host.
Returns:
Boolean indicating success.

insertSongs

public void insertSongs(java.util.List<java.util.Map<java.lang.String,java.lang.String>> inserts)
Deals with mass insertions that can be associated with the the synch process of the database with the server.

Parameters:
inserts - List of Maps containing new rows to insert.

updateSongs

public void updateSongs(java.util.List<java.util.Map<java.lang.String,java.lang.String>> updates)
This method is a variant of the insertSongs method handling the intricacies of updates versus inserts. So overall the function is a bit simpler other then the handling of the UNIQUE identifier of a song.

Parameters:
updates - A List of Map entries which contains every row that must be modified. We do not care about comparing differences and simply replace the entire rows details.

updateSongRating

public void updateSongRating(java.lang.String file,
                             java.lang.String rating)
Ratings are the only element of a song displayed that can be changed due to the source of the songs themselves. Since rating is not part of the Music Player Daemon (MPD) data set we are free to play with it as need be.

Parameters:
file - String name of the file name.
rating - String representing rating number.

updateHostStatistics

public void updateHostStatistics(java.util.Set<java.lang.String> keys,
                                 java.util.Map<java.lang.String,java.lang.String> values)
Statistics are a major component of how we do business. This will update the database with the server and skip the synch process in the future.

Parameters:
keys - Keys to update on the database side.
values - Value Map to used to update.

updateSettings

public void updateSettings(java.util.Map<java.lang.String,java.lang.String> settings,
                           java.lang.String filter)
Will update the settings to include new state information. The operation is a transaction and will replace all rows regardless of any real changes.

Parameters:
settings - String Map containing values to store.
filter - String containing pre-check to limit update to necessary group.

updateSettings

public void updateSettings(java.util.Map<java.lang.String,java.lang.String> settings)
Will update the settings to include new state information. The operation is a transaction and will replace all rows regardless of any real changes.

Parameters:
settings - String Map containing values to store.

updatePrompt

public void updatePrompt()
This update can only be done one way, since the interface that uses it will only disable the prompt.


deleteSongs

public void deleteSongs(java.util.Set<java.lang.String> deletes)
Method which deals with the removing superfluous rows from the song library. While we could create a large query which would fit all the rows in an IN statement, transactions seem to lend themselves better for overall code simplicity and potential overflow in the entries number in abnormally large numbers.

Parameters:
deletes - Set containing all of the remaining keys.

deleteHost

public boolean deleteHost(java.lang.String ident)
Removes a host from the database.

Parameters:
ident - Host identifier to remove.
Returns:
boolean indicating success of operation.

deleteHosts

public void deleteHosts()
Removes all hosts from the database. This clearance is typically only done after the singular host entry in the database failed connection and the user wishes to try again.