blob: 6c982bfa71c6c9e58c6c9714af87c78284e99183 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.configserver;
import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.NodeRepository;
import com.yahoo.vespa.hosted.node.admin.configserver.noderepository.RealNodeRepository;
import com.yahoo.vespa.hosted.node.admin.configserver.orchestrator.Orchestrator;
import com.yahoo.vespa.hosted.node.admin.configserver.orchestrator.OrchestratorImpl;
import com.yahoo.vespa.hosted.node.admin.configserver.state.State;
import com.yahoo.vespa.hosted.node.admin.configserver.state.StateImpl;
/**
* {@link ConfigServerClients} using the default implementation for the various clients,
* and backed by a {@link ConfigServerApi}.
*
* @author freva
*/
public class RealConfigServerClients implements ConfigServerClients {
private final ConfigServerApi configServerApi;
private final NodeRepository nodeRepository;
private final Orchestrator orchestrator;
private final State state;
/**
* @param configServerApi the backend API to use - will be closed at {@link #stop()}.
*/
public RealConfigServerClients(ConfigServerApi configServerApi) {
this.configServerApi = configServerApi;
nodeRepository = new RealNodeRepository(configServerApi);
orchestrator = new OrchestratorImpl(configServerApi);
state = new StateImpl(configServerApi);
}
@Override
public NodeRepository nodeRepository() {
return nodeRepository;
}
@Override
public Orchestrator orchestrator() {
return orchestrator;
}
@Override
public State state() {
return state;
}
@Override
public void stop() {
configServerApi.close();
}
}
|