info.magnolia.imaging.caching
Class CachingImageStreamer<P>

java.lang.Object
  extended by info.magnolia.imaging.caching.CachingImageStreamer<P>
Type Parameters:
P - type of ParameterProvider's parameter
All Implemented Interfaces:
ImageStreamer<P>

public class CachingImageStreamer<P>
extends Object
implements ImageStreamer<P>

An ImageStreamer which stores and serves generated images to/from a specific workspace.

Version:
$Id$

Constructor Summary
CachingImageStreamer(info.magnolia.cms.core.HierarchyManager hm, CachingStrategy<P> cachingStrategy, ImageStreamer<P> delegate)
           
 
Method Summary
protected  info.magnolia.cms.core.NodeData fetchFromCache(ImageGenerator<ParameterProvider<P>> generator, ParameterProvider<P> parameterProvider)
          Gets the binary property (NodeData) for the appropriate image, ready to be served, or null if the image should be regenerated.
protected  info.magnolia.cms.core.NodeData generateAndStore(ImageGenerator<ParameterProvider<P>> generator, ParameterProvider<P> parameterProvider)
           
protected  void serve(info.magnolia.cms.core.NodeData binary, OutputStream out)
           
 void serveImage(ImageGenerator<ParameterProvider<P>> generator, ParameterProvider<P> params, OutputStream out)
          Generates an image (if deemed necessary) with the given ImageGenerator and Parameters, streams it to the given OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingImageStreamer

public CachingImageStreamer(info.magnolia.cms.core.HierarchyManager hm,
                            CachingStrategy<P> cachingStrategy,
                            ImageStreamer<P> delegate)
Method Detail

serveImage

public void serveImage(ImageGenerator<ParameterProvider<P>> generator,
                       ParameterProvider<P> params,
                       OutputStream out)
                throws IOException,
                       ImagingException
Description copied from interface: ImageStreamer
Generates an image (if deemed necessary) with the given ImageGenerator and Parameters, streams it to the given OutputStream.

Specified by:
serveImage in interface ImageStreamer<P>
Throws:
IOException
ImagingException

fetchFromCache

protected info.magnolia.cms.core.NodeData fetchFromCache(ImageGenerator<ParameterProvider<P>> generator,
                                                         ParameterProvider<P> parameterProvider)
Gets the binary property (NodeData) for the appropriate image, ready to be served, or null if the image should be regenerated.


serve

protected void serve(info.magnolia.cms.core.NodeData binary,
                     OutputStream out)
              throws IOException
Throws:
IOException

generateAndStore

protected info.magnolia.cms.core.NodeData generateAndStore(ImageGenerator<ParameterProvider<P>> generator,
                                                           ParameterProvider<P> parameterProvider)
                                                    throws IOException,
                                                           ImagingException
Throws:
IOException
ImagingException


Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.