1 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 32 public class PipelineFactory extends BaseLocatable implements ServiceImplementationFactory 33 { 34 private ClassFactory _classFactory; 35 36 private DefaultImplementationBuilder _defaultImplementationBuilder; 37 38 39 private ErrorLog _errorLog; 40 41 public Object createCoreServiceImplementation( 42 ServiceImplementationFactoryParameters factoryParameters) 43 { 44 PipelineParameters pp = (PipelineParameters) factoryParameters.getFirstParameter(); 45 46 PipelineAssembler pa = new PipelineAssembler(_errorLog, factoryParameters.getServiceId(), 47 factoryParameters.getServiceInterface(), pp.getFilterInterface(), _classFactory, 48 _defaultImplementationBuilder); 49 50 Object terminator = pp.getTerminator(); 51 52 if (terminator != null) 53 pa.setTerminator(terminator, pp.getLocation()); 54 55 List l = pp.getPipelineConfiguration(); 56 57 Iterator i = l.iterator(); 58 while (i.hasNext()) 59 { 60 PipelineContribution c = (PipelineContribution) i.next(); 61 62 c.informAssembler(pa); 63 } 64 65 return pa.createPipeline(); 66 } 67 68 public void setClassFactory(ClassFactory factory) 69 { 70 _classFactory = factory; 71 } 72 73 public void setDefaultImplementationBuilder(DefaultImplementationBuilder builder) 74 { 75 _defaultImplementationBuilder = builder; 76 } 77 78 79 public void setErrorLog(ErrorLog errorLog) 80 { 81 _errorLog = errorLog; 82 } 83 } | Popular Tags |