From cfdd5c02bd64f3ffcd15705d8ba45218131b3095 Mon Sep 17 00:00:00 2001
From: Steven Murray <Steven.Murray@cern.ch>
Date: Tue, 13 Feb 2018 20:50:41 +0100
Subject: [PATCH] Added dummy RequestMessage::processOPENW() method

---
 xroot_plugins/XrdSsiCtaRequestMessage.cpp | 29 +++++++++++++++++++++++
 xroot_plugins/XrdSsiCtaRequestMessage.hpp |  1 +
 2 files changed, 30 insertions(+)

diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.cpp b/xroot_plugins/XrdSsiCtaRequestMessage.cpp
index f73efbfebc..f752af569a 100644
--- a/xroot_plugins/XrdSsiCtaRequestMessage.cpp
+++ b/xroot_plugins/XrdSsiCtaRequestMessage.cpp
@@ -289,6 +289,9 @@ void RequestMessage::process(const cta::xrd::Request &request, cta::xrd::Respons
          switch(request.notification().wf().event()) {
             using namespace cta::eos;
 
+            case Workflow::OPENW:
+               processOPENW (request.notification(), response);
+               break;
             case Workflow::CLOSEW:
                processCLOSEW (request.notification(), response);
                break;
@@ -319,6 +322,32 @@ void RequestMessage::process(const cta::xrd::Request &request, cta::xrd::Respons
 
 // EOS Workflow commands
 
+void RequestMessage::processOPENW(const cta::eos::Notification &notification, cta::xrd::Response &response)
+{
+   // Unpack message
+
+   cta::common::dataStructures::UserIdentity originator;
+   originator.name          = notification.cli().user().username();
+   originator.group         = notification.cli().user().groupname();
+
+   cta::utils::Timer t;
+
+   const std::string storageClass = notification.file().xattr().at("CTA_StorageClass");
+   // uint64_t archiveFileId = m_catalogue.checkAndGetNextArchiveFileId(m_cliIdentity.username, storageClass, originator);
+
+   // Create a log entry
+
+   cta::log::ScopedParamContainer params(m_lc);
+   //params.add("fileId", archiveFileId).add("catalogueTime", t.secs());
+   m_lc.log(cta::log::INFO, "In processOPENW(): getting new archive file ID.");
+
+   // response.mutable_xattr()->insert(google::protobuf::MapPair<std::string,std::string>("CTA_ArchiveFileId", std::to_string(archiveFileId)));
+
+   // Set response type
+
+   response.set_type(cta::xrd::Response::RSP_SUCCESS);
+}
+
 void RequestMessage::processCLOSEW(const cta::eos::Notification &notification, cta::xrd::Response &response)
 {
    // Unpack message
diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.hpp b/xroot_plugins/XrdSsiCtaRequestMessage.hpp
index d005b0e573..b5936035cf 100644
--- a/xroot_plugins/XrdSsiCtaRequestMessage.hpp
+++ b/xroot_plugins/XrdSsiCtaRequestMessage.hpp
@@ -63,6 +63,7 @@ private:
     */
    typedef void notification_event_t(const cta::eos::Notification &notification, cta::xrd::Response &response);
 
+   notification_event_t processOPENW;        //!< New archive file ID event
    notification_event_t processCLOSEW;       //!< Archive file event
    notification_event_t processPREPARE;      //!< Retrieve file event
    notification_event_t processDELETE;       //!< Delete file event
-- 
GitLab