1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.extension.repository.xwiki.internal; |
21 |
|
|
22 |
|
import javax.inject.Inject; |
23 |
|
import javax.inject.Named; |
24 |
|
import javax.inject.Singleton; |
25 |
|
import javax.xml.bind.JAXBContext; |
26 |
|
import javax.xml.bind.JAXBException; |
27 |
|
import javax.xml.bind.Marshaller; |
28 |
|
import javax.xml.bind.Unmarshaller; |
29 |
|
|
30 |
|
import org.xwiki.component.annotation.Component; |
31 |
|
import org.xwiki.component.phase.Initializable; |
32 |
|
import org.xwiki.component.phase.InitializationException; |
33 |
|
import org.xwiki.extension.ExtensionLicenseManager; |
34 |
|
import org.xwiki.extension.internal.ExtensionFactory; |
35 |
|
import org.xwiki.extension.repository.AbstractExtensionRepositoryFactory; |
36 |
|
import org.xwiki.extension.repository.ExtensionRepository; |
37 |
|
import org.xwiki.extension.repository.ExtensionRepositoryDescriptor; |
38 |
|
import org.xwiki.extension.repository.ExtensionRepositoryException; |
39 |
|
import org.xwiki.extension.repository.http.internal.HttpClientFactory; |
40 |
|
|
41 |
|
|
42 |
|
@version |
43 |
|
@since |
44 |
|
|
45 |
|
@Component |
46 |
|
@Singleton |
47 |
|
@Named("xwiki") |
|
|
| 83.3% |
Uncovered Elements: 2 (12) |
Complexity: 6 |
Complexity Density: 0.75 |
|
48 |
|
public class XWikiExtensionRepositoryFactory extends AbstractExtensionRepositoryFactory implements Initializable |
49 |
|
{ |
50 |
|
@Inject |
51 |
|
private ExtensionLicenseManager licenseManager; |
52 |
|
|
53 |
|
@Inject |
54 |
|
private HttpClientFactory httpClientFactory; |
55 |
|
|
56 |
|
@Inject |
57 |
|
private ExtensionFactory factory; |
58 |
|
|
59 |
|
private JAXBContext jaxbContext; |
60 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
61 |
2 |
@Override... |
62 |
|
public void initialize() throws InitializationException |
63 |
|
{ |
64 |
2 |
try { |
65 |
2 |
this.jaxbContext = JAXBContext.newInstance("org.xwiki.extension.repository.xwiki.model.jaxb"); |
66 |
|
} catch (JAXBException e) { |
67 |
0 |
throw new InitializationException("Failed to create JAXB context", e); |
68 |
|
} |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
@return |
75 |
|
@throws |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
77 |
28 |
public Marshaller createMarshaller() throws JAXBException... |
78 |
|
{ |
79 |
28 |
return this.jaxbContext.createMarshaller(); |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
@return |
86 |
|
@throws |
87 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
88 |
85 |
public Unmarshaller createUnmarshaller() throws JAXBException... |
89 |
|
{ |
90 |
85 |
return this.jaxbContext.createUnmarshaller(); |
91 |
|
} |
92 |
|
|
93 |
|
|
94 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
95 |
2 |
@Override... |
96 |
|
public ExtensionRepository createRepository(ExtensionRepositoryDescriptor repositoryDescriptor) |
97 |
|
throws ExtensionRepositoryException |
98 |
|
{ |
99 |
2 |
try { |
100 |
2 |
return new XWikiExtensionRepository(repositoryDescriptor, this, this.licenseManager, this.httpClientFactory, |
101 |
|
this.factory); |
102 |
|
} catch (Exception e) { |
103 |
0 |
throw new ExtensionRepositoryException("Failed to create repository [" + repositoryDescriptor + "]", e); |
104 |
|
} |
105 |
|
} |
106 |
|
} |