1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.vfs.internal; |
21 |
|
|
22 |
|
import java.util.Arrays; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import javax.inject.Inject; |
26 |
|
import javax.inject.Named; |
27 |
|
import javax.inject.Provider; |
28 |
|
import javax.inject.Singleton; |
29 |
|
|
30 |
|
import org.xwiki.bridge.event.ApplicationReadyEvent; |
31 |
|
import org.xwiki.component.annotation.Component; |
32 |
|
import org.xwiki.component.manager.ComponentManager; |
33 |
|
import org.xwiki.observation.EventListener; |
34 |
|
import org.xwiki.observation.event.Event; |
35 |
|
import org.xwiki.vfs.internal.attach.AttachDriver; |
36 |
|
|
37 |
|
import net.java.truevfs.access.TArchiveDetector; |
38 |
|
import net.java.truevfs.access.TConfig; |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
@version |
44 |
|
@since |
45 |
|
|
46 |
|
@Component |
47 |
|
@Named("vfsAttachDriver") |
48 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 0.75 |
|
49 |
|
public class VfsAttachDriverRegistrationListener implements EventListener |
50 |
|
{ |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
private static final String NAME = "vfsAttachDriver"; |
55 |
|
|
56 |
|
@Inject |
57 |
|
@Named("context") |
58 |
|
private Provider<ComponentManager> componentManagerProvider; |
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
60 |
4 |
@Override... |
61 |
|
public String getName() |
62 |
|
{ |
63 |
4 |
return NAME; |
64 |
|
} |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
1 |
@Override... |
67 |
|
public List<Event> getEvents() |
68 |
|
{ |
69 |
1 |
return Arrays.<Event>asList(new ApplicationReadyEvent()); |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
72 |
1 |
@Override... |
73 |
|
public void onEvent(Event event, Object source, Object data) |
74 |
|
{ |
75 |
|
|
76 |
1 |
TConfig config = TConfig.current(); |
77 |
|
|
78 |
|
|
79 |
1 |
config.setArchiveDetector(new TArchiveDetector(config.getArchiveDetector(), "attach", |
80 |
|
new AttachDriver(this.componentManagerProvider.get()))); |
81 |
|
} |
82 |
|
} |