Package com.tagtraum.beatunes.library
Class LibraryDescriptor
- java.lang.Object
-
- com.tagtraum.beatunes.library.LibraryDescriptor
-
- Direct Known Subclasses:
FileSystemLibraryDescriptor
,ITLibraryDescriptor
,ITunesLibraryDescriptor
,PlainLibraryDescriptor
public abstract class LibraryDescriptor extends Object
Describes a library.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Constructor Description LibraryDescriptor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract LibraryLoader
createLibraryLoader()
Creates a library loader appropriate for this kind of library.boolean
exists()
Indicates whether the library described by this instance actually exists.Long
getId()
Numeric version of the library id, if it exists.abstract String
getIdAsString()
Library id asString
.abstract long
getLastModified()
If this library descriptor describes a document or is capable of determining the last modification of the library as a whole, this method returns the date.MediaLibrary
getMediaLibrary()
Returns the actual implementation (if already available).abstract String
getName()
Name.abstract boolean
needsRefresh(long lastSync)
Indicates whether we might want to sync this library.void
setMediaLibrary(MediaLibrary mediaLibrary)
Registers an actualMediaLibrary
with the descriptor.abstract AudioSong
wrap(AudioSong audioSong)
Wraps an internal database song into anotherAudioSong
that is capable of writing/reading data to external databases or files (e.g.abstract PlayList
wrap(PlayList playList)
Wraps an internal database playlist into anotherPlayList
that is capable of writing/reading data to external databases or files.
-
-
-
Method Detail
-
getLastModified
public abstract long getLastModified() throws IOException
If this library descriptor describes a document or is capable of determining the last modification of the library as a whole, this method returns the date.- Returns:
- date of last modification or 0 if unknown
- Throws:
IOException
-
needsRefresh
public abstract boolean needsRefresh(long lastSync) throws IOException
Indicates whether we might want to sync this library. If this cannot determined accurately, this method returnstrue
.- Parameters:
lastSync
- date of last sync- Returns:
- true, if we should probably sync
- Throws:
IOException
-
getIdAsString
public abstract String getIdAsString()
Library id asString
.- Returns:
- id
- See Also:
PersistentId.idStringToLong(String)
-
getId
public Long getId()
Numeric version of the library id, if it exists.- Returns:
- numeric library id
- See Also:
PersistentId.idStringToLong(String)
,getIdAsString()
-
getName
public abstract String getName()
Name. E.g. "iTunes".- Returns:
- library name
-
exists
public boolean exists()
Indicates whether the library described by this instance actually exists. Defaults totrue
.- Returns:
- true or false
-
setMediaLibrary
public void setMediaLibrary(MediaLibrary mediaLibrary)
Registers an actualMediaLibrary
with the descriptor.- Parameters:
mediaLibrary
- library implementation
-
getMediaLibrary
public MediaLibrary getMediaLibrary()
Returns the actual implementation (if already available).- Returns:
- library implementation
-
createLibraryLoader
public abstract LibraryLoader createLibraryLoader()
Creates a library loader appropriate for this kind of library.- Returns:
- library loader
-
wrap
public abstract AudioSong wrap(AudioSong audioSong)
Wraps an internal database song into anotherAudioSong
that is capable of writing/reading data to external databases or files (e.g.Track
orAudioMetaData
). Depending on the kind of library, this wrapper might be quite different.- Parameters:
audioSong
- song object to be wrapped, e.g.Song
- Returns:
- wrapper
-
wrap
public abstract PlayList wrap(PlayList playList)
Wraps an internal database playlist into anotherPlayList
that is capable of writing/reading data to external databases or files. Depending on the kind of library, this wrapper might be quite different.- Parameters:
playList
- song object to be wrapped, e.g.HibernatePlayList
- Returns:
- wrapper
-
-