org.nanocontainer.nanowar.chain
Class ServletChainBuilder

java.lang.Object
  extended by org.nanocontainer.nanowar.chain.ServletChainBuilder

public class ServletChainBuilder
extends Object

ServletChainBuilder builds ContainerChains from servlet path and caches container recorders for later use.

Author:
Kontantin Pribluda, Mauro Talevi

Constructor Summary
ServletChainBuilder(javax.servlet.ServletContext context, String containerBuilderClassName, String containerScriptName, String emptyContainerScript)
          Constructor for the ServletChainBuilder object
 
Method Summary
 ContainerChain buildChain(Object[] pathElements, org.picocontainer.PicoContainer parent)
          Build ContainerChain for path elements
 void populateContainerForPath(org.picocontainer.MutablePicoContainer container, String path)
          populate container for given path.
 void populateRecursively(ContainerChain chain, org.picocontainer.PicoContainer parent, Iterator pathElements)
          Create and populate containers in recursive way
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletChainBuilder

public ServletChainBuilder(javax.servlet.ServletContext context,
                           String containerBuilderClassName,
                           String containerScriptName,
                           String emptyContainerScript)
Constructor for the ServletChainBuilder object

Parameters:
context - the ServletContext
containerBuilderClassName - the class name of the ContainerBuilder
containerScriptName - the name of the container script resource
emptyContainerScript - the script for empty container if the container config is not found
Method Detail

populateContainerForPath

public void populateContainerForPath(org.picocontainer.MutablePicoContainer container,
                                     String path)
                              throws ClassNotFoundException
populate container for given path. cache result in container recorders

Parameters:
container - the MutablePicoContainer used by the recorder
path - the String representing the servlet path used as key for the recorder cache
Throws:
ClassNotFoundException - if the container builder class is not found

buildChain

public ContainerChain buildChain(Object[] pathElements,
                                 org.picocontainer.PicoContainer parent)
                          throws ClassNotFoundException
Build ContainerChain for path elements

Parameters:
pathElements - an array of Objects used as keys for selecting Application objects
parent - the parent PicoContainer or null
Returns:
The configured ContainerChain
Throws:
ClassNotFoundException

populateRecursively

public void populateRecursively(ContainerChain chain,
                                org.picocontainer.PicoContainer parent,
                                Iterator pathElements)
                         throws ClassNotFoundException
Create and populate containers in recursive way

Parameters:
chain - the ContainerChain to which the containers are added
parent - the parent PicoContainer
pathElements - the Iterator on the path elements
Throws:
ClassNotFoundException


Copyright © 2003-2009 Codehaus. All Rights Reserved.