Interface DatabaseListener


  • public interface DatabaseListener

    The listener interface for receiving updates when CrateDigger has obtained the rekordbox database that was just mounted in a player slot, or when that slot has unmounted so the database is no longer relevant.

    Classes that are interested displaying up-to-date information about databases for mounted media can implement this interface, and then pass the implementing instance to CrateDigger.addDatabaseListener(DatabaseListener). Then, when a new database is available, databaseMounted(SlotReference, Database) will be called, identifying the slot for which a database is now available, and the database itself. When the underlying media is unmounted, databaseUnmounted(SlotReference, Database) will be called to report that the database is no longer relevant for that slot.

    Author:
    James Elliott
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void databaseMounted​(SlotReference slot, org.deepsymmetry.cratedigger.Database database)
      Invoked whenever a rekordbox database has been successfully retrieved and parsed from a slot, so it can be used locally to obtain metadata about the tracks in that slot.
      void databaseUnmounted​(SlotReference slot, org.deepsymmetry.cratedigger.Database database)
      Invoked whenever the media in for which a database had been obtained is unmounted, to report that the database is no longer relevant for that slot.
    • Method Detail

      • databaseMounted

        void databaseMounted​(SlotReference slot,
                             org.deepsymmetry.cratedigger.Database database)

        Invoked whenever a rekordbox database has been successfully retrieved and parsed from a slot, so it can be used locally to obtain metadata about the tracks in that slot.

        To reduce latency, updates are delivered to listeners directly on the thread that is receiving packets from the network, so if you want to interact with user interface objects in this method, you need to use javax.swing.SwingUtilities.invokeLater(Runnable) to do so on the Event Dispatch Thread.

        Even if you are not interacting with user interface objects, any code in this method must finish quickly, or it will add latency for other listeners, and device updates will back up. If you want to perform lengthy processing of any sort, do so on another thread.

        Parameters:
        slot - uniquely identifies a media slot on the network which might host a rekordbox database
        database - the database that has been retrieved and parsed from that slot
      • databaseUnmounted

        void databaseUnmounted​(SlotReference slot,
                               org.deepsymmetry.cratedigger.Database database)

        Invoked whenever the media in for which a database had been obtained is unmounted, to report that the database is no longer relevant for that slot.

        To reduce latency, updates are delivered to listeners directly on the thread that is receiving packets from the network, so if you want to interact with user interface objects in this method, you need to use javax.swing.SwingUtilities.invokeLater(Runnable) to do so on the Event Dispatch Thread.

        Even if you are not interacting with user interface objects, any code in this method must finish quickly, or it will add latency for other listeners, and device updates will back up. If you want to perform lengthy processing of any sort, do so on another thread.

        Parameters:
        slot - uniquely identifies a media slot on the network which might host a rekordbox database
        database - the database that had previously provided information about tracks in that slot