From 17d87268246d32a75407590f8fef118148b87ccd Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Tue, 31 Dec 2019 15:00:10 +0100 Subject: Implement query removal in new API --- .../cloudatlas/agent/NewApiImplementation.java | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/main/java/pl/edu/mimuw') 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> 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 { -- cgit v1.2.3