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: 89   Methods: 5
NCLOC: 53   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
PropertyPersistenceStrategySourceImpl.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.record;
 16   
 
 17   
 import java.util.ArrayList;
 18   
 import java.util.Collection;
 19   
 import java.util.HashMap;
 20   
 import java.util.Iterator;
 21   
 import java.util.List;
 22   
 import java.util.Map;
 23   
 
 24   
 import org.apache.hivemind.ApplicationRuntimeException;
 25   
 import org.apache.tapestry.IRequestCycle;
 26   
 
 27   
 /**
 28   
  * @author Howard M. Lewis Ship
 29   
  */
 30   
 public class PropertyPersistenceStrategySourceImpl implements PropertyPersistenceStrategySource
 31   
 {
 32   
     // Set from tapestry.props.PersistenceStrategy
 33   
     private List _contributions;
 34   
 
 35   
     private Map _strategies = new HashMap();
 36   
 
 37  55
     public void initializeService()
 38   
     {
 39  55
         Iterator i = _contributions.iterator();
 40  55
         while (i.hasNext())
 41   
         {
 42  55
             PropertyPersistenceStrategyContribution c = (PropertyPersistenceStrategyContribution) i
 43   
                     .next();
 44   
 
 45  55
             _strategies.put(c.getName(), c.getStrategy());
 46   
         }
 47   
     }
 48   
 
 49  33
     public PropertyPersistenceStrategy getStrategy(String name)
 50   
     {
 51  33
         if (!_strategies.containsKey(name))
 52  1
             throw new ApplicationRuntimeException(RecordMessages.unknownPersistenceStrategy(name));
 53   
 
 54  32
         return (PropertyPersistenceStrategy) _strategies.get(name);
 55   
     }
 56   
 
 57  264
     public Collection getAllStoredChanges(String pageName, IRequestCycle cycle)
 58   
     {
 59  264
         Collection result = new ArrayList();
 60   
 
 61  264
         Iterator i = _strategies.values().iterator();
 62   
 
 63  264
         while (i.hasNext())
 64   
         {
 65  264
             PropertyPersistenceStrategy s = (PropertyPersistenceStrategy) i.next();
 66   
 
 67  264
             result.addAll(s.getStoredChanges(pageName, cycle));
 68   
         }
 69   
 
 70  264
         return result;
 71   
     }
 72   
 
 73  1
     public void discardAllStoredChanged(String pageName, IRequestCycle cycle)
 74   
     {
 75  1
         Iterator i = _strategies.values().iterator();
 76   
 
 77  1
         while (i.hasNext())
 78   
         {
 79  1
             PropertyPersistenceStrategy s = (PropertyPersistenceStrategy) i.next();
 80   
 
 81  1
             s.discardStoredChanges(pageName, cycle);
 82   
         }
 83   
     }
 84   
 
 85  56
     public void setContributions(List contributions)
 86   
     {
 87  56
         _contributions = contributions;
 88   
     }
 89   
 }