2009/04/15 - Apache HiveMind has been retired.

For more information, please explore the Attic.

Clover coverage report - Code Coverage for hivemind-lib release 1.2.1
Coverage timestamp: Fri Feb 10 2006 16:34:07 PST
file stats: LOC: 83   Methods: 4
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PipelineFactory.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.hivemind.lib.pipeline;
 16   
 17    import java.util.Iterator;
 18    import java.util.List;
 19   
 20    import org.apache.hivemind.ErrorLog;
 21    import org.apache.hivemind.ServiceImplementationFactory;
 22    import org.apache.hivemind.ServiceImplementationFactoryParameters;
 23    import org.apache.hivemind.impl.BaseLocatable;
 24    import org.apache.hivemind.lib.DefaultImplementationBuilder;
 25    import org.apache.hivemind.service.ClassFactory;
 26   
 27    /**
 28    * Service factory that builds a pipeline of objects.
 29    *
 30    * @author Howard Lewis Ship
 31    */
 32    public class PipelineFactory extends BaseLocatable implements ServiceImplementationFactory
 33    {
 34    private ClassFactory _classFactory;
 35   
 36    private DefaultImplementationBuilder _defaultImplementationBuilder;
 37   
 38    /** @since 1.1 */
 39    private ErrorLog _errorLog;
 40   
 41  4 public Object createCoreServiceImplementation(
 42    ServiceImplementationFactoryParameters factoryParameters)
 43    {
 44  4 PipelineParameters pp = (PipelineParameters) factoryParameters.getParameters().get(0);
 45   
 46  4 PipelineAssembler pa = new PipelineAssembler(_errorLog, factoryParameters.getServiceId(),
 47    factoryParameters.getServiceInterface(), pp.getFilterInterface(), _classFactory,
 48    _defaultImplementationBuilder);
 49   
 50  4 Object terminator = pp.getTerminator();
 51   
 52  4 if (terminator != null)
 53  1 pa.setTerminator(terminator, pp.getLocation());
 54   
 55  4 List l = pp.getPipelineConfiguration();
 56   
 57  4 Iterator i = l.iterator();
 58  4 while (i.hasNext())
 59    {
 60  7 PipelineContribution c = (PipelineContribution) i.next();
 61   
 62  7 c.informAssembler(pa);
 63    }
 64   
 65  4 return pa.createPipeline();
 66    }
 67   
 68  4 public void setClassFactory(ClassFactory factory)
 69    {
 70  4 _classFactory = factory;
 71    }
 72   
 73  4 public void setDefaultImplementationBuilder(DefaultImplementationBuilder builder)
 74    {
 75  4 _defaultImplementationBuilder = builder;
 76    }
 77   
 78    /** @since 1.1 */
 79  4 public void setErrorLog(ErrorLog errorLog)
 80    {
 81  4 _errorLog = errorLog;
 82    }
 83    }