summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gearman/controllerWorker/ControllerWorker/Boot.java55
-rw-r--r--gearman/controllerWorker/ControllerWorker/StatusWorker.java11
2 files changed, 53 insertions, 13 deletions
diff --git a/gearman/controllerWorker/ControllerWorker/Boot.java b/gearman/controllerWorker/ControllerWorker/Boot.java
index 5fa4f0a..238ec99 100644
--- a/gearman/controllerWorker/ControllerWorker/Boot.java
+++ b/gearman/controllerWorker/ControllerWorker/Boot.java
@@ -30,6 +30,7 @@ public class Boot extends Thread {
private final int updateRate;
private final long updatePeriod;
private String bootOS;
+ private String[] statusText;
private HashMap<Integer, GearmanJob> pingJobs;
private HashMap<Integer, GearmanJob> wolJobs;
@@ -74,6 +75,27 @@ public class Boot extends Thread {
this.finished = false;
this.error = false;
this.bootOS = bootOS;
+ this.statusText = new String[20];
+ this.statusText[0] = "Booting has been started.";
+ this.statusText[1] = "Ping has been started.";
+ this.statusText[2] = "Client is alive.";
+ this.statusText[3] = "Client is not alive.";
+ this.statusText[4] = "Wake on LAN has been started.";
+ this.statusText[5] = "Magic packet has been send.";
+ this.statusText[6] = "Ping after wake on LAN has been started.";
+ this.statusText[7] = "Doing ping again and again, until client is alive or two minutes has been elapsed";
+ this.statusText[8] = "The check for the correct operating system has been started.";
+ this.statusText[9] = "Wrong operating system is running.";
+ this.statusText[10] = "The check if a user is logged in has been started.";
+ this.statusText[11] = "A user is logged in.";
+ this.statusText[12] = "The check if the user is working has been started.";
+ this.statusText[13] = "The user is not working.";
+ this.statusText[14] = "A restart of the client has been triggered.";
+ this.statusText[15] = "The user is working.";
+ this.statusText[16] = "";
+ this.statusText[17] = "";
+ this.statusText[18] = "Booting has not been finished, due to an error.";
+ this.statusText[19] = "Booting has been finished.";
}
public void run() {
@@ -336,8 +358,13 @@ public class Boot extends Thread {
break;
+ case 15:
+ System.out.println("User is working Logik");
+
+ break;
+
case 18:
- System.out.println("Boot failed after 2min"); // errorState
+ System.out.println("Boot failed"); // errorState
break;
@@ -463,6 +490,20 @@ public class Boot extends Thread {
System.out.println("restart " + ipAddress);
}
+ public String getStatusText(HashMap<String, String> client) {
+ int clientID = Integer.parseInt(client.get("id"));
+ int clientStatus = this.status.get(clientID);
+ return this.statusText[clientStatus];
+ }
+
+ public Boolean isFinished() {
+ return finished;
+ }
+
+ public Boolean isFinishedWithErrors() {
+ return finished && error;
+ }
+
public Vector<HashMap<String, String>> getClients() {
return clients;
}
@@ -499,19 +540,7 @@ public class Boot extends Thread {
return restartJobs;
}
- public HashMap<Integer, Integer> getStatus() {
- return status;
- }
-
public HashMap<Integer, Integer> getErrors() {
return errors;
}
-
- public Boolean isFinished() {
- return finished;
- }
-
- public Boolean isFinishedWithErrors() {
- return finished && error;
- }
}
diff --git a/gearman/controllerWorker/ControllerWorker/StatusWorker.java b/gearman/controllerWorker/ControllerWorker/StatusWorker.java
index 5a2da36..c8b9b57 100644
--- a/gearman/controllerWorker/ControllerWorker/StatusWorker.java
+++ b/gearman/controllerWorker/ControllerWorker/StatusWorker.java
@@ -47,6 +47,17 @@ public class StatusWorker extends AbstractGearmanFunction {
+ " finished with errors!";
} else {
res[count] = "Booting of " + event + " not yet finished!";
+ Vector<HashMap<String, String>> clients = boot.getClients();
+ String[] clientStatus = new String[clients.size()];
+ int statusCount = 0;
+ for(HashMap<String, String> client: clients) {
+ String ipAddress = client.get("ip");
+ String statusText = boot.getStatusText(client);
+ clientStatus[statusCount] = "Status of the client with the ip " + ipAddress + ": " + statusText;
+ statusCount++;
+ }
+ String jsonClientStatus = JSONValue.toJSONString(clientStatus);
+ res[count] += jsonClientStatus;
}
count++;