1515import java .io .FileWriter ;
1616import java .io .IOException ;
1717import java .util .Calendar ;
18+ import java .util .Random ;
1819import java .util .concurrent .TimeUnit ;
1920import java .util .logging .Level ;
2021import java .util .logging .Logger ;
2930import org .apache .http .util .EntityUtils ;
3031import toe .HttpFactory ;
3132import toe .support ;
33+ import toe .typedef ;
3234
3335/**
3436 *
@@ -44,6 +46,8 @@ public class SimulatorWebSlave implements Runnable {
4446 HttpClient client ;
4547 HttpGet httpGet ;
4648 HttpPost postRequest ;
49+ String clientID ;//ID of this client to be marked in server to append to download request
50+ String clientSkills ;//Skills of Client in one String to append to download request
4751
4852 /**
4953 * Constructor
@@ -57,14 +61,23 @@ public SimulatorWebSlave() {
5761 * from server, checking for next files, starting loacal simulations and
5862 * uploading results
5963 */
64+ @ Override
6065 public void run () {
6166 support .setLogToWindow (false );//stop window-logging. this is not saved in properties
62- while (!shouldEnd ) {
63- this .pathToTimeNet = support .getPathToTimeNet ();// pathToTimeNetTMP;
67+ this .pathToTimeNet = support .getPathToTimeNet ();// pathToTimeNetTMP;
68+ clientID =String .valueOf (Math .random ())+Long .toString (Calendar .getInstance ().getTimeInMillis ());
69+ clientID =String .valueOf (Math .abs (clientID .hashCode ()));
70+ //TODO set skill-string correctly!
71+ clientSkills ="" ;
72+ if (support .checkTimeNetPath ()){
73+ clientSkills +="_" +typedef .typeOfClientSkills .TIMENET .toString ()+"_" ;
74+ }
75+
76+ while (!shouldEnd ) {
6477 //Request the server Api to get the Status Code and response body.
6578 // Getting the status code.
6679 client = HttpFactory .getHttpClient ();
67- httpGet = HttpFactory .getGetRequest (support .getReMoteAddress () + "/rest/api/downloads/ND" );
80+ httpGet = HttpFactory .getGetRequest (support .getReMoteAddress () + "/rest/api/downloads/ND?ID=" + clientID + "&SKILLS=" + clientSkills );
6881 HttpResponse response ;
6982 String responseString ;
7083 try {
0 commit comments