org.jmage.filterchain
Class FilterChainManager

java.lang.Object
  extended by org.jmage.filterchain.FilterChainManager
All Implemented Interfaces:
Configurable, RequestHandler

public class FilterChainManager
extends java.lang.Object
implements RequestHandler

FilterChainManager controls all FilterChains and acts as a delegate to all it's attached FilterChainFactories. Create FilterChains by specifying a URI filterchain:com.package.FilterChain and let the delegates work out how to create it. FilterChains can be constructed out of single filters, in which case the class name of that Filter should be provided.

A more sophisticated way to create chains is to serialize them into XML format. See resources/xml for examples.


Field Summary
protected  ApplicationContext applicationContext
           
protected  java.util.List filterChainFactories
           
protected static org.apache.log4j.Logger log
           
 
Constructor Summary
protected FilterChainManager()
          Default Constructor
  FilterChainManager(java.util.List filterChainFactories)
          Creates a EncoderManager for an array of given FilterChainFactories
 
Method Summary
 void configure(ApplicationContext context)
          Configure FilterChainManager
protected  FilterChain[] create(ImageRequest request)
          Creates a FilterChain object to use for a given unique chainUri, denoted by a URI following the convention filterchain:com.package.FilterChain
protected  javax.media.jai.PlanarImage doFilter(FilterChain[] chains, javax.media.jai.PlanarImage image)
          Filters an image through an existing FilterChain[].
protected  javax.media.jai.PlanarImage filter(ImageRequest imageRequest)
          Convenience method combining filter creation and image filtering.
 void handle(ImageRequest request)
          Filters an ImageRequest with an existing Filterchain
protected  java.lang.String lookupFilterChainName(java.lang.String filterChain)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

filterChainFactories

protected java.util.List filterChainFactories

applicationContext

protected ApplicationContext applicationContext

log

protected static org.apache.log4j.Logger log
Constructor Detail

FilterChainManager

protected FilterChainManager()
Default Constructor


FilterChainManager

public FilterChainManager(java.util.List filterChainFactories)
Creates a EncoderManager for an array of given FilterChainFactories

Parameters:
filterChainFactories -
Method Detail

configure

public void configure(ApplicationContext context)
Configure FilterChainManager

Specified by:
configure in interface Configurable
Parameters:
context -

handle

public void handle(ImageRequest request)
            throws JmageException
Filters an ImageRequest with an existing Filterchain

Specified by:
handle in interface RequestHandler
Parameters:
request - the request
Throws:
FilterChainException
FilterException
JmageException

create

protected FilterChain[] create(ImageRequest request)
                        throws FilterChainException,
                               FilterException
Creates a FilterChain object to use for a given unique chainUri, denoted by a URI following the convention filterchain:com.package.FilterChain

Parameters:
request - the ImageRequest
Returns:
the FilterChain object.
Throws:
FilterChainException - if the filterchain cannot be constructed or handled properly
FilterException

doFilter

protected javax.media.jai.PlanarImage doFilter(FilterChain[] chains,
                                               javax.media.jai.PlanarImage image)
                                        throws FilterException
Filters an image through an existing FilterChain[].

Parameters:
chains - the FilterChain[]
image - the image
Returns:
the filtered image
Throws:
FilterException

filter

protected javax.media.jai.PlanarImage filter(ImageRequest imageRequest)
                                      throws FilterChainException,
                                             FilterException
Convenience method combining filter creation and image filtering. Use this if you need the FilterChain only for one ImageRequest. Builds an unconfigured FilterChain and filters an image through it instantly.

Parameters:
imageRequest - the request
Returns:
the filtered image
Throws:
FilterChainException - if the filterchain can't be created or found
FilterException - if the filterchain can't filter the image.

lookupFilterChainName

protected java.lang.String lookupFilterChainName(java.lang.String filterChain)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2004-2008 Sourceforge. All Rights Reserved.