diff options
author | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2020-01-12 22:57:26 +0100 |
---|---|---|
committer | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2020-01-12 22:57:26 +0100 |
commit | c97540a2640bc2d8ecffedb0e85f2d1e3d517eb0 (patch) | |
tree | 0574dc5675f9e7128da380adcb923d454e7179df /src/main/java/pl/edu/mimuw/cloudatlas/agent | |
parent | f6ada2aae355781e5e16534d3d2e7959cbac69c4 (diff) |
Change agent rmi api
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent')
-rw-r--r-- | src/main/java/pl/edu/mimuw/cloudatlas/agent/ApiImplementation.java | 13 | ||||
-rw-r--r-- | src/main/java/pl/edu/mimuw/cloudatlas/agent/NewApiImplementation.java | 13 |
2 files changed, 10 insertions, 16 deletions
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)); } 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 450382d..bf75210 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/NewApiImplementation.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/NewApiImplementation.java @@ -22,6 +22,7 @@ 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.QueryUtils; public class NewApiImplementation implements Api { private EventBus eventBus; @@ -79,14 +80,9 @@ public class NewApiImplementation 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); ValueTime timestamp = new ValueTime(System.currentTimeMillis()); Map<Attribute, Entry<ValueQuery, ValueTime>> queries = new HashMap(); @@ -98,7 +94,8 @@ public class NewApiImplementation implements Api { } } - public void uninstallQuery(String queryName, byte[] querySignature) throws RemoteException { + public void uninstallQuery(String queryName, ValueQuery query) throws RemoteException { + QueryUtils.validateQueryName(queryName); try { Attribute attributeName = new Attribute(queryName); ValueTime timestamp = new ValueTime(System.currentTimeMillis()); |