catalog: implement catalog driver and facade

This commit also refactories the QueryAdapter's code, adds corresponding
unit-test. Catalog-adapter and catalog do not use template, so the definition
are moved to corresponding cpp files.

refs: #2599, #2600

Change-Id: I2be492ec3c2538e865bfa7c09ac8cd49e2a9527d
diff --git a/client/query/query.html b/client/query/query.html
index 9e68518..08fe6f5 100644
--- a/client/query/query.html
+++ b/client/query/query.html
@@ -77,7 +77,6 @@
         function query(prefix, parameters, callback, pipeline) {
             results = [];
             dropdown = [];
-
             var resultTable = $(".resultTable");
             resultTable.empty();
             resultTable.append('<tr><td>Results</td></tr>');
@@ -85,6 +84,7 @@
             var queryPrefix = new Name(prefix);
             queryPrefix.append("query");
 
+            var jsonString = JSON.stringify(parameters);
             queryPrefix.append(JSON.stringify(parameters));
 
             state = {
@@ -139,11 +139,10 @@
         function onQueryResultsData(interest, data) {
             var name = data.getName();
             delete state["outstanding"][interest.getName().toUri()];
-
-            if (!name.get(-1).equals(new Name.Component("END"))) {
+            if (!name.get(-1).equals(data.getMetaInfo().getFinalBlockId())) {
                 expressNextInterest();
             } else {
-                alert("found final block");
+                //alert("found final block");
             }
 
             state["userOnData"](data);