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 --- .../pl/edu/mimuw/cloudatlas/model/ValueQuery.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/model') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java index 82e1602..d203e99 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java @@ -15,6 +15,28 @@ public class ValueQuery extends Value { private String code; // Parsed query private Program query; + + public byte[] getSignature() { + return signature; + } + + public void setSignature(byte[] signature) { + this.signature = signature; + } + + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } + + // Query signature + private byte[] signature; + // Query signing timestamp + private long timestamp; + /** * Constructs a new ValueQuery object. * -- cgit v1.2.3 From 36cf47fd63352c67a5fdeea7a922c16f0856e9aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sun, 12 Jan 2020 22:57:43 +0100 Subject: Add new fields to value query --- .../pl/edu/mimuw/cloudatlas/model/ValueQuery.java | 39 ++++++++++++---------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/model') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java index d203e99..26a5fbb 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java @@ -15,23 +15,6 @@ public class ValueQuery extends Value { private String code; // Parsed query private Program query; - - public byte[] getSignature() { - return signature; - } - - public void setSignature(byte[] signature) { - this.signature = signature; - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - // Query signature private byte[] signature; // Query signing timestamp @@ -47,17 +30,39 @@ public class ValueQuery extends Value { this.code = query; Yylex lex = new Yylex(new ByteArrayInputStream(query.getBytes())); this.query = (new parser(lex)).pProgram(); + this.signature = null; + this.timestamp = System.currentTimeMillis(); + } + + public ValueQuery(String query, byte[] querySignature) throws Exception { + this.code = query; + Yylex lex = new Yylex(new ByteArrayInputStream(query.getBytes())); + this.query = (new parser(lex)).pProgram(); + this.signature = querySignature; + this.timestamp = System.currentTimeMillis(); } private ValueQuery() { this.code = null; this.query = null; + this.signature = null; + this.timestamp = System.currentTimeMillis(); } public Program getQuery() { return query; } + public byte[] getSignature() { return signature; } + + public long getTimestamp() { return timestamp; } + + public void setTimestamp(long timestamp) { this.timestamp = timestamp; } + + public String getCode() { + return code; + } + @Override public Type getType() { return TypePrimitive.QUERY; -- cgit v1.2.3 From cc901690a8e3e41a1958ae33d95462031fba8e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sun, 12 Jan 2020 23:07:32 +0100 Subject: Fix query value typo --- src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/model') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java index c5d4b54..6839e4c 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java @@ -23,7 +23,6 @@ public class ValueQuery extends Value { /** * Constructs a new ValueQuery object. * - * @param name the name of the query * @param query the code of the query */ public ValueQuery(String query) throws Exception { @@ -61,10 +60,6 @@ public class ValueQuery extends Value { public void setTimestamp(long timestamp) { this.timestamp = timestamp; } - public String getCode() { - return code; - } - @Override public Type getType() { return TypePrimitive.QUERY; -- 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/model/ValueQuery.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/model') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java index 6839e4c..ece50b5 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java @@ -6,6 +6,7 @@ import pl.edu.mimuw.cloudatlas.interpreter.query.Absyn.Program; import pl.edu.mimuw.cloudatlas.interpreter.query.parser; import pl.edu.mimuw.cloudatlas.interpreter.query.Yylex; import pl.edu.mimuw.cloudatlas.model.Value; +import pl.edu.mimuw.cloudatlas.querysigner.QueryData; /** * A class that holds a CloudAtlas query. @@ -41,6 +42,14 @@ public class ValueQuery extends Value { this.timestamp = System.currentTimeMillis(); } + public ValueQuery(QueryData queryData) throws Exception { + this.code = queryData.getCode(); + Yylex lex = new Yylex(new ByteArrayInputStream(queryData.getCode().getBytes())); + this.query = (new parser(lex)).pProgram(); + this.signature = queryData.getSignature(); + this.timestamp = System.currentTimeMillis(); + } + private ValueQuery() { this.code = null; this.query = null; -- cgit v1.2.3