Clover coverage report - Cactus 1.4 for J2EE API 13
Coverage timestamp: Sun Aug 25 2002 18:02:10 BST
file stats: LOC: 117   Methods: 7
NCLOC: 53   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
FilterConfigWrapper.java 0% 0% 0% 0%
 1   
 /*   Generated by AspectJ version 1.0.5 */
 2   
 package org.apache.cactus.server;
 3   
 import java.util.Enumeration;
 4   
 import java.util.Hashtable;
 5   
 import java.util.Vector;
 6   
 import javax.servlet.FilterConfig;
 7   
 import javax.servlet.ServletContext;
 8   
 
 9   
 /** 
 10   
  * Wrapper around <code>FilterConfig</code> which overrides the 
 11   
  * <code>getServletContext()</code> method to return our own wrapper around 
 12   
  * <code>ServletContext</code>. 
 13   
  * 
 14   
  * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a> 
 15   
  * 
 16   
  * @version $Id: FilterConfigWrapper.java,v 1.2 2002/04/14 10:35:44 vmassol Exp $ 
 17   
  * @see ServletContext 
 18   
  */
 19   
 public class FilterConfigWrapper implements FilterConfig {
 20   
   /** 
 21   
        * The original filter config object 
 22   
        */
 23   
   private FilterConfig originalConfig;
 24   
   /** 
 25   
        * List of parameters set using the <code>setInitParameter()</code> method. 
 26   
        */
 27   
   private Hashtable initParameters;
 28   
   /** 
 29   
        * Simulated name of the filter 
 30   
        */
 31   
   private String filterName;
 32   
   /** 
 33   
        * @param theOriginalConfig the original filter config object 
 34   
        */
 35  0
   public FilterConfigWrapper(FilterConfig theOriginalConfig) {
 36  0
     super();
 37  0
     this.originalConfig = theOriginalConfig;
 38  0
     this.initParameters = new Hashtable();
 39   
   } 
 40   
   /** 
 41   
        * Sets a parameter as if it were set in the <code>web.xml</code> file. 
 42   
        * 
 43   
        * @param theName the parameter's name 
 44   
        * @param theValue the parameter's value 
 45   
        */
 46  0
   public void setInitParameter(String theName, String theValue) {
 47  0
     this.initParameters.put(theName, theValue);
 48   
   } 
 49   
 
 50   
   /** 
 51   
        * Sets the filter name. That will be the value returned by the 
 52   
        * <code>getFilterName()</code> method. 
 53   
        * 
 54   
        * @param theFilterName the filter name 
 55   
        */
 56  0
   public void setFilterName(String theFilterName) {
 57  0
     this.filterName = theFilterName;
 58   
   } 
 59   
 
 60   
   /** 
 61   
        * @return the simulated filter's name if defined or the redirector 
 62   
        *         filter's name 
 63   
        */
 64  0
   public String getFilterName() {
 65  0
     if (this.filterName != null) {
 66  0
       return this.filterName;
 67   
     } 
 68  0
     return this.originalConfig.getFilterName();
 69   
   } 
 70   
 
 71   
   /** 
 72   
        * @return our own wrapped servlet context object 
 73   
        */
 74  0
   public ServletContext getServletContext() {
 75  0
     return new ServletContextWrapper(this.originalConfig.getServletContext());
 76   
   } 
 77   
 
 78   
   /** 
 79   
        * Return the union of the parameters defined in the Redirector 
 80   
        * <code>web.xml</code> file and the one set using the 
 81   
        * <code>setInitParameter()</code> method. The parameters with the same 
 82   
        * name (and same case) are only returned once. 
 83   
        * 
 84   
        * @return the init parameters 
 85   
        */
 86  0
   public Enumeration getInitParameterNames() {
 87  0
     Vector names = new Vector();
 88  0
     Enumeration enum = this.initParameters.keys();
 89  0
     while (enum.hasMoreElements()){
 90  0
       String value = (String)enum.nextElement();
 91  0
       names.add(value);
 92   
     } 
 93  0
     enum = this.originalConfig.getInitParameterNames();
 94  0
     while (enum.hasMoreElements()){
 95  0
       String value = (String)enum.nextElement();
 96  0
       if (!names.contains(value)) {
 97  0
         names.add(value);
 98   
       } 
 99   
     } 
 100  0
     return names.elements();
 101   
   } 
 102   
 
 103   
   /** 
 104   
        * @param theName the name of the parameter's value to return 
 105   
        * @return the value of the parameter, looking for it first in the list of 
 106   
        *         parameters set using the <code>setInitParameter()</code> method 
 107   
        *         and then in those set in <code>web.xml</code>. 
 108   
        */
 109  0
   public String getInitParameter(String theName) {
 110  0
     String value = (String)this.initParameters.get(theName);
 111  0
     if (value == null) {
 112  0
       value = this.originalConfig.getInitParameter(theName);
 113   
     } 
 114  0
     return value;
 115   
   } 
 116   
 
 117   
 }