switched to consitent messaging system (ticket 178)
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java
index 7666dda..b1f3d1c 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AbstractSyntaxTree.java
@@ -53,20 +53,45 @@
 	public static boolean verbose = false;
 	ParseTree currentNode = null;
 	Integer stackedObjects = 0;
-	ArrayList<String> errorMsgs = new ArrayList<String>();
-	ArrayList<String> warnings = new ArrayList<String>();
-	ArrayList<String> announcements = new ArrayList<String>();
+	private ArrayList<List<Object>> errors = new ArrayList<List<Object>>();
+	private ArrayList<List<Object>> warnings = new ArrayList<List<Object>>();
+	private ArrayList<List<Object>> messages = new ArrayList<List<Object>>();
 	LinkedHashMap<String, Object> collection = new LinkedHashMap<String,Object>();
 	
 	AbstractSyntaxTree() {
 		requestMap.put("@context", "http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld");
-		requestMap.put("errors", errorMsgs);
+		requestMap.put("errors", errors);
 		requestMap.put("warnings", warnings);
-		requestMap.put("announcements", announcements);
+		requestMap.put("messages", messages);
 		requestMap.put("collection", collection);
 		requestMap.put("meta", new LinkedHashMap<String, Object>());
 	}
 	
+	public void addWarning(int code, String msg) {
+		List<Object> warning = Arrays.asList(new Object[]{code, msg}); 
+		warnings.add(warning);
+	}
+	
+	public void addWarning(String msg) {
+		List<Object> warning = Arrays.asList(new Object[]{msg}); 
+		warnings.add(warning);
+	}
+	
+	public void addMessage(int code, String msg) {
+		List<Object> message = Arrays.asList(new Object[]{code, msg}); 
+		messages.add(message);
+	}
+	
+	public void addMessage(String msg) {
+		List<Object> message = Arrays.asList(new Object[]{msg}); 
+		messages.add(message);
+	}
+	
+	public void addError(int code, String msg) {
+		List<Object> error = Arrays.asList(new Object[]{code, msg}); 
+		errors.add(error);
+	}
+	
 	public Map<String, Object> getRequestMap() {
 		return requestMap;
 	}
@@ -133,7 +158,7 @@
 		if (max != null) {
 			group.put("max", max);
 		}
-		announcements.add("Deprecated 2014-07-24: 'min' and 'max' to be supported until 3 months from deprecation date.");
+		addMessage(303, "Deprecated 2014-07-24: 'min' and 'max' to be supported until 3 months from deprecation date.");
 		return group;
 	}
 	
@@ -187,7 +212,7 @@
 			frame = "frame:contains";
 		}
 		group.put("frame", frame);
-		announcements.add("Deprecated 2014-09-22: 'frame' only to be supported until 3 months from deprecation date. " +
+		addMessage(303, "Deprecated 2014-09-22: 'frame' only to be supported until 3 months from deprecation date. " +
 				"Position frames are now expressed through 'frames'.");
 		return group;
 	}
@@ -203,13 +228,13 @@
 		if (setBySystem) {
 			group.put("class", 128+classCount);
 			group.put("classOut", 128+classCount);
-			announcements.add("A class has been introduced into the backend representation of " +
+			addMessage("A class has been introduced into the backend representation of " +
 					"your query for later reference to a part of the query. The class id is "+(128+classCount));
 		} else {
 			group.put("class", classCount);
 			group.put("classOut", classCount);
 		}
-		announcements.add("Deprecated 2014-10-07: 'class' only to be supported until 3 months from deprecation date. " +
+		addMessage(303, "Deprecated 2014-10-07: 'class' only to be supported until 3 months from deprecation date. " +
 				"Classes are now defined using the 'classOut' attribute.");
 		group.put("operands", new ArrayList<Object>());
 		return group;
@@ -227,7 +252,7 @@
 		group.put("classIn", Arrays.asList(classIn));
 		group.put("classOut", classOut);
 		group.put("class", classOut);
-		announcements.add("Deprecated 2014-10-07: 'class' only to be supported until 3 months from deprecation date. " +
+		addMessage(303, "Deprecated 2014-10-07: 'class' only to be supported until 3 months from deprecation date. " +
 				"Classes are now defined using the 'classOut' attribute.");
 		group.put("operands", new ArrayList<Object>());
 		return group;
@@ -281,7 +306,7 @@
 		if (max != null) {
 			group.put("max", max);
 		}
-		announcements.add("Deprecated 2014-07-24: 'min' and 'max' to be supported until 3 months from deprecation date.");
+		addMessage(303, "Deprecated 2014-07-24: 'min' and 'max' to be supported until 3 months from deprecation date.");
 		return group;
 	}
 	
@@ -359,7 +384,7 @@
 			number = MAXIMUM_DISTANCE; 
 			String warning = String.format("You specified a distance between two segments that is greater than " +
 					"the allowed max value of %d. Your query will be re-interpreted using a distance of %d.", MAXIMUM_DISTANCE, MAXIMUM_DISTANCE);
-			warnings.add(warning);
+			addWarning(warning);
 			log.warn("User warning: "+warning);
 		}
 		return number;
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryTree.java
index 59f4c0d..46d4b3f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CollectionQueryTree.java
@@ -224,7 +224,7 @@
 		String type = (String) term.get("type");
 		if (type == null || type.equals("type:regex")) {
 			if (!(match.equals("match:eq") || match.equals("match:ne") || match.equals("match:contains"))) {
-				errorMsgs.add("You used an inequation operator with a string value.");
+				addError(302, "You used an inequation operator with a string value.");
 				System.err.println("You used an inequation operator with a string value.");
 				return 1;
 			}
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
index 054d526..776a0e3 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/CosmasTree.java
@@ -880,7 +880,7 @@
 		posOptions.put("frames", positions);
 		posOptions.put("classRefCheck", classRefCheck);
 		posOptions.put("frame", "frame:"+frame);
-		announcements.add("Deprecated 2014-09-22: 'frame' only to be supported until 3 months from deprecation date. " +
+		addMessage(303, "Deprecated 2014-09-22: 'frame' only to be supported until 3 months from deprecation date. " +
 				"Position frames are now expressed through 'frames' and 'sharedClasses'");
 
 		if (exclnode != null) {
@@ -967,7 +967,7 @@
 		posOptions.put("frames", positions);
 		posOptions.put("classRefCheck", classRefCheck);
 		posOptions.put("frame", "frame:"+frame);
-		announcements.add("Deprecated 2014-09-22: 'frame' only to be supported until 3 months from deprecation date. " +
+		addMessage(303, "Deprecated 2014-09-22: 'frame' only to be supported until 3 months from deprecation date. " +
 				"Position frames are now expressed through 'frames' and 'sharedClasses'");
 
 		if (exclnode != null) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
index 277c147..e1092e5 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
@@ -91,7 +91,7 @@
 				quantGroup.put("boundary", makeBoundary(minmax[0], minmax[1]));
 				if (minmax[0] != null) quantGroup.put("min", minmax[0]);
 				if (minmax[1] != null) quantGroup.put("max", minmax[1]);
-				announcements.add("Deprecated 2014-07-24: 'min' and 'max' to be " +
+				addMessage(303, "Deprecated 2014-07-24: 'min' and 'max' to be " +
 						"supported until 3 months from deprecation date.");
 				putIntoSuperObject(quantGroup);
 				objectStack.push(quantGroup);
@@ -310,7 +310,7 @@
 				}
 				// only allow class id up to 127
 				if (classId > 127) {
-					warnings.add("Only class IDs up to 127 are allowed. Your class "+classId+" has been set back to 127. "
+					addWarning("Only class IDs up to 127 are allowed. Your class "+classId+" has been set back to 127. "
 							+ "Check for possible conflict with other classes.");
 					classId = 127;
 				}
@@ -338,7 +338,7 @@
 						} catch (NumberFormatException e) {
 							String err = "The specified class reference in the " +
 									"shrink/split-Operator is not a number.";
-							errorMsgs.add(err);
+							addError(302, err);
 							throw new QueryException(err);
 						}
 					}