m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/pl')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java3
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java4
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java4
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java8
4 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java
index 0cbda2d..53255aa 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java
@@ -44,12 +44,13 @@ public class Agent {
// TODO config setup
String zonePath = System.getProperty("zone_path");
+ System.out.println("zonePAth " + zonePath);
String selectionStrategy = System.getProperty("Gossip.zone_strategy");
Long queryPeriod = Long.getLong("query_period");
Long gossipPeriod = Long.getLong("gossip_period");
HierarchyConfig hierarchyConfig = new HierarchyConfig(eventBus, zonePath, selectionStrategy);
hierarchyConfig.startQueries(queryPeriod);
- hierarchyConfig.startGossip(gossipPeriod);
+ hierarchyConfig.startGossip(gossipPeriod, zonePath);
}
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java
index dc5241d..f9e323a 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java
@@ -37,7 +37,7 @@ public class HierarchyConfig {
}
}
- public void startGossip(long gossipPeriod) {
+ public void startGossip(long gossipPeriod, String zonePath) {
Supplier<TimerScheduledTask> taskSupplier = () ->
new TimerScheduledTask() {
public void run() {
@@ -47,7 +47,7 @@ public class HierarchyConfig {
ValueContact contact = selectContactFromLevel(gossipLevel);
if (contact != null) {
System.out.println("INFO: found a contact " + contact.toString());
- InitiateGossipMessage message = new InitiateGossipMessage("", 0, new PathName("/uw/violet07"), contact);
+ InitiateGossipMessage message = new InitiateGossipMessage("", 0, new PathName(zonePath), contact);
sendMessage(message);
} else {
System.out.println("DEBUG: couldn't find contact for gossip");
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
index f6c49cf..4019696 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
@@ -53,8 +53,7 @@ public class ClientController {
return size() > MAX_ENTRIES;
}
};
- // TODO set zone in config
- this.currentZoneName = "/uw/violet08";
+ this.currentZoneName = System.getProperty("zone_path");
fetchAttributeData(); // fetch attribute data as early as possible
}
@@ -446,7 +445,6 @@ public class ClientController {
return "zoneForm";
}
- // TODO available zones dont work when our zone changed
@PostMapping("/zones")
public String zonesPostPage(@ModelAttribute DataStringInput zoneName, Model model) {
this.currentZoneName = zoneName.getString();
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java b/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java
index f96d259..12d795a 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java
@@ -92,7 +92,7 @@ public class Fetcher {
}
// https://jj09.net/interprocess-communication-python-java/
- private static void fetchData() {
+ private static void fetchData(String zonePath) {
BufferedReader bufferRead;
ArrayList deserializedAttribs;
String jsonAttribs;
@@ -111,8 +111,7 @@ public class Fetcher {
deserializedAttribs = deserializeAttribs(jsonAttribs);
for (int i = 0; i < fetcherAttributeNames.size(); i++) {
api.setAttributeValue(
- // TODO enable setup in config
- "/uw/violet08",
+ zonePath,
fetcherAttributeNames.get(i),
packAttributeValue(
deserializedAttribs.get(i),
@@ -144,7 +143,8 @@ public class Fetcher {
}
public static void main(String[] args) {
+ String zonePath = System.getProperty("zone_path");
parseArgs(args);
- fetchData();
+ fetchData(zonePath);
}
}