Package app

Interface MediaStorage

All Known Implementing Classes:
SQLiteStorage

public interface MediaStorage
Implementors of this interface can be used as a Media storage back-end by MediaCommunicator.

The methods in this interface permit throwing exceptions to accomodate implementations backed by something fallible, such as the filesystem. The possible sources of error (if any) depend on the specific implementation.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deleteMedia(long id)
    Delete the Media with the given ID.
    getIDsWithin(double x, double y, double w, double h)
     
    boolean
    isIDtaken(long id)
     
    loadMedia(long id)
    Load the Media with the given name.
    void
    Save the given Media.
  • Method Details

    • deleteMedia

      void deleteMedia(long id) throws Exception
      Delete the Media with the given ID.
      Throws:
      Exception
    • saveMedia

      void saveMedia(Media media) throws Exception
      Save the given Media.

      The Media must be assigned an ID other than `Media.EMPTY_ID`.

      Throws:
      Exception
    • loadMedia

      Media loadMedia(long id) throws Exception
      Load the Media with the given name.
      Parameters:
      id - The unique identifier of the Media to load
      Returns:
      The Media object with the given ID, or `null` if no such Media object is stored.
      Throws:
      Exception
    • getIDsWithin

      Set<Long> getIDsWithin(double x, double y, double w, double h) throws Exception
      Returns:
      The IDs of the Media objects within the rectangular region with width `w`, height `h`, and top-left corner at (`x`, `y`).
      Throws:
      Exception
    • isIDtaken

      boolean isIDtaken(long id) throws Exception
      Returns:
      Whether or not Media with the given identifier is stored.
      Throws:
      Exception