summaryrefslogtreecommitdiffstats
path: root/src/main/java/derms/client/ResponderClient.java
blob: af5dc3d32f3df88d2f33ae799a32d90589757eb3 (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
package derms.client;

import java.net.MalformedURLException;

public class ResponderClient extends Client {
    public static final String usage = "Usage: java derms.client.ResponderClienet <FE host>";

    public ResponderClient(String FEhost) throws MalformedURLException {
        super(FEhost);
    }

    public static void main(String[] args) {
        if (args.length < 1) {
            System.err.println("Missing argument 'FE host'");
            System.exit(1);
        }

        String FEhost = args[0];

        ResponderClient client = null;
        try {
            client = new ResponderClient(FEhost);
        } catch (MalformedURLException e) {
            System.err.println(e.getMessage());
            System.exit(1);
        }

        System.out.println("Adding resource...");
        String response = client.addResource("MTL1234", "AMBULANCE", 100);
        System.out.println("Response: " + response);
    }

    public String addResource(String resourceID, String resourceName, int duration) {
        return server.addResource(resourceID, resourceName, duration);
    }
}