1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.script.internal.service; |
21 |
|
|
22 |
|
import javax.inject.Inject; |
23 |
|
import javax.inject.Named; |
24 |
|
import javax.inject.Provider; |
25 |
|
import javax.inject.Singleton; |
26 |
|
|
27 |
|
import org.slf4j.Logger; |
28 |
|
import org.xwiki.component.annotation.Component; |
29 |
|
import org.xwiki.component.manager.ComponentManager; |
30 |
|
import org.xwiki.script.service.ScriptService; |
31 |
|
import org.xwiki.script.service.ScriptServiceManager; |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
39 |
|
@Component |
40 |
|
@Singleton |
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 3 |
Complexity Density: 0.43 |
|
41 |
|
public class DefaultScriptServiceManager implements ScriptServiceManager |
42 |
|
{ |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@Inject |
49 |
|
@Named("context") |
50 |
|
private Provider<ComponentManager> componentManager; |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
@Inject |
56 |
|
private Logger logger; |
57 |
|
|
|
|
| 88.9% |
Uncovered Elements: 1 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
58 |
423800 |
@Override... |
59 |
|
public ScriptService get(String serviceName) |
60 |
|
{ |
61 |
423797 |
ScriptService scriptService = null; |
62 |
|
|
63 |
423791 |
if (this.componentManager.get().hasComponent(ScriptService.class, serviceName)) { |
64 |
414894 |
try { |
65 |
414895 |
scriptService = this.componentManager.get().getInstance(ScriptService.class, serviceName); |
66 |
|
} catch (Exception e) { |
67 |
0 |
this.logger.error("Failed to lookup script service for role hint [{}]", serviceName, e); |
68 |
|
} |
69 |
|
} else { |
70 |
8898 |
this.logger.debug("No script service registered for role hint [{}]", serviceName); |
71 |
|
} |
72 |
|
|
73 |
423800 |
return scriptService; |
74 |
|
} |
75 |
|
} |