m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/agent
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2019-12-31 15:00:10 +0100
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2019-12-31 15:00:10 +0100
commit17d87268246d32a75407590f8fef118148b87ccd (patch)
tree7f0ea4c5d0559e0adc3c3ee1b865ee55bf2bb7c6 /src/main/java/pl/edu/mimuw/cloudatlas/agent
parent393f087e7e3d2e3a636ae0ffeb075c2354ff0966 (diff)
Implement query removal in new API
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/NewApiImplementation.java21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/NewApiImplementation.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/NewApiImplementation.java
index 3bedd90..52d6321 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/NewApiImplementation.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/NewApiImplementation.java
@@ -114,18 +114,17 @@ public class NewApiImplementation implements Api {
}
public void uninstallQuery(String queryName) throws RemoteException {
- // uninstallQueryInHierarchy(root, new Attribute(queryName));
- }
-
- private void uninstallQueryInHierarchy(ZMI zmi, Attribute queryName) {
- /*
- if (!zmi.getSons().isEmpty()) {
- zmi.getAttributes().remove(queryName);
- for (ZMI son : zmi.getSons()) {
- uninstallQueryInHierarchy(son, queryName);
- }
+ try {
+ Attribute attributeName = new Attribute(queryName);
+ ValueTime timestamp = new ValueTime(System.currentTimeMillis());
+ Map<Attribute, Entry<ValueQuery, ValueTime>> queries = new HashMap();
+ queries.put(attributeName, new SimpleImmutableEntry(null, timestamp));
+ UpdateQueriesMessage message = new UpdateQueriesMessage("", 0, queries);
+ eventBus.addMessage(message);
+ } catch (Exception e) {
+ System.out.println("ERROR: failed to remove query");
+ throw new RemoteException("Failed to uninstall query", e);
}
- */
}
public void setAttributeValue(String zoneName, String attributeName, Value value) throws RemoteException {