1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rest.internal; |
21 |
|
|
22 |
|
import java.lang.reflect.Type; |
23 |
|
import java.util.HashSet; |
24 |
|
import java.util.List; |
25 |
|
import java.util.Set; |
26 |
|
import java.util.logging.Level; |
27 |
|
|
28 |
|
import javax.ws.rs.core.Application; |
29 |
|
|
30 |
|
import org.restlet.Context; |
31 |
|
import org.xwiki.component.descriptor.ComponentDescriptor; |
32 |
|
import org.xwiki.component.manager.ComponentManager; |
33 |
|
import org.xwiki.rest.internal.Constants; |
34 |
|
import org.xwiki.rest.XWikiRestComponent; |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@version |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
50 |
|
public class XWikiJaxRsApplication extends Application |
51 |
|
{ |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
private Set<Class< ? >> jaxRsClasses; |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
57 |
18 |
public XWikiJaxRsApplication(Context context)... |
58 |
|
{ |
59 |
18 |
this.jaxRsClasses = new HashSet<Class< ? >>(); |
60 |
|
|
61 |
18 |
ComponentManager componentManager = |
62 |
|
(ComponentManager) context.getAttributes().get(Constants.XWIKI_COMPONENT_MANAGER); |
63 |
|
|
64 |
|
|
65 |
18 |
List<ComponentDescriptor<XWikiRestComponent>> cds = |
66 |
|
componentManager.getComponentDescriptorList((Type) XWikiRestComponent.class); |
67 |
|
|
68 |
18 |
for (ComponentDescriptor<XWikiRestComponent> cd : cds) { |
69 |
1119 |
this.jaxRsClasses.add(cd.getImplementation()); |
70 |
1119 |
context.getLogger().log(Level.FINE, String.format("%s registered.", cd.getImplementation().getName())); |
71 |
|
} |
72 |
|
|
73 |
18 |
context.getLogger().log(Level.INFO, "RESTful API subsystem initialized."); |
74 |
|
} |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
18 |
@Override... |
77 |
|
public Set<Class< ? >> getClasses() |
78 |
|
{ |
79 |
18 |
return jaxRsClasses; |
80 |
|
} |
81 |
|
|
82 |
|
} |