Skip to content

Package: AbstractElasticsearchClient

AbstractElasticsearchClient

nameinstructionbranchcomplexitylinemethod
AbstractElasticsearchClient(String)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getClient()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getClientConfiguration()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getModelContext()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getModelConverter()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
withClient(Closeable)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
withClientConfiguration(ElasticsearchClientConfiguration)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
withModelContext(ModelContext)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
withModelConverter(QueryConverter)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2020, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.elasticsearch.client;
14:
15: import org.eclipse.kapua.service.elasticsearch.client.configuration.ElasticsearchClientConfiguration;
16:
17: import java.io.Closeable;
18:
19: /**
20: * {@link ElasticsearchClient} {@code abstract} implementation.
21: *
22: * @since 1.0.0
23: */
24: public abstract class AbstractElasticsearchClient<C extends Closeable> implements ElasticsearchClient<C> {
25:
26: protected String clientType;
27:
28: protected C client;
29:
30: private ElasticsearchClientConfiguration clientConfiguration;
31: private ModelContext modelContext;
32: private QueryConverter modelConverter;
33:
34: protected AbstractElasticsearchClient(String clientType) {
35: this.clientType = clientType;
36: }
37:
38: @Override
39: public C getClient() {
40: return client;
41: }
42:
43: @Override
44: public ElasticsearchClient<C> withClient(C client) {
45: this.client = client;
46: return this;
47: }
48:
49: @Override
50: public ElasticsearchClientConfiguration getClientConfiguration() {
51: return clientConfiguration;
52: }
53:
54: @Override
55: public AbstractElasticsearchClient<C> withClientConfiguration(ElasticsearchClientConfiguration clientConfiguration) {
56: this.clientConfiguration = clientConfiguration;
57: return this;
58: }
59:
60: @Override
61: public ModelContext getModelContext() {
62: return modelContext;
63: }
64:
65: @Override
66: public AbstractElasticsearchClient<C> withModelContext(ModelContext modelContext) {
67: this.modelContext = modelContext;
68: return this;
69: }
70:
71: @Override
72: public QueryConverter getModelConverter() {
73: return modelConverter;
74: }
75:
76: @Override
77: public AbstractElasticsearchClient<C> withModelConverter(QueryConverter queryConverter) {
78: this.modelConverter = queryConverter;
79: return this;
80: }
81:
82: }