]> git.somenet.org - pub/jan/dst18.git/blob - ass3-elastic/src/main/java/dst/ass3/elastic/ContainerInfo.java
[3.1] seems to work.
[pub/jan/dst18.git] / ass3-elastic / src / main / java / dst / ass3 / elastic / ContainerInfo.java
1 package dst.ass3.elastic;
2
3 import dst.ass3.messaging.RequestType;
4
5 import java.util.Objects;
6
7 /**
8  * Value type that represents a container.
9  */
10 public class ContainerInfo {
11
12     /**
13      * The name of the container image.
14      */
15     private String image;
16
17     /**
18      * The container ID.
19      */
20     private String containerId;
21
22     /**
23      * True if the container is running.
24      */
25     private boolean running;
26
27     /**
28      * If the container is a worker (indicated by the image dst/ass3-worker), then this field should contain the worker
29      * type. Otherwise it can be null.
30      */
31     private RequestType workerType;
32
33     public String getImage() {
34         return image;
35     }
36
37     public void setImage(String image) {
38         this.image = image;
39     }
40
41     public String getContainerId() {
42         return containerId;
43     }
44
45     public void setContainerId(String containerId) {
46         this.containerId = containerId;
47     }
48
49     public boolean isRunning() {
50         return running;
51     }
52
53     public void setRunning(boolean running) {
54         this.running = running;
55     }
56
57
58     public RequestType getWorkerType() {
59         return workerType;
60     }
61
62     public void setWorkerType(RequestType workerType) {
63         this.workerType = workerType;
64     }
65
66     @Override
67     public boolean equals(Object o) {
68         if (this == o) {
69             return true;
70         }
71         if (o == null || getClass() != o.getClass()) {
72             return false;
73         }
74         ContainerInfo that = (ContainerInfo) o;
75         return running == that.running &&
76                 Objects.equals(image, that.image) &&
77                 Objects.equals(containerId, that.containerId) &&
78                 Objects.equals(workerType, that.workerType);
79     }
80
81     @Override
82     public int hashCode() {
83
84         return Objects.hash(image, containerId, running, workerType);
85     }
86
87     @Override
88     public String toString() {
89         return "ContainerInfo{" +
90                 "image='" + image + '\'' +
91                 ", containerId='" + containerId + '\'' +
92                 ", running=" + running +
93                 ", workerType='" + workerType + '\'' +
94                 '}';
95     }
96 }