de.axelwernicke.mypod
Class DataPool

java.lang.Object
  extended byde.axelwernicke.mypod.DataPool

public class DataPool
extends java.lang.Object

holds information about all scanned mp3 files

Author:
axel wernicke

Constructor Summary
DataPool()
           
 
Method Summary
protected  void addData(java.io.File file, MP3MetaV2 mp3Meta)
          Adds meta data object to the data pool.
protected  boolean contains(java.lang.Long oid)
          Checks if an oid is in the data pool
protected  boolean deserializeData()
          deserializes clip meta data
 java.util.Vector getAllAlbumValues(java.util.Vector clips, boolean sort)
          Gets the albums of all clips.
 javax.swing.DefaultListModel getAllArtistValues()
          Gets all artists known by the data pool.
 java.util.Vector getAllArtistValues(java.util.Vector clips, boolean sort)
          Gets the titles of all clips.
 java.util.Vector getAllBandValues(java.util.Vector clips, boolean sort)
          Gets the bands of all clips.
 java.util.Vector getAllBpmValues(java.util.Vector clips, boolean sort)
          Gets the bpm values of all clips.
 java.util.Vector getAllCdIdentifierValues(java.util.Vector clips, boolean sort)
          Gets the cd identifier values of all clips.
 java.util.Vector getAllCommentValues(java.util.Vector clips, boolean sort)
          Gets the comments of all clips.
 java.util.Vector getAllComposerValues(java.util.Vector clips, boolean sort)
          Gets the composers of all clips.
 java.util.Vector getAllContentGroupSetValues(java.util.Vector clips, boolean sort)
          Gets the content group set values of all clips.
 java.util.Vector getAllCopyrightTextValues(java.util.Vector clips, boolean sort)
          Gets the copyright text values of all clips.
 java.util.Vector getAllCopyrightWebpageValues(java.util.Vector clips, boolean sort)
          Gets the copyright webpage values of all clips.
 java.util.Vector getAllEncodedByValues(java.util.Vector clips, boolean sort)
          Gets the encoded by values of all clips.
 javax.swing.DefaultListModel getAllGenreValues()
          Gets all genres known by the data pool.
 java.util.Vector getAllGenreValues(java.util.Vector clips, boolean sort)
          Gets the genres of all clips.
 java.util.Vector getAllIsrcValues(java.util.Vector clips, boolean sort)
          Gets the isrc values of all clips.
 java.util.Vector getAllLanguageValues(java.util.Vector clips, boolean sort)
          Gets the isrc values of all clips.
 java.util.Vector getAllLyricistValues(java.util.Vector clips, boolean sort)
          Gets the lyricist of all clips.
protected  java.util.Set getAllOid()
          gets the oids for all music in the datapool
 java.util.Vector getAllOriginalArtists(java.util.Vector clips, boolean sort)
          Gets the original artist values of all clips.
 java.util.Vector getAllOriginalArtistValues(java.util.Vector clips, boolean sort)
          Gets the original artist values of all clips.
 java.util.Vector getAllOriginalLyricistValues(java.util.Vector clips, boolean sort)
          Gets the original lyricist values of all clips.
 java.util.Vector getAllOriginalTitleValues(java.util.Vector clips, boolean sort)
          Gets the original title values of all clips.
 java.util.Vector getAllOriginalYearValues(java.util.Vector clips, boolean sort)
          Gets the original year values of all clips.
 java.util.Vector getAllPlaycounterValues(java.util.Vector clips, boolean sort)
          Gets the playcounter of all clips.
 java.util.Vector getAllPublisherValues(java.util.Vector clips, boolean sort)
          Gets the publisher values of all clips.
 java.util.Vector getAllPublisherWebpageValues(java.util.Vector clips, boolean sort)
          Gets the publisher webpage values of all clips.
 java.util.Vector getAllTitleValues(java.util.Vector clips, boolean sort)
          Gets the titles of all clips.
 java.util.Vector getAllTrackValues(java.util.Vector clips, boolean sort)
          Gets the track values of all clips.
 javax.swing.DefaultListModel getAllYearValues()
          Gets all years known by the data pool.
 java.util.Vector getAllYearValues(java.util.Vector clips, boolean sort)
          Gets the years of all clips.
protected  long getLastModified(java.io.File file)
          gets from data pool the date when the selected track was modified the last time.
protected  MP3MetaV2 getMeta(java.io.File file)
          gets information about an mp3 from database.
 MP3MetaV2 getMeta(java.lang.Long oid)
          gets all information about a track
protected  java.lang.Long getOid(java.lang.String filename)
          gets the oid of a clip from its filename
protected  boolean isInPool(java.io.File file)
          checks if the clip specified by path and filename is in the data pool
protected  void rebuildFilenameCache()
          Rebuilds the filename cache from scratch.
protected  void removeClip(java.lang.Long oid)
          Removes a clip from the data pool.
protected  void setData(java.util.Hashtable data)
          Sets data hashtable
protected  void shutdown()
          Shuts the datapool down
protected  void updateData(java.io.File file, MP3MetaV2 mp3Meta)
          Updates the id3 tags in the clip from the meta data object.
protected  void updateData(java.lang.Long oid, MP3MetaV2 mp3Meta)
          Updates the id3 tags in the clip from the meta data object.
protected  boolean updateFilePath(java.lang.Long oid, java.lang.String newPath)
          Updates meta data and filename cache if file name or path changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataPool

public DataPool()
Method Detail

shutdown

protected void shutdown()
Shuts the datapool down


getOid

protected java.lang.Long getOid(java.lang.String filename)
gets the oid of a clip from its filename

Parameters:
filename - filename of the clip
Returns:
oid for the clip

contains

protected boolean contains(java.lang.Long oid)
Checks if an oid is in the data pool

Parameters:
oid - to check
Returns:
true, if oid is in the data pool

getAllOid

protected java.util.Set getAllOid()
gets the oids for all music in the datapool

Returns:
set of oids

getMeta

protected MP3MetaV2 getMeta(java.io.File file)
gets information about an mp3 from database.

Parameters:
file - file to get the information for
Returns:
information for an mp3 file

getMeta

public MP3MetaV2 getMeta(java.lang.Long oid)
gets all information about a track

Parameters:
oid - oid of the track to get information for
Returns:
meta data for the track

getLastModified

protected long getLastModified(java.io.File file)
gets from data pool the date when the selected track was modified the last time.

Parameters:
file - file to get the information for
Returns:
date in milliseconds

isInPool

protected boolean isInPool(java.io.File file)
checks if the clip specified by path and filename is in the data pool

Parameters:
file - filename and path of the clip
Returns:
true, if the file is known to the data pool

updateData

protected void updateData(java.io.File file,
                          MP3MetaV2 mp3Meta)
Updates the id3 tags in the clip from the meta data object.

Parameters:
mp3Meta - to update from
file - to set the meta data for

updateData

protected void updateData(java.lang.Long oid,
                          MP3MetaV2 mp3Meta)
Updates the id3 tags in the clip from the meta data object.

Parameters:
oid -
mp3Meta - to update from

addData

protected void addData(java.io.File file,
                       MP3MetaV2 mp3Meta)
Adds meta data object to the data pool. A new (unique) oid is generated. data and filename cache are updated

Parameters:
mp3Meta - set of meta data to add to the pool
file - the set of meta data belongs to

removeClip

protected void removeClip(java.lang.Long oid)
Removes a clip from the data pool. data and filename cache are updated. Note: the clip must be removed from all playlists and iPod before calling this!!

Parameters:
oid - of the clip to remove

rebuildFilenameCache

protected void rebuildFilenameCache()
Rebuilds the filename cache from scratch.


deserializeData

protected boolean deserializeData()
deserializes clip meta data

Returns:

setData

protected void setData(java.util.Hashtable data)
Sets data hashtable

Parameters:
data - to set

updateFilePath

protected boolean updateFilePath(java.lang.Long oid,
                                 java.lang.String newPath)
Updates meta data and filename cache if file name or path changed.

Parameters:
newPath -
oid - of the changed clip
Returns:

getAllTitleValues

public java.util.Vector getAllTitleValues(java.util.Vector clips,
                                          boolean sort)
Gets the titles of all clips.

Parameters:
clips - to get titles from. If clips is null, all clips in the data pool are evaluated.
sort - the titles
Returns:
a vector containing all titles

getAllArtistValues

public java.util.Vector getAllArtistValues(java.util.Vector clips,
                                           boolean sort)
Gets the titles of all clips.

Parameters:
clips - to get titles from. If clips is null, all clips in the data pool are evaluated.
sort - the titles
Returns:
a vector containing all titles

getAllAlbumValues

public java.util.Vector getAllAlbumValues(java.util.Vector clips,
                                          boolean sort)
Gets the albums of all clips.

Parameters:
clips - to get artists from. If clips is null, all clips in the data pool are evaluated.
sort - the artists
Returns:
a vector containing all artists

getAllBandValues

public java.util.Vector getAllBandValues(java.util.Vector clips,
                                         boolean sort)
Gets the bands of all clips.

Parameters:
clips - to get bands from. If clips is null, all clips in the data pool are evaluated.
sort - the bands
Returns:
a vector containing all bands

getAllBpmValues

public java.util.Vector getAllBpmValues(java.util.Vector clips,
                                        boolean sort)
Gets the bpm values of all clips.

Parameters:
clips - to get bands from. If clips is null, all clips in the data pool are evaluated.
sort - the bpm values
Returns:
a vector containing all bpm values

getAllCdIdentifierValues

public java.util.Vector getAllCdIdentifierValues(java.util.Vector clips,
                                                 boolean sort)
Gets the cd identifier values of all clips.

Parameters:
clips - to get bands from. If clips is null, all clips in the data pool are evaluated.
sort - the cd identifier values
Returns:
a vector containing all cd identifier values

getAllCommentValues

public java.util.Vector getAllCommentValues(java.util.Vector clips,
                                            boolean sort)
Gets the comments of all clips.

Parameters:
clips - to get comments from. If clips is null, all clips in the data pool are evaluated.
sort - the comments
Returns:
a vector containing all comments

getAllComposerValues

public java.util.Vector getAllComposerValues(java.util.Vector clips,
                                             boolean sort)
Gets the composers of all clips.

Parameters:
clips - to get composers from. If clips is null, all clips in the data pool are evaluated.
sort - the composers
Returns:
a vector containing all composers

getAllContentGroupSetValues

public java.util.Vector getAllContentGroupSetValues(java.util.Vector clips,
                                                    boolean sort)
Gets the content group set values of all clips.

Parameters:
clips - to get content group set values from. If clips is null, all clips in the data pool are evaluated.
sort - the content group set values
Returns:
a vector containing all content group set values

getAllCopyrightTextValues

public java.util.Vector getAllCopyrightTextValues(java.util.Vector clips,
                                                  boolean sort)
Gets the copyright text values of all clips.

Parameters:
clips - to get copyright text values from. If clips is null, all clips in the data pool are evaluated.
sort - the copyright text values
Returns:
a vector containing all copyright text values

getAllCopyrightWebpageValues

public java.util.Vector getAllCopyrightWebpageValues(java.util.Vector clips,
                                                     boolean sort)
Gets the copyright webpage values of all clips.

Parameters:
clips - to get copyright webpage values from. If clips is null, all clips in the data pool are evaluated.
sort - the copyright webpage values
Returns:
a vector containing all copyright webpage values

getAllEncodedByValues

public java.util.Vector getAllEncodedByValues(java.util.Vector clips,
                                              boolean sort)
Gets the encoded by values of all clips.

Parameters:
clips - to get encoded by values from. If clips is null, all clips in the data pool are evaluated.
sort - the encoded by values
Returns:
a vector containing all encoded by values

getAllGenreValues

public java.util.Vector getAllGenreValues(java.util.Vector clips,
                                          boolean sort)
Gets the genres of all clips.

Parameters:
clips - to get genres from. If clips is null, all clips in the data pool are evaluated.
sort - the genres
Returns:
a vector containing all genres

getAllIsrcValues

public java.util.Vector getAllIsrcValues(java.util.Vector clips,
                                         boolean sort)
Gets the isrc values of all clips.

Parameters:
clips - to get encoded by values from. If clips is null, all clips in the data pool are evaluated.
sort - the encoded by values
Returns:
a vector containing all encoded by values

getAllLanguageValues

public java.util.Vector getAllLanguageValues(java.util.Vector clips,
                                             boolean sort)
Gets the isrc values of all clips.

Parameters:
clips - to get encoded by values from. If clips is null, all clips in the data pool are evaluated.
sort - the encoded by values
Returns:
a vector containing all encoded by values

getAllLyricistValues

public java.util.Vector getAllLyricistValues(java.util.Vector clips,
                                             boolean sort)
Gets the lyricist of all clips.

Parameters:
clips - to get lyricists from. If clips is null, all clips in the data pool are evaluated.
sort - the lyricists
Returns:
a vector containing all lyricists

getAllOriginalArtistValues

public java.util.Vector getAllOriginalArtistValues(java.util.Vector clips,
                                                   boolean sort)
Gets the original artist values of all clips.

Parameters:
clips - to get original artist values from. If clips is null, all clips in the data pool are evaluated.
sort - the original artist values
Returns:
a vector containing all original artist values

getAllPlaycounterValues

public java.util.Vector getAllPlaycounterValues(java.util.Vector clips,
                                                boolean sort)
Gets the playcounter of all clips.

Parameters:
clips - to get playcounter from. If clips is null, all clips in the data pool are evaluated.
sort - the playcounter values
Returns:
a vector containing all playcounter values

getAllOriginalArtists

public java.util.Vector getAllOriginalArtists(java.util.Vector clips,
                                              boolean sort)
Gets the original artist values of all clips.

Parameters:
clips - to get original artist values from. If clips is null, all clips in the data pool are evaluated.
sort - the original artist values
Returns:
a vector containing all original artist values

getAllOriginalLyricistValues

public java.util.Vector getAllOriginalLyricistValues(java.util.Vector clips,
                                                     boolean sort)
Gets the original lyricist values of all clips.

Parameters:
clips - to get original lyricist values from. If clips is null, all clips in the data pool are evaluated.
sort - the original lyricist values
Returns:
a vector containing all original lyricist values

getAllOriginalTitleValues

public java.util.Vector getAllOriginalTitleValues(java.util.Vector clips,
                                                  boolean sort)
Gets the original title values of all clips.

Parameters:
clips - to get original title values from. If clips is null, all clips in the data pool are evaluated.
sort - the original title values
Returns:
a vector containing all original title values

getAllOriginalYearValues

public java.util.Vector getAllOriginalYearValues(java.util.Vector clips,
                                                 boolean sort)
Gets the original year values of all clips.

Parameters:
clips - to get original year values from. If clips is null, all clips in the data pool are evaluated.
sort - the original year values
Returns:
a vector containing all original year values

getAllPublisherValues

public java.util.Vector getAllPublisherValues(java.util.Vector clips,
                                              boolean sort)
Gets the publisher values of all clips.

Parameters:
clips - to get publisher values from. If clips is null, all clips in the data pool are evaluated.
sort - the publisher values
Returns:
a vector containing all publisher values

getAllPublisherWebpageValues

public java.util.Vector getAllPublisherWebpageValues(java.util.Vector clips,
                                                     boolean sort)
Gets the publisher webpage values of all clips.

Parameters:
clips - to get publisher webpage values from. If clips is null, all clips in the data pool are evaluated.
sort - the publisher webpage values
Returns:
a vector containing all publisher webpage values

getAllTrackValues

public java.util.Vector getAllTrackValues(java.util.Vector clips,
                                          boolean sort)
Gets the track values of all clips.

Parameters:
clips - to get track values from. If clips is null, all clips in the data pool are evaluated.
sort - the track values
Returns:
a vector containing all track values

getAllYearValues

public java.util.Vector getAllYearValues(java.util.Vector clips,
                                         boolean sort)
Gets the years of all clips.

Parameters:
clips - to get years from. If clips is null, all clips in the data pool are evaluated.
sort - the years
Returns:
a vector containing all years

getAllArtistValues

public javax.swing.DefaultListModel getAllArtistValues()
Gets all artists known by the data pool. The content ist sortet.

Returns:
sorted vector containing all artits

getAllGenreValues

public javax.swing.DefaultListModel getAllGenreValues()
Gets all genres known by the data pool. The content ist sortet.

Returns:
sorted vector containing all genres

getAllYearValues

public javax.swing.DefaultListModel getAllYearValues()
Gets all years known by the data pool. The content ist sortet.

Returns:
sorted vector containing all years