Clover coverage report - Code Coverage for tapestry release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:05:49 EDT
file stats: LOC: 83   Methods: 4
NCLOC: 41   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. 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
InvokeEngineTerminator.java - 100% 100% 100%
coverage
 1   
 // Copyright 2004, 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.tapestry.services.impl;
 16   
 
 17   
 import java.io.IOException;
 18   
 
 19   
 import org.apache.tapestry.Constants;
 20   
 import org.apache.tapestry.IEngine;
 21   
 import org.apache.tapestry.services.EngineManager;
 22   
 import org.apache.tapestry.services.Infrastructure;
 23   
 import org.apache.tapestry.services.RequestGlobals;
 24   
 import org.apache.tapestry.services.WebRequestServicer;
 25   
 import org.apache.tapestry.web.WebRequest;
 26   
 import org.apache.tapestry.web.WebResponse;
 27   
 
 28   
 /**
 29   
  * The terminatior for the <code>tapestry.RequestProcessor</code> pipeline, this service is
 30   
  * responsible for:
 31   
  * <ul>
 32   
  * <li>Storing the request and response into {@link org.apache.tapestry.services.RequestGlobals}.
 33   
  * <li>Locating the correct engine instance and letting it to the rest of the request.
 34   
  * <li>Returning the engine instance to the pool at the end of the request. </ul
 35   
  * 
 36   
  * @author Howard Lewis Ship
 37   
  * @since 4.0
 38   
  */
 39   
 public class InvokeEngineTerminator implements WebRequestServicer
 40   
 {
 41   
     private EngineManager _engineManager;
 42   
 
 43   
     private Infrastructure _infrastructure;
 44   
 
 45   
     private RequestGlobals _requestGlobals;
 46   
 
 47  148
     public void service(WebRequest request, WebResponse response) throws IOException
 48   
     {
 49  148
         _requestGlobals.store(request, response);
 50   
 
 51  148
         IEngine engine = _engineManager.getEngineInstance();
 52   
 
 53   
         // Until we can inject the infrastructure into the engine
 54   
         // we do this to let the engine know about it.
 55   
 
 56  148
         request.setAttribute(Constants.INFRASTRUCTURE_KEY, _infrastructure);
 57   
 
 58  148
         try
 59   
         {
 60  148
             engine.service(request, response);
 61   
         }
 62   
         finally
 63   
         {
 64  148
             _engineManager.storeEngineInstance(engine);
 65   
         }
 66   
 
 67   
     }
 68   
 
 69  45
     public void setEngineManager(EngineManager manager)
 70   
     {
 71  45
         _engineManager = manager;
 72   
     }
 73   
 
 74  45
     public void setInfrastructure(Infrastructure infrastructure)
 75   
     {
 76  45
         _infrastructure = infrastructure;
 77   
     }
 78   
 
 79  45
     public void setRequestGlobals(RequestGlobals requestGlobals)
 80   
     {
 81  45
         _requestGlobals = requestGlobals;
 82   
     }
 83   
 }