Clover coverage report - Code Coverage for tapestry release 3.1-alpha-1
Coverage timestamp: Mon Feb 21 2005 09:16:14 EST
file stats: LOC: 78   Methods: 5
NCLOC: 38   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
EngineManagerImpl.java 100% 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.util.Locale;
 18   
 
 19   
 import javax.servlet.http.HttpServletRequest;
 20   
 import javax.servlet.http.HttpSession;
 21   
 
 22   
 import org.apache.tapestry.IEngine;
 23   
 import org.apache.tapestry.services.EngineFactory;
 24   
 import org.apache.tapestry.services.EngineManager;
 25   
 import org.apache.tapestry.services.RequestLocaleManager;
 26   
 import org.apache.tapestry.services.ObjectPool;
 27   
 
 28   
 /**
 29   
  * Implementation of service {@link org.apache.tapestry.services.EngineManager}.
 30   
  * Service point tapestry.request.EngineManager.
 31   
  * 
 32   
  * @author Howard Lewis Ship
 33   
  * @since 3.1
 34   
  */
 35   
 public class EngineManagerImpl implements EngineManager
 36   
 {
 37   
     private ObjectPool _enginePool;
 38   
 
 39   
     private EngineFactory _engineFactory;
 40   
 
 41   
     private RequestLocaleManager _localeManager;
 42   
 
 43  187
     public IEngine getEngineInstance()
 44   
     {
 45  187
         Locale locale = _localeManager.extractLocaleForCurrentRequest();
 46   
 
 47  187
         IEngine result = (IEngine) _enginePool.get(locale);
 48   
 
 49   
         // This happens when either the pool is empty, or when a session exists
 50   
         // but the engine has not been stored into it (which should never happen, and
 51   
         // probably indicates an error in the framework or the application).
 52   
 
 53  187
         if (result == null)
 54  61
             result = _engineFactory.constructNewEngineInstance(locale);
 55   
 
 56  187
         return result;
 57   
     }
 58   
 
 59  186
     public void storeEngineInstance(IEngine engine)
 60   
     {
 61  186
         _enginePool.store(engine.getLocale(), engine);
 62   
     }
 63   
 
 64  53
     public void setEngineFactory(EngineFactory factory)
 65   
     {
 66  53
         _engineFactory = factory;
 67   
     }
 68   
 
 69  55
     public void setEnginePool(ObjectPool pool)
 70   
     {
 71  55
         _enginePool = pool;
 72   
     }
 73   
 
 74  54
     public void setLocaleManager(RequestLocaleManager manager)
 75   
     {
 76  54
         _localeManager = manager;
 77   
     }
 78   
 }