diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2020-01-12 21:52:38 +0100 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2020-01-12 21:52:38 +0100 |
commit | 84df6c11a868e8cd98fa14455456d313e25234db (patch) | |
tree | 73e3b3193282c3f9634fc04b91446a6f61d525ef /src/main/java/pl | |
parent | 32bfe8f7efc1f4fb99ddf827a19ab466724dac06 (diff) |
Set zone levels
Diffstat (limited to 'src/main/java/pl')
-rw-r--r-- | src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java index 999c193..f572efe 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java @@ -61,6 +61,7 @@ public class Stanik extends Module { public void handleGetState(GetStateMessage message) throws InterruptedException { pruneHierarchy(); + addLevels(); StateMessage response = new StateMessage( "", message.getRequestingModule(), @@ -78,6 +79,17 @@ public class Stanik extends Module { pruneZMI(hierarchy, now); } + private void addLevels() { + addLevelsRecursive(hierarchy, 0); + } + + private void addLevelsRecursive(ZMI zmi, long level) { + zmi.getAttributes().addOrChange("level", new ValueInt(level)); + for (ZMI son : zmi.getSons()) { + addLevelsRecursive(son, level + 1); + } + } + private boolean pruneZMI(ZMI zmi, ValueTime time) { Value timestamp = zmi.getAttributes().get("timestamp"); |