NextApp Echo
App Container 1.0.5

nextapp.echoservlet.image
Class ImageRepository

java.lang.Object
  extended bynextapp.echoservlet.image.ImageRepository
All Implemented Interfaces:
java.io.Serializable

public class ImageRepository
extends java.lang.Object
implements java.io.Serializable

A caching repository of image peers.

See Also:
Serialized Form

Field Summary
private static int CACHE_SIZE
           
private  int currentRecencyValue
           
private  InstancePeer instancePeer
           
private static int REDUCTION_SIZE
           
private  java.util.Map ref2peer
           
 
Constructor Summary
ImageRepository(InstancePeer instancePeer)
          Creates a new ImageRepository.
 
Method Summary
 ImagePeer getImagePeer(nextapp.echo.ImageReference imageRef)
          Returns an image peer for the specified image.
private  ImagePeer loadPeer(nextapp.echo.ImageReference imageRef)
          Retreives an image peer from the cache for the specified image.
private  void reduce()
          Reduces the number of cached image peers by removing those that have not been used recently.
private  void storePeer(nextapp.echo.ImageReference imageRef, ImagePeer peer)
          Stores an image peer in the cache for the specifeid image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHE_SIZE

private static final int CACHE_SIZE
See Also:
Constant Field Values

REDUCTION_SIZE

private static final int REDUCTION_SIZE
See Also:
Constant Field Values

ref2peer

private transient java.util.Map ref2peer

currentRecencyValue

private transient int currentRecencyValue

instancePeer

private InstancePeer instancePeer
Constructor Detail

ImageRepository

public ImageRepository(InstancePeer instancePeer)
Creates a new ImageRepository.

Method Detail

getImagePeer

public ImagePeer getImagePeer(nextapp.echo.ImageReference imageRef)
Returns an image peer for the specified image. A peer will be retrieved from the cache if possible, otherwise one will be created.

Parameters:
imageRef - The image for which to return a peer.
Returns:
A peer suitable for the specified image reference.

loadPeer

private ImagePeer loadPeer(nextapp.echo.ImageReference imageRef)
Retreives an image peer from the cache for the specified image.

Parameters:
imageRef - The image for which to return a peer.
Returns:
An image peer for the specified image, or null if one cannot be found.

reduce

private void reduce()
Reduces the number of cached image peers by removing those that have not been used recently.


storePeer

private void storePeer(nextapp.echo.ImageReference imageRef,
                       ImagePeer peer)
Stores an image peer in the cache for the specifeid image.

Parameters:
imageRef - The image reference whose peer is to be stored.
peer - The image reference's peer.

NextApp Echo
App Container 1.0.5