Module org.jpo
Package org.jpo.cache

Class JpoCache

java.lang.Object
org.jpo.cache.JpoCache

public class JpoCache extends Object
Cache for the Jpo application
  • Method Details

    • getGroupThumbnailDimension

      @TestOnly public static Dimension getGroupThumbnailDimension()
      Returns the instance of the JpoCache singleton
      Returns:
      the instance of the cache object

      public static JpoCache getInstance() { LOGGER.log(Level.INFO, "Returning an instance of the cache"); //return JpoCacheHolder.INSTANCE; return this; }

    • loadProperties

      public static Properties loadProperties()
      Loads the properties from the cache.ccf file in the bundle
      Returns:
      The properties object created from the ccf file
    • shutdown

      public static void shutdown()
      Method to properly shut down the cache
    • getHighresImageBytes

      public static ImageBytes getHighresImageBytes(String sha256, File file) throws IOException
      Returns the highres image bytes from the cache or from the disk file on a cache miss.
      Parameters:
      file - The file of the image
      Returns:
      and ImageBytes object
      Throws:
      IOException - if something went wrong
    • getThumbnailImageBytes

      public static ImageBytes getThumbnailImageBytes(File file, double rotation, Dimension maxSize)
      Returns an ImageBytes object with thumbnail image data for the supplied file
      Parameters:
      file - The file of the highres picture for which a thumbnail is needed
      rotation - The rotation in degrees (0..360) for the thumbnail
      maxSize - The maximum size of the thumbnail
      Returns:
      The ImageBytes of the thumbnail
    • getGroupThumbnailImageBytes

      public static ImageBytes getGroupThumbnailImageBytes(List<SortableDefaultMutableTreeNode> childPictureNodes) throws IOException
      Returns a thumbnail for a group of pictures
      Parameters:
      childPictureNodes - The pictures that make up the group
      Returns:
      The thumbnail
      Throws:
      IOException - if something went wrong
    • getHighresCacheStats

      public static String getHighresCacheStats()
      Returns a text from the JCS with statistics on the cache
      Returns:
      a test with statistics from the cache
    • getThumbnailCacheStats

      public static String getThumbnailCacheStats()
      Returns a text from the JCS with statistics on the cache
      Returns:
      a test with statistics from the cache
    • clearHighresCache

      public static void clearHighresCache()
      Clears the highres image cache
    • clearThumbnailCache

      public static void clearThumbnailCache()
      Clears the thumbnail image cache
    • removeFromThumbnailCache

      @TestOnly public static void removeFromThumbnailCache(String key)
      Accessor to the cache to facilitate unit tests.
      Parameters:
      key - the entry to remove
    • removeFromHighresCache

      @TestOnly public static void removeFromHighresCache(String sha256)
      Accessor to the cache to facilitate unit tests.
      Parameters:
      sha256 - the entry to remove