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 LibraryLoadercreateLibraryLoader()Creates a library loader appropriate for this kind of library.booleanexists()Indicates whether the library described by this instance actually exists.LonggetId()Numeric version of the library id, if it exists.abstract StringgetIdAsString()Library id asString.abstract longgetLastModified()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.MediaLibrarygetMediaLibrary()Returns the actual implementation (if already available).abstract StringgetName()Name.abstract booleanneedsRefresh(long lastSync)Indicates whether we might want to sync this library.voidsetMediaLibrary(MediaLibrary mediaLibrary)Registers an actualMediaLibrarywith the descriptor.abstract AudioSongwrap(AudioSong audioSong)Wraps an internal database song into anotherAudioSongthat is capable of writing/reading data to external databases or files (e.g.abstract PlayListwrap(PlayList playList)Wraps an internal database playlist into anotherPlayListthat is capable of writing/reading data to external databases or files.
-
-
-
Method Detail
-
getLastModified
public abstract long getLastModified() throws IOExceptionIf 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 IOExceptionIndicates 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 actualMediaLibrarywith 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 anotherAudioSongthat is capable of writing/reading data to external databases or files (e.g.TrackorAudioMetaData). 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 anotherPlayListthat 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
-
-