From da5df3957ba41d28256ab8183aae0dd3b6e0dcba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sun, 12 Jan 2020 21:05:28 +0100 Subject: Add query signer architecture --- src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java index d2e808a..fe3136d 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java @@ -60,7 +60,7 @@ public class ApiImplementation implements Api { } } - public void installQuery(String name, String queryCode) throws RemoteException { + public void installQuery(String name, String queryCode, byte[] querySignature) throws RemoteException { Pattern queryNamePattern = Pattern.compile("&[a-zA-Z][\\w_]*"); Matcher matcher = queryNamePattern.matcher(name); if (!matcher.matches()) { @@ -85,7 +85,7 @@ public class ApiImplementation implements Api { } } - public void uninstallQuery(String queryName) throws RemoteException { + public void uninstallQuery(String queryName, byte[] querySignature) throws RemoteException { uninstallQueryInHierarchy(root, new Attribute(queryName)); } -- cgit v1.2.3 From c97540a2640bc2d8ecffedb0e85f2d1e3d517eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sun, 12 Jan 2020 22:57:26 +0100 Subject: Change agent rmi api --- .../pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java index fe3136d..e9dbb7e 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java @@ -28,6 +28,7 @@ import pl.edu.mimuw.cloudatlas.model.Type; import pl.edu.mimuw.cloudatlas.model.TypePrimitive; import pl.edu.mimuw.cloudatlas.model.ZMI; import pl.edu.mimuw.cloudatlas.api.Api; +import pl.edu.mimuw.cloudatlas.querysigner.QueryUtils; public class ApiImplementation implements Api { ZMI root; @@ -60,14 +61,9 @@ public class ApiImplementation implements Api { } } - public void installQuery(String name, String queryCode, byte[] querySignature) throws RemoteException { - Pattern queryNamePattern = Pattern.compile("&[a-zA-Z][\\w_]*"); - Matcher matcher = queryNamePattern.matcher(name); - if (!matcher.matches()) { - throw new RemoteException("Invalid query identifier"); - } + public void installQuery(String name, ValueQuery query) throws RemoteException { + QueryUtils.validateQueryName(name); try { - ValueQuery query = new ValueQuery(queryCode); Attribute attributeName = new Attribute(name); installQueryInHierarchy(root, attributeName, query); executeAllQueries(root); @@ -85,7 +81,8 @@ public class ApiImplementation implements Api { } } - public void uninstallQuery(String queryName, byte[] querySignature) throws RemoteException { + public void uninstallQuery(String queryName, ValueQuery query) throws RemoteException { + QueryUtils.validateQueryName(queryName); uninstallQueryInHierarchy(root, new Attribute(queryName)); } -- cgit v1.2.3 From 23b8714b29816b608cb3aa330b6e93610e107126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Mon, 13 Jan 2020 20:56:41 +0100 Subject: Create simple query data structure so that RMI doesn't blow up --- src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java index e9dbb7e..90e7789 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java @@ -28,6 +28,7 @@ import pl.edu.mimuw.cloudatlas.model.Type; import pl.edu.mimuw.cloudatlas.model.TypePrimitive; import pl.edu.mimuw.cloudatlas.model.ZMI; import pl.edu.mimuw.cloudatlas.api.Api; +import pl.edu.mimuw.cloudatlas.querysigner.QueryData; import pl.edu.mimuw.cloudatlas.querysigner.QueryUtils; public class ApiImplementation implements Api { @@ -61,11 +62,11 @@ public class ApiImplementation implements Api { } } - public void installQuery(String name, ValueQuery query) throws RemoteException { + public void installQuery(String name, QueryData query) throws RemoteException { QueryUtils.validateQueryName(name); try { Attribute attributeName = new Attribute(name); - installQueryInHierarchy(root, attributeName, query); + installQueryInHierarchy(root, attributeName, new ValueQuery(query)); executeAllQueries(root); } catch (Exception e) { throw new RemoteException("Failed to install query", e); @@ -81,7 +82,7 @@ public class ApiImplementation implements Api { } } - public void uninstallQuery(String queryName, ValueQuery query) throws RemoteException { + public void uninstallQuery(String queryName, QueryData query) throws RemoteException { QueryUtils.validateQueryName(queryName); uninstallQueryInHierarchy(root, new Attribute(queryName)); } -- cgit v1.2.3