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: 48   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
DispatchToInjectWorker.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.enhance;
 16   
 
 17   
 import java.util.Iterator;
 18   
 import java.util.Map;
 19   
 
 20   
 import org.apache.hivemind.ErrorLog;
 21   
 import org.apache.tapestry.spec.IComponentSpecification;
 22   
 import org.apache.tapestry.spec.InjectSpecification;
 23   
 
 24   
 /**
 25   
  * Iterates over the {@link org.apache.tapestry.spec.InjectSpecification}s and locates and
 26   
  * delegates to a {@link org.apache.tapestry.enhance.InjectEnhancementWorker} for each one.
 27   
  * 
 28   
  * @author Howard M. Lewis Ship
 29   
  * @since 4.0
 30   
  */
 31   
 public class DispatchToInjectWorker implements EnhancementWorker
 32   
 {
 33   
     private ErrorLog _errorLog;
 34   
 
 35   
     private Map _injectWorkers;
 36   
 
 37  465
     public void performEnhancement(EnhancementOperation op, IComponentSpecification spec)
 38   
     {
 39  465
         Iterator i = spec.getInjectSpecifications().iterator();
 40   
 
 41  465
         while (i.hasNext())
 42   
         {
 43  382
             InjectSpecification is = (InjectSpecification) i.next();
 44   
 
 45  382
             invokeWorker(op, is);
 46   
         }
 47   
     }
 48   
 
 49  382
     private void invokeWorker(EnhancementOperation op, InjectSpecification spec)
 50   
     {
 51  382
         try
 52   
         {
 53  382
             InjectEnhancementWorker worker = (InjectEnhancementWorker) _injectWorkers.get(spec
 54   
                     .getType());
 55   
 
 56  382
             if (worker == null)
 57   
             {
 58  1
                 _errorLog.error(EnhanceMessages.unknownInjectType(spec.getProperty(), spec
 59   
                         .getType()), spec.getLocation(), null);
 60  1
                 return;
 61   
             }
 62   
 
 63  381
             worker.performEnhancement(op, spec);
 64   
 
 65   
         }
 66   
         catch (Exception ex)
 67   
         {
 68  1
             _errorLog.error(EnhanceMessages.errorAddingProperty(spec.getProperty(), op
 69   
                     .getBaseClass(), ex), spec.getLocation(), ex);
 70   
         }
 71   
     }
 72   
 
 73  47
     public void setErrorLog(ErrorLog errorLog)
 74   
     {
 75  47
         _errorLog = errorLog;
 76   
     }
 77   
 
 78  48
     public void setInjectWorkers(Map injectWorkers)
 79   
     {
 80  48
         _injectWorkers = injectWorkers;
 81   
     }
 82   
 }
 83