1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.seasar.teeda.core.config.faces.assembler.impl; |
17 | |
|
18 | |
import java.util.Iterator; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import javax.faces.FactoryFinder; |
22 | |
|
23 | |
import org.seasar.teeda.core.config.faces.assembler.FactoryAssembler; |
24 | |
import org.seasar.teeda.core.config.faces.assembler.FactoryChildAssembler; |
25 | |
import org.seasar.teeda.core.config.faces.element.FactoryElement; |
26 | |
import org.seasar.teeda.core.util.IteratorUtil; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
public class DefaultFactoryAssembler extends FactoryAssembler { |
32 | |
|
33 | |
private FactoryChildAssembler applicationFactory_; |
34 | |
|
35 | |
private FactoryChildAssembler facesContextFactory_; |
36 | |
|
37 | |
private FactoryChildAssembler lifecycleFactory_; |
38 | |
|
39 | |
private FactoryChildAssembler renderKitFactory_; |
40 | |
|
41 | |
public DefaultFactoryAssembler(List factories) { |
42 | 4 | super(factories); |
43 | 4 | } |
44 | |
|
45 | |
protected void setupBeforeAssemble() { |
46 | 4 | applicationFactory_ = new FactoryChildAssembler() { |
47 | 4 | protected String getFactoryClassName() { |
48 | 4 | return FactoryFinder.APPLICATION_FACTORY; |
49 | |
} |
50 | |
}; |
51 | |
|
52 | 4 | facesContextFactory_ = new FactoryChildAssembler() { |
53 | 4 | protected String getFactoryClassName() { |
54 | 3 | return FactoryFinder.FACES_CONTEXT_FACTORY; |
55 | |
} |
56 | |
}; |
57 | |
|
58 | 4 | lifecycleFactory_ = new FactoryChildAssembler() { |
59 | 4 | protected String getFactoryClassName() { |
60 | 3 | return FactoryFinder.LIFECYCLE_FACTORY; |
61 | |
} |
62 | |
}; |
63 | |
|
64 | 4 | renderKitFactory_ = new FactoryChildAssembler() { |
65 | 4 | protected String getFactoryClassName() { |
66 | 3 | return FactoryFinder.RENDER_KIT_FACTORY; |
67 | |
} |
68 | |
}; |
69 | |
|
70 | 4 | for (Iterator itr = IteratorUtil.getIterator(getFactories()); itr |
71 | 8 | .hasNext();) { |
72 | 4 | FactoryElement factory = (FactoryElement) itr.next(); |
73 | 4 | applicationFactory_.setTargetFactories(factory |
74 | |
.getApplicationFactories()); |
75 | 4 | facesContextFactory_.setTargetFactories(factory |
76 | |
.getFacesContextFactories()); |
77 | 4 | lifecycleFactory_.setTargetFactories(factory |
78 | |
.getLifecycleFactories()); |
79 | 4 | renderKitFactory_.setTargetFactories(factory |
80 | |
.getRenderKitFactories()); |
81 | |
} |
82 | |
|
83 | 4 | } |
84 | |
|
85 | |
protected void assembleApplicationFactory() { |
86 | 4 | applicationFactory_.assemble(); |
87 | 4 | } |
88 | |
|
89 | |
protected void assembleFacesContextFactory() { |
90 | 4 | facesContextFactory_.assemble(); |
91 | 4 | } |
92 | |
|
93 | |
protected void assembleLifecycleFactory() { |
94 | 4 | lifecycleFactory_.assemble(); |
95 | 4 | } |
96 | |
|
97 | |
protected void assembleRenderKitFactory() { |
98 | 4 | renderKitFactory_.assemble(); |
99 | 4 | } |
100 | |
|
101 | |
} |