From 3159df80ee02f6f65fe8e8ae1bae8fecb8fad070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 14 Jan 2020 15:10:44 +0100 Subject: Debug install validation --- .../mimuw/cloudatlas/agent/NewApiImplementation.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent') 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 0bf4338..a2ac358 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/NewApiImplementation.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/NewApiImplementation.java @@ -1,9 +1,8 @@ package pl.edu.mimuw.cloudatlas.agent; -import java.io.PrintStream; - import java.rmi.RemoteException; +import java.security.PublicKey; import java.util.concurrent.CompletableFuture; import java.util.List; import java.util.AbstractMap.SimpleImmutableEntry; @@ -12,24 +11,20 @@ import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import java.util.regex.Pattern; -import java.util.regex.Matcher; import pl.edu.mimuw.cloudatlas.agent.messages.*; -import pl.edu.mimuw.cloudatlas.interpreter.Interpreter; -import pl.edu.mimuw.cloudatlas.interpreter.InterpreterException; -import pl.edu.mimuw.cloudatlas.interpreter.Main; -import pl.edu.mimuw.cloudatlas.interpreter.QueryResult; import pl.edu.mimuw.cloudatlas.model.*; import pl.edu.mimuw.cloudatlas.api.Api; -import pl.edu.mimuw.cloudatlas.querysigner.QueryData; -import pl.edu.mimuw.cloudatlas.querysigner.QueryUtils; +import pl.edu.mimuw.cloudatlas.querysigner.*; public class NewApiImplementation implements Api { private EventBus eventBus; + private PublicKey publicKey; public NewApiImplementation(EventBus eventBus) { this.eventBus = eventBus; + String publicKeyFile = System.getProperty("public_key_file"); + publicKey = KeyUtils.getPublicKey(publicKeyFile); } public Set getZoneSet() throws RemoteException { @@ -82,8 +77,9 @@ public class NewApiImplementation implements Api { } public void installQuery(String name, QueryData query) throws RemoteException { - QueryUtils.validateQueryName(name); try { + QueryUtils.validateQueryName(name); + QuerySignerApiImplementation.validateInstallQuery(name, query, this.publicKey); Attribute attributeName = new Attribute(name); ValueTime timestamp = new ValueTime(System.currentTimeMillis()); Map> queries = new HashMap(); -- cgit v1.2.3