Class LibraryDescriptor

    • Constructor Detail

      • LibraryDescriptor

        public LibraryDescriptor()
    • 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 returns true.
        Parameters:
        lastSync - date of last sync
        Returns:
        true, if we should probably sync
        Throws:
        IOException
      • setId

        public abstract void setId​(String id)
        Sets the library id.
        Parameters:
        id - id
      • getName

        public abstract String getName()
        Name. E.g. "iTunes".
        Returns:
        library name
      • exists

        public abstract boolean exists()
        Indicates whether the library described by this instance actually exists.
        Returns:
        true or false
      • setMediaLibrary

        public void setMediaLibrary​(MediaLibrary mediaLibrary)
        Registers an actual MediaLibrary 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 another AudioSong that is capable of writing/reading data to external databases or files (e.g. Track or AudioMetaData). 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 another PlayList 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