m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/model')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/model/ValueQuery.java27
1 files changed, 27 insertions, 0 deletions
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 6d233ea..c5d4b54 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,11 @@ public class ValueQuery extends Value {
private String code;
// Parsed query
private Program query;
+ // Query signature
+ private byte[] signature;
+ // Query signing timestamp
+ private long timestamp;
+
/**
* Constructs a new <code>ValueQuery</code> object.
*
@@ -25,11 +30,23 @@ 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 String getCode() { return code; }
@@ -38,6 +55,16 @@ public class ValueQuery extends Value {
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;