java.lang.Object
org.jpo.cache.JpoCache
Cache for the Jpo application
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Clears the highres image cachestatic void
Clears the thumbnail image cachestatic Dimension
Returns the instance of the JpoCache singletonstatic ImageBytes
getGroupThumbnailImageBytes
(List<SortableDefaultMutableTreeNode> childPictureNodes) Returns a thumbnail for a group of picturesstatic String
Returns a text from the JCS with statistics on the cachestatic ImageBytes
getHighresImageBytes
(String sha256, File file) Returns the highres image bytes from the cache or from the disk file on a cache miss.static String
Returns a text from the JCS with statistics on the cachestatic ImageBytes
getThumbnailImageBytes
(File file, double rotation, Dimension maxSize) Returns an ImageBytes object with thumbnail image data for the supplied filestatic Properties
Loads the properties from the cache.ccf file in the bundlestatic void
removeFromHighresCache
(String sha256) Accessor to the cache to facilitate unit tests.static void
Accessor to the cache to facilitate unit tests.static void
shutdown()
Method to properly shut down the cache
-
Method Details
-
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
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
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
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 neededrotation
- The rotation in degrees (0..360) for the thumbnailmaxSize
- 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
Returns a text from the JCS with statistics on the cache- Returns:
- a test with statistics from the cache
-
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
Accessor to the cache to facilitate unit tests.- Parameters:
key
- the entry to remove
-
removeFromHighresCache
Accessor to the cache to facilitate unit tests.- Parameters:
sha256
- the entry to remove
-