Clover coverage report - Code Coverage for hivemind-lib release 1.0-rc-2
Coverage timestamp: Sat Sep 11 2004 09:10:14 EDT
file stats: LOC: 93   Methods: 4
NCLOC: 58   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
PipelineFactory.java 100% 100% 100% 100%
coverage
 1   
 //  Copyright 2004 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.hivemind.lib.pipeline;
 16   
 
 17   
 import java.util.Iterator;
 18   
 import java.util.List;
 19   
 
 20   
 import org.apache.commons.logging.Log;
 21   
 import org.apache.hivemind.ErrorHandler;
 22   
 import org.apache.hivemind.ServiceImplementationFactory;
 23   
 import org.apache.hivemind.impl.BaseLocatable;
 24   
 import org.apache.hivemind.internal.Module;
 25   
 import org.apache.hivemind.lib.DefaultImplementationBuilder;
 26   
 import org.apache.hivemind.service.ClassFactory;
 27   
 
 28   
 /**
 29   
  * Service factory that builds a pipeline of objects.
 30   
  *
 31   
  * @author Howard Lewis Ship
 32   
  */
 33   
 public class PipelineFactory extends BaseLocatable implements ServiceImplementationFactory
 34   
 {
 35   
     private ClassFactory _classFactory;
 36   
     private DefaultImplementationBuilder _defaultImplementationBuilder;
 37   
     private ErrorHandler _errorHandler;
 38   
 
 39  4
     public Object createCoreServiceImplementation(
 40   
         String serviceId,
 41   
         Class serviceInterface,
 42   
         Log serviceLog,
 43   
         Module invokingModule,
 44   
         List parameters)
 45   
     {
 46  4
         PipelineParameters pp = (PipelineParameters) parameters.get(0);
 47   
 
 48  4
         PipelineAssembler pa =
 49   
             new PipelineAssembler(
 50   
                 serviceLog,
 51   
                 _errorHandler,
 52   
                 serviceId,
 53   
                 serviceInterface,
 54   
                 pp.getFilterInterface(),
 55   
                 _classFactory,
 56   
                 _defaultImplementationBuilder,
 57   
                 invokingModule);
 58   
 
 59  4
         Object terminator = pp.getTerminator();
 60   
 
 61  4
         if (terminator != null)
 62  1
             pa.setTerminator(terminator, pp.getLocation());
 63   
 
 64  4
         List l = pp.getPipelineConfiguration();
 65   
 
 66  4
         Iterator i = l.iterator();
 67  4
         while (i.hasNext())
 68   
         {
 69  7
             PipelineContribution c = (PipelineContribution) i.next();
 70   
 
 71  7
             c.informAssembler(pa);
 72   
         }
 73   
 
 74  4
         return pa.createPipeline();
 75   
     }
 76   
 
 77  4
     public void setClassFactory(ClassFactory factory)
 78   
     {
 79  4
         _classFactory = factory;
 80   
     }
 81   
 
 82  4
     public void setDefaultImplementationBuilder(DefaultImplementationBuilder builder)
 83   
     {
 84  4
         _defaultImplementationBuilder = builder;
 85   
     }
 86   
 
 87  4
     public void setErrorHandler(ErrorHandler handler)
 88   
     {
 89  4
         _errorHandler = handler;
 90   
     }
 91   
 
 92   
 }
 93