summaryrefslogtreecommitdiffstats
path: root/src/main/java/derms/replica1/CentralRepo.java
blob: fe1fc45987060b2469cb0628a517122ecb3bb25b (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
package derms.replica1;

import javax.jws.WebMethod;
import javax.jws.WebService;
import java.util.HashMap;
import java.util.Map;

import javax.xml.ws.Endpoint;

@WebService
public class CentralRepo {

    public static void main(String[] args) {
        Endpoint.publish("http://localhost:8387/CentralRepo", new CentralRepo());
        System.out.println("derms.CentralRepo is up and running...");
    }

    private final Map<String, Integer> serverNames = new HashMap<>();

    @WebMethod
    public Map<String, Integer> listServers() {
        return serverNames;
    }

    @WebMethod
    public void addServer(String serverName, int serverPort) {
        serverNames.put(serverName, serverPort);
    }
}