|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
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 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
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 |
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 |
| |
|
79 |
4
| public void setErrorLog(ErrorLog errorLog)
|
|
80 |
| { |
|
81 |
4
| _errorLog = errorLog;
|
|
82 |
| } |
|
83 |
| } |