1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.activeinstalls.internal; |
21 |
|
|
22 |
|
import javax.inject.Inject; |
23 |
|
import javax.inject.Singleton; |
24 |
|
|
25 |
|
import org.xwiki.activeinstalls.ActiveInstallsConfiguration; |
26 |
|
import org.xwiki.component.annotation.Component; |
27 |
|
import org.xwiki.component.manager.ComponentLifecycleException; |
28 |
|
import org.xwiki.component.phase.Disposable; |
29 |
|
import org.xwiki.component.phase.Initializable; |
30 |
|
import org.xwiki.component.phase.InitializationException; |
31 |
|
|
32 |
|
import io.searchbox.client.JestClient; |
33 |
|
import io.searchbox.client.JestClientFactory; |
34 |
|
import io.searchbox.client.config.HttpClientConfig; |
35 |
|
|
36 |
|
|
37 |
|
@link |
38 |
|
|
39 |
|
|
40 |
|
@version |
41 |
|
@since |
42 |
|
|
43 |
|
@Component |
44 |
|
@Singleton |
|
|
| 92.3% |
Uncovered Elements: 1 (13) |
Complexity: 4 |
Complexity Density: 0.5 |
|
45 |
|
public class DefaultJestClientManager implements JestClientManager, Initializable, Disposable |
46 |
|
{ |
47 |
|
@Inject |
48 |
|
private ActiveInstallsConfiguration configuration; |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
private JestClient client; |
54 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
55 |
8 |
@Override... |
56 |
|
public void initialize() throws InitializationException |
57 |
|
{ |
58 |
8 |
String pingURL = this.configuration.getPingInstanceURL(); |
59 |
8 |
HttpClientConfig clientConfig = new HttpClientConfig.Builder(pingURL).multiThreaded(true).build(); |
60 |
8 |
JestClientFactory factory = new XWikiJestClientFactory(this.configuration); |
61 |
8 |
factory.setHttpClientConfig(clientConfig); |
62 |
8 |
this.client = factory.getObject(); |
63 |
|
} |
64 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
65 |
8 |
@Override... |
66 |
|
public void dispose() throws ComponentLifecycleException |
67 |
|
{ |
68 |
8 |
if (this.client != null) { |
69 |
8 |
this.client.shutdownClient(); |
70 |
|
} |
71 |
|
} |
72 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
73 |
36 |
@Override... |
74 |
|
public JestClient getClient() |
75 |
|
{ |
76 |
36 |
return this.client; |
77 |
|
} |
78 |
|
} |