Clover coverage report - angkor - 0.4
Coverage timestamp: ti okt 15 2002 22:32:48 CEST
file stats: LOC: 69   Methods: 3
NCLOC: 48   Classes: 2
Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
ParseValve.java 100% 100% 100% 100%
 1   
 /*
 2   
  * Angkor Web Framework
 3   
  *
 4   
  * Distributable under LGPL license.
 5   
  * See terms of license at gnu.org.
 6   
  */
 7   
 
 8   
 package com.tirsen.angkor.process;
 9   
 
 10   
 import com.tirsen.angkor.Application;
 11   
 import com.tirsen.angkor.Debug;
 12   
 import com.tirsen.angkor.RenderContext;
 13   
 import com.tirsen.angkor.View;
 14   
 import org.apache.log4j.Category;
 15   
 
 16   
 import java.util.Iterator;
 17   
 
 18   
 /**
 19   
  * <!-- $Id: ParseValve.java,v 1.4 2002/10/13 13:37:26 tirsen Exp $ -->
 20   
  * <!-- $Author: tirsen $ -->
 21   
  *
 22   
  * @author Jon Tirs&acute;n (tirsen@users.sourceforge.net)
 23   
  * @version $Revision: 1.4 $
 24   
  */
 25   
 public class ParseValve implements Valve
 26   
 {
 27   
     private static final Category logger = Debug.getCategory();
 28   
 
 29  11
     private Pipeline createParsePipeline()
 30   
     {
 31  11
         Pipeline pipeline = new DefaultPipeline();
 32  11
         pipeline.addValve(new ParseComponentValve());
 33  11
         return pipeline;
 34   
     }
 35   
 
 36   
     public static class ParseComponentValve implements Valve
 37   
     {
 38  6
         public void execute(ExecuteContext exec) throws Exception
 39   
         {
 40  6
             View currentView = (View) exec.getAttribute(ExecuteContext.CurrentViewAttribute);
 41  6
             RenderContext renderContext = (RenderContext) exec.getAttribute(ExecuteContext.RenderContextAttribute);
 42  6
             logger.debug("parsing view " + currentView);
 43  6
             currentView.parse(renderContext);
 44   
         }
 45   
     }
 46   
 
 47  11
     public void execute(ExecuteContext exec) throws Exception
 48   
     {
 49  11
         Application application = (Application) exec.getAttribute(ExecuteContext.ApplicationAttribute);
 50  11
         try
 51   
         {
 52  11
             Pipeline parsePipeline = createParsePipeline();
 53  11
             Iterator it = application.iterateParsingComponents();
 54  11
             while (it.hasNext())
 55   
             {
 56  6
                 View view = (View) it.next();
 57  6
                 ExecuteContext subExec = parsePipeline.createSubContext(exec);
 58  6
                 subExec.setAttribute(ExecuteContext.CurrentViewAttribute, view);
 59  6
                 parsePipeline.execute(subExec);
 60   
             }
 61   
         }
 62   
         finally
 63   
         {
 64  11
             application.resetParsingComponents();
 65   
         }
 66  11
         exec.executeNext();
 67   
     }
 68   
 }
 69