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