catalog: initial query module
Change-Id: I0ddd22c5774d5e5d54c1ee80e0f01566fed311fd
refs: #2638
diff --git a/catalog/src/main.cpp b/catalog/src/main.cpp
index 6e2fae1..3f199ee 100644
--- a/catalog/src/main.cpp
+++ b/catalog/src/main.cpp
@@ -1,44 +1,51 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
-/*
- * Copyright (c) 2015, Colorado State University.
+/** NDN-Atmos: Cataloging Service for distributed data originally developed
+ * for atmospheric science data
+ * Copyright (C) 2015 Colorado State University
*
- * This file is part of ndn-atmos.
+ * NDN-Atmos is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * ndn-atmos is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
+ * NDN-Atmos is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * ndn-atmos is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-atmos, e.g., in COPYING.md file. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-atmos authors and contributors.
- */
+ * You should have received a copy of the GNU General Public License
+ * along with NDN-Atmos. If not, see <http://www.gnu.org/licenses/>.
+**/
+
+#include "catalog/catalog.hpp"
+#include "util/mysql-util.hpp"
#include <ChronoSync/socket.hpp>
-#include <ndn-cxx/face.hpp>
-#include <json/value.h>
-#include <mysql.h>
-using namespace std;
-using namespace ndn;
+#include <ndn-cxx/data.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/interest.hpp>
+#include <ndn-cxx/name.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+
+#include "mysql/mysql.h"
+
+#include <memory>
int main()
{
- Face face; // use ndn-cxx
- shared_ptr<chronosync::Socket> socket; // use ChronoSync
+ std::shared_ptr<chronosync::Socket> socket; // use ChronoSync
+ std::shared_ptr<ndn::Face> face(new ndn::Face());
+ std::shared_ptr<ndn::KeyChain> keyChain(new ndn::KeyChain());
- Json::Value root; // use jsoncpp
- MYSQL *con = mysql_init(NULL);
- if (con == NULL)
- {
- fprintf(stderr, "%s\n", mysql_error(con));
- return 1;
- }
+ // This should be unique to each instance
+ ndn::Name aName("/catalog/myUniqueName");
+
+ atmos::util::ConnectionDetails mysqlID("atmos-den.es.net", "testuser", "test623", "testdb");
+ std::shared_ptr<MYSQL> conn;
+ conn = atmos::util::MySQLConnectionSetup(mysqlID);
+
+ atmos::catalog::Catalog<MYSQL> catalog(face, keyChain, conn, aName);
+ face->processEvents();
return 0;
}