summaryrefslogtreecommitdiffstats
path: root/gearman/controllerWorker/ControllerWorker/BootState.java
blob: 91c1f7a648b366a1f9b0754b3cbbdcb189b4658c (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
53
54
55
56
57
58
59
60
61
62
63
64
65
package ControllerWorker;

import java.util.Vector;

public class BootState {
	private String eventName;
	private String bootOS;
	private Vector<Client> clients;
	private Boolean finished;
	private Boolean error;

	public BootState(String eventName, Vector<Client> clients, String bootOS) {
		this.eventName = eventName;
		this.clients = clients;
		this.bootOS = bootOS;
		finished = false;
		error = false;
	}

	public Boolean isFinished() {
		return finished && !error;
	}

	public Boolean isFinishedWithErrors() {
		return finished && error;
	}

	public Vector<Client> getClients() {
		return clients;
	}

	public String getEventName() {
		return eventName;
	}

	public String getBootOS() {
		return bootOS;
	}

	public void finish() {
		this.finished = true;
	}

	public void error() {
		this.error = true;
	}

	public void setClientState(int clientID, ClientState newClientState) {
		for (Client client : clients) {
			if (client.getId() == clientID) {
				client.setState(newClientState);
				break;
			}
		}
	}

	public void setClientError(int clientID, String error) {
		for (Client client : clients) {
			if (client.getId() == clientID) {
				client.setError(error);
				break;
			}
		}
	}
}