summaryrefslogtreecommitdiffstats
path: root/gearman/controllerWorker/ControllerWorker/BootState.java
blob: 0026b53da419337bc0736c9978b46dfcc21cacb6 (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
66
67
68
69
70
71
72
73
74
75
76
package ControllerWorker;

import java.util.Vector;

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

	public BootState(String eventName, Boolean force, Vector<Client> clients,
			String bootOS) {
		this.eventName = eventName;
		this.force = force;
		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 Boolean getForce() {
		return force;
	}

	public void setForce(Boolean force) {
		this.force = force;
	}

	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;
			}
		}
	}
}