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: 103   Methods: 6
NCLOC: 61   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
SOMRegistryImpl.java 100% 100% 100% 100%
coverage
 1   
 // Copyright 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.engine.state;
 16   
 
 17   
 import java.util.HashMap;
 18   
 import java.util.Iterator;
 19   
 import java.util.Map;
 20   
 
 21   
 import org.apache.hivemind.ApplicationRuntimeException;
 22   
 import org.apache.hivemind.ErrorLog;
 23   
 
 24   
 /**
 25   
  * @author Howard M. Lewis Ship
 26   
  * @since 4.0
 27   
  */
 28   
 public class SOMRegistryImpl implements StateObjectManagerRegistry
 29   
 {
 30   
     private ErrorLog _errorLog;
 31   
 
 32   
     private Map _factoryContributions;
 33   
 
 34   
     private Map _applicationContributions;
 35   
 
 36   
     private Map _persistenceManagers;
 37   
 
 38   
     private Map _objectManagers = new HashMap();
 39   
 
 40  5
     public void initializeService()
 41   
     {
 42  5
         Map contributions = new HashMap();
 43  5
         contributions.putAll(_factoryContributions);
 44   
         // Overwrite any duplicates with the application contributions
 45  5
         contributions.putAll(_applicationContributions);
 46   
 
 47  5
         Iterator i = contributions.values().iterator();
 48  5
         while (i.hasNext())
 49   
         {
 50  8
             StateObjectContribution c = (StateObjectContribution) i.next();
 51   
 
 52  8
             String objectName = c.getName();
 53  8
             String scope = c.getScope();
 54   
 
 55  8
             StateObjectPersistenceManager pm = (StateObjectPersistenceManager) _persistenceManagers
 56   
                     .get(scope);
 57   
 
 58  8
             if (pm == null)
 59   
             {
 60  1
                 _errorLog.error(
 61   
                         StateMessages.unknownScope(objectName, scope),
 62   
                         c.getLocation(),
 63   
                         null);
 64  1
                 continue;
 65   
             }
 66   
 
 67  7
             StateObjectManager manager = new StateObjectManagerImpl(objectName, c.getFactory(), pm);
 68   
 
 69  7
             _objectManagers.put(objectName, manager);
 70   
 
 71   
         }
 72   
     }
 73   
 
 74  9
     public StateObjectManager get(String objectName)
 75   
     {
 76  9
         StateObjectManager manager = (StateObjectManager) _objectManagers.get(objectName);
 77   
 
 78  9
         if (manager == null)
 79  1
             throw new ApplicationRuntimeException(StateMessages.unknownStateObjectName(objectName));
 80   
 
 81  8
         return manager;
 82   
     }
 83   
 
 84  5
     public void setApplicationContributions(Map applicationContributions)
 85   
     {
 86  5
         _applicationContributions = applicationContributions;
 87   
     }
 88   
 
 89  4
     public void setErrorLog(ErrorLog errorLog)
 90   
     {
 91  4
         _errorLog = errorLog;
 92   
     }
 93   
 
 94  5
     public void setFactoryContributions(Map factoryContributions)
 95   
     {
 96  5
         _factoryContributions = factoryContributions;
 97   
     }
 98   
 
 99  5
     public void setPersistenceManagers(Map persistenceManagers)
 100   
     {
 101  5
         _persistenceManagers = persistenceManagers;
 102   
     }
 103   
 }