face: consistently use the template method pattern in ProtocolFactory

Change-Id: Ied0bf02cfcdffc7e9b2c28c5452441c01f98ccbc
diff --git a/daemon/face/unix-stream-factory.cpp b/daemon/face/unix-stream-factory.cpp
index 2d8567a..211203a 100644
--- a/daemon/face/unix-stream-factory.cpp
+++ b/daemon/face/unix-stream-factory.cpp
@@ -34,20 +34,15 @@
 NFD_REGISTER_PROTOCOL_FACTORY(UnixStreamFactory);
 
 const std::string&
-UnixStreamFactory::getId()
+UnixStreamFactory::getId() noexcept
 {
   static std::string id("unix");
   return id;
 }
 
-UnixStreamFactory::UnixStreamFactory(const CtorParams& params)
-  : ProtocolFactory(params)
-{
-}
-
 void
-UnixStreamFactory::processConfig(OptionalConfigSection configSection,
-                                 FaceSystem::ConfigContext& context)
+UnixStreamFactory::doProcessConfig(OptionalConfigSection configSection,
+                                   FaceSystem::ConfigContext& context)
 {
   // unix
   // {
@@ -58,7 +53,7 @@
 
   if (!configSection) {
     if (!context.isDryRun && !m_channels.empty()) {
-      NFD_LOG_WARN("Cannot disable unix channel after initialization");
+      NFD_LOG_WARN("Cannot disable Unix channel after initialization");
     }
     return;
   }
@@ -77,20 +72,14 @@
     }
   }
 
-  if (!context.isDryRun) {
-    auto channel = this->createChannel(path);
-    if (!channel->isListening()) {
-      channel->listen(this->addFace, nullptr);
-    }
+  if (context.isDryRun) {
+    return;
   }
-}
 
-void
-UnixStreamFactory::createFace(const CreateFaceRequest& req,
-                              const FaceCreatedCallback& onCreated,
-                              const FaceCreationFailedCallback& onFailure)
-{
-  onFailure(406, "Unsupported protocol");
+  auto channel = this->createChannel(path);
+  if (!channel->isListening()) {
+    channel->listen(this->addFace, nullptr);
+  }
 }
 
 shared_ptr<UnixStreamChannel>
@@ -100,30 +89,20 @@
   p = boost::filesystem::canonical(p.parent_path()) / p.filename();
   unix_stream::Endpoint endpoint(p.string());
 
-  auto channel = findChannel(endpoint);
-  if (channel)
-    return channel;
+  auto it = m_channels.find(endpoint);
+  if (it != m_channels.end())
+    return it->second;
 
-  channel = make_shared<UnixStreamChannel>(endpoint, m_wantCongestionMarking);
+  auto channel = make_shared<UnixStreamChannel>(endpoint, m_wantCongestionMarking);
   m_channels[endpoint] = channel;
   return channel;
 }
 
 std::vector<shared_ptr<const Channel>>
-UnixStreamFactory::getChannels() const
+UnixStreamFactory::doGetChannels() const
 {
   return getChannelsFromMap(m_channels);
 }
 
-shared_ptr<UnixStreamChannel>
-UnixStreamFactory::findChannel(const unix_stream::Endpoint& endpoint) const
-{
-  auto i = m_channels.find(endpoint);
-  if (i != m_channels.end())
-    return i->second;
-  else
-    return nullptr;
-}
-
 } // namespace face
 } // namespace nfd