org.mycore.services.imaging
Interface CacheManager

All Known Implementing Classes:
MCRImgCacheManager

public interface CacheManager

The cache manager represents an object which is responsible for the creating and deleting cache files for an image in the MyCore system.

Author:
chi

Method Summary
 void deleteImage(MCRFile image)
          Deletes every cache version for the original image.
 void deleteImage(MCRFile image, String filename)
          Deletes one certain cache version for the original image.
 boolean existInCache(MCRFile image)
          Checks if the original image has at least one cache version.
 boolean existInCache(MCRFile image, String filename)
          Checks if one certain cache version of the original image exists in cache.
 void getImage(MCRFile image, String filename, OutputStream imageData)
          Get the cache version of the image.
 InputStream getImageAsInputStream(MCRFile image, String filename)
           
 int getImgHeight(MCRFile image)
          Get the width of the original image height is stored in the cache
 int getImgWidth(MCRFile image)
          Get the width of the original image which is stored in the cache
 void saveImage(MCRFile image, String filename, InputStream imageData)
          Save the edited image as cache for the original image.
 void setImgSize(MCRFile image, int width, int height)
          Save the size of the original image in the cache.
 

Method Detail

getImage

void getImage(MCRFile image,
              String filename,
              OutputStream imageData)
Get the cache version of the image.

Parameters:
image - the original image
filename - the cache version thumbnail etc.
imageData - the cached image

getImageAsInputStream

InputStream getImageAsInputStream(MCRFile image,
                                  String filename)
                                  throws IOException
Throws:
IOException

saveImage

void saveImage(MCRFile image,
               String filename,
               InputStream imageData)
Save the edited image as cache for the original image.

Parameters:
image - the original image
filename - the cache version
imageData - the cached image

deleteImage

void deleteImage(MCRFile image,
                 String filename)
Deletes one certain cache version for the original image.

Parameters:
image - the original image
filename - the cache version of the original image

deleteImage

void deleteImage(MCRFile image)
Deletes every cache version for the original image.

Parameters:
image - the original image

existInCache

boolean existInCache(MCRFile image,
                     String filename)
Checks if one certain cache version of the original image exists in cache.

Parameters:
image - the original image
filename - the cache version
Returns:
true if the cache version exists in cache

existInCache

boolean existInCache(MCRFile image)
Checks if the original image has at least one cache version.

Parameters:
image -
Returns:
true if the the original image has at least one cache version

getImgWidth

int getImgWidth(MCRFile image)
Get the width of the original image which is stored in the cache

Parameters:
image - the original image
Returns:
int the image width

getImgHeight

int getImgHeight(MCRFile image)
Get the width of the original image height is stored in the cache

Parameters:
image - the original image
Returns:
int the image height

setImgSize

void setImgSize(MCRFile image,
                int width,
                int height)
Save the size of the original image in the cache.

Parameters:
image - the original image
width - original image width
height - original image height