Switch from NDNx to CCNx

Change-Id: Icc2e6dd95d9c4e0ba22b7efb9933c1db7194842e
diff --git a/src/state-server.cc b/src/state-server.cc
index 2d1d96a..418f8da 100644
--- a/src/state-server.cc
+++ b/src/state-server.cc
@@ -31,17 +31,17 @@
 
 INIT_LOGGER ("StateServer");
 
-using namespace Ccnx;
+using namespace Ndnx;
 using namespace std;
 using namespace boost;
 
-StateServer::StateServer(CcnxWrapperPtr ccnx, ActionLogPtr actionLog,
+StateServer::StateServer(NdnxWrapperPtr ndnx, ActionLogPtr actionLog,
                          const boost::filesystem::path &rootDir,
-                         const Ccnx::Name &userName, const std::string &sharedFolderName,
+                         const Ndnx::Name &userName, const std::string &sharedFolderName,
                          const std::string &appName,
                          ObjectManager &objectManager,
                          int freshness/* = -1*/)
-  : m_ccnx(ccnx)
+  : m_ndnx(ndnx)
   , m_actionLog(actionLog)
   , m_objectManager (objectManager)
   , m_rootDir(rootDir)
@@ -78,28 +78,28 @@
   // will be extended to support all planned commands later
 
   // <PREFIX_INFO>/"actions"/"all"/<segment>  get list of all actions
-  m_ccnx->setInterestFilter (Name (m_PREFIX_INFO)("actions")("folder"), bind(&StateServer::info_actions_folder, this, _1));
-  m_ccnx->setInterestFilter (Name (m_PREFIX_INFO)("actions")("file"),   bind(&StateServer::info_actions_file, this, _1));
+  m_ndnx->setInterestFilter (Name (m_PREFIX_INFO)("actions")("folder"), bind(&StateServer::info_actions_folder, this, _1));
+  m_ndnx->setInterestFilter (Name (m_PREFIX_INFO)("actions")("file"),   bind(&StateServer::info_actions_file, this, _1));
 
   // <PREFIX_INFO>/"filestate"/"all"/<segment>
-  m_ccnx->setInterestFilter (Name (m_PREFIX_INFO)("files")("folder"), bind(&StateServer::info_files_folder, this, _1));
+  m_ndnx->setInterestFilter (Name (m_PREFIX_INFO)("files")("folder"), bind(&StateServer::info_files_folder, this, _1));
 
   // <PREFIX_CMD>/"restore"/"file"/<one-component-relative-file-name>/<version>/<file-hash>
-  m_ccnx->setInterestFilter (Name (m_PREFIX_CMD)("restore")("file"), bind(&StateServer::cmd_restore_file, this, _1));
+  m_ndnx->setInterestFilter (Name (m_PREFIX_CMD)("restore")("file"), bind(&StateServer::cmd_restore_file, this, _1));
 }
 
 void
 StateServer::deregisterPrefixes ()
 {
-  m_ccnx->clearInterestFilter (Name (m_PREFIX_INFO)("actions")("folder"));
-  m_ccnx->clearInterestFilter (Name (m_PREFIX_INFO)("actions")("file"));
-  m_ccnx->clearInterestFilter (Name (m_PREFIX_INFO)("files")("folder"));
-  m_ccnx->clearInterestFilter (Name (m_PREFIX_CMD) ("restore")("file"));
+  m_ndnx->clearInterestFilter (Name (m_PREFIX_INFO)("actions")("folder"));
+  m_ndnx->clearInterestFilter (Name (m_PREFIX_INFO)("actions")("file"));
+  m_ndnx->clearInterestFilter (Name (m_PREFIX_INFO)("files")("folder"));
+  m_ndnx->clearInterestFilter (Name (m_PREFIX_CMD) ("restore")("file"));
 }
 
 void
 StateServer::formatActionJson (json_spirit::Array &actions,
-                               const Ccnx::Name &name, sqlite3_int64 seq_no, const ActionItem &action)
+                               const Ndnx::Name &name, sqlite3_int64 seq_no, const ActionItem &action)
 {
 /*
  *      {
@@ -161,7 +161,7 @@
   if (action.has_parent_device_name ())
     {
       Object parentId;
-      Ccnx::Name parent_device_name (action.parent_device_name ().c_str (), action.parent_device_name ().size ());
+      Ndnx::Name parent_device_name (action.parent_device_name ().c_str (), action.parent_device_name ().size ());
       id.push_back (Pair ("userName", boost::lexical_cast<string> (parent_device_name)));
       id.push_back (Pair ("seqNo",    action.parent_seq_no ()));
 
@@ -201,7 +201,7 @@
 
 
 void
-StateServer::info_actions_fileOrFolder_Execute (const Ccnx::Name &interest, bool isFolder/* = true*/)
+StateServer::info_actions_fileOrFolder_Execute (const Ndnx::Name &interest, bool isFolder/* = true*/)
 {
   // <PREFIX_INFO>/"actions"/"folder|file"/<folder|file>/<offset>  get list of all actions
 
@@ -250,18 +250,18 @@
       if (more)
         {
           json.push_back (Pair ("more", lexical_cast<string> (offset + 1)));
-          // Ccnx::Name more = Name (interest.getPartialName (0, interest.size () - 1))(offset + 1);
+          // Ndnx::Name more = Name (interest.getPartialName (0, interest.size () - 1))(offset + 1);
           // json.push_back (Pair ("more", lexical_cast<string> (more)));
         }
 
       ostringstream os;
       write_stream (Value (json), os, pretty_print | raw_utf8);
-      m_ccnx->publishData (interest, os.str (), 1);
+      m_ndnx->publishData (interest, os.str (), 1);
     }
-  catch (Ccnx::NameException &ne)
+  catch (Ndnx::NameException &ne)
     {
       // ignore any unexpected interests and errors
-      _LOG_ERROR (*boost::get_error_info<Ccnx::error_info_str>(ne));
+      _LOG_ERROR (*boost::get_error_info<Ndnx::error_info_str>(ne));
     }
 }
 
@@ -298,7 +298,7 @@
   json.push_back (Pair ("version",   file.version ()));
   {
     Object owner;
-    Ccnx::Name device_name (file.device_name ().c_str (), file.device_name ().size ());
+    Ndnx::Name device_name (file.device_name ().c_str (), file.device_name ().size ());
     owner.push_back (Pair ("userName", boost::lexical_cast<string> (device_name)));
     owner.push_back (Pair ("seqNo",    file.seq_no ()));
 
@@ -323,7 +323,7 @@
 }
 
 void
-StateServer::info_files_folder (const Ccnx::Name &interest)
+StateServer::info_files_folder (const Ndnx::Name &interest)
 {
   if (interest.size () - m_PREFIX_INFO.size () != 3 &&
       interest.size () - m_PREFIX_INFO.size () != 4)
@@ -338,7 +338,7 @@
 
 
 void
-StateServer::info_files_folder_Execute (const Ccnx::Name &interest)
+StateServer::info_files_folder_Execute (const Ndnx::Name &interest)
 {
   // <PREFIX_INFO>/"filestate"/"folder"/<one-component-relative-folder-name>/<offset>
   try
@@ -379,24 +379,24 @@
       if (more)
         {
           json.push_back (Pair ("more", lexical_cast<string> (offset + 1)));
-          // Ccnx::Name more = Name (interest.getPartialName (0, interest.size () - 1))(offset + 1);
+          // Ndnx::Name more = Name (interest.getPartialName (0, interest.size () - 1))(offset + 1);
           // json.push_back (Pair ("more", lexical_cast<string> (more)));
         }
 
       ostringstream os;
       write_stream (Value (json), os, pretty_print | raw_utf8);
-      m_ccnx->publishData (interest, os.str (), 1);
+      m_ndnx->publishData (interest, os.str (), 1);
     }
-  catch (Ccnx::NameException &ne)
+  catch (Ndnx::NameException &ne)
     {
       // ignore any unexpected interests and errors
-      _LOG_ERROR (*boost::get_error_info<Ccnx::error_info_str>(ne));
+      _LOG_ERROR (*boost::get_error_info<Ndnx::error_info_str>(ne));
     }
 }
 
 
 void
-StateServer::cmd_restore_file (const Ccnx::Name &interest)
+StateServer::cmd_restore_file (const Ndnx::Name &interest)
 {
   if (interest.size () - m_PREFIX_CMD.size () != 4 &&
       interest.size () - m_PREFIX_CMD.size () != 5)
@@ -410,7 +410,7 @@
 }
 
 void
-StateServer::cmd_restore_file_Execute (const Ccnx::Name &interest)
+StateServer::cmd_restore_file_Execute (const Ndnx::Name &interest)
 {
   // <PREFIX_CMD>/"restore"/"file"/<one-component-relative-file-name>/<version>/<file-hash>
 
@@ -446,7 +446,7 @@
 
       if (!file)
         {
-          m_ccnx->publishData (interest, "FAIL: Requested file is not found", 1);
+          m_ndnx->publishData (interest, "FAIL: Requested file is not found", 1);
           return;
         }
 
@@ -468,14 +468,14 @@
 #endif
               *Hash::FromFileContent (filePath) == hash)
             {
-              m_ccnx->publishData (interest, "OK: File already exists", 1);
+              m_ndnx->publishData (interest, "OK: File already exists", 1);
               _LOG_DEBUG ("Asking to assemble a file, but file already exists on a filesystem");
               return;
             }
         }
       catch (filesystem::filesystem_error &error)
         {
-          m_ccnx->publishData (interest, "FAIL: File operation failed", 1);
+          m_ndnx->publishData (interest, "FAIL: File operation failed", 1);
           _LOG_ERROR ("File operations failed on [" << filePath << "] (ignoring)");
         }
 
@@ -486,16 +486,16 @@
 #if BOOST_VERSION >= 104900
           permissions (filePath, static_cast<filesystem::perms> (file->mode ()));
 #endif
-          m_ccnx->publishData (interest, "OK", 1);
+          m_ndnx->publishData (interest, "OK", 1);
         }
       else
         {
-          m_ccnx->publishData (interest, "FAIL: Unknown error while restoring file", 1);
+          m_ndnx->publishData (interest, "FAIL: Unknown error while restoring file", 1);
         }
     }
-  catch (Ccnx::NameException &ne)
+  catch (Ndnx::NameException &ne)
     {
       // ignore any unexpected interests and errors
-      _LOG_ERROR(*boost::get_error_info<Ccnx::error_info_str>(ne));
+      _LOG_ERROR(*boost::get_error_info<Ndnx::error_info_str>(ne));
     }
 }