1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.filter.instance.internal.output; |
21 |
|
|
22 |
|
import java.io.IOException; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import javax.inject.Inject; |
26 |
|
import javax.inject.Named; |
27 |
|
import javax.inject.Provider; |
28 |
|
|
29 |
|
import org.xwiki.component.annotation.Component; |
30 |
|
import org.xwiki.component.annotation.InstantiationStrategy; |
31 |
|
import org.xwiki.component.descriptor.ComponentInstantiationStrategy; |
32 |
|
import org.xwiki.component.manager.ComponentLookupException; |
33 |
|
import org.xwiki.component.manager.ComponentManager; |
34 |
|
import org.xwiki.filter.FilterDescriptorManager; |
35 |
|
import org.xwiki.filter.FilterException; |
36 |
|
import org.xwiki.filter.instance.internal.InstanceUtils; |
37 |
|
import org.xwiki.filter.instance.output.InstanceOutputProperties; |
38 |
|
import org.xwiki.filter.instance.output.OutputInstanceFilterStreamFactory; |
39 |
|
import org.xwiki.filter.output.AbstractBeanOutputFilterStream; |
40 |
|
|
41 |
|
|
42 |
|
@version |
43 |
|
@since |
44 |
|
|
45 |
|
@Component |
46 |
|
@Named(InstanceUtils.ROLEHINT) |
47 |
|
@InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) |
|
|
| 92.9% |
Uncovered Elements: 1 (14) |
Complexity: 4 |
Complexity Density: 0.36 |
|
48 |
|
public class InstanceOutputFilterStream extends AbstractBeanOutputFilterStream<InstanceOutputProperties> |
49 |
|
{ |
50 |
|
@Inject |
51 |
|
private FilterDescriptorManager filterManager; |
52 |
|
|
53 |
|
@Inject |
54 |
|
@Named("context") |
55 |
|
private Provider<ComponentManager> componentManager; |
56 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 2 |
Complexity Density: 0.2 |
|
57 |
16 |
@Override... |
58 |
|
public void setProperties(InstanceOutputProperties properties) throws FilterException |
59 |
|
{ |
60 |
16 |
super.setProperties(properties); |
61 |
|
|
62 |
16 |
List<OutputInstanceFilterStreamFactory> factories; |
63 |
16 |
try { |
64 |
16 |
factories = this.componentManager.get().getInstanceList(OutputInstanceFilterStreamFactory.class); |
65 |
|
} catch (ComponentLookupException e) { |
66 |
0 |
throw new FilterException( |
67 |
|
"Failed to get regsitered instance of OutputInstanceFilterStreamFactory components", e); |
68 |
|
} |
69 |
|
|
70 |
16 |
Object[] filters = new Object[factories.size()]; |
71 |
16 |
int i = 0; |
72 |
16 |
for (OutputInstanceFilterStreamFactory factory : factories) { |
73 |
30 |
filters[i++] = factory.createOutputFilterStream(properties).getFilter(); |
74 |
|
} |
75 |
|
|
76 |
16 |
this.filter = this.filterManager.createCompositeFilter(filters); |
77 |
|
} |
78 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
79 |
16 |
@Override... |
80 |
|
public Object getFilter() throws FilterException |
81 |
|
{ |
82 |
16 |
return this.filter; |
83 |
|
} |
84 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
85 |
16 |
@Override... |
86 |
|
public void close() throws IOException |
87 |
|
{ |
88 |
|
|
89 |
|
} |
90 |
|
} |