diff --git a/.cppcheck-suppressions.txt b/.cppcheck-suppressions.txt
index beb025d21971d5e591d31d153be03fa5ea01ad16..255269d17751d50a668168769361a3fe0d3bc55c 100644
--- a/.cppcheck-suppressions.txt
+++ b/.cppcheck-suppressions.txt
@@ -3,3 +3,4 @@ syntaxError:*Tests.cpp
 localMutex:common/threading/MutexLtrace.cpp
 unknownMacro:tapeserver/castor/tape/tapeserver/file/FileTest.cpp
 nullPointer:common/utils/utils.cpp
+uninitStructMember:objectstore/RetrieveRequest.cpp
\ No newline at end of file
diff --git a/catalogue/CMakeLists.txt b/catalogue/CMakeLists.txt
index b088783d95ddd60f5fe25bb572e6ba801ec5ad49..50fb86782fcbd4260a84b062be1e6c142e81663f 100644
--- a/catalogue/CMakeLists.txt
+++ b/catalogue/CMakeLists.txt
@@ -40,27 +40,29 @@ set (CATALOGUE_LIB_SRC_FILES
   Catalogue.cpp
   CatalogueFactory.cpp
   CatalogueFactoryFactory.cpp
+  CatalogueRetryWrapper.cpp
   CatalogueSchema.cpp
   CmdLineTool.cpp
   DriveConfig.cpp
+  DummyCatalogue.cpp
   InMemoryCatalogue.cpp
   InMemoryCatalogueFactory.cpp
   PostgresCatalogue.cpp
   PostgresqlCatalogueFactory.cpp
-  SqliteCatalogueSchema.cpp
-  TapeFileWritten.cpp
-  TapeItemImplementation.cpp
-  TapePool.cpp
   RdbmsCatalogue.cpp
   RdbmsCatalogueGetArchiveFilesForRepackItor.cpp
   RdbmsCatalogueGetArchiveFilesItor.cpp
-  RdbmsCatalogueTapeContentsItor.cpp
   RdbmsCatalogueGetFileRecycleLogItor.cpp
+  RdbmsCatalogueTapeContentsItor.cpp
   SchemaCreatingSqliteCatalogue.cpp
-  TapeDrivesCatalogueState.cpp
-  SqliteCatalogue.cpp
   SchemaVersion.cpp
+  SqliteCatalogue.cpp
+  SqliteCatalogueSchema.cpp
+  TapeDrivesCatalogueState.cpp
+  TapeFileWritten.cpp
   TapeForWriting.cpp
+  TapeItemImplementation.cpp
+  TapePool.cpp
 )
 
 if (OCCI_SUPPORT)
diff --git a/catalogue/Catalogue.hpp b/catalogue/Catalogue.hpp
index be6c5e83fe0e468a5b511464f58973b988cebe49..bb6b296c351c27a16cd31b458f4240e82cdb005a 100644
--- a/catalogue/Catalogue.hpp
+++ b/catalogue/Catalogue.hpp
@@ -17,89 +17,76 @@
 
 #pragma once
 
-#include "catalogue/CatalogueItor.hpp"
-#include "catalogue/CreateTapeAttributes.hpp"
-#include "catalogue/MediaType.hpp"
-#include "catalogue/MediaTypeWithLogs.hpp"
-#include "catalogue/SchemaVersion.hpp"
-#include "catalogue/TapeFileSearchCriteria.hpp"
-#include "catalogue/TapeItemWrittenPointer.hpp"
-#include "catalogue/TapeFileWritten.hpp"
-#include "catalogue/TapeForWriting.hpp"
-#include "catalogue/TapePool.hpp"
-#include "catalogue/TapeSearchCriteria.hpp"
-#include "common/dataStructures/AdminUser.hpp"
-#include "common/dataStructures/ArchiveFile.hpp"
-#include "common/dataStructures/ArchiveFileQueueCriteria.hpp"
-#include "common/dataStructures/ArchiveFileQueueCriteriaAndFileId.hpp"
-#include "common/dataStructures/ArchiveFileSummary.hpp"
-#include "common/dataStructures/ArchiveJob.hpp"
-#include "common/dataStructures/ArchiveRoute.hpp"
-#include "common/dataStructures/CancelRetrieveRequest.hpp"
-#include "common/dataStructures/DiskSpaceReservationRequest.hpp"
-#include "common/dataStructures/DeleteArchiveRequest.hpp"
-#include "common/dataStructures/DiskFileInfo.hpp"
-#include "common/dataStructures/DiskInstance.hpp"
-#include "common/dataStructures/DiskInstanceSpace.hpp"
-#include "common/dataStructures/DriveState.hpp"
-#include "common/dataStructures/FileRecycleLog.hpp"
-#include "common/dataStructures/EntryLog.hpp"
-#include "common/dataStructures/ListStorageClassRequest.hpp"
-#include "common/dataStructures/LogicalLibrary.hpp"
-#include "common/dataStructures/MountType.hpp"
-#include "common/dataStructures/MountPolicy.hpp"
-#include "common/dataStructures/ReadTestResult.hpp"
-#include "common/dataStructures/RequesterGroupMountRule.hpp"
-#include "common/dataStructures/RequesterMountRule.hpp"
-#include "common/dataStructures/RequesterActivityMountRule.hpp"
-#include "common/dataStructures/RetrieveFileQueueCriteria.hpp"
-#include "common/dataStructures/RetrieveJob.hpp"
-#include "common/dataStructures/RetrieveRequest.hpp"
-#include "common/dataStructures/SecurityIdentity.hpp"
-#include "common/dataStructures/StorageClass.hpp"
-#include "common/dataStructures/Tape.hpp"
-#include "common/dataStructures/TapeCopyToPoolMap.hpp"
-#include "common/dataStructures/TapeDrive.hpp"
-#include "common/dataStructures/TapeDriveStatistics.hpp"
-#include "common/dataStructures/TapeFile.hpp"
-#include "common/dataStructures/RequesterIdentity.hpp"
-#include "common/dataStructures/VirtualOrganization.hpp"
-#include "common/dataStructures/VidToTapeMap.hpp"
-#include "common/dataStructures/WriteTestResult.hpp"
-#include "common/exception/FileSizeMismatch.hpp"
-#include "common/exception/TapeFseqMismatch.hpp"
-#include "common/exception/UserError.hpp"
-#include "common/exception/UserErrorWithCacheInfo.hpp"
-#include "common/log/LogContext.hpp"
-#include "common/log/Logger.hpp"
-#include "disk/DiskSystem.hpp"
-#include "RecyleTapeFileSearchCriteria.hpp"
-#include "CreateMountPolicyAttributes.hpp"
-#include "TapePoolSearchCriteria.hpp"
-
 #include <list>
 #include <map>
 #include <memory>
 #include <optional>
 #include <set>
-#include <stdint.h>
 #include <string>
+#include <tuple>
+#include <utility>
+
+#include "catalogue/RecyleTapeFileSearchCriteria.hpp"
+#include "catalogue/TapeFileSearchCriteria.hpp"
+#include "catalogue/TapePoolSearchCriteria.hpp"
+#include "catalogue/TapeSearchCriteria.hpp"
+#include "common/dataStructures/DiskSpaceReservationRequest.hpp"
+#include "common/dataStructures/VidToTapeMap.hpp"
+#include "common/exception/UserError.hpp"
 
 namespace cta {
-namespace disk {
+namespace common {
+namespace dataStructures {
+struct AdminUser;
+struct ArchiveFile;
+struct ArchiveFileQueueCriteria;
+struct ArchiveFileSummary;
+struct ArchiveRoute;
+struct DeleteArchiveRequest;
+struct DesiredDriveState;
+struct DiskInstance;
+struct DiskInstanceSpace;
+struct DriveState;
+struct FileRecycleLog;
+struct LogicalLibrary;
+struct MountPolicy;
+struct RequesterActivityMountRule;
+struct RequesterGroupMountRule;
+struct RequesterIdentity;
+struct RequesterMountRule;
+struct RetrieveFileQueueCriteria;
+struct SecurityIdentity;
+struct StorageClass;
+struct Tape;
+struct TapeDrive;
+struct TapeDriveStatistics;
+struct TapeFile;
+struct VirtualOrganization;
+}  // namespace dataStructures
+}  // namespace common
 
-/**
- * Forward declaration.
- */
+namespace disk {
+class DiskSystem;
 class DiskSystemList;
+}
 
-} // namespace disk
-} // namespace cta
+namespace log {
+class LogContext;
+}
 
+namespace catalogue {
 
-namespace cta {
+template <typename Item>
+class CatalogueItor;
 
-namespace catalogue {
+struct CreateMountPolicyAttributes;
+struct CreateTapeAttributes;
+struct MediaType;
+struct MediaTypeWithLogs;
+struct SchemaVersion;
+struct TapeForWriting;
+struct TapeItemWrittenPointer;
+struct TapePool;
 
 CTA_GENERATE_EXCEPTION_CLASS(CommentOrReasonWithMoreSizeThanMaximunAllowed);
 CTA_GENERATE_EXCEPTION_CLASS(NegativeDiskSpaceReservationReached);
@@ -155,7 +142,6 @@ CTA_GENERATE_USER_EXCEPTION_CLASS(UserSpecifiedTapePoolUsedInAnArchiveRoute);
  */
 class Catalogue {
 public:
-
   /**
    * Destructor.
    */
@@ -245,7 +231,7 @@ public:
    * @param vid The volume identifier of the tape.
    * @param drive The name of the drive where the tape was mounted.
    */
-  virtual void tapeMountedForArchive(const std::string &vid, const std::string &drive) = 0; // internal function (noCLI)
+  virtual void tapeMountedForArchive(const std::string &vid, const std::string &drive) = 0;  // internal function (noCLI)
 
   /**
    * Prepares for a file retrieval by returning the information required to
@@ -282,7 +268,7 @@ public:
    * @param vid The volume identifier of the tape.
    * @param drive The name of the drive where the tape was mounted.
    */
-  virtual void tapeMountedForRetrieve(const std::string &vid, const std::string &drive) = 0; // internal function (noCLI)
+  virtual void tapeMountedForRetrieve(const std::string &vid, const std::string &drive) = 0;  // internal function (noCLI)
 
   /**
    * This method notifies the CTA catalogue that there is no more free space on
@@ -685,7 +671,7 @@ public:
    * This method will throw an exception if the specified tape is not FULL.
    *
    * This method will throw an exception if there is still at least one tape
-   * file recorded in the cataligue as being on the specified tape.
+   * file recorded in the catalogue as being on the specified tape.
    *
    * @param admin The administrator.
    * @param vid The volume identifier of the tape to be reclaimed.
@@ -708,7 +694,7 @@ public:
    * @param vid the vid in which we will the number of files
    * @return the number of files on the tape
    */
-  virtual uint64_t getNbFilesOnTape(const std::string &vid) const = 0 ;
+  virtual uint64_t getNbFilesOnTape(const std::string &vid) const = 0;
 
   virtual void modifyTapeMediaType(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &mediaType) = 0;
   virtual void modifyTapeVendor(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &vendor) = 0;
@@ -724,7 +710,7 @@ public:
    * @param state the new state
    * @param stateReason the reason why the state changes, if the state is ACTIVE and the stateReason is std::nullopt, the state will be reset to null
    */
-  virtual void modifyTapeState(const common::dataStructures::SecurityIdentity &admin,const std::string &vid, const common::dataStructures::Tape::State & state, const std::optional<std::string> & stateReason) = 0;
+  virtual void modifyTapeState(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const common::dataStructures::Tape::State & state, const std::optional<std::string> & stateReason) = 0;
   /**
    * Sets the full status of the specified tape.
    *
@@ -777,7 +763,7 @@ public:
   virtual void modifyRequesterGroupMountRulePolicy(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterGroupName, const std::string &mountPolicy) = 0;
   virtual void modifyRequesterGroupMountRuleComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterGroupName, const std::string &comment) = 0;
 
-   virtual void createMountPolicy(const common::dataStructures::SecurityIdentity &admin, const CreateMountPolicyAttributes & mountPolicy) = 0;
+  virtual void createMountPolicy(const common::dataStructures::SecurityIdentity &admin, const CreateMountPolicyAttributes & mountPolicy) = 0;
 
   /**
    * Returns the list of all existing mount policies.
@@ -1038,8 +1024,8 @@ public:
     const std::string &name, const std::string &diskInstance, const std::string &comment) = 0;
   virtual void modifyDiskInstanceSpaceRefreshInterval(const common::dataStructures::SecurityIdentity &admin,
     const std::string &name, const std::string &diskInstance, const uint64_t refreshInterval) = 0;
-  virtual void modifyDiskInstanceSpaceFreeSpace(const std::string &name, 
-    const std::string &diskInstance, const uint64_t freeSpace) = 0;  
+  virtual void modifyDiskInstanceSpaceFreeSpace(const std::string &name,
+    const std::string &diskInstance, const uint64_t freeSpace) = 0;
   virtual void modifyDiskInstanceSpaceQueryURL(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance,
     const std::string &freeSpaceQueryURL) = 0;
 
@@ -1395,7 +1381,7 @@ public:
    * @param keyName The key of the parameter.
    * @return Returns the category, value and source of a parameter of the configuarion
    */
-  virtual std::optional<std::tuple<std::string, std::string, std::string>> getTapeDriveConfig( const std::string &tapeDriveName,
+  virtual std::optional<std::tuple<std::string, std::string, std::string>> getTapeDriveConfig(const std::string &tapeDriveName,
     const std::string &keyName) const = 0;
 
   /**
@@ -1420,9 +1406,7 @@ public:
    * If the amount released exceeds the current reservation, the reservation will be reduced to zero.
    */
   virtual void releaseDiskSpace(const std::string& driveName, const uint64_t mountId, const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) = 0;
+};  // class Catalogue
 
-
-}; // class Catalogue
-
-} // namespace catalogue
-} // namespace cta
+}  // namespace catalogue
+}  // namespace cta
diff --git a/catalogue/CatalogueFactory.hpp b/catalogue/CatalogueFactory.hpp
index 8bf21bcbb59b1ed11c8a7c98ac2f4ba88efd2c1a..bb0efd43ca64b41b136dd92c1ca6ce43792ec556 100644
--- a/catalogue/CatalogueFactory.hpp
+++ b/catalogue/CatalogueFactory.hpp
@@ -17,19 +17,18 @@
 
 #pragma once
 
-#include "catalogue/Catalogue.hpp"
-
 #include <memory>
 
 namespace cta {
 namespace catalogue {
 
+class Catalogue;
+
 /**
  * Specifies the interface to a factory Catalogue objects.
  */
 class CatalogueFactory {
 public:
-
   /**
    * Destructor.
    */
@@ -39,8 +38,7 @@ public:
    * Returns a newly created CTA catalogue object.
    */
   virtual std::unique_ptr<Catalogue> create() = 0;
+};  // class CatalogueFactory
 
-}; // class CatalogueFactory
-
-} // namespace catalogue
-} // namespace cta
+}  // namespace catalogue
+}  // namespace cta
diff --git a/catalogue/CatalogueFactoryFactory.cpp b/catalogue/CatalogueFactoryFactory.cpp
index 8e44be05717fa805df7cafa958f1e2df208ee00f..d13e8a4a0132c0e01a14e5805bb1362bc092ea01 100644
--- a/catalogue/CatalogueFactoryFactory.cpp
+++ b/catalogue/CatalogueFactoryFactory.cpp
@@ -20,6 +20,8 @@
 #include "catalogue/CatalogueFactoryFactory.hpp"
 #include "catalogue/InMemoryCatalogueFactory.hpp"
 #include "catalogue/PostgresqlCatalogueFactory.hpp"
+#include "common/exception/Exception.hpp"
+#include "common/log/Logger.hpp"
 
 #ifdef SUPPORT_OCCI
   #include "catalogue/OracleCatalogueFactory.hpp"
diff --git a/catalogue/CatalogueFactoryFactory.hpp b/catalogue/CatalogueFactoryFactory.hpp
index 97c1c6ce37bf8749fba43750fe98be76f1ff8b38..5d646b4807f0acf3946bc755e56050b00d640a4f 100644
--- a/catalogue/CatalogueFactoryFactory.hpp
+++ b/catalogue/CatalogueFactoryFactory.hpp
@@ -17,20 +17,27 @@
 
 #pragma once
 
-#include "catalogue/CatalogueFactory.hpp"
-#include "rdbms/Login.hpp"
-
 #include <memory>
 
 namespace cta {
+
+namespace log {
+class Logger;
+}
+
+namespace rdbms {
+class Login;
+}
+
 namespace catalogue {
 
+class CatalogueFactory;
+
 /**
  * Factory of catalogue factories.  This class is a singleton.
  */
 class CatalogueFactoryFactory {
 public:
-
   /**
    * Prevent objects of this class from being instantiated.
    */
@@ -60,8 +67,7 @@ public:
     const uint64_t nbConns,
     const uint64_t nbArchiveFileListingConns,
     const uint32_t maxTriesToConnect = 3);
+};  // class CatalogueFactoryFactory
 
-}; // class CatalogueFactoryFactory
-
-} // namespace catalogue
-} // namespace cta
+}  // namespace catalogue
+}  // namespace cta
diff --git a/catalogue/CatalogueRetryWrapper.cpp b/catalogue/CatalogueRetryWrapper.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f2c009281427dda6f5a26f15405773680e0b42c1
--- /dev/null
+++ b/catalogue/CatalogueRetryWrapper.cpp
@@ -0,0 +1,767 @@
+/*
+ * @project      The CERN Tape Archive (CTA)
+ * @copyright    Copyright © 2021-2022 CERN
+ * @license      This program is free software, distributed under the terms of the GNU General Public
+ *               Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". You can
+ *               redistribute it and/or modify it under the terms of the GPL Version 3, or (at your
+ *               option) any later version.
+ *
+ *               This program 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.
+ *
+ *               In applying this licence, CERN does not waive the privileges and immunities
+ *               granted to it by virtue of its status as an Intergovernmental Organization or
+ *               submit itself to any jurisdiction.
+ */
+
+#include <memory>
+
+#include "catalogue/CatalogueItor.hpp"
+#include "catalogue/CatalogueRetryWrapper.hpp"
+#include "catalogue/MediaType.hpp"
+#include "catalogue/MediaTypeWithLogs.hpp"
+#include "catalogue/retryOnLostConnection.hpp"
+#include "catalogue/SchemaVersion.hpp"
+#include "catalogue/TapeForWriting.hpp"
+#include "catalogue/TapePool.hpp"
+#include "common/dataStructures/AdminUser.hpp"
+#include "common/dataStructures/ArchiveFileQueueCriteria.hpp"
+#include "common/dataStructures/ArchiveFileSummary.hpp"
+#include "common/dataStructures/ArchiveRoute.hpp"
+#include "common/dataStructures/DiskInstance.hpp"
+#include "common/dataStructures/LogicalLibrary.hpp"
+#include "common/dataStructures/RequesterActivityMountRule.hpp"
+#include "common/dataStructures/RequesterGroupMountRule.hpp"
+#include "common/dataStructures/RequesterMountRule.hpp"
+#include "common/dataStructures/RetrieveFileQueueCriteria.hpp"
+#include "common/dataStructures/StorageClass.hpp"
+#include "common/dataStructures/TapeDrive.hpp"
+#include "disk/DiskSystem.hpp"
+
+namespace cta {
+
+namespace catalogue {
+
+CatalogueRetryWrapper::CatalogueRetryWrapper(log::Logger &log, std::unique_ptr<Catalogue> catalogue,
+  const uint32_t maxTriesToConnect):
+  m_log(log),
+  m_catalogue(std::move(catalogue)),
+  m_maxTriesToConnect(maxTriesToConnect) {
+}
+
+void CatalogueRetryWrapper::tapeLabelled(const std::string &vid, const std::string &drive) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->tapeLabelled(vid, drive);}, m_maxTriesToConnect);
+}
+
+uint64_t CatalogueRetryWrapper::checkAndGetNextArchiveFileId(const std::string &diskInstanceName,
+  const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->checkAndGetNextArchiveFileId(diskInstanceName, storageClassName, user);}, m_maxTriesToConnect);
+}
+
+common::dataStructures::ArchiveFileQueueCriteria CatalogueRetryWrapper::getArchiveFileQueueCriteria(const std::string &diskInstanceName,
+  const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFileQueueCriteria(diskInstanceName, storageClassName, user);}, m_maxTriesToConnect);
+}
+
+std::list<TapeForWriting> CatalogueRetryWrapper::getTapesForWriting(const std::string &logicalLibraryName) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapesForWriting(logicalLibraryName);}, m_maxTriesToConnect);
+}
+
+common::dataStructures::Label::Format CatalogueRetryWrapper::getTapeLabelFormat(const std::string& vid) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapeLabelFormat(vid);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::filesWrittenToTape(const std::set<TapeItemWrittenPointer> &event) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->filesWrittenToTape(event);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::tapeMountedForArchive(const std::string &vid, const std::string &drive) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->tapeMountedForArchive(vid, drive);}, m_maxTriesToConnect);
+}
+
+common::dataStructures::RetrieveFileQueueCriteria CatalogueRetryWrapper::prepareToRetrieveFile(const std::string& diskInstanceName, const uint64_t archiveFileId, const common::dataStructures::RequesterIdentity& user, const std::optional<std::string>& activity, log::LogContext& lc, const std::optional<std::string> &mountPolicyName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->prepareToRetrieveFile(diskInstanceName, archiveFileId, user, activity, lc, mountPolicyName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::tapeMountedForRetrieve(const std::string &vid, const std::string &drive) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->tapeMountedForRetrieve(vid, drive);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::noSpaceLeftOnTape(const std::string &vid) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->noSpaceLeftOnTape(vid);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createAdminUser(const common::dataStructures::SecurityIdentity &admin, const std::string &username, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createAdminUser(admin, username, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteAdminUser(const std::string &username) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteAdminUser(username);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::AdminUser> CatalogueRetryWrapper::getAdminUsers() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getAdminUsers();}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyAdminUserComment(const common::dataStructures::SecurityIdentity &admin, const std::string &username, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyAdminUserComment(admin, username, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createVirtualOrganization(const common::dataStructures::SecurityIdentity &admin, const common::dataStructures::VirtualOrganization &vo) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createVirtualOrganization(admin, vo);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteVirtualOrganization(const std::string &voName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteVirtualOrganization(voName);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::VirtualOrganization> CatalogueRetryWrapper::getVirtualOrganizations() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getVirtualOrganizations();}, m_maxTriesToConnect);
+}
+
+common::dataStructures::VirtualOrganization CatalogueRetryWrapper::getVirtualOrganizationOfTapepool(const std::string & tapepoolName) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getVirtualOrganizationOfTapepool(tapepoolName);}, m_maxTriesToConnect);
+}
+
+common::dataStructures::VirtualOrganization CatalogueRetryWrapper::getCachedVirtualOrganizationOfTapepool(const std::string & tapepoolName) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getCachedVirtualOrganizationOfTapepool(tapepoolName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyVirtualOrganizationName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentVoName, const std::string &newVoName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationName(admin,currentVoName,newVoName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t readMaxDrives) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationReadMaxDrives(admin,voName,readMaxDrives);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t writeMaxDrives) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationWriteMaxDrives(admin,voName,writeMaxDrives);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyVirtualOrganizationMaxFileSize(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxFileSize) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationMaxFileSize(admin,voName,maxFileSize);}, m_maxTriesToConnect);
+}
+
+
+void CatalogueRetryWrapper::modifyVirtualOrganizationComment(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationComment(admin,voName,comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyVirtualOrganizationDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &diskInstance) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationDiskInstanceName(admin,voName,diskInstance);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createStorageClass(const common::dataStructures::SecurityIdentity &admin, const common::dataStructures::StorageClass &storageClass) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createStorageClass(admin, storageClass);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteStorageClass(const std::string &storageClassName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteStorageClass(storageClassName);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::StorageClass> CatalogueRetryWrapper::getStorageClasses() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getStorageClasses();}, m_maxTriesToConnect);
+}
+
+common::dataStructures::StorageClass CatalogueRetryWrapper::getStorageClass(const std::string &name) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getStorageClass(name);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t nbCopies) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyStorageClassNbCopies(admin, name, nbCopies);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyStorageClassComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyStorageClassComment(admin, name, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyStorageClassName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyStorageClassName(admin, currentName, newName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyStorageClassVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyStorageClassVo(admin, name, vo);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createMediaType(const common::dataStructures::SecurityIdentity &admin, const MediaType &mediaType) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createMediaType(admin, mediaType);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteMediaType(const std::string &name) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteMediaType(name);}, m_maxTriesToConnect);
+}
+
+std::list<MediaTypeWithLogs> CatalogueRetryWrapper::getMediaTypes() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getMediaTypes();}, m_maxTriesToConnect);
+}
+
+MediaType CatalogueRetryWrapper::getMediaTypeByVid(const std::string & vid) const {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->getMediaTypeByVid(vid);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMediaTypeName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeName(admin, currentName, newName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMediaTypeCartridge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &cartridge) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeCartridge(admin, name, cartridge);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMediaTypeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t capacityInBytes) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeCapacityInBytes(admin, name, capacityInBytes);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMediaTypePrimaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t primaryDensityCode) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypePrimaryDensityCode(admin, name, primaryDensityCode);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMediaTypeSecondaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t secondaryDensityCode) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeSecondaryDensityCode(admin, name, secondaryDensityCode);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMediaTypeNbWraps(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint32_t> &nbWraps) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeNbWraps(admin, name, nbWraps);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMediaTypeMinLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &minLPos) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeMinLPos(admin, name, minLPos);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMediaTypeMaxLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &maxLPos) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeMaxLPos(admin, name, maxLPos);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMediaTypeComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeComment(admin, name, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createTapePool(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo, const uint64_t nbPartialTapes, const bool encryptionValue, const std::optional<std::string> &supply, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createTapePool(admin, name, vo, nbPartialTapes, encryptionValue, supply, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteTapePool(const std::string &name) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteTapePool(name);}, m_maxTriesToConnect);
+}
+
+std::list<TapePool> CatalogueRetryWrapper::getTapePools(const TapePoolSearchCriteria &searchCriteria) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapePools(searchCriteria);}, m_maxTriesToConnect);
+}
+
+std::optional<TapePool> CatalogueRetryWrapper::getTapePool(const std::string &tapePoolName) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapePool(tapePoolName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapePoolVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapePoolVo(admin, name, vo);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapePoolNbPartialTapes(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t nbPartialTapes) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapePoolNbPartialTapes(admin, name, nbPartialTapes);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapePoolComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapePoolComment(admin, name, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::setTapePoolEncryption(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool encryptionValue) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->setTapePoolEncryption(admin, name, encryptionValue);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapePoolSupply(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &supply) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapePoolSupply(admin, name, supply);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapePoolName(admin, currentName, newName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createArchiveRoute(const common::dataStructures::SecurityIdentity &admin, const std::string &storageClassName, const uint32_t copyNb, const std::string &tapePoolName, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createArchiveRoute(admin, storageClassName, copyNb, tapePoolName, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteArchiveRoute(const std::string &storageClassName, const uint32_t copyNb) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteArchiveRoute(storageClassName, copyNb);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::ArchiveRoute> CatalogueRetryWrapper::getArchiveRoutes() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveRoutes();}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::ArchiveRoute> CatalogueRetryWrapper::getArchiveRoutes(const std::string &storageClassName, const std::string &tapePoolName) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveRoutes(storageClassName, tapePoolName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyArchiveRouteTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &storageClassName, const uint32_t copyNb, const std::string &tapePoolName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyArchiveRouteTapePoolName(admin, storageClassName, copyNb, tapePoolName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyArchiveRouteComment(const common::dataStructures::SecurityIdentity &admin, const std::string &storageClassName, const uint32_t copyNb, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyArchiveRouteComment(admin, storageClassName, copyNb, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createLogicalLibrary(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool isDisabled, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createLogicalLibrary(admin, name, isDisabled, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteLogicalLibrary(const std::string &name) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteLogicalLibrary(name);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::LogicalLibrary> CatalogueRetryWrapper::getLogicalLibraries() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getLogicalLibraries();}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyLogicalLibraryName(admin, currentName, newName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyLogicalLibraryComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyLogicalLibraryComment(admin, name, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyLogicalLibraryDisabledReason(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &disabledReason) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyLogicalLibraryDisabledReason(admin, name, disabledReason);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::setLogicalLibraryDisabled(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool disabledValue) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->setLogicalLibraryDisabled(admin, name, disabledValue);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createTape( const common::dataStructures::SecurityIdentity &admin, const CreateTapeAttributes & tape) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createTape(admin, tape);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteTape(const std::string &vid) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteTape(vid);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::Tape> CatalogueRetryWrapper::getTapes(const TapeSearchCriteria &searchCriteria) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapes(searchCriteria);}, m_maxTriesToConnect);
+}
+
+common::dataStructures::VidToTapeMap CatalogueRetryWrapper::getTapesByVid(const std::string& vid) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapesByVid(vid);}, m_maxTriesToConnect);
+}
+
+common::dataStructures::VidToTapeMap CatalogueRetryWrapper::getTapesByVid(const std::set<std::string> &vids) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapesByVid(vids);}, m_maxTriesToConnect);
+}
+
+std::map<std::string, std::string> CatalogueRetryWrapper::getVidToLogicalLibrary(const std::set<std::string> &vids) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getVidToLogicalLibrary(vids);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::reclaimTape(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, cta::log::LogContext & lc) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->reclaimTape(admin, vid,lc);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::checkTapeForLabel(const std::string &vid) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->checkTapeForLabel(vid);}, m_maxTriesToConnect);
+}
+
+uint64_t CatalogueRetryWrapper::getNbFilesOnTape(const std::string &vid) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getNbFilesOnTape(vid);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapeMediaType(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &mediaType) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeMediaType(admin, vid, mediaType);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapeVendor(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &vendor) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeVendor(admin, vid, vendor);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeLogicalLibraryName(admin, vid, logicalLibraryName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeTapePoolName(admin, vid, tapePoolName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeEncryptionKeyName(admin, vid, encryptionKeyName);}, m_maxTriesToConnect);
+}
+void CatalogueRetryWrapper::modifyTapeVerificationStatus(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &verificationStatus) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeVerificationStatus(admin, vid, verificationStatus);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapeState(const common::dataStructures::SecurityIdentity &admin,const std::string &vid, const common::dataStructures::Tape::State & state, const std::optional<std::string> & stateReason) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeState(admin,vid, state, stateReason);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::setTapeFull(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const bool fullValue) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->setTapeFull(admin, vid, fullValue);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::setTapeDirty(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const bool dirtyValue) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->setTapeDirty(admin, vid, dirtyValue);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::setTapeIsFromCastorInUnitTests(const std::string &vid) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->setTapeIsFromCastorInUnitTests(vid);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::setTapeDisabled(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string & reason) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->setTapeDisabled(admin, vid, reason);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::setTapeDirty(const std::string & vid) {
+  return retryOnLostConnection(m_log,[&]{ return m_catalogue->setTapeDirty(vid);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapeComment(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::optional<std::string> &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeComment(admin, vid, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyRequesterActivityMountRulePolicy(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &activityRegex, const std::string &mountPolicy) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesterActivityMountRulePolicy(admin, instanceName, requesterName, activityRegex, mountPolicy);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyRequesterActivityMountRuleComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &activityRegex, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesterActivityMountRuleComment(admin, instanceName, requesterName, activityRegex, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyRequesterMountRulePolicy(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &mountPolicy) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesterMountRulePolicy(admin, instanceName, requesterName, mountPolicy);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyRequesteMountRuleComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesteMountRuleComment(admin, instanceName, requesterName, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyRequesterGroupMountRulePolicy(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterGroupName, const std::string &mountPolicy) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesterGroupMountRulePolicy(admin, instanceName, requesterGroupName, mountPolicy);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyRequesterGroupMountRuleComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterGroupName, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesterGroupMountRuleComment(admin, instanceName, requesterGroupName, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createMountPolicy(const common::dataStructures::SecurityIdentity &admin, const CreateMountPolicyAttributes & mountPolicy) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createMountPolicy(admin, mountPolicy);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::MountPolicy> CatalogueRetryWrapper::getMountPolicies() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getMountPolicies();}, m_maxTriesToConnect);
+}
+
+std::optional<common::dataStructures::MountPolicy> CatalogueRetryWrapper::getMountPolicy(const std::string &mountPolicyName) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getMountPolicy(mountPolicyName);}, m_maxTriesToConnect);
+}
+
+
+std::list<common::dataStructures::MountPolicy> CatalogueRetryWrapper::getCachedMountPolicies() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getCachedMountPolicies();}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteMountPolicy(const std::string &name) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteMountPolicy(name);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createRequesterActivityMountRule(const common::dataStructures::SecurityIdentity &admin, const std::string &mountPolicyName, const std::string &diskInstance, const std::string &requesterName, const std::string &activityRegex, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createRequesterActivityMountRule(admin, mountPolicyName, diskInstance, requesterName, activityRegex, comment);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::RequesterActivityMountRule> CatalogueRetryWrapper::getRequesterActivityMountRules() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getRequesterActivityMountRules();}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteRequesterActivityMountRule(const std::string &diskInstanceName, const std::string &requesterName, const std::string &activityRegex) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteRequesterActivityMountRule(diskInstanceName, requesterName, activityRegex);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createRequesterMountRule(const common::dataStructures::SecurityIdentity &admin, const std::string &mountPolicyName, const std::string &diskInstance, const std::string &requesterName, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createRequesterMountRule(admin, mountPolicyName, diskInstance, requesterName, comment);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::RequesterMountRule> CatalogueRetryWrapper::getRequesterMountRules() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getRequesterMountRules();}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteRequesterMountRule(const std::string &diskInstanceName, const std::string &requesterName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteRequesterMountRule(diskInstanceName, requesterName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createRequesterGroupMountRule(const common::dataStructures::SecurityIdentity &admin, const std::string &mountPolicyName, const std::string &diskInstanceName, const std::string &requesterGroupName, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createRequesterGroupMountRule(admin, mountPolicyName, diskInstanceName, requesterGroupName, comment);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::RequesterGroupMountRule> CatalogueRetryWrapper::getRequesterGroupMountRules() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getRequesterGroupMountRules();}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteRequesterGroupMountRule(const std::string &diskInstanceName, const std::string &requesterGroupName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteRequesterGroupMountRule(diskInstanceName, requesterGroupName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMountPolicyArchivePriority(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t archivePriority) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyArchivePriority(admin, name, archivePriority);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMountPolicyArchiveMinRequestAge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t minArchiveRequestAge) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyArchiveMinRequestAge(admin, name, minArchiveRequestAge);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMountPolicyRetrievePriority(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t retrievePriority) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyRetrievePriority(admin, name, retrievePriority);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMountPolicyRetrieveMinRequestAge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t minRetrieveRequestAge) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyRetrieveMinRequestAge(admin, name, minRetrieveRequestAge);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyMountPolicyComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyComment(admin, name, comment);}, m_maxTriesToConnect);
+}
+
+disk::DiskSystemList CatalogueRetryWrapper::getAllDiskSystems() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getAllDiskSystems();}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createDiskSystem(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName, const std::string &diskInstanceSpaceName, const std::string &fileRegexp, const uint64_t targetedFreeSpace, const time_t sleepTime, const std::string &comment)   {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createDiskSystem(admin, name, diskInstanceName, diskInstanceSpaceName, fileRegexp, targetedFreeSpace, sleepTime, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteDiskSystem(const std::string &name) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteDiskSystem(name);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyDiskSystemFileRegexp(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &fileRegexp) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemFileRegexp(admin, name, fileRegexp);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyDiskSystemTargetedFreeSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t targetedFreeSpace) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemTargetedFreeSpace(admin, name, targetedFreeSpace);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyDiskSystemComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemComment(admin, name, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyDiskSystemDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemDiskInstanceName(admin, name, diskInstanceName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyDiskSystemDiskInstanceSpaceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceSpaceName) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemDiskInstanceSpaceName(admin, name, diskInstanceSpaceName);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyDiskSystemSleepTime(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t sleepTime) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemSleepTime(admin, name, sleepTime);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createDiskInstance(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment)   {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createDiskInstance(admin, name, comment);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::DiskInstance> CatalogueRetryWrapper::getAllDiskInstances() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getAllDiskInstances();}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteDiskInstance(const std::string &name) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteDiskInstance(name);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyDiskInstanceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskInstanceComment(admin, name, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createDiskInstanceSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL, const uint64_t refreshInterval, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->createDiskInstanceSpace(admin, name, diskInstance, freeSpaceQueryURL, refreshInterval, comment);}, m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::DiskInstanceSpace> CatalogueRetryWrapper::getAllDiskInstanceSpaces() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getAllDiskInstanceSpaces();}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteDiskInstanceSpace(const std::string &name, const std::string &diskInstance) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteDiskInstanceSpace(name, diskInstance);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyDiskInstanceSpaceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &comment) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskInstanceSpaceComment(admin, name, diskInstance, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyDiskInstanceSpaceRefreshInterval(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const uint64_t refreshInterval) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskInstanceSpaceRefreshInterval(admin, name, diskInstance, refreshInterval);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyDiskInstanceSpaceQueryURL(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskInstanceSpaceQueryURL(admin, name, diskInstance, freeSpaceQueryURL);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyDiskInstanceSpaceFreeSpace(const std::string &name, const std::string &diskInstance, const uint64_t freeSpace) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskInstanceSpaceFreeSpace(name, diskInstance, freeSpace);}, m_maxTriesToConnect); 
+}
+
+using ArchiveFileItor = CatalogueItor<common::dataStructures::ArchiveFile>;
+ArchiveFileItor CatalogueRetryWrapper::getArchiveFilesItor(const TapeFileSearchCriteria &searchCriteria) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFilesItor(searchCriteria);}, m_maxTriesToConnect);
+}
+
+using FileRecycleLogItor = CatalogueItor<common::dataStructures::FileRecycleLog>;
+FileRecycleLogItor CatalogueRetryWrapper::getFileRecycleLogItor(const RecycleTapeFileSearchCriteria & searchCriteria) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getFileRecycleLogItor(searchCriteria);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::restoreFileInRecycleLog(const RecycleTapeFileSearchCriteria & searchCriteria, const std::string &newFid) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->restoreFileInRecycleLog(searchCriteria, newFid);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteFileFromRecycleBin(const uint64_t archiveFileId, log::LogContext &lc){
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->deleteFileFromRecycleBin(archiveFileId,lc);},m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteFilesFromRecycleLog(const std::string & vid, log::LogContext & lc){
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->deleteFilesFromRecycleLog(vid,lc);},m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::ArchiveFile> CatalogueRetryWrapper::getFilesForRepack(const std::string &vid, const uint64_t startFSeq, const uint64_t maxNbFiles) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getFilesForRepack(vid, startFSeq, maxNbFiles);}, m_maxTriesToConnect);
+}
+
+ArchiveFileItor CatalogueRetryWrapper::getArchiveFilesForRepackItor(const std::string &vid, const uint64_t startFSeq) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFilesForRepackItor(vid, startFSeq);}, m_maxTriesToConnect);
+}
+
+common::dataStructures::ArchiveFileSummary CatalogueRetryWrapper::getTapeFileSummary(const TapeFileSearchCriteria &searchCriteria) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapeFileSummary(searchCriteria);}, m_maxTriesToConnect);
+}
+
+common::dataStructures::ArchiveFile CatalogueRetryWrapper::getArchiveFileForDeletion(const TapeFileSearchCriteria &searchCriteria) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFileForDeletion(searchCriteria);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteTapeFileCopy(common::dataStructures::ArchiveFile &file, const std::string &reason) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteTapeFileCopy(file, reason);}, m_maxTriesToConnect);
+}
+
+common::dataStructures::ArchiveFile CatalogueRetryWrapper::getArchiveFileById(const uint64_t id) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFileById(id);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::DO_NOT_USE_deleteArchiveFile_DO_NOT_USE(const std::string &instanceName, const uint64_t archiveFileId, log::LogContext &lc) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->DO_NOT_USE_deleteArchiveFile_DO_NOT_USE(instanceName, archiveFileId, lc);}, m_maxTriesToConnect);
+}
+
+bool CatalogueRetryWrapper::isAdmin(const common::dataStructures::SecurityIdentity &admin) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->isAdmin(admin);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::ping() {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->ping();}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::verifySchemaVersion() {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->verifySchemaVersion();}, m_maxTriesToConnect);
+}
+
+SchemaVersion CatalogueRetryWrapper::getSchemaVersion() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getSchemaVersion();}, m_maxTriesToConnect);
+}
+
+bool CatalogueRetryWrapper::tapePoolExists(const std::string &tapePoolName) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->tapePoolExists(tapePoolName);}, m_maxTriesToConnect);
+}
+
+bool CatalogueRetryWrapper::tapeExists(const std::string &vid) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->tapeExists(vid);}, m_maxTriesToConnect);
+}
+
+bool CatalogueRetryWrapper::diskSystemExists(const std::string &name) const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->diskSystemExists(name);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::updateDiskFileId(uint64_t archiveFileId, const std::string &diskInstance, const std::string &diskFileId) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->updateDiskFileId(archiveFileId, diskInstance, diskFileId);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::moveArchiveFileToRecycleLog(const common::dataStructures::DeleteArchiveRequest &request,
+log::LogContext & lc) {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->moveArchiveFileToRecycleLog(request,lc);},m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createTapeDrive(const common::dataStructures::TapeDrive &tapeDrive) {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->createTapeDrive(tapeDrive);},m_maxTriesToConnect);
+}
+
+std::list<std::string> CatalogueRetryWrapper::getTapeDriveNames() const {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDriveNames();},m_maxTriesToConnect);
+}
+
+std::list<common::dataStructures::TapeDrive> CatalogueRetryWrapper::getTapeDrives() const {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDrives();},m_maxTriesToConnect);
+}
+
+std::optional<common::dataStructures::TapeDrive> CatalogueRetryWrapper::getTapeDrive(const std::string &tapeDriveName) const {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDrive(tapeDriveName);},m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::setDesiredTapeDriveState(const std::string& tapeDriveName,
+  const common::dataStructures::DesiredDriveState &desiredState) {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->setDesiredTapeDriveState(tapeDriveName, desiredState);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::setDesiredTapeDriveStateComment(const std::string& tapeDriveName,
+  const std::string &comment) {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->setDesiredTapeDriveStateComment(tapeDriveName, comment);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::updateTapeDriveStatistics(const std::string& tapeDriveName,
+  const std::string& host, const std::string& logicalLibrary,
+  const common::dataStructures::TapeDriveStatistics& statistics) {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->updateTapeDriveStatistics(tapeDriveName, host, logicalLibrary, statistics);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::updateTapeDriveStatus(const common::dataStructures::TapeDrive &tapeDrive) {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->updateTapeDriveStatus(tapeDrive);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteTapeDrive(const std::string &tapeDriveName) {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->deleteTapeDrive(tapeDriveName);},m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::createTapeDriveConfig(const std::string &driveName, const std::string &category,
+  const std::string &keyName, const std::string &value, const std::string &source) {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->createTapeDriveConfig(driveName, category, keyName, value, source);},m_maxTriesToConnect);
+}
+
+std::list<cta::catalogue::Catalogue::DriveConfig> CatalogueRetryWrapper::getTapeDriveConfigs() const {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDriveConfigs();},m_maxTriesToConnect);
+}
+
+std::list<std::pair<std::string, std::string>> CatalogueRetryWrapper::getTapeDriveConfigNamesAndKeys() const {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDriveConfigNamesAndKeys();},m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::modifyTapeDriveConfig(const std::string &driveName, const std::string &category,
+  const std::string &keyName, const std::string &value, const std::string &source) {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->modifyTapeDriveConfig(driveName, category, keyName, value, source);},m_maxTriesToConnect);
+}
+
+std::optional<std::tuple<std::string, std::string, std::string>> CatalogueRetryWrapper::getTapeDriveConfig( const std::string &tapeDriveName,
+  const std::string &keyName) const {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDriveConfig(tapeDriveName, keyName);},m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::deleteTapeDriveConfig(const std::string &tapeDriveName, const std::string &keyName) {
+  return retryOnLostConnection(m_log,[&]{return m_catalogue->deleteTapeDriveConfig(tapeDriveName, keyName);},m_maxTriesToConnect);
+}
+
+std::map<std::string, uint64_t> CatalogueRetryWrapper::getDiskSpaceReservations() const {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->getDiskSpaceReservations();}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::reserveDiskSpace(const std::string& driveName, const uint64_t mountId, const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->reserveDiskSpace(driveName, mountId, diskSpaceReservation, lc);}, m_maxTriesToConnect);
+}
+
+void CatalogueRetryWrapper::releaseDiskSpace(const std::string& driveName, const uint64_t mountId, const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) {
+  return retryOnLostConnection(m_log, [&]{return m_catalogue->releaseDiskSpace(driveName, mountId, diskSpaceReservation, lc);}, m_maxTriesToConnect);
+}
+
+}  // namespace catalogue
+}  // namespace cta
diff --git a/catalogue/CatalogueRetryWrapper.hpp b/catalogue/CatalogueRetryWrapper.hpp
index 33547358a89d1bb5f268504d1b4be1fba7ef83dc..f53daf15f0bf662890f7a6f0949bddabc14d5fde 100644
--- a/catalogue/CatalogueRetryWrapper.hpp
+++ b/catalogue/CatalogueRetryWrapper.hpp
@@ -17,11 +17,11 @@
 
 #pragma once
 
-#include "catalogue/Catalogue.hpp"
-#include "catalogue/retryOnLostConnection.hpp"
-
 #include <memory>
 
+#include "catalogue/Catalogue.hpp"
+#include "common/log/LogContext.hpp"
+
 namespace cta {
 
 namespace catalogue {
@@ -41,749 +41,373 @@ public:
    * try to connect to the database in the event of LostDatabaseConnection
    * exceptions being thrown.
    */
-  CatalogueRetryWrapper(log::Logger &log, std::unique_ptr<Catalogue> catalogue, const uint32_t maxTriesToConnect = 3):
-    m_log(log),
-    m_catalogue(std::move(catalogue)),
-    m_maxTriesToConnect(maxTriesToConnect) {
-  }
+  CatalogueRetryWrapper(log::Logger &log, std::unique_ptr<Catalogue> catalogue, const uint32_t maxTriesToConnect = 3);
 
-  /**
-   * Deletion of the copy constructor.
-   */
   CatalogueRetryWrapper(CatalogueRetryWrapper &) = delete;
 
-  /**
-   * Destructor.
-   */
   ~CatalogueRetryWrapper() override = default;
 
-  /**
-   * Deletion of the copy assignment operator.
-   */
   CatalogueRetryWrapper &operator=(const CatalogueRetryWrapper &) = delete;
 
-  void tapeLabelled(const std::string &vid, const std::string &drive) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->tapeLabelled(vid, drive);}, m_maxTriesToConnect);
-  }
+  void tapeLabelled(const std::string &vid, const std::string &drive) override;
 
-  uint64_t checkAndGetNextArchiveFileId(const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->checkAndGetNextArchiveFileId(diskInstanceName, storageClassName, user);}, m_maxTriesToConnect);
-  }
+  uint64_t checkAndGetNextArchiveFileId(const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override;
 
   common::dataStructures::ArchiveFileQueueCriteria getArchiveFileQueueCriteria(const std::string &diskInstanceName,
-    const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFileQueueCriteria(diskInstanceName, storageClassName, user);}, m_maxTriesToConnect);
-  }
+    const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override;
 
-  std::list<TapeForWriting> getTapesForWriting(const std::string &logicalLibraryName) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapesForWriting(logicalLibraryName);}, m_maxTriesToConnect);
-  }
+  std::list<TapeForWriting> getTapesForWriting(const std::string &logicalLibraryName) const override;
 
-  common::dataStructures::Label::Format getTapeLabelFormat(const std::string& vid) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapeLabelFormat(vid);}, m_maxTriesToConnect);
-  }
+  common::dataStructures::Label::Format getTapeLabelFormat(const std::string& vid) const override;
 
-  void filesWrittenToTape(const std::set<TapeItemWrittenPointer> &event) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->filesWrittenToTape(event);}, m_maxTriesToConnect);
-  }
+  void filesWrittenToTape(const std::set<TapeItemWrittenPointer> &event) override;
 
-  void tapeMountedForArchive(const std::string &vid, const std::string &drive) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->tapeMountedForArchive(vid, drive);}, m_maxTriesToConnect);
-  }
+  void tapeMountedForArchive(const std::string &vid, const std::string &drive) override;
 
-  common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFile(const std::string& diskInstanceName, const uint64_t archiveFileId, const common::dataStructures::RequesterIdentity& user, const std::optional<std::string>& activity, log::LogContext& lc, const std::optional<std::string> &mountPolicyName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->prepareToRetrieveFile(diskInstanceName, archiveFileId, user, activity, lc, mountPolicyName);}, m_maxTriesToConnect);
-  }
+  common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFile(const std::string& diskInstanceName, const uint64_t archiveFileId, const common::dataStructures::RequesterIdentity& user, const std::optional<std::string>& activity, log::LogContext& lc, const std::optional<std::string> &mountPolicyName) override;
 
-  void tapeMountedForRetrieve(const std::string &vid, const std::string &drive) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->tapeMountedForRetrieve(vid, drive);}, m_maxTriesToConnect);
-  }
+  void tapeMountedForRetrieve(const std::string &vid, const std::string &drive) override;
 
-  void noSpaceLeftOnTape(const std::string &vid) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->noSpaceLeftOnTape(vid);}, m_maxTriesToConnect);
-  }
+  void noSpaceLeftOnTape(const std::string &vid) override;
 
-  void createAdminUser(const common::dataStructures::SecurityIdentity &admin, const std::string &username, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createAdminUser(admin, username, comment);}, m_maxTriesToConnect);
-  }
+  void createAdminUser(const common::dataStructures::SecurityIdentity &admin, const std::string &username, const std::string &comment) override;
 
-  void deleteAdminUser(const std::string &username) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteAdminUser(username);}, m_maxTriesToConnect);
-  }
+  void deleteAdminUser(const std::string &username) override;
 
-  std::list<common::dataStructures::AdminUser> getAdminUsers() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getAdminUsers();}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::AdminUser> getAdminUsers() const override;
 
-  void modifyAdminUserComment(const common::dataStructures::SecurityIdentity &admin, const std::string &username, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyAdminUserComment(admin, username, comment);}, m_maxTriesToConnect);
-  }
+  void modifyAdminUserComment(const common::dataStructures::SecurityIdentity &admin, const std::string &username, const std::string &comment) override;
 
-  void createVirtualOrganization(const common::dataStructures::SecurityIdentity &admin, const common::dataStructures::VirtualOrganization &vo) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createVirtualOrganization(admin, vo);}, m_maxTriesToConnect);
-  }
+  void createVirtualOrganization(const common::dataStructures::SecurityIdentity &admin, const common::dataStructures::VirtualOrganization &vo) override;
 
-  void deleteVirtualOrganization(const std::string &voName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteVirtualOrganization(voName);}, m_maxTriesToConnect);
-  }
+  void deleteVirtualOrganization(const std::string &voName) override;
 
-  std::list<common::dataStructures::VirtualOrganization> getVirtualOrganizations() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getVirtualOrganizations();}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::VirtualOrganization> getVirtualOrganizations() const override;
 
-  common::dataStructures::VirtualOrganization getVirtualOrganizationOfTapepool(const std::string & tapepoolName) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getVirtualOrganizationOfTapepool(tapepoolName);}, m_maxTriesToConnect);
-  }
+  common::dataStructures::VirtualOrganization getVirtualOrganizationOfTapepool(const std::string & tapepoolName) const override;
 
-  common::dataStructures::VirtualOrganization getCachedVirtualOrganizationOfTapepool(const std::string & tapepoolName) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getCachedVirtualOrganizationOfTapepool(tapepoolName);}, m_maxTriesToConnect);
-  }
+  common::dataStructures::VirtualOrganization getCachedVirtualOrganizationOfTapepool(const std::string & tapepoolName) const override;
 
-  void modifyVirtualOrganizationName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentVoName, const std::string &newVoName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationName(admin,currentVoName,newVoName);}, m_maxTriesToConnect);
-  }
+  void modifyVirtualOrganizationName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentVoName, const std::string &newVoName) override;
 
-  void modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t readMaxDrives) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationReadMaxDrives(admin,voName,readMaxDrives);}, m_maxTriesToConnect);
-  }
+  void modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t readMaxDrives) override ;
 
-  void modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t writeMaxDrives) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationWriteMaxDrives(admin,voName,writeMaxDrives);}, m_maxTriesToConnect);
-  }
+  void modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t writeMaxDrives) override;
 
-  void modifyVirtualOrganizationMaxFileSize(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxFileSize) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationMaxFileSize(admin,voName,maxFileSize);}, m_maxTriesToConnect);
-  }
+  void modifyVirtualOrganizationMaxFileSize(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxFileSize) override;
 
 
-  void modifyVirtualOrganizationComment(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationComment(admin,voName,comment);}, m_maxTriesToConnect);
-  }
+  void modifyVirtualOrganizationComment(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &comment) override;
 
-  void modifyVirtualOrganizationDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &diskInstance) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyVirtualOrganizationDiskInstanceName(admin,voName,diskInstance);}, m_maxTriesToConnect);
-  }
+  void modifyVirtualOrganizationDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &diskInstance) override;
 
-  void createStorageClass(const common::dataStructures::SecurityIdentity &admin, const common::dataStructures::StorageClass &storageClass) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createStorageClass(admin, storageClass);}, m_maxTriesToConnect);
-  }
+  void createStorageClass(const common::dataStructures::SecurityIdentity &admin, const common::dataStructures::StorageClass &storageClass) override;
 
-  void deleteStorageClass(const std::string &storageClassName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteStorageClass(storageClassName);}, m_maxTriesToConnect);
-  }
+  void deleteStorageClass(const std::string &storageClassName) override;
 
-  std::list<common::dataStructures::StorageClass> getStorageClasses() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getStorageClasses();}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::StorageClass> getStorageClasses() const override;
 
-  common::dataStructures::StorageClass getStorageClass(const std::string &name) const override {
-   return retryOnLostConnection(m_log, [&]{return m_catalogue->getStorageClass(name);}, m_maxTriesToConnect);
-  }
+  common::dataStructures::StorageClass getStorageClass(const std::string &name) const override;
 
-  void modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t nbCopies) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyStorageClassNbCopies(admin, name, nbCopies);}, m_maxTriesToConnect);
-  }
+  void modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t nbCopies) override;
 
-  void modifyStorageClassComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyStorageClassComment(admin, name, comment);}, m_maxTriesToConnect);
-  }
+  void modifyStorageClassComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
 
-  void modifyStorageClassName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyStorageClassName(admin, currentName, newName);}, m_maxTriesToConnect);
-  }
+  void modifyStorageClassName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override;
 
-  void modifyStorageClassVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyStorageClassVo(admin, name, vo);}, m_maxTriesToConnect);
-  }
+  void modifyStorageClassVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) override;
 
-  void createMediaType(const common::dataStructures::SecurityIdentity &admin, const MediaType &mediaType) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createMediaType(admin, mediaType);}, m_maxTriesToConnect);
-  }
+  void createMediaType(const common::dataStructures::SecurityIdentity &admin, const MediaType &mediaType) override;
 
-  void deleteMediaType(const std::string &name) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteMediaType(name);}, m_maxTriesToConnect);
-  }
+  void deleteMediaType(const std::string &name) override;
 
-  std::list<MediaTypeWithLogs> getMediaTypes() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getMediaTypes();}, m_maxTriesToConnect);
-  }
+  std::list<MediaTypeWithLogs> getMediaTypes() const override;
 
-  MediaType getMediaTypeByVid(const std::string & vid) const override {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->getMediaTypeByVid(vid);}, m_maxTriesToConnect);
-  }
+  MediaType getMediaTypeByVid(const std::string & vid) const override;
 
-  void modifyMediaTypeName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeName(admin, currentName, newName);}, m_maxTriesToConnect);
-  }
+  void modifyMediaTypeName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override;
 
-  void modifyMediaTypeCartridge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &cartridge) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeCartridge(admin, name, cartridge);}, m_maxTriesToConnect);
-  }
+  void modifyMediaTypeCartridge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &cartridge) override;
 
-  void modifyMediaTypeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t capacityInBytes) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeCapacityInBytes(admin, name, capacityInBytes);}, m_maxTriesToConnect);
-  }
+  void modifyMediaTypeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t capacityInBytes) override;
 
-  void modifyMediaTypePrimaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t primaryDensityCode) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypePrimaryDensityCode(admin, name, primaryDensityCode);}, m_maxTriesToConnect);
-  }
+  void modifyMediaTypePrimaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t primaryDensityCode) override;
 
-  void modifyMediaTypeSecondaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t secondaryDensityCode) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeSecondaryDensityCode(admin, name, secondaryDensityCode);}, m_maxTriesToConnect);
-  }
+  void modifyMediaTypeSecondaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t secondaryDensityCode) override;
 
-  void modifyMediaTypeNbWraps(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint32_t> &nbWraps) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeNbWraps(admin, name, nbWraps);}, m_maxTriesToConnect);
-  }
+  void modifyMediaTypeNbWraps(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint32_t> &nbWraps) override;
 
-  void modifyMediaTypeMinLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &minLPos) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeMinLPos(admin, name, minLPos);}, m_maxTriesToConnect);
-  }
+  void modifyMediaTypeMinLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &minLPos) override;
 
-  void modifyMediaTypeMaxLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &maxLPos) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeMaxLPos(admin, name, maxLPos);}, m_maxTriesToConnect);
-  }
+  void modifyMediaTypeMaxLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &maxLPos) override;
 
-  void modifyMediaTypeComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMediaTypeComment(admin, name, comment);}, m_maxTriesToConnect);
-  }
+  void modifyMediaTypeComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
 
-  void createTapePool(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo, const uint64_t nbPartialTapes, const bool encryptionValue, const std::optional<std::string> &supply, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createTapePool(admin, name, vo, nbPartialTapes, encryptionValue, supply, comment);}, m_maxTriesToConnect);
-  }
+  void createTapePool(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo, const uint64_t nbPartialTapes, const bool encryptionValue, const std::optional<std::string> &supply, const std::string &comment) override;
 
-  void deleteTapePool(const std::string &name) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteTapePool(name);}, m_maxTriesToConnect);
-  }
+  void deleteTapePool(const std::string &name) override;
 
-  std::list<TapePool> getTapePools(const TapePoolSearchCriteria &searchCriteria) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapePools(searchCriteria);}, m_maxTriesToConnect);
-  }
+  std::list<TapePool> getTapePools(const TapePoolSearchCriteria &searchCriteria) const override;
 
-  std::optional<TapePool> getTapePool(const std::string &tapePoolName) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapePool(tapePoolName);}, m_maxTriesToConnect);
-  }
+  std::optional<TapePool> getTapePool(const std::string &tapePoolName) const override;
 
-  void modifyTapePoolVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapePoolVo(admin, name, vo);}, m_maxTriesToConnect);
-  }
+  void modifyTapePoolVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) override;
 
-  void modifyTapePoolNbPartialTapes(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t nbPartialTapes) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapePoolNbPartialTapes(admin, name, nbPartialTapes);}, m_maxTriesToConnect);
-  }
+  void modifyTapePoolNbPartialTapes(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t nbPartialTapes) override;
 
-  void modifyTapePoolComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapePoolComment(admin, name, comment);}, m_maxTriesToConnect);
-  }
+  void modifyTapePoolComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
 
-  void setTapePoolEncryption(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool encryptionValue) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->setTapePoolEncryption(admin, name, encryptionValue);}, m_maxTriesToConnect);
-  }
+  void setTapePoolEncryption(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool encryptionValue) override;
 
-  void modifyTapePoolSupply(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &supply) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapePoolSupply(admin, name, supply);}, m_maxTriesToConnect);
-  }
+  void modifyTapePoolSupply(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &supply) override;
 
-  void modifyTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapePoolName(admin, currentName, newName);}, m_maxTriesToConnect);
-  }
+  void modifyTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override;
 
-  void createArchiveRoute(const common::dataStructures::SecurityIdentity &admin, const std::string &storageClassName, const uint32_t copyNb, const std::string &tapePoolName, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createArchiveRoute(admin, storageClassName, copyNb, tapePoolName, comment);}, m_maxTriesToConnect);
-  }
+  void createArchiveRoute(const common::dataStructures::SecurityIdentity &admin, const std::string &storageClassName, const uint32_t copyNb, const std::string &tapePoolName, const std::string &comment) override;
 
-  void deleteArchiveRoute(const std::string &storageClassName, const uint32_t copyNb) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteArchiveRoute(storageClassName, copyNb);}, m_maxTriesToConnect);
-  }
+  void deleteArchiveRoute(const std::string &storageClassName, const uint32_t copyNb) override;
 
-  std::list<common::dataStructures::ArchiveRoute> getArchiveRoutes() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveRoutes();}, m_maxTriesToConnect);
-  }
-
-  std::list<common::dataStructures::ArchiveRoute> getArchiveRoutes(const std::string &storageClassName, const std::string &tapePoolName) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveRoutes(storageClassName, tapePoolName);}, m_maxTriesToConnect);
-  }
-
-  void modifyArchiveRouteTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &storageClassName, const uint32_t copyNb, const std::string &tapePoolName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyArchiveRouteTapePoolName(admin, storageClassName, copyNb, tapePoolName);}, m_maxTriesToConnect);
-  }
-
-  void modifyArchiveRouteComment(const common::dataStructures::SecurityIdentity &admin, const std::string &storageClassName, const uint32_t copyNb, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyArchiveRouteComment(admin, storageClassName, copyNb, comment);}, m_maxTriesToConnect);
-  }
-
-  void createLogicalLibrary(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool isDisabled, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createLogicalLibrary(admin, name, isDisabled, comment);}, m_maxTriesToConnect);
-  }
-
-  void deleteLogicalLibrary(const std::string &name) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteLogicalLibrary(name);}, m_maxTriesToConnect);
-  }
-
-  std::list<common::dataStructures::LogicalLibrary> getLogicalLibraries() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getLogicalLibraries();}, m_maxTriesToConnect);
-  }
-
-  void modifyLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyLogicalLibraryName(admin, currentName, newName);}, m_maxTriesToConnect);
-  }
-
-  void modifyLogicalLibraryComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyLogicalLibraryComment(admin, name, comment);}, m_maxTriesToConnect);
-  }
-
-  void modifyLogicalLibraryDisabledReason(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &disabledReason) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyLogicalLibraryDisabledReason(admin, name, disabledReason);}, m_maxTriesToConnect);
-  }
-
-  void setLogicalLibraryDisabled(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool disabledValue) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->setLogicalLibraryDisabled(admin, name, disabledValue);}, m_maxTriesToConnect);
-  }
-
-  void createTape( const common::dataStructures::SecurityIdentity &admin, const CreateTapeAttributes & tape) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createTape(admin, tape);}, m_maxTriesToConnect);
-  }
-
-  void deleteTape(const std::string &vid) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteTape(vid);}, m_maxTriesToConnect);
-  }
-
-  std::list<common::dataStructures::Tape> getTapes(const TapeSearchCriteria &searchCriteria) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapes(searchCriteria);}, m_maxTriesToConnect);
-  }
-
-  common::dataStructures::VidToTapeMap getTapesByVid(const std::string& vid) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapesByVid(vid);}, m_maxTriesToConnect);
-  }
-
-  common::dataStructures::VidToTapeMap getTapesByVid(const std::set<std::string> &vids) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapesByVid(vids);}, m_maxTriesToConnect);
-  }
-
-  std::map<std::string, std::string> getVidToLogicalLibrary(const std::set<std::string> &vids) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getVidToLogicalLibrary(vids);}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::ArchiveRoute> getArchiveRoutes() const override;
 
-  void reclaimTape(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, cta::log::LogContext & lc) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->reclaimTape(admin, vid,lc);}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::ArchiveRoute> getArchiveRoutes(const std::string &storageClassName, const std::string &tapePoolName) const override;
 
-  void checkTapeForLabel(const std::string &vid) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->checkTapeForLabel(vid);}, m_maxTriesToConnect);
-  }
+  void modifyArchiveRouteTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &storageClassName, const uint32_t copyNb, const std::string &tapePoolName) override;
 
-  uint64_t getNbFilesOnTape(const std::string &vid) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getNbFilesOnTape(vid);}, m_maxTriesToConnect);
-  }
+  void modifyArchiveRouteComment(const common::dataStructures::SecurityIdentity &admin, const std::string &storageClassName, const uint32_t copyNb, const std::string &comment) override;
 
-  void modifyTapeMediaType(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &mediaType) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeMediaType(admin, vid, mediaType);}, m_maxTriesToConnect);
-  }
+  void createLogicalLibrary(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool isDisabled, const std::string &comment) override;
 
-  void modifyTapeVendor(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &vendor) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeVendor(admin, vid, vendor);}, m_maxTriesToConnect);
-  }
+  void deleteLogicalLibrary(const std::string &name) override;
 
-  void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeLogicalLibraryName(admin, vid, logicalLibraryName);}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::LogicalLibrary> getLogicalLibraries() const override;
 
-  void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeTapePoolName(admin, vid, tapePoolName);}, m_maxTriesToConnect);
-  }
-
-  void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeEncryptionKeyName(admin, vid, encryptionKeyName);}, m_maxTriesToConnect);
-  }
-  void modifyTapeVerificationStatus(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &verificationStatus) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeVerificationStatus(admin, vid, verificationStatus);}, m_maxTriesToConnect);
-  }
-  
-  void modifyTapeState(const common::dataStructures::SecurityIdentity &admin,const std::string &vid, const common::dataStructures::Tape::State & state, const std::optional<std::string> & stateReason) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeState(admin,vid, state, stateReason);}, m_maxTriesToConnect);
-  }
-
-  void setTapeFull(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const bool fullValue) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->setTapeFull(admin, vid, fullValue);}, m_maxTriesToConnect);
-  }
-
-  void setTapeDirty(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const bool dirtyValue) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->setTapeDirty(admin, vid, dirtyValue);}, m_maxTriesToConnect);
-  }
-
-  void setTapeIsFromCastorInUnitTests(const std::string &vid) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->setTapeIsFromCastorInUnitTests(vid);}, m_maxTriesToConnect);
-  }
-
-  void setTapeDisabled(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string & reason) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->setTapeDisabled(admin, vid, reason);}, m_maxTriesToConnect);
-  }
-
-  void setTapeDirty(const std::string & vid) override {
-    return retryOnLostConnection(m_log,[&]{ return m_catalogue->setTapeDirty(vid);}, m_maxTriesToConnect);
-  }
-
-  void modifyTapeComment(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::optional<std::string> &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyTapeComment(admin, vid, comment);}, m_maxTriesToConnect);
-  }
-
-  void modifyRequesterActivityMountRulePolicy(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &activityRegex, const std::string &mountPolicy) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesterActivityMountRulePolicy(admin, instanceName, requesterName, activityRegex, mountPolicy);}, m_maxTriesToConnect);
-  }
-
-  void modifyRequesterActivityMountRuleComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &activityRegex, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesterActivityMountRuleComment(admin, instanceName, requesterName, activityRegex, comment);}, m_maxTriesToConnect);
-  }
-
-  void modifyRequesterMountRulePolicy(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &mountPolicy) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesterMountRulePolicy(admin, instanceName, requesterName, mountPolicy);}, m_maxTriesToConnect);
-  }
-
-  void modifyRequesteMountRuleComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesteMountRuleComment(admin, instanceName, requesterName, comment);}, m_maxTriesToConnect);
-  }
-
-  void modifyRequesterGroupMountRulePolicy(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterGroupName, const std::string &mountPolicy) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesterGroupMountRulePolicy(admin, instanceName, requesterGroupName, mountPolicy);}, m_maxTriesToConnect);
-  }
-
-  void modifyRequesterGroupMountRuleComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterGroupName, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyRequesterGroupMountRuleComment(admin, instanceName, requesterGroupName, comment);}, m_maxTriesToConnect);
-  }
-
-  void createMountPolicy(const common::dataStructures::SecurityIdentity &admin, const CreateMountPolicyAttributes & mountPolicy) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createMountPolicy(admin, mountPolicy);}, m_maxTriesToConnect);
-  }
-
-  std::list<common::dataStructures::MountPolicy> getMountPolicies() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getMountPolicies();}, m_maxTriesToConnect);
-  }
-
-  std::optional<common::dataStructures::MountPolicy> getMountPolicy(const std::string &mountPolicyName) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getMountPolicy(mountPolicyName);}, m_maxTriesToConnect);
-  }
+  void modifyLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override;
 
+  void modifyLogicalLibraryComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
 
-  std::list<common::dataStructures::MountPolicy> getCachedMountPolicies() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getCachedMountPolicies();}, m_maxTriesToConnect);
-  }
+  void modifyLogicalLibraryDisabledReason(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &disabledReason) override;
 
-  void deleteMountPolicy(const std::string &name) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteMountPolicy(name);}, m_maxTriesToConnect);
-  }
+  void setLogicalLibraryDisabled(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool disabledValue) override;
 
-  void createRequesterActivityMountRule(const common::dataStructures::SecurityIdentity &admin, const std::string &mountPolicyName, const std::string &diskInstance, const std::string &requesterName, const std::string &activityRegex, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createRequesterActivityMountRule(admin, mountPolicyName, diskInstance, requesterName, activityRegex, comment);}, m_maxTriesToConnect);
-  }
+  void createTape( const common::dataStructures::SecurityIdentity &admin, const CreateTapeAttributes & tape) override;
 
-  std::list<common::dataStructures::RequesterActivityMountRule> getRequesterActivityMountRules() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getRequesterActivityMountRules();}, m_maxTriesToConnect);
-  }
+  void deleteTape(const std::string &vid) override;
 
-  void deleteRequesterActivityMountRule(const std::string &diskInstanceName, const std::string &requesterName, const std::string &activityRegex) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteRequesterActivityMountRule(diskInstanceName, requesterName, activityRegex);}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::Tape> getTapes(const TapeSearchCriteria &searchCriteria) const override;
 
-  void createRequesterMountRule(const common::dataStructures::SecurityIdentity &admin, const std::string &mountPolicyName, const std::string &diskInstance, const std::string &requesterName, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createRequesterMountRule(admin, mountPolicyName, diskInstance, requesterName, comment);}, m_maxTriesToConnect);
-  }
+  common::dataStructures::VidToTapeMap getTapesByVid(const std::string& vid) const override;
 
-  std::list<common::dataStructures::RequesterMountRule> getRequesterMountRules() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getRequesterMountRules();}, m_maxTriesToConnect);
-  }
+  common::dataStructures::VidToTapeMap getTapesByVid(const std::set<std::string> &vids) const override;
 
-  void deleteRequesterMountRule(const std::string &diskInstanceName, const std::string &requesterName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteRequesterMountRule(diskInstanceName, requesterName);}, m_maxTriesToConnect);
-  }
+  std::map<std::string, std::string> getVidToLogicalLibrary(const std::set<std::string> &vids) const override;
 
-  void createRequesterGroupMountRule(const common::dataStructures::SecurityIdentity &admin, const std::string &mountPolicyName, const std::string &diskInstanceName, const std::string &requesterGroupName, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createRequesterGroupMountRule(admin, mountPolicyName, diskInstanceName, requesterGroupName, comment);}, m_maxTriesToConnect);
-  }
+  void reclaimTape(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, cta::log::LogContext & lc) override;
 
-  std::list<common::dataStructures::RequesterGroupMountRule> getRequesterGroupMountRules() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getRequesterGroupMountRules();}, m_maxTriesToConnect);
-  }
+  void checkTapeForLabel(const std::string &vid) override;
 
-  void deleteRequesterGroupMountRule(const std::string &diskInstanceName, const std::string &requesterGroupName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteRequesterGroupMountRule(diskInstanceName, requesterGroupName);}, m_maxTriesToConnect);
-  }
+  uint64_t getNbFilesOnTape(const std::string &vid) const override ;
 
-  void modifyMountPolicyArchivePriority(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t archivePriority) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyArchivePriority(admin, name, archivePriority);}, m_maxTriesToConnect);
-  }
+  void modifyTapeMediaType(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &mediaType) override;
 
-  void modifyMountPolicyArchiveMinRequestAge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t minArchiveRequestAge) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyArchiveMinRequestAge(admin, name, minArchiveRequestAge);}, m_maxTriesToConnect);
-  }
+  void modifyTapeVendor(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &vendor) override;
 
-  void modifyMountPolicyRetrievePriority(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t retrievePriority) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyRetrievePriority(admin, name, retrievePriority);}, m_maxTriesToConnect);
-  }
+  void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) override;
 
-  void modifyMountPolicyRetrieveMinRequestAge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t minRetrieveRequestAge) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyRetrieveMinRequestAge(admin, name, minRetrieveRequestAge);}, m_maxTriesToConnect);
-  }
+  void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) override;
 
-  void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyMountPolicyComment(admin, name, comment);}, m_maxTriesToConnect);
-  }
+  void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &encryptionKeyName) override;
 
-  disk::DiskSystemList getAllDiskSystems() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getAllDiskSystems();}, m_maxTriesToConnect);
-  }
+  void modifyTapeVerificationStatus(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &verificationStatus) override;
 
-  void createDiskSystem(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName, const std::string &diskInstanceSpaceName, const std::string &fileRegexp, const uint64_t targetedFreeSpace, const time_t sleepTime, const std::string &comment)  override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createDiskSystem(admin, name, diskInstanceName, diskInstanceSpaceName, fileRegexp, targetedFreeSpace, sleepTime, comment);}, m_maxTriesToConnect);
-  }
+  void modifyTapeState(const common::dataStructures::SecurityIdentity &admin,const std::string &vid, const common::dataStructures::Tape::State & state, const std::optional<std::string> & stateReason) override;
 
-  void deleteDiskSystem(const std::string &name) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteDiskSystem(name);}, m_maxTriesToConnect);
-  }
+  void setTapeFull(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const bool fullValue) override;
 
-  void modifyDiskSystemFileRegexp(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &fileRegexp) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemFileRegexp(admin, name, fileRegexp);}, m_maxTriesToConnect);
-  }
+  void setTapeDirty(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const bool dirtyValue) override;
 
-  void modifyDiskSystemTargetedFreeSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t targetedFreeSpace) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemTargetedFreeSpace(admin, name, targetedFreeSpace);}, m_maxTriesToConnect);
-  }
+  void setTapeIsFromCastorInUnitTests(const std::string &vid) override;
 
-  void modifyDiskSystemComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemComment(admin, name, comment);}, m_maxTriesToConnect);
-  }
+  void setTapeDisabled(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string & reason) override;
 
-  void modifyDiskSystemDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemDiskInstanceName(admin, name, diskInstanceName);}, m_maxTriesToConnect);
-  }
+  void setTapeDirty(const std::string & vid) override;
 
-  void modifyDiskSystemDiskInstanceSpaceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceSpaceName) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemDiskInstanceSpaceName(admin, name, diskInstanceSpaceName);}, m_maxTriesToConnect);
-  }
+  void modifyTapeComment(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::optional<std::string> &comment) override;
 
-  void modifyDiskSystemSleepTime(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t sleepTime) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskSystemSleepTime(admin, name, sleepTime);}, m_maxTriesToConnect);
-  }
+  void modifyRequesterActivityMountRulePolicy(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &activityRegex, const std::string &mountPolicy) override;
 
-  void createDiskInstance(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment)  override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createDiskInstance(admin, name, comment);}, m_maxTriesToConnect);
-  }
+  void modifyRequesterActivityMountRuleComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &activityRegex, const std::string &comment) override;
 
-  std::list<common::dataStructures::DiskInstance> getAllDiskInstances() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getAllDiskInstances();}, m_maxTriesToConnect);
-  }
+  void modifyRequesterMountRulePolicy(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &mountPolicy) override;
 
-  void deleteDiskInstance(const std::string &name) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteDiskInstance(name);}, m_maxTriesToConnect);
-  }
+  void modifyRequesteMountRuleComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterName, const std::string &comment) override;
 
-  void modifyDiskInstanceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskInstanceComment(admin, name, comment);}, m_maxTriesToConnect);
-  }
+  void modifyRequesterGroupMountRulePolicy(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterGroupName, const std::string &mountPolicy) override;
 
-  void createDiskInstanceSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL, const uint64_t refreshInterval, const std::string &comment) override{
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->createDiskInstanceSpace(admin, name, diskInstance, freeSpaceQueryURL, refreshInterval, comment);}, m_maxTriesToConnect);
-  }
+  void modifyRequesterGroupMountRuleComment(const common::dataStructures::SecurityIdentity &admin, const std::string &instanceName, const std::string &requesterGroupName, const std::string &comment) override;
 
-  std::list<common::dataStructures::DiskInstanceSpace> getAllDiskInstanceSpaces() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getAllDiskInstanceSpaces();}, m_maxTriesToConnect);
-  }
+  void createMountPolicy(const common::dataStructures::SecurityIdentity &admin, const CreateMountPolicyAttributes & mountPolicy) override;
 
-  void deleteDiskInstanceSpace(const std::string &name, const std::string &diskInstance) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteDiskInstanceSpace(name, diskInstance);}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::MountPolicy> getMountPolicies() const override;
 
-  void modifyDiskInstanceSpaceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &comment) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskInstanceSpaceComment(admin, name, diskInstance, comment);}, m_maxTriesToConnect);
-  }
+  std::optional<common::dataStructures::MountPolicy> getMountPolicy(const std::string &mountPolicyName) const override;
 
-  void modifyDiskInstanceSpaceRefreshInterval(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const uint64_t refreshInterval) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskInstanceSpaceRefreshInterval(admin, name, diskInstance, refreshInterval);}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::MountPolicy> getCachedMountPolicies() const override;
 
-  void modifyDiskInstanceSpaceQueryURL(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskInstanceSpaceQueryURL(admin, name, diskInstance, freeSpaceQueryURL);}, m_maxTriesToConnect);
-  }
+  void deleteMountPolicy(const std::string &name) override;
 
-  void modifyDiskInstanceSpaceFreeSpace(const std::string &name, const std::string &diskInstance, const uint64_t freeSpace) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyDiskInstanceSpaceFreeSpace(name, diskInstance, freeSpace);}, m_maxTriesToConnect); 
-  }
+  void createRequesterActivityMountRule(const common::dataStructures::SecurityIdentity &admin, const std::string &mountPolicyName, const std::string &diskInstance, const std::string &requesterName, const std::string &activityRegex, const std::string &comment) override;
 
-  ArchiveFileItor getArchiveFilesItor(const TapeFileSearchCriteria &searchCriteria) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFilesItor(searchCriteria);}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::RequesterActivityMountRule> getRequesterActivityMountRules() const override;
 
-  FileRecycleLogItor getFileRecycleLogItor(const RecycleTapeFileSearchCriteria & searchCriteria) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getFileRecycleLogItor(searchCriteria);}, m_maxTriesToConnect);
-  }
+  void deleteRequesterActivityMountRule(const std::string &diskInstanceName, const std::string &requesterName, const std::string &activityRegex) override;
 
-  void restoreFileInRecycleLog(const RecycleTapeFileSearchCriteria & searchCriteria, const std::string &newFid) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->restoreFileInRecycleLog(searchCriteria, newFid);}, m_maxTriesToConnect);
-  }
+  void createRequesterMountRule(const common::dataStructures::SecurityIdentity &admin, const std::string &mountPolicyName, const std::string &diskInstance, const std::string &requesterName, const std::string &comment) override;
 
-  void deleteFileFromRecycleBin(const uint64_t archiveFileId, log::LogContext &lc){
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->deleteFileFromRecycleBin(archiveFileId,lc);},m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::RequesterMountRule> getRequesterMountRules() const override;
 
-  /**
-   * Deletes all the log entries corresponding to the vid passed in parameter.
-   *
-   * Please note that this method is idempotent.  If there are no recycle log
-   * entries associated to the vid passed in parameter, the method will return
-   * without any error.
-   *
-   * @param vid, the vid of the files to be deleted
-   * @param lc, the logContext
-   */
-  void deleteFilesFromRecycleLog(const std::string & vid, log::LogContext & lc){
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->deleteFilesFromRecycleLog(vid,lc);},m_maxTriesToConnect);
-  }
+  void deleteRequesterMountRule(const std::string &diskInstanceName, const std::string &requesterName) override;
+
+  void createRequesterGroupMountRule(const common::dataStructures::SecurityIdentity &admin, const std::string &mountPolicyName, const std::string &diskInstanceName, const std::string &requesterGroupName, const std::string &comment) override;
+
+  std::list<common::dataStructures::RequesterGroupMountRule> getRequesterGroupMountRules() const override;
+
+  void deleteRequesterGroupMountRule(const std::string &diskInstanceName, const std::string &requesterGroupName) override;
+
+  void modifyMountPolicyArchivePriority(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t archivePriority) override;
+
+  void modifyMountPolicyArchiveMinRequestAge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t minArchiveRequestAge) override;
+
+  void modifyMountPolicyRetrievePriority(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t retrievePriority) override;
+
+  void modifyMountPolicyRetrieveMinRequestAge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t minRetrieveRequestAge) override;
+
+  void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
+
+  disk::DiskSystemList getAllDiskSystems() const override;
+
+  void createDiskSystem(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName, const std::string &diskInstanceSpaceName, const std::string &fileRegexp, const uint64_t targetedFreeSpace, const time_t sleepTime, const std::string &comment) override;
+
+  void deleteDiskSystem(const std::string &name) override;
 
-  std::list<common::dataStructures::ArchiveFile> getFilesForRepack(const std::string &vid, const uint64_t startFSeq, const uint64_t maxNbFiles) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getFilesForRepack(vid, startFSeq, maxNbFiles);}, m_maxTriesToConnect);
-  }
+  void modifyDiskSystemFileRegexp(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &fileRegexp) override;
 
-  ArchiveFileItor getArchiveFilesForRepackItor(const std::string &vid, const uint64_t startFSeq) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFilesForRepackItor(vid, startFSeq);}, m_maxTriesToConnect);
-  }
+  void modifyDiskSystemTargetedFreeSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t targetedFreeSpace) override;
 
-  common::dataStructures::ArchiveFileSummary getTapeFileSummary(const TapeFileSearchCriteria &searchCriteria) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getTapeFileSummary(searchCriteria);}, m_maxTriesToConnect);
-  }
+  void modifyDiskSystemComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
 
-  common::dataStructures::ArchiveFile getArchiveFileForDeletion(const TapeFileSearchCriteria &searchCriteria = TapeFileSearchCriteria()) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFileForDeletion(searchCriteria);}, m_maxTriesToConnect);
-  }
+  void modifyDiskSystemDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName) override;
 
-  void deleteTapeFileCopy(common::dataStructures::ArchiveFile &file, const std::string &reason) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->deleteTapeFileCopy(file, reason);}, m_maxTriesToConnect);
-  }
+  void modifyDiskSystemDiskInstanceSpaceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceSpaceName) override;
 
-  common::dataStructures::ArchiveFile getArchiveFileById(const uint64_t id) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getArchiveFileById(id);}, m_maxTriesToConnect);
-  }
+  void modifyDiskSystemSleepTime(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t sleepTime) override;
 
-  void DO_NOT_USE_deleteArchiveFile_DO_NOT_USE(const std::string &instanceName, const uint64_t archiveFileId, log::LogContext &lc) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->DO_NOT_USE_deleteArchiveFile_DO_NOT_USE(instanceName, archiveFileId, lc);}, m_maxTriesToConnect);
-  }
+  void createDiskInstance(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
 
-  bool isAdmin(const common::dataStructures::SecurityIdentity &admin) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->isAdmin(admin);}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::DiskInstance> getAllDiskInstances() const override;
 
-  void ping() override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->ping();}, m_maxTriesToConnect);
-  }
+  void deleteDiskInstance(const std::string &name) override;
 
-  void verifySchemaVersion() override{
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->verifySchemaVersion();}, m_maxTriesToConnect);
-  }
+  void modifyDiskInstanceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
 
-  SchemaVersion getSchemaVersion() const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getSchemaVersion();}, m_maxTriesToConnect);
-  }
+  void createDiskInstanceSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL, const uint64_t refreshInterval, const std::string &comment) override;
 
-  bool tapePoolExists(const std::string &tapePoolName) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->tapePoolExists(tapePoolName);}, m_maxTriesToConnect);
-  }
+  std::list<common::dataStructures::DiskInstanceSpace> getAllDiskInstanceSpaces() const override;
 
-  bool tapeExists(const std::string &vid) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->tapeExists(vid);}, m_maxTriesToConnect);
-  }
+  void deleteDiskInstanceSpace(const std::string &name, const std::string &diskInstance) override;
 
-  bool diskSystemExists(const std::string &name) const override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->diskSystemExists(name);}, m_maxTriesToConnect);
-  }
+  void modifyDiskInstanceSpaceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &comment) override;
 
-  void updateDiskFileId(uint64_t archiveFileId, const std::string &diskInstance, const std::string &diskFileId) override {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->updateDiskFileId(archiveFileId, diskInstance, diskFileId);}, m_maxTriesToConnect);
-  }
+  void modifyDiskInstanceSpaceRefreshInterval(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const uint64_t refreshInterval) override;
 
-  void moveArchiveFileToRecycleLog(const common::dataStructures::DeleteArchiveRequest &request,
-  log::LogContext & lc) override {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->moveArchiveFileToRecycleLog(request,lc);},m_maxTriesToConnect);
-  }
+  void modifyDiskInstanceSpaceQueryURL(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL) override;
 
-  void createTapeDrive(const common::dataStructures::TapeDrive &tapeDrive) override {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->createTapeDrive(tapeDrive);},m_maxTriesToConnect);
-  }
+  void modifyDiskInstanceSpaceFreeSpace(const std::string &name, const std::string &diskInstance, const uint64_t freeSpace) override;
 
-  std::list<std::string> getTapeDriveNames() const override {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDriveNames();},m_maxTriesToConnect);
-  }
+  ArchiveFileItor getArchiveFilesItor(const TapeFileSearchCriteria &searchCriteria) const override;
 
-  std::list<common::dataStructures::TapeDrive> getTapeDrives() const override {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDrives();},m_maxTriesToConnect);
-  }
+  FileRecycleLogItor getFileRecycleLogItor(const RecycleTapeFileSearchCriteria & searchCriteria) const override;
 
-  std::optional<common::dataStructures::TapeDrive> getTapeDrive(const std::string &tapeDriveName) const override {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDrive(tapeDriveName);},m_maxTriesToConnect);
-  }
+  void restoreFileInRecycleLog(const RecycleTapeFileSearchCriteria & searchCriteria, const std::string &newFid) override;
+
+  void deleteFileFromRecycleBin(const uint64_t archiveFileId, log::LogContext &lc) override;
+
+  void deleteFilesFromRecycleLog(const std::string & vid, log::LogContext & lc) override;
+
+  std::list<common::dataStructures::ArchiveFile> getFilesForRepack(const std::string &vid, const uint64_t startFSeq, const uint64_t maxNbFiles) const override;
+
+  ArchiveFileItor getArchiveFilesForRepackItor(const std::string &vid, const uint64_t startFSeq) const override;
+
+  common::dataStructures::ArchiveFileSummary getTapeFileSummary(const TapeFileSearchCriteria &searchCriteria) const override;
+
+  common::dataStructures::ArchiveFile getArchiveFileForDeletion(const TapeFileSearchCriteria &searchCriteria = TapeFileSearchCriteria()) const override;
+
+  void deleteTapeFileCopy(common::dataStructures::ArchiveFile &file, const std::string &reason) override;
+
+  common::dataStructures::ArchiveFile getArchiveFileById(const uint64_t id) const override;
+
+  void DO_NOT_USE_deleteArchiveFile_DO_NOT_USE(const std::string &instanceName, const uint64_t archiveFileId, log::LogContext &lc) override;
+
+  bool isAdmin(const common::dataStructures::SecurityIdentity &admin) const override;
+
+  void ping() override;
+
+  void verifySchemaVersion() override;
+
+  SchemaVersion getSchemaVersion() const override;
+
+  bool tapePoolExists(const std::string &tapePoolName) const override;
+
+  bool tapeExists(const std::string &vid) const;
+
+  bool diskSystemExists(const std::string &name) const override;
+
+  void updateDiskFileId(uint64_t archiveFileId, const std::string &diskInstance, const std::string &diskFileId) override;
+
+  void moveArchiveFileToRecycleLog(const common::dataStructures::DeleteArchiveRequest &request, log::LogContext & lc) override;
+
+  void createTapeDrive(const common::dataStructures::TapeDrive &tapeDrive) override;
+
+  std::list<std::string> getTapeDriveNames() const override;
+
+  std::list<common::dataStructures::TapeDrive> getTapeDrives() const override;
+
+  std::optional<common::dataStructures::TapeDrive> getTapeDrive(const std::string &tapeDriveName) const override;
 
   void setDesiredTapeDriveState(const std::string& tapeDriveName,
-    const common::dataStructures::DesiredDriveState &desiredState) override {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->setDesiredTapeDriveState(tapeDriveName, desiredState);}, m_maxTriesToConnect);
-  }
+    const common::dataStructures::DesiredDriveState &desiredState) override;
 
-  void setDesiredTapeDriveStateComment(const std::string& tapeDriveName,
-    const std::string &comment) override {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->setDesiredTapeDriveStateComment(tapeDriveName, comment);}, m_maxTriesToConnect);
-  }
+  void setDesiredTapeDriveStateComment(const std::string& tapeDriveName, const std::string &comment) override;
 
   void updateTapeDriveStatistics(const std::string& tapeDriveName,
     const std::string& host, const std::string& logicalLibrary,
-    const common::dataStructures::TapeDriveStatistics& statistics) override {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->updateTapeDriveStatistics(tapeDriveName, host, logicalLibrary, statistics);}, m_maxTriesToConnect);
-  }
+    const common::dataStructures::TapeDriveStatistics& statistics) override;
 
-  void updateTapeDriveStatus(const common::dataStructures::TapeDrive &tapeDrive) override {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->updateTapeDriveStatus(tapeDrive);}, m_maxTriesToConnect);
-  }
+  void updateTapeDriveStatus(const common::dataStructures::TapeDrive &tapeDrive) override;
 
-  void deleteTapeDrive(const std::string &tapeDriveName) override {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->deleteTapeDrive(tapeDriveName);},m_maxTriesToConnect);
-  }
+  void deleteTapeDrive(const std::string &tapeDriveName) override;
 
   void createTapeDriveConfig(const std::string &driveName, const std::string &category,
-    const std::string &keyName, const std::string &value, const std::string &source) {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->createTapeDriveConfig(driveName, category, keyName, value, source);},m_maxTriesToConnect);
-  }
+    const std::string &keyName, const std::string &value, const std::string &source) override;
 
-  std::list<cta::catalogue::Catalogue::DriveConfig> getTapeDriveConfigs() const {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDriveConfigs();},m_maxTriesToConnect);
-  }
+  std::list<cta::catalogue::Catalogue::DriveConfig> getTapeDriveConfigs() const override;
 
-  std::list<std::pair<std::string, std::string>> getTapeDriveConfigNamesAndKeys() const {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDriveConfigNamesAndKeys();},m_maxTriesToConnect);
-  }
+  std::list<std::pair<std::string, std::string>> getTapeDriveConfigNamesAndKeys() const override;
 
   void modifyTapeDriveConfig(const std::string &driveName, const std::string &category,
-    const std::string &keyName, const std::string &value, const std::string &source) {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->modifyTapeDriveConfig(driveName, category, keyName, value, source);},m_maxTriesToConnect);
-  }
+    const std::string &keyName, const std::string &value, const std::string &source) override;
 
   std::optional<std::tuple<std::string, std::string, std::string>> getTapeDriveConfig( const std::string &tapeDriveName,
-    const std::string &keyName) const {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->getTapeDriveConfig(tapeDriveName, keyName);},m_maxTriesToConnect);
-  }
+    const std::string &keyName) const override;
 
-  void deleteTapeDriveConfig(const std::string &tapeDriveName, const std::string &keyName) {
-    return retryOnLostConnection(m_log,[&]{return m_catalogue->deleteTapeDriveConfig(tapeDriveName, keyName);},m_maxTriesToConnect);
-  }
+  void deleteTapeDriveConfig(const std::string &tapeDriveName, const std::string &keyName) override;
 
-  std::map<std::string, uint64_t> getDiskSpaceReservations() const {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->getDiskSpaceReservations();}, m_maxTriesToConnect);
-  }
+  std::map<std::string, uint64_t> getDiskSpaceReservations() const override;
 
-  void reserveDiskSpace(const std::string& driveName, const uint64_t mountId, const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->reserveDiskSpace(driveName, mountId, diskSpaceReservation, lc);}, m_maxTriesToConnect);
-  }
+  void reserveDiskSpace(const std::string& driveName, const uint64_t mountId, const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) override;
 
-  void releaseDiskSpace(const std::string& driveName, const uint64_t mountId, const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) {
-    return retryOnLostConnection(m_log, [&]{return m_catalogue->releaseDiskSpace(driveName, mountId, diskSpaceReservation, lc);}, m_maxTriesToConnect);
-  }
+  void releaseDiskSpace(const std::string& driveName, const uint64_t mountId, const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) override;
 
 protected:
-
   /**
    * Object representing the API to the CTA logging system.
    */
@@ -799,8 +423,7 @@ protected:
    * database in the event of LostDatabaseConnection exceptions being thrown.
    */
   uint32_t m_maxTriesToConnect;
+};  // class CatalogueRetryWrapper
 
-}; // class CatalogueRetryWrapper
-
-} // namespace catalogue
-} // namespace cta
+}  // namespace catalogue
+}  // namespace cta
diff --git a/catalogue/CatalogueTest.cpp b/catalogue/CatalogueTest.cpp
index a9a474d235f5c968408bd846ece3c40d2a676a0d..c9ed269d8ab399274ab48df868f960df58f9f236 100644
--- a/catalogue/CatalogueTest.cpp
+++ b/catalogue/CatalogueTest.cpp
@@ -15,34 +15,53 @@
  *               submit itself to any jurisdiction.
  */
 
-#include "catalogue/ArchiveFileRow.hpp"
+#include <gtest/gtest.h>
+
+#include <algorithm>
+#include <iomanip>
+#include <limits>
+#include <list>
+#include <map>
+#include <memory>
+#include <set>
+#include <string>
+
 #include "catalogue/CatalogueTest.hpp"
+#include "catalogue/CreateMountPolicyAttributes.hpp"
+#include "catalogue/InsertFileRecycleLog.hpp"
+#include "catalogue/RdbmsCatalogue.hpp"
 #include "catalogue/SchemaVersion.hpp"
 #include "catalogue/TapeDrivesCatalogueState.hpp"
+#include "catalogue/TapeForWriting.hpp"
+#include "catalogue/TapeItemWrittenPointer.hpp"
 #include "common/Constants.hpp"
+#include "common/dataStructures/AdminUser.hpp"
+#include "common/dataStructures/ArchiveFileQueueCriteria.hpp"
+#include "common/dataStructures/ArchiveFileSummary.hpp"
+#include "common/dataStructures/ArchiveRoute.hpp"
+#include "common/dataStructures/DeleteArchiveRequest.hpp"
+#include "common/dataStructures/DesiredDriveState.hpp"
 #include "common/dataStructures/DriveInfo.hpp"
 #include "common/dataStructures/EntryLog.hpp"
+#include "common/dataStructures/FileRecycleLog.hpp"
+#include "common/dataStructures/LogicalLibrary.hpp"
+#include "common/dataStructures/RequesterActivityMountRule.hpp"
+#include "common/dataStructures/RequesterGroupMountRule.hpp"
+#include "common/dataStructures/RequesterMountRule.hpp"
+#include "common/dataStructures/RetrieveFileQueueCriteria.hpp"
+#include "common/dataStructures/SecurityIdentity.hpp"
+#include "common/dataStructures/Tape.hpp"
+#include "common/dataStructures/TapeDrive.hpp"
 #include "common/exception/Exception.hpp"
+#include "common/exception/FileSizeMismatch.hpp"
+#include "common/exception/TapeFseqMismatch.hpp"
 #include "common/exception/UserError.hpp"
 #include "common/exception/UserErrorWithCacheInfo.hpp"
 #include "common/SourcedParameter.hpp"
 #include "common/threading/Mutex.hpp"
 #include "common/threading/MutexLocker.hpp"
 #include "common/threading/Thread.hpp"
-#include "InsertFileRecycleLog.hpp"
-#include "rdbms/Conn.hpp"
-#include "rdbms/wrapper/ConnFactoryFactory.hpp"
-#include "RdbmsCatalogue.hpp"
-
-#include <algorithm>
-#include <gtest/gtest.h>
-#include <iomanip>
-#include <limits>
-#include <list>
-#include <map>
-#include <memory>
-#include <set>
-#include <string>
+#include "disk/DiskSystem.hpp"
 
 namespace unitTests {
 
diff --git a/catalogue/CatalogueTest.hpp b/catalogue/CatalogueTest.hpp
index 952dd768b451bf3be527a1449afbea3dc43d7896..675b367cac6e1177c99894645f25a9446b528b09 100644
--- a/catalogue/CatalogueTest.hpp
+++ b/catalogue/CatalogueTest.hpp
@@ -17,26 +17,36 @@
 
 #pragma once
 
-#include "catalogue/ArchiveFileRow.hpp"
-#include "catalogue/CatalogueFactory.hpp"
-#include "catalogue/CreateTapeAttributes.hpp"
-#include "common/exception/Exception.hpp"
-#include "common/log/DummyLogger.hpp"
-
 #include <gtest/gtest.h>
+
+#include <list>
 #include <map>
 #include <memory>
 #include <set>
+#include <string>
+
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/CatalogueFactory.hpp"
+#include "catalogue/CatalogueItor.hpp"
+#include "catalogue/CreateTapeAttributes.hpp"
+#include "catalogue/MediaTypeWithLogs.hpp"
+#include "catalogue/TapePool.hpp"
+#include "common/dataStructures/AdminUser.hpp"
+#include "common/dataStructures/ArchiveFile.hpp"
+#include "common/dataStructures/DiskInstance.hpp"
+#include "common/dataStructures/LogicalLibrary.hpp"
+#include "common/dataStructures/SecurityIdentity.hpp"
+#include "common/dataStructures/StorageClass.hpp"
+#include "common/dataStructures/VirtualOrganization.hpp"
+#include "common/log/DummyLogger.hpp"
 
 namespace unitTests {
 
 class cta_catalogue_CatalogueTest : public ::testing::TestWithParam<cta::catalogue::CatalogueFactory **> {
 public:
-
   cta_catalogue_CatalogueTest();
 
 protected:
-
   cta::log::DummyLogger m_dummyLog;
   std::unique_ptr<cta::catalogue::Catalogue> m_catalogue;
   const cta::common::dataStructures::SecurityIdentity m_localAdmin;
@@ -128,6 +138,6 @@ protected:
   std::map<std::string, cta::catalogue::TapePool> tapePoolListToMap(
     const std::list<cta::catalogue::TapePool> &listOfTapePools);
 
-}; // cta_catalogue_CatalogueTest
+};  // cta_catalogue_CatalogueTest
 
-} // namespace unitTests
+}  // namespace unitTests
diff --git a/catalogue/CreateAdminUserCmd.cpp b/catalogue/CreateAdminUserCmd.cpp
index 4ca49c10f4cb94c635b65290a0bc794af479e13b..fa813c4f199a640c6512b47e038ce4fa076da8e9 100644
--- a/catalogue/CreateAdminUserCmd.cpp
+++ b/catalogue/CreateAdminUserCmd.cpp
@@ -15,9 +15,12 @@
  *               submit itself to any jurisdiction.
  */
 
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/CatalogueFactory.hpp"
 #include "catalogue/CatalogueFactoryFactory.hpp"
 #include "catalogue/CreateAdminUserCmd.hpp"
 #include "catalogue/CreateAdminUserCmdLineArgs.hpp"
+#include "common/dataStructures/SecurityIdentity.hpp"
 #include "common/log/DummyLogger.hpp"
 #include "rdbms/wrapper/ConnFactoryFactory.hpp"
 
diff --git a/catalogue/CreateAdminUserCmd.hpp b/catalogue/CreateAdminUserCmd.hpp
index e7f02fcd1d24cb88d63016198d070cb18d8f4b66..e27a46a152ac19e4d1e59a74ea2b3f4bd8721f41 100644
--- a/catalogue/CreateAdminUserCmd.hpp
+++ b/catalogue/CreateAdminUserCmd.hpp
@@ -17,7 +17,6 @@
 
 #pragma once
 
-#include "catalogue/Catalogue.hpp"
 #include "catalogue/CmdLineTool.hpp"
 
 namespace cta {
@@ -28,7 +27,6 @@ namespace catalogue {
  */
 class CreateAdminUserCmd: public CmdLineTool {
 public:
-
   /**
    * Constructor.
    *
@@ -44,7 +42,6 @@ public:
   ~CreateAdminUserCmd() noexcept;
 
 private:
-
   /**
    * An exception throwing version of main().
    *
@@ -60,8 +57,7 @@ private:
    * @param os The output stream to which the usage message is to be printed.
    */
   void printUsage(std::ostream &os) override;
+};  // class CreateAdminUserCmd
 
-}; // class CreateAdminUserCmd
-
-} // namespace catalogue
-} // namespace cta
+}  // namespace catalogue
+}  // namespace cta
diff --git a/catalogue/CreateMountPolicyAttributes.hpp b/catalogue/CreateMountPolicyAttributes.hpp
index afc89b67ad194fde2d688fad84ebd02f5289b604..377de718d6a1a357c4c4f0d959c7a0fcdad50ca6 100644
--- a/catalogue/CreateMountPolicyAttributes.hpp
+++ b/catalogue/CreateMountPolicyAttributes.hpp
@@ -17,21 +17,19 @@
 
 #pragma once
 
-#include "common/dataStructures/Tape.hpp"
-
 #include <optional>
 #include <string>
 
 namespace cta {
 namespace catalogue {
 
-  struct CreateMountPolicyAttributes {
-    std::string name;
-    uint64_t archivePriority;
-    uint64_t minArchiveRequestAge;
-    uint64_t retrievePriority;
-    uint64_t minRetrieveRequestAge;
-    std::string comment;
-  };
+struct CreateMountPolicyAttributes {
+  std::string name;
+  uint64_t archivePriority;
+  uint64_t minArchiveRequestAge;
+  uint64_t retrievePriority;
+  uint64_t minRetrieveRequestAge;
+  std::string comment;
+};
 
 }}
diff --git a/catalogue/DatabaseMetadataGetter.cpp b/catalogue/DatabaseMetadataGetter.cpp
index 0172829ff1a99969c496919c5b43381e97c8da5d..9fa1b004a86fb8e6e9e50e13242d1542a1bae97b 100644
--- a/catalogue/DatabaseMetadataGetter.cpp
+++ b/catalogue/DatabaseMetadataGetter.cpp
@@ -15,9 +15,11 @@
  *               submit itself to any jurisdiction.
  */
 
-#include "DatabaseMetadataGetter.hpp"
 #include <algorithm>
 
+#include "catalogue/DatabaseMetadataGetter.hpp"
+#include "common/utils/Regex.hpp"
+
 namespace cta {
 namespace catalogue {
 
diff --git a/catalogue/DatabaseMetadataGetter.hpp b/catalogue/DatabaseMetadataGetter.hpp
index 9345a9813d6e6d755c452929385f80b16933e3d5..2619824de4c4353658ecc2a206035d3710d41941 100644
--- a/catalogue/DatabaseMetadataGetter.hpp
+++ b/catalogue/DatabaseMetadataGetter.hpp
@@ -17,20 +17,27 @@
 
 #pragma once
 
+#include <list>
+#include <map>
+#include <memory>
+#include <set>
+#include <string>
+
+#include "catalogue/SchemaCreatingSqliteCatalogue.hpp"
+#include "catalogue/SchemaVersion.hpp"
 #include "rdbms/Conn.hpp"
 #include "rdbms/Login.hpp"
-#include "SchemaCreatingSqliteCatalogue.hpp"
-#include "SchemaVersion.hpp"
-#include <list>
 
 namespace cta {
-namespace catalogue {
+namespace utils {
+class Regex;
+}
 
+namespace catalogue {
 /**
  * Interface class to get database metadata
  */
 class MetadataGetter{
-
 protected:
   void removeObjectNameContaining(std::list<std::string>& objects, const std::list<std::string> &wordsToTriggerRemoval);
   void removeObjectNameNotContaining(std::list<std::string>& objects, const std::list<std::string> &wordsNotToTriggerRemoval);
@@ -39,7 +46,7 @@ protected:
 public:
   virtual std::list<std::string> getIndexNames() = 0;
   virtual std::list<std::string> getTableNames() = 0;
-  virtual std::map<std::string,std::string> getColumns(const std::string& tableName) = 0;
+  virtual std::map<std::string, std::string> getColumns(const std::string& tableName) = 0;
   virtual std::list<std::string> getConstraintNames(const std::string& tableName) = 0;
   virtual ~MetadataGetter() = 0;
 };
@@ -49,31 +56,31 @@ public:
  * It will simply call the methods from the connection (Conn) instance and adapt or not the metadata returned.
  */
 class DatabaseMetadataGetter: public MetadataGetter {
-  protected:
-    rdbms::Conn& m_conn;
-  public:
-    DatabaseMetadataGetter(cta::rdbms::Conn & conn);
-    virtual ~DatabaseMetadataGetter();
-    SchemaVersion getCatalogueVersion();
-    virtual std::list<std::string> getIndexNames();
-    virtual std::list<std::string> getTableNames();
-    virtual std::map<std::string,std::string> getColumns(const std::string& tableName);
-    virtual std::list<std::string> getConstraintNames(const std::string& tableName);
-    virtual std::list<std::string> getParallelTableNames();
-    virtual cta::rdbms::Login::DbType getDbType() = 0;
-    virtual std::list<std::string> getStoredProcedures();
-    virtual std::list<std::string> getSynonyms();
-    virtual std::list<std::string> getTypes();
-    /**
-     * Returns ERROR logging tables.
-     * (Oracle only : ERR$_TABLE_NAME)
-     * @return the ERROR logging tables (Oracle only)
-     */
-    virtual std::list<std::string> getErrorLoggingTables();
-    /**
-     * Returns a set of columns which are part of a foreign key constraint but have no index defined
-     */
-    virtual std::set<std::string> getMissingIndexes() = 0;
+protected:
+  rdbms::Conn& m_conn;
+public:
+  explicit DatabaseMetadataGetter(cta::rdbms::Conn & conn);
+  virtual ~DatabaseMetadataGetter();
+  SchemaVersion getCatalogueVersion();
+  virtual std::list<std::string> getIndexNames();
+  virtual std::list<std::string> getTableNames();
+  virtual std::map<std::string, std::string> getColumns(const std::string& tableName);
+  virtual std::list<std::string> getConstraintNames(const std::string& tableName);
+  virtual std::list<std::string> getParallelTableNames();
+  virtual cta::rdbms::Login::DbType getDbType() = 0;
+  virtual std::list<std::string> getStoredProcedures();
+  virtual std::list<std::string> getSynonyms();
+  virtual std::list<std::string> getTypes();
+  /**
+    * Returns ERROR logging tables.
+    * (Oracle only : ERR$_TABLE_NAME)
+    * @return the ERROR logging tables (Oracle only)
+    */
+  virtual std::list<std::string> getErrorLoggingTables();
+  /**
+    * Returns a set of columns which are part of a foreign key constraint but have no index defined
+    */
+  virtual std::set<std::string> getMissingIndexes() = 0;
 };
 
 /**
@@ -81,12 +88,12 @@ class DatabaseMetadataGetter: public MetadataGetter {
  */
 class SQLiteDatabaseMetadataGetter: public DatabaseMetadataGetter{
 public:
-  SQLiteDatabaseMetadataGetter(cta::rdbms::Conn& conn);
+  explicit SQLiteDatabaseMetadataGetter(cta::rdbms::Conn& conn);
   virtual ~SQLiteDatabaseMetadataGetter();
   std::list<std::string> getIndexNames() override;
   std::list<std::string> getTableNames() override;
   cta::rdbms::Login::DbType getDbType() override;
-  virtual std::set<std::string> getMissingIndexes() override;
+  std::set<std::string> getMissingIndexes() override;
 };
 
 /**
@@ -94,11 +101,11 @@ public:
  */
 class OracleDatabaseMetadataGetter: public DatabaseMetadataGetter{
 public:
-  OracleDatabaseMetadataGetter(cta::rdbms::Conn& conn);
+  explicit OracleDatabaseMetadataGetter(cta::rdbms::Conn& conn);
   virtual ~OracleDatabaseMetadataGetter();
   cta::rdbms::Login::DbType getDbType() override;
   std::list<std::string> getTableNames() override;
-  virtual std::set<std::string> getMissingIndexes() override;
+  std::set<std::string> getMissingIndexes() override;
 };
 
 /**
@@ -106,10 +113,10 @@ public:
  */
 class PostgresDatabaseMetadataGetter: public DatabaseMetadataGetter{
 public:
-  PostgresDatabaseMetadataGetter(cta::rdbms::Conn& conn);
+  explicit PostgresDatabaseMetadataGetter(cta::rdbms::Conn& conn);
   virtual ~PostgresDatabaseMetadataGetter();
   cta::rdbms::Login::DbType getDbType() override;
-  virtual std::set<std::string> getMissingIndexes() override;
+  std::set<std::string> getMissingIndexes() override;
 };
 
 /**
@@ -129,14 +136,15 @@ public:
 class SchemaMetadataGetter: public MetadataGetter{
 protected:
   std::unique_ptr<SQLiteDatabaseMetadataGetter> m_sqliteDatabaseMetadataGetter;
-  //The database type we would like to compare the SQLite schema against (used for filtering the results)
+  // The database type we would like to compare the SQLite schema against (used for filtering the results)
   cta::rdbms::Login::DbType m_dbType;
 public:
   SchemaMetadataGetter(std::unique_ptr<SQLiteDatabaseMetadataGetter> sqliteCatalogueMetadataGetter, const cta::rdbms::Login::DbType dbType);
-  virtual std::list<std::string> getIndexNames() override;
-  virtual std::list<std::string> getTableNames() override;
-  virtual std::map<std::string,std::string> getColumns(const std::string& tableName) override;
-  virtual std::list<std::string> getConstraintNames(const std::string& tableName) override;
+  std::list<std::string> getIndexNames() override;
+  std::list<std::string> getTableNames() override;
+  std::map<std::string, std::string> getColumns(const std::string& tableName) override;
+  std::list<std::string> getConstraintNames(const std::string& tableName) override;
 };
 
-}}
+}  // namespace catalogue
+}  // namespace cta
diff --git a/catalogue/DriveConfig.cpp b/catalogue/DriveConfig.cpp
index e9420ffa2a21c1c1b9eda3ff568c1d2a402588a4..f970b0f02bc90ed1f070def4ee2b0da4ba2ce2f3 100644
--- a/catalogue/DriveConfig.cpp
+++ b/catalogue/DriveConfig.cpp
@@ -19,9 +19,10 @@
 #include <string>
 #include <utility>
 
-#include "DriveConfig.hpp"
-#include "tapeserver/daemon/FetchReportOrFlushLimits.hpp"
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/DriveConfig.hpp"
 #include "common/SourcedParameter.hpp"
+#include "tapeserver/daemon/FetchReportOrFlushLimits.hpp"
 
 namespace cta {
 
diff --git a/catalogue/DriveConfig.hpp b/catalogue/DriveConfig.hpp
index 225cdc1a93d53cd6d60410bf7622690ce124cdee..e98c686e4ee7f7be452aaa487def566b88b51b81 100644
--- a/catalogue/DriveConfig.hpp
+++ b/catalogue/DriveConfig.hpp
@@ -20,12 +20,15 @@
 #include <memory>
 #include <string>
 
-#include "catalogue/Catalogue.hpp"
 #include "common/SourcedParameter.hpp"
 #include "tapeserver/daemon/TapedConfiguration.hpp"
 
 namespace cta {
 
+namespace catalogue {
+class Catalogue;
+}
+
 /**
  * Static class to set TapedConfiguration in Database
  */
diff --git a/catalogue/DropSchemaCmd.hpp b/catalogue/DropSchemaCmd.hpp
index b4212fea623d4f7f26bb8e8cfb9d3ed94e51c569..d049cd3e9b8d53a9d57559c8f8b7dd79a47be73a 100644
--- a/catalogue/DropSchemaCmd.hpp
+++ b/catalogue/DropSchemaCmd.hpp
@@ -17,7 +17,6 @@
 
 #pragma once
 
-#include "catalogue/Catalogue.hpp"
 #include "catalogue/CmdLineTool.hpp"
 #include "rdbms/Conn.hpp"
 #include "rdbms/Login.hpp"
@@ -30,7 +29,6 @@ namespace catalogue {
  */
 class DropSchemaCmd: public CmdLineTool {
 public:
-
   /**
    * Constructor.
    *
@@ -52,7 +50,6 @@ public:
   static bool isProductionSet(rdbms::Conn & conn);
 
 private:
-
   /**
    * An exception throwing version of main().
    *
@@ -109,8 +106,7 @@ private:
    * @return true if the production bit is set, false otherwise
    */
   bool isProductionProtectionCheckable(rdbms::Conn & conn, const cta::rdbms::Login::DbType dbType);
+};  // class DropSchemaCmd
 
-}; // class DropSchemaCmd
-
-} // namespace catalogue
-} // namespace cta
+}  // namespace catalogue
+}  // namespace cta
diff --git a/catalogue/DummyCatalogue.cpp b/catalogue/DummyCatalogue.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..ed7c365e2585f440e265f0129e5aaf7e2a2d850b
--- /dev/null
+++ b/catalogue/DummyCatalogue.cpp
@@ -0,0 +1,427 @@
+/*
+ * @project      The CERN Tape Archive (CTA)
+ * @copyright    Copyright © 2021-2022 CERN
+ * @license      This program is free software, distributed under the terms of the GNU General Public
+ *               Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". You can
+ *               redistribute it and/or modify it under the terms of the GPL Version 3, or (at your
+ *               option) any later version.
+ *
+ *               This program 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.
+ *
+ *               In applying this licence, CERN does not waive the privileges and immunities
+ *               granted to it by virtue of its status as an Intergovernmental Organization or
+ *               submit itself to any jurisdiction.
+ */
+
+#include <list>
+#include <map>
+
+#include "catalogue/CatalogueItor.hpp"
+#include "catalogue/DummyCatalogue.hpp"
+#include "catalogue/MediaType.hpp"
+#include "catalogue/SchemaVersion.hpp"
+#include "catalogue/TapePool.hpp"
+#include "common/dataStructures/ArchiveFile.hpp"
+#include "common/dataStructures/ArchiveFileQueueCriteria.hpp"
+#include "common/dataStructures/ArchiveFileSummary.hpp"
+#include "common/dataStructures/DesiredDriveState.hpp"
+#include "common/dataStructures/DiskInstance.hpp"
+#include "common/dataStructures/RetrieveFileQueueCriteria.hpp"
+#include "common/dataStructures/StorageClass.hpp"
+#include "common/dataStructures/TapeDrive.hpp"
+#include "common/dataStructures/TapeDriveStatistics.hpp"
+#include "common/threading/MutexLocker.hpp"
+
+namespace cta {
+namespace catalogue {
+
+void DummyCatalogue::createAdminUser(const common::dataStructures::SecurityIdentity& admin, const std::string& username, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::createArchiveRoute(const common::dataStructures::SecurityIdentity& admin, const std::string& storageClassName, const uint32_t copyNb, const std::string& tapePoolName, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::createLogicalLibrary(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const bool isDisabled, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::createMountPolicy(const common::dataStructures::SecurityIdentity& admin, const CreateMountPolicyAttributes & mountPolicy) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::createRequesterGroupMountRule(const common::dataStructures::SecurityIdentity& admin, const std::string& mountPolicyName, const std::string& diskInstanceName, const std::string& requesterGroupName, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::createRequesterMountRule(const common::dataStructures::SecurityIdentity& admin, const std::string& mountPolicyName, const std::string& diskInstance, const std::string& requesterName, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::createRequesterActivityMountRule(const common::dataStructures::SecurityIdentity& admin, const std::string& mountPolicyName, const std::string& diskInstance, const std::string& requesterName, const std::string &activityRegex, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::createStorageClass(const common::dataStructures::SecurityIdentity& admin, const common::dataStructures::StorageClass& storageClass) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::createTape(const common::dataStructures::SecurityIdentity &admin, const CreateTapeAttributes & tape) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::createMediaType(const common::dataStructures::SecurityIdentity &admin, const MediaType &mediaType) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteMediaType(const std::string &name) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::list<MediaTypeWithLogs> DummyCatalogue::getMediaTypes() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+MediaType DummyCatalogue::getMediaTypeByVid(const std::string & vid) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMediaTypeName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMediaTypeCartridge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &cartridge) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMediaTypeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t capacityInBytes) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMediaTypePrimaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t primaryDensityCode) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMediaTypeSecondaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t secondaryDensityCode) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMediaTypeNbWraps(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint32_t> &nbWraps) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMediaTypeMinLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &minLPos) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMediaTypeMaxLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &maxLPos) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMediaTypeComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::createTapePool(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string & vo, const uint64_t nbPartialTapes, const bool encryptionValue, const std::optional<std::string> &supply, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteAdminUser(const std::string& username) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::DO_NOT_USE_deleteArchiveFile_DO_NOT_USE(const std::string& instanceName, const uint64_t archiveFileId, log::LogContext &lc) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteArchiveRoute(const std::string& storageClassName, const uint32_t copyNb) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteLogicalLibrary(const std::string& name) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteMountPolicy(const std::string& name) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteRequesterGroupMountRule(const std::string& diskInstanceName, const std::string& requesterGroupName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteRequesterMountRule(const std::string& diskInstanceName, const std::string& requesterName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteRequesterActivityMountRule(const std::string& diskInstanceName, const std::string& requesterName, const std::string &activityRegex) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteStorageClass(const std::string& storageClassName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteTape(const std::string& vid) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteTapePool(const std::string& name) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::filesWrittenToTape(const std::set<TapeItemWrittenPointer>& event) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteDiskSystem(const std::string &name) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyDiskSystemFileRegexp(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &fileRegexp) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::modifyDiskSystemTargetedFreeSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t targetedFreeSpace) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::modifyDiskSystemSleepTime(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t sleepTime) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::modifyDiskSystemComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::modifyDiskSystemDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::modifyDiskSystemDiskInstanceSpaceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceSpaceName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+std::list<common::dataStructures::DiskInstance> DummyCatalogue::getAllDiskInstances() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::deleteDiskInstance(const std::string &name) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyDiskInstanceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+std::list<common::dataStructures::DiskInstanceSpace> DummyCatalogue::getAllDiskInstanceSpaces() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::deleteDiskInstanceSpace(const std::string &name, const std::string &diskInstance) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::modifyDiskInstanceSpaceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::modifyDiskInstanceSpaceRefreshInterval(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const uint64_t refreshInterval) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::modifyDiskInstanceSpaceQueryURL(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+std::list<common::dataStructures::AdminUser> DummyCatalogue::getAdminUsers() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+common::dataStructures::ArchiveFile DummyCatalogue::getArchiveFileById(const uint64_t id) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+using ArchiveFileItor = CatalogueItor<common::dataStructures::ArchiveFile>;
+ArchiveFileItor DummyCatalogue::getArchiveFilesItor(const TapeFileSearchCriteria& searchCriteria) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+using FileRecycleLogItor = CatalogueItor<common::dataStructures::FileRecycleLog>;
+FileRecycleLogItor DummyCatalogue::getFileRecycleLogItor(const RecycleTapeFileSearchCriteria & searchCriteria) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::restoreFileInRecycleLog(const RecycleTapeFileSearchCriteria & searchCriteria, const std::string &newFid) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteFileFromRecycleBin(const uint64_t archiveFileId, log::LogContext &lc) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::deleteFilesFromRecycleLog(const std::string & vid, log::LogContext & lc) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::createTapeDrive(const common::dataStructures::TapeDrive &tapeDrive) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::deleteTapeDrive(const std::string &tapeDriveName) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::createTapeDriveConfig(const std::string &tapeDriveName, const std::string &category, const std::string &keyName, const std::string &value, const std::string &source) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+std::list<cta::catalogue::Catalogue::DriveConfig> DummyCatalogue::getTapeDriveConfigs() const {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+std::list<std::pair<std::string, std::string>> DummyCatalogue::getTapeDriveConfigNamesAndKeys() const {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::modifyTapeDriveConfig(const std::string &tapeDriveName, const std::string &category, const std::string &keyName, const std::string &value, const std::string &source) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+std::optional<std::tuple<std::string, std::string, std::string>> DummyCatalogue::getTapeDriveConfig( const std::string &tapeDriveName, const std::string &keyName) const {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::deleteTapeDriveConfig(const std::string &tapeDriveName, const std::string &keyName) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+std::list<common::dataStructures::ArchiveFile> DummyCatalogue::getFilesForRepack(const std::string &vid, const uint64_t startFSeq, const uint64_t maxNbFiles) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+ArchiveFileItor DummyCatalogue::getArchiveFilesForRepackItor(const std::string &vid, const uint64_t startFSeq) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::list<common::dataStructures::ArchiveRoute> DummyCatalogue::getArchiveRoutes() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::list<common::dataStructures::ArchiveRoute> DummyCatalogue::getArchiveRoutes(const std::string &storageClassName, const std::string &tapePoolName) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::list<common::dataStructures::LogicalLibrary> DummyCatalogue::getLogicalLibraries() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::list<common::dataStructures::RequesterGroupMountRule> DummyCatalogue::getRequesterGroupMountRules() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::list<common::dataStructures::RequesterMountRule> DummyCatalogue::getRequesterMountRules() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::list<common::dataStructures::RequesterActivityMountRule> DummyCatalogue::getRequesterActivityMountRules() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::list<common::dataStructures::StorageClass> DummyCatalogue::getStorageClasses() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+common::dataStructures::StorageClass DummyCatalogue::getStorageClass(const std::string &name) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+common::dataStructures::ArchiveFileSummary DummyCatalogue::getTapeFileSummary(const TapeFileSearchCriteria& searchCriteria) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+common::dataStructures::ArchiveFile DummyCatalogue::getArchiveFileForDeletion(const TapeFileSearchCriteria &searchCriteria) const {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+void DummyCatalogue::deleteTapeFileCopy(common::dataStructures::ArchiveFile &file, const std::string &reason) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+std::list<TapePool> DummyCatalogue::getTapePools(const TapePoolSearchCriteria &searchCriteria) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::optional<TapePool> DummyCatalogue::getTapePool(const std::string &tapePoolName) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::optional<common::dataStructures::MountPolicy> DummyCatalogue::getMountPolicy(const std::string &mountPolicyName) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::list<common::dataStructures::Tape> DummyCatalogue::getTapes(const TapeSearchCriteria& searchCriteria) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::map<std::string, std::string> DummyCatalogue::getVidToLogicalLibrary(const std::set<std::string> &vids) const { throw exception::Exception(std::string("In ") + __PRETTY_FUNCTION__ + ": not implemented"); }
+common::dataStructures::Label::Format DummyCatalogue::getTapeLabelFormat(const std::string& vid) const { throw exception::Exception(std::string("In ") + __PRETTY_FUNCTION__ + ": not implemented"); }
+std::list<TapeForWriting> DummyCatalogue::getTapesForWriting(const std::string& logicalLibraryName) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+bool DummyCatalogue::isAdmin(const common::dataStructures::SecurityIdentity& admin) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyAdminUserComment(const common::dataStructures::SecurityIdentity& admin, const std::string& username, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::createVirtualOrganization(const common::dataStructures::SecurityIdentity &admin, const common::dataStructures::VirtualOrganization &vo) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::deleteVirtualOrganization(const std::string &voName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+std::list<common::dataStructures::VirtualOrganization> DummyCatalogue::getVirtualOrganizations() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+common::dataStructures::VirtualOrganization DummyCatalogue::getVirtualOrganizationOfTapepool(const std::string & tapepoolName) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+common::dataStructures::VirtualOrganization DummyCatalogue::getCachedVirtualOrganizationOfTapepool(const std::string & tapepoolName) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyVirtualOrganizationName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentVoName, const std::string &newVoName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t readMaxDrives) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t writeMaxDrives) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyVirtualOrganizationMaxFileSize(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxFileSize) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyVirtualOrganizationComment(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyVirtualOrganizationDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &diskInstance) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyArchiveRouteComment(const common::dataStructures::SecurityIdentity& admin, const std::string& storageClassName, const uint32_t copyNb, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyArchiveRouteTapePoolName(const common::dataStructures::SecurityIdentity& admin, const std::string& storageClassName, const uint32_t copyNb, const std::string& tapePoolName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyLogicalLibraryComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyLogicalLibraryDisabledReason(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& disabledReason) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::setLogicalLibraryDisabled(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool disabledValue) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMountPolicyArchiveMinRequestAge(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t minArchiveRequestAge) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMountPolicyArchivePriority(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t archivePriority) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMountPolicyComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMountPolicyRetrieveMinRequestAge(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t minRetrieveRequestAge) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyMountPolicyRetrievePriority(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t retrievePriority) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyRequesterActivityMountRuleComment(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string &activityRegex, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyRequesteMountRuleComment(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyRequesterGroupMountRuleComment(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterGroupName, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyRequesterGroupMountRulePolicy(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterGroupName, const std::string& mountPolicy) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyRequesterMountRulePolicy(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string& mountPolicy) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyRequesterActivityMountRulePolicy(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string &activityRegex, const std::string& mountPolicy) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyStorageClassComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyStorageClassVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyStorageClassName(const common::dataStructures::SecurityIdentity& admin, const std::string& currentName, const std::string& newName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t nbCopies) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapeComment(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::optional<std::string> &comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& encryptionKeyName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapeVerificationStatus(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& verificationStatus) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapeState(const common::dataStructures::SecurityIdentity &admin,const std::string &vid, const common::dataStructures::Tape::State & state, const std::optional<std::string> & stateReason) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapeMediaType(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& mediaType) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapeVendor(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& vendor) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& logicalLibraryName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapePoolComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapePoolVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapePoolNbPartialTapes(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t nbPartialTapes) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapePoolSupply(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& supply) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapePoolName(const common::dataStructures::SecurityIdentity& admin, const std::string& currentName, const std::string& newName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& tapePoolName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::noSpaceLeftOnTape(const std::string& vid) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::ping() { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::verifySchemaVersion() { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+SchemaVersion DummyCatalogue::getSchemaVersion() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+uint64_t DummyCatalogue::checkAndGetNextArchiveFileId(const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+common::dataStructures::ArchiveFileQueueCriteria DummyCatalogue::getArchiveFileQueueCriteria(const std::string &diskInstanceName,
+  const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+common::dataStructures::RetrieveFileQueueCriteria DummyCatalogue::prepareToRetrieveFile(const std::string& diskInstanceName, const uint64_t archiveFileId, const common::dataStructures::RequesterIdentity& user, const std::optional<std::string>& activity, log::LogContext& lc, const std::optional<std::string> &mountPolicyName) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::reclaimTape(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, cta::log::LogContext & lc) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::checkTapeForLabel(const std::string& vid) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+uint64_t DummyCatalogue::getNbFilesOnTape(const std::string& vid) const  { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::setTapeDisabled(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string & reason) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::setTapeFull(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const bool fullValue) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::setTapeDirty(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const bool dirtyValue) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::setTapeDirty(const std::string & vid) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::setTapeIsFromCastorInUnitTests(const std::string &vid) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::setTapePoolEncryption(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const bool encryptionValue) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+bool DummyCatalogue::tapeExists(const std::string& vid) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+bool DummyCatalogue::diskSystemExists(const std::string& name) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::tapeLabelled(const std::string& vid, const std::string& drive) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::tapeMountedForArchive(const std::string& vid, const std::string& drive) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::tapeMountedForRetrieve(const std::string& vid, const std::string& drive) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+bool DummyCatalogue::tapePoolExists(const std::string& tapePoolName) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::updateDiskFileId(uint64_t archiveFileId, const std::string &diskInstance, const std::string &diskFileId) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+void DummyCatalogue::moveArchiveFileToRecycleLog(const common::dataStructures::DeleteArchiveRequest &request,
+  log::LogContext & lc) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
+
+// Special functions for unit tests.
+void DummyCatalogue::addEnabledTape(const std::string & vid) {
+  threading::MutexLocker lm(m_tapeEnablingMutex);
+  m_tapeEnabling[vid]=common::dataStructures::Tape::ACTIVE;
+}
+void DummyCatalogue::addDisabledTape(const std::string & vid) {
+  threading::MutexLocker lm(m_tapeEnablingMutex);
+  m_tapeEnabling[vid]=common::dataStructures::Tape::DISABLED;
+}
+common::dataStructures::VidToTapeMap DummyCatalogue::getTapesByVid(const std::string& vid) const {
+  std::set<std::string> vids = {vid};
+  return getTapesByVid(vids);
+}
+common::dataStructures::VidToTapeMap DummyCatalogue::getTapesByVid(const std::set<std::string>& vids) const {
+  // Minimal implementation of VidToMap for retrieve request unit tests. We just support
+  // disabled status for the tapes.
+  // If the tape is not listed, it is listed as enabled in the return value.
+  threading::MutexLocker lm(m_tapeEnablingMutex);
+  common::dataStructures::VidToTapeMap ret;
+  for (const auto & v: vids) {
+    try {
+      ret[v].state = m_tapeEnabling.at(v);
+    } catch (std::out_of_range &) {
+      ret[v].state = common::dataStructures::Tape::ACTIVE;
+    }
+  }
+  return ret;
+}
+std::list<common::dataStructures::MountPolicy> DummyCatalogue::getMountPolicies() const {
+  std::list<common::dataStructures::MountPolicy> mountPolicies;
+  common::dataStructures::MountPolicy mp1;
+  mp1.name = "mountPolicy";
+  mp1.archivePriority = 1;
+  mp1.archiveMinRequestAge = 0;
+  mp1.retrievePriority = 1;
+  mp1.retrieveMinRequestAge = 0;
+  mountPolicies.push_back(mp1);
+
+  common::dataStructures::MountPolicy mp2;
+  mp2.name = "moreAdvantageous";
+  mp2.archivePriority = 2;
+  mp2.archiveMinRequestAge = 0;
+  mp2.retrievePriority = 2;
+  mp2.retrieveMinRequestAge = 0;
+  mountPolicies.push_back(mp1);
+  return mountPolicies;
+}
+
+std::list<common::dataStructures::MountPolicy> DummyCatalogue::getCachedMountPolicies() const {
+  std::list<common::dataStructures::MountPolicy> mountPolicies;
+  common::dataStructures::MountPolicy mp1;
+  mp1.name = "mountPolicy";
+  mp1.archivePriority = 1;
+  mp1.archiveMinRequestAge = 0;
+  mp1.retrievePriority = 1;
+  mp1.retrieveMinRequestAge = 0;
+  mountPolicies.push_back(mp1);
+
+  common::dataStructures::MountPolicy mp2;
+  mp2.name = "moreAdvantageous";
+  mp2.archivePriority = 2;
+  mp2.archiveMinRequestAge = 0;
+  mp2.retrievePriority = 2;
+  mp2.retrieveMinRequestAge = 0;
+  mountPolicies.push_back(mp1);
+  return mountPolicies;
+}
+
+std::list<std::string> DummyCatalogue::getTapeDriveNames() const {
+  return {m_tapeDriveStatus.driveName};
+}
+
+std::optional<common::dataStructures::TapeDrive> DummyCatalogue::getTapeDrive(const std::string &tapeDriveName) const {
+  if (m_tapeDriveStatus.driveName != "") return m_tapeDriveStatus;
+  common::dataStructures::TapeDrive tapeDriveStatus;
+  const time_t reportTime = time(nullptr);
+
+  tapeDriveStatus.driveName = tapeDriveName;
+  tapeDriveStatus.host = "Dummy_Host";
+  tapeDriveStatus.logicalLibrary = "Dummy_Library";
+
+  tapeDriveStatus.downOrUpStartTime = reportTime;
+
+  tapeDriveStatus.mountType = common::dataStructures::MountType::NoMount;
+  tapeDriveStatus.driveStatus = common::dataStructures::DriveStatus::Down;
+  tapeDriveStatus.desiredUp = false;
+  tapeDriveStatus.desiredForceDown = false;
+
+  tapeDriveStatus.diskSystemName = "Dummy_System";
+  tapeDriveStatus.reservedBytes = 0;
+  tapeDriveStatus.reservationSessionId = 0;
+
+
+  return tapeDriveStatus;
+}
+
+std::list<common::dataStructures::TapeDrive> DummyCatalogue::getTapeDrives() const {
+  std::list<common::dataStructures::TapeDrive> tapeDrives;
+  const auto tapeDrive = getTapeDrive(m_tapeDriveStatus.driveName);
+  if (tapeDrive.has_value()) tapeDrives.push_back(tapeDrive.value());
+  return tapeDrives;
+}
+
+void DummyCatalogue::setDesiredTapeDriveState(const std::string&,
+    const common::dataStructures::DesiredDriveState &desiredState) {
+  m_tapeDriveStatus.desiredUp = desiredState.up;
+  m_tapeDriveStatus.desiredForceDown = desiredState.forceDown;
+  m_tapeDriveStatus.reasonUpDown = desiredState.reason;
+}
+
+void DummyCatalogue::setDesiredTapeDriveStateComment(const std::string& tapeDriveName,
+  const std::string &comment) {
+  m_tapeDriveStatus.userComment = comment;
+}
+
+void DummyCatalogue::updateTapeDriveStatistics(const std::string& tapeDriveName,
+  const std::string& host, const std::string& logicalLibrary,
+  const common::dataStructures::TapeDriveStatistics& statistics) {
+  m_tapeDriveStatus.driveName = tapeDriveName;
+  m_tapeDriveStatus.host = host;
+  m_tapeDriveStatus.logicalLibrary = logicalLibrary;
+  m_tapeDriveStatus.bytesTransferedInSession = statistics.bytesTransferedInSession;
+  m_tapeDriveStatus.filesTransferedInSession = statistics.filesTransferedInSession;
+  m_tapeDriveStatus.lastModificationLog = statistics.lastModificationLog;
+}
+
+void DummyCatalogue::updateTapeDriveStatus(const common::dataStructures::TapeDrive &tapeDrive) {
+  m_tapeDriveStatus = tapeDrive;
+}
+
+std::map<std::string, uint64_t> DummyCatalogue::getDiskSpaceReservations() const {
+  std::map<std::string, uint64_t> ret;
+  const auto tdNames = getTapeDriveNames();
+  for (const auto& driveName : tdNames) {
+    const auto tdStatus = getTapeDrive(driveName);
+    if (tdStatus.value().diskSystemName) {
+      // no need to check key, operator[] initializes missing values at zero for scalar types
+      ret[tdStatus.value().diskSystemName.value()] += tdStatus.value().reservedBytes.value();
+    }
+  }
+  return ret;
+}
+
+void DummyCatalogue::reserveDiskSpace(const std::string& driveName, const uint64_t mountId,
+  const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) {
+  if (diskSpaceReservation.empty()) return;
+
+  log::ScopedParamContainer params(lc);
+  params.add("driveName", driveName)
+        .add("diskSystem", diskSpaceReservation.begin()->first)
+        .add("reservationBytes", diskSpaceReservation.begin()->second)
+        .add("mountId", mountId);
+  lc.log(log::DEBUG, "In RetrieveMount::reserveDiskSpace(): reservation request.");
+
+  auto tdStatus = getTapeDrive(driveName);
+  if (!tdStatus) return;
+
+  if (!tdStatus.value().reservationSessionId) {
+    tdStatus.value().reservationSessionId = mountId;
+    tdStatus.value().reservedBytes = 0;
+  }
+
+  if (tdStatus.value().reservationSessionId != mountId) {
+    tdStatus.value().reservationSessionId = mountId;
+    tdStatus.value().reservedBytes = 0;
+  }
+
+  tdStatus.value().diskSystemName = diskSpaceReservation.begin()->first;
+  tdStatus.value().reservedBytes.value() += diskSpaceReservation.begin()->second;
+  updateTapeDriveStatus(tdStatus.value());
+}
+
+void DummyCatalogue::releaseDiskSpace(const std::string& driveName, const uint64_t mountId,
+  const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) {
+  if (diskSpaceReservation.empty()) return;
+
+  log::ScopedParamContainer params(lc);
+  params.add("driveName", driveName)
+        .add("diskSystem", diskSpaceReservation.begin()->first)
+        .add("reservationBytes", diskSpaceReservation.begin()->second)
+        .add("mountId", mountId);
+  lc.log(log::DEBUG, "In RetrieveMount::releaseDiskSpace(): reservation release request.");
+
+  auto tdStatus = getTapeDrive(driveName);
+
+  if (!tdStatus) return;
+  if (!tdStatus.value().reservationSessionId) {
+    return;
+  }
+  if (tdStatus.value().reservationSessionId != mountId) {
+    return;
+  }
+  auto& bytes = diskSpaceReservation.begin()->second;
+  if (bytes > tdStatus.value().reservedBytes) throw NegativeDiskSpaceReservationReached(
+    "In DriveState::subtractDiskSpaceReservation(): we would reach a negative reservation size.");
+  tdStatus.value().diskSystemName = diskSpaceReservation.begin()->first;
+  tdStatus.value().reservedBytes.value() -= bytes;
+  updateTapeDriveStatus(tdStatus.value());
+}
+
+
+/*
+  * Implemented for testing disk space reservation logic
+  */
+disk::DiskSystemList DummyCatalogue::getAllDiskSystems() const {
+  return m_diskSystemList;
+}
+
+void DummyCatalogue::createDiskInstance(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) {
+  m_diskInstances[name] = {name, comment, common::dataStructures::EntryLog(), common::dataStructures::EntryLog()};
+}
+
+void DummyCatalogue::createDiskInstanceSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL, const uint64_t refreshInterval, const std::string &comment) {
+  m_diskInstanceSpaces[name] = {name, diskInstance, freeSpaceQueryURL, refreshInterval, 0, 0, comment, common::dataStructures::EntryLog(), common::dataStructures::EntryLog()};
+}
+
+void DummyCatalogue::createDiskSystem(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName, const std::string &diskInstanceSpaceName, const std::string &fileRegexp, const uint64_t targetedFreeSpace, const time_t sleepTime, const std::string &comment)  {
+  m_diskSystemList.push_back({name, m_diskInstanceSpaces.at(diskInstanceSpaceName), fileRegexp, targetedFreeSpace, sleepTime, common::dataStructures::EntryLog(), common::dataStructures::EntryLog{}, comment});
+}
+
+void DummyCatalogue::modifyDiskInstanceSpaceFreeSpace(const std::string &name, const std::string &diskInstance, const uint64_t freeSpace) {
+  m_diskInstanceSpaces[name].freeSpace = freeSpace;
+  m_diskInstanceSpaces[name].lastRefreshTime = time(nullptr);
+}
+
+}  // namespace catalogue
+}  // namespace cta
diff --git a/catalogue/DummyCatalogue.hpp b/catalogue/DummyCatalogue.hpp
index 570623fec8f2bb84b097d9d94ba15003a593c271..0d6fd342cc1a35531a07130b54206ea387eecec9 100644
--- a/catalogue/DummyCatalogue.hpp
+++ b/catalogue/DummyCatalogue.hpp
@@ -17,14 +17,18 @@
 
 #pragma once
 
-#include <iostream>
 #include <list>
+#include <map>
+#include <string>
 
-#include "Catalogue.hpp"
+#include "catalogue/Catalogue.hpp"
+#include "common/dataStructures/ArchiveFileSummary.hpp"
+#include "common/dataStructures/DiskInstance.hpp"
+#include "common/dataStructures/TapeDrive.hpp"
 #include "common/threading/MutexLocker.hpp"
+#include "disk/DiskSystem.hpp"
 
 namespace cta {
-
 namespace catalogue {
 
 /**
@@ -37,392 +41,212 @@ public:
   DummyCatalogue() = default;
   ~DummyCatalogue() override = default;
 
-  void createAdminUser(const common::dataStructures::SecurityIdentity& admin, const std::string& username, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void createArchiveRoute(const common::dataStructures::SecurityIdentity& admin, const std::string& storageClassName, const uint32_t copyNb, const std::string& tapePoolName, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void createLogicalLibrary(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const bool isDisabled, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void createMountPolicy(const common::dataStructures::SecurityIdentity& admin, const CreateMountPolicyAttributes & mountPolicy) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void createRequesterGroupMountRule(const common::dataStructures::SecurityIdentity& admin, const std::string& mountPolicyName, const std::string& diskInstanceName, const std::string& requesterGroupName, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void createRequesterMountRule(const common::dataStructures::SecurityIdentity& admin, const std::string& mountPolicyName, const std::string& diskInstance, const std::string& requesterName, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void createRequesterActivityMountRule(const common::dataStructures::SecurityIdentity& admin, const std::string& mountPolicyName, const std::string& diskInstance, const std::string& requesterName, const std::string &activityRegex, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void createStorageClass(const common::dataStructures::SecurityIdentity& admin, const common::dataStructures::StorageClass& storageClass) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void createTape(const common::dataStructures::SecurityIdentity &admin, const CreateTapeAttributes & tape) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void createMediaType(const common::dataStructures::SecurityIdentity &admin, const MediaType &mediaType) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteMediaType(const std::string &name) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::list<MediaTypeWithLogs> getMediaTypes() const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  MediaType getMediaTypeByVid(const std::string & vid) const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMediaTypeName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMediaTypeCartridge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &cartridge) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMediaTypeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t capacityInBytes) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMediaTypePrimaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t primaryDensityCode) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMediaTypeSecondaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t secondaryDensityCode) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMediaTypeNbWraps(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint32_t> &nbWraps) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMediaTypeMinLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &minLPos) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMediaTypeMaxLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &maxLPos) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMediaTypeComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void createTapePool(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string & vo, const uint64_t nbPartialTapes, const bool encryptionValue, const std::optional<std::string> &supply, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteAdminUser(const std::string& username) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void DO_NOT_USE_deleteArchiveFile_DO_NOT_USE(const std::string& instanceName, const uint64_t archiveFileId, log::LogContext &lc) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteArchiveRoute(const std::string& storageClassName, const uint32_t copyNb) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteLogicalLibrary(const std::string& name) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteMountPolicy(const std::string& name) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteRequesterGroupMountRule(const std::string& diskInstanceName, const std::string& requesterGroupName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteRequesterMountRule(const std::string& diskInstanceName, const std::string& requesterName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteRequesterActivityMountRule(const std::string& diskInstanceName, const std::string& requesterName, const std::string &activityRegex) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteStorageClass(const std::string& storageClassName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteTape(const std::string& vid) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteTapePool(const std::string& name) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void filesWrittenToTape(const std::set<TapeItemWrittenPointer>& event) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteDiskSystem(const std::string &name) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyDiskSystemFileRegexp(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &fileRegexp) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void modifyDiskSystemTargetedFreeSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t targetedFreeSpace) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void modifyDiskSystemSleepTime(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t sleepTime) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void modifyDiskSystemComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void modifyDiskSystemDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void modifyDiskSystemDiskInstanceSpaceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceSpaceName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  std::list<common::dataStructures::DiskInstance> getAllDiskInstances() const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void deleteDiskInstance(const std::string &name) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyDiskInstanceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  std::list<common::dataStructures::DiskInstanceSpace> getAllDiskInstanceSpaces() const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void deleteDiskInstanceSpace(const std::string &name, const std::string &diskInstance) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void modifyDiskInstanceSpaceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void modifyDiskInstanceSpaceRefreshInterval(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const uint64_t refreshInterval) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void modifyDiskInstanceSpaceQueryURL(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  std::list<common::dataStructures::AdminUser> getAdminUsers() const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  common::dataStructures::ArchiveFile getArchiveFileById(const uint64_t id) const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  ArchiveFileItor getArchiveFilesItor(const TapeFileSearchCriteria& searchCriteria) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  FileRecycleLogItor getFileRecycleLogItor(const RecycleTapeFileSearchCriteria & searchCriteria) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void restoreFileInRecycleLog(const RecycleTapeFileSearchCriteria & searchCriteria, const std::string &newFid) { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteFileFromRecycleBin(const uint64_t archiveFileId, log::LogContext &lc) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void deleteFilesFromRecycleLog(const std::string & vid, log::LogContext & lc) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void createTapeDrive(const common::dataStructures::TapeDrive &tapeDrive) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void deleteTapeDrive(const std::string &tapeDriveName) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void createTapeDriveConfig(const std::string &tapeDriveName, const std::string &category, const std::string &keyName, const std::string &value, const std::string &source) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  std::list<cta::catalogue::Catalogue::DriveConfig> getTapeDriveConfigs() const {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  std::list<std::pair<std::string, std::string>> getTapeDriveConfigNamesAndKeys() const {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void modifyTapeDriveConfig(const std::string &tapeDriveName, const std::string &category, const std::string &keyName, const std::string &value, const std::string &source) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  std::optional<std::tuple<std::string, std::string, std::string>> getTapeDriveConfig( const std::string &tapeDriveName, const std::string &keyName) const {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void deleteTapeDriveConfig(const std::string &tapeDriveName, const std::string &keyName) {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  std::list<common::dataStructures::ArchiveFile> getFilesForRepack(const std::string &vid, const uint64_t startFSeq, const uint64_t maxNbFiles) const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  ArchiveFileItor getArchiveFilesForRepackItor(const std::string &vid, const uint64_t startFSeq) const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::list<common::dataStructures::ArchiveRoute> getArchiveRoutes() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::list<common::dataStructures::ArchiveRoute> getArchiveRoutes(const std::string &storageClassName, const std::string &tapePoolName) const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::list<common::dataStructures::LogicalLibrary> getLogicalLibraries() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::list<common::dataStructures::RequesterGroupMountRule> getRequesterGroupMountRules() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::list<common::dataStructures::RequesterMountRule> getRequesterMountRules() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::list<common::dataStructures::RequesterActivityMountRule> getRequesterActivityMountRules() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::list<common::dataStructures::StorageClass> getStorageClasses() const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  common::dataStructures::StorageClass getStorageClass(const std::string &name) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  common::dataStructures::ArchiveFileSummary getTapeFileSummary(const TapeFileSearchCriteria& searchCriteria) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  common::dataStructures::ArchiveFile getArchiveFileForDeletion(const TapeFileSearchCriteria &searchCriteria = TapeFileSearchCriteria()) const override {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  void deleteTapeFileCopy(common::dataStructures::ArchiveFile &file, const std::string &reason) override {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  std::list<TapePool> getTapePools(const TapePoolSearchCriteria &searchCriteria) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::optional<TapePool> getTapePool(const std::string &tapePoolName) const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::optional<common::dataStructures::MountPolicy> getMountPolicy(const std::string &mountPolicyName) const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::list<common::dataStructures::Tape> getTapes(const TapeSearchCriteria& searchCriteria) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+  void createAdminUser(const common::dataStructures::SecurityIdentity& admin, const std::string& username, const std::string& comment) override;
+  void createArchiveRoute(const common::dataStructures::SecurityIdentity& admin, const std::string& storageClassName, const uint32_t copyNb, const std::string& tapePoolName, const std::string& comment) override;
+  void createLogicalLibrary(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const bool isDisabled, const std::string& comment) override;
+  void createMountPolicy(const common::dataStructures::SecurityIdentity& admin, const CreateMountPolicyAttributes & mountPolicy) override;
+  void createRequesterGroupMountRule(const common::dataStructures::SecurityIdentity& admin, const std::string& mountPolicyName, const std::string& diskInstanceName, const std::string& requesterGroupName, const std::string& comment) override;
+  void createRequesterMountRule(const common::dataStructures::SecurityIdentity& admin, const std::string& mountPolicyName, const std::string& diskInstance, const std::string& requesterName, const std::string& comment) override;
+  void createRequesterActivityMountRule(const common::dataStructures::SecurityIdentity& admin, const std::string& mountPolicyName, const std::string& diskInstance, const std::string& requesterName, const std::string &activityRegex, const std::string& comment) override;
+  void createStorageClass(const common::dataStructures::SecurityIdentity& admin, const common::dataStructures::StorageClass& storageClass) override;
+  void createTape(const common::dataStructures::SecurityIdentity &admin, const CreateTapeAttributes & tape) override;
+  void createMediaType(const common::dataStructures::SecurityIdentity &admin, const MediaType &mediaType) override;
+  void deleteMediaType(const std::string &name) override;
+  std::list<MediaTypeWithLogs> getMediaTypes() const override;
+  MediaType getMediaTypeByVid(const std::string & vid) const override;
+  void modifyMediaTypeName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override;
+  void modifyMediaTypeCartridge(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &cartridge) override;
+  void modifyMediaTypeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t capacityInBytes) override;
+  void modifyMediaTypePrimaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t primaryDensityCode) override;
+  void modifyMediaTypeSecondaryDensityCode(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint8_t secondaryDensityCode) override;
+  void modifyMediaTypeNbWraps(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint32_t> &nbWraps) override;
+  void modifyMediaTypeMinLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &minLPos) override;
+  void modifyMediaTypeMaxLPos(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::optional<std::uint64_t> &maxLPos) override;
+  void modifyMediaTypeComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
+  void createTapePool(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string & vo, const uint64_t nbPartialTapes, const bool encryptionValue, const std::optional<std::string> &supply, const std::string& comment) override;
+  void deleteAdminUser(const std::string& username) override;
+  void DO_NOT_USE_deleteArchiveFile_DO_NOT_USE(const std::string& instanceName, const uint64_t archiveFileId, log::LogContext &lc) override;
+  void deleteArchiveRoute(const std::string& storageClassName, const uint32_t copyNb) override;
+  void deleteLogicalLibrary(const std::string& name) override;
+  void deleteMountPolicy(const std::string& name) override;
+  void deleteRequesterGroupMountRule(const std::string& diskInstanceName, const std::string& requesterGroupName) override;
+  void deleteRequesterMountRule(const std::string& diskInstanceName, const std::string& requesterName) override;
+  void deleteRequesterActivityMountRule(const std::string& diskInstanceName, const std::string& requesterName, const std::string &activityRegex) override;
+  void deleteStorageClass(const std::string& storageClassName) override;
+  void deleteTape(const std::string& vid) override;
+  void deleteTapePool(const std::string& name) override;
+  void filesWrittenToTape(const std::set<TapeItemWrittenPointer>& event) override;
+  void deleteDiskSystem(const std::string &name) override;
+  void modifyDiskSystemFileRegexp(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &fileRegexp) override;
+  void modifyDiskSystemTargetedFreeSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const uint64_t targetedFreeSpace) override;
+  void modifyDiskSystemSleepTime(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t sleepTime) override;
+  void modifyDiskSystemComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
+  void modifyDiskSystemDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName) override;
+  void modifyDiskSystemDiskInstanceSpaceName(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceSpaceName) override;
+  std::list<common::dataStructures::DiskInstance> getAllDiskInstances() const override;
+  void deleteDiskInstance(const std::string &name) override;
+  void modifyDiskInstanceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
+  std::list<common::dataStructures::DiskInstanceSpace> getAllDiskInstanceSpaces() const override;
+  void deleteDiskInstanceSpace(const std::string &name, const std::string &diskInstance) override;
+  void modifyDiskInstanceSpaceComment(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &comment) override;
+  void modifyDiskInstanceSpaceRefreshInterval(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const uint64_t refreshInterval) override;
+  void modifyDiskInstanceSpaceQueryURL(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL) override;
+  std::list<common::dataStructures::AdminUser> getAdminUsers() const override;
+  common::dataStructures::ArchiveFile getArchiveFileById(const uint64_t id) const override;
+  ArchiveFileItor getArchiveFilesItor(const TapeFileSearchCriteria& searchCriteria) const;
+  FileRecycleLogItor getFileRecycleLogItor(const RecycleTapeFileSearchCriteria & searchCriteria) const;
+  void restoreFileInRecycleLog(const RecycleTapeFileSearchCriteria & searchCriteria, const std::string &newFid);
+  void deleteFileFromRecycleBin(const uint64_t archiveFileId, log::LogContext &lc);
+  void deleteFilesFromRecycleLog(const std::string & vid, log::LogContext & lc);
+  void createTapeDrive(const common::dataStructures::TapeDrive &tapeDrive);
+  void deleteTapeDrive(const std::string &tapeDriveName);
+  void createTapeDriveConfig(const std::string &tapeDriveName, const std::string &category, const std::string &keyName, const std::string &value, const std::string &source);
+  std::list<cta::catalogue::Catalogue::DriveConfig> getTapeDriveConfigs() const;
+  std::list<std::pair<std::string, std::string>> getTapeDriveConfigNamesAndKeys() const;
+  void modifyTapeDriveConfig(const std::string &tapeDriveName, const std::string &category, const std::string &keyName, const std::string &value, const std::string &source);
+  std::optional<std::tuple<std::string, std::string, std::string>> getTapeDriveConfig( const std::string &tapeDriveName, const std::string &keyName) const;
+  void deleteTapeDriveConfig(const std::string &tapeDriveName, const std::string &keyName);
+  std::list<common::dataStructures::ArchiveFile> getFilesForRepack(const std::string &vid, const uint64_t startFSeq, const uint64_t maxNbFiles) const override;
+  ArchiveFileItor getArchiveFilesForRepackItor(const std::string &vid, const uint64_t startFSeq) const override;
+  std::list<common::dataStructures::ArchiveRoute> getArchiveRoutes() const;
+  std::list<common::dataStructures::ArchiveRoute> getArchiveRoutes(const std::string &storageClassName, const std::string &tapePoolName) const override;
+  std::list<common::dataStructures::LogicalLibrary> getLogicalLibraries() const;
+  std::list<common::dataStructures::RequesterGroupMountRule> getRequesterGroupMountRules() const;
+  std::list<common::dataStructures::RequesterMountRule> getRequesterMountRules() const;
+  std::list<common::dataStructures::RequesterActivityMountRule> getRequesterActivityMountRules() const;
+  std::list<common::dataStructures::StorageClass> getStorageClasses() const;
+  common::dataStructures::StorageClass getStorageClass(const std::string &name) const;
+  common::dataStructures::ArchiveFileSummary getTapeFileSummary(const TapeFileSearchCriteria& searchCriteria) const;
+  common::dataStructures::ArchiveFile getArchiveFileForDeletion(const TapeFileSearchCriteria &searchCriteria = TapeFileSearchCriteria()) const override;
+  void deleteTapeFileCopy(common::dataStructures::ArchiveFile &file, const std::string &reason) override;
+  std::list<TapePool> getTapePools(const TapePoolSearchCriteria &searchCriteria) const;
+  std::optional<TapePool> getTapePool(const std::string &tapePoolName) const override;
+  std::optional<common::dataStructures::MountPolicy> getMountPolicy(const std::string &mountPolicyName) const override;
+  std::list<common::dataStructures::Tape> getTapes(const TapeSearchCriteria& searchCriteria) const;
  // getTapesByVid is implemented below (and works).
-  std::map<std::string, std::string> getVidToLogicalLibrary(const std::set<std::string> &vids) const override { throw exception::Exception(std::string("In ") + __PRETTY_FUNCTION__ + ": not implemented"); }
-  common::dataStructures::Label::Format getTapeLabelFormat(const std::string& vid) const override { throw exception::Exception(std::string("In ") + __PRETTY_FUNCTION__ + ": not implemented"); }
-  std::list<TapeForWriting> getTapesForWriting(const std::string& logicalLibraryName) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  bool isAdmin(const common::dataStructures::SecurityIdentity& admin) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyAdminUserComment(const common::dataStructures::SecurityIdentity& admin, const std::string& username, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void createVirtualOrganization(const common::dataStructures::SecurityIdentity &admin, const common::dataStructures::VirtualOrganization &vo) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void deleteVirtualOrganization(const std::string &voName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  std::list<common::dataStructures::VirtualOrganization> getVirtualOrganizations() const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  common::dataStructures::VirtualOrganization getVirtualOrganizationOfTapepool(const std::string & tapepoolName) const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  common::dataStructures::VirtualOrganization getCachedVirtualOrganizationOfTapepool(const std::string & tapepoolName) const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyVirtualOrganizationName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentVoName, const std::string &newVoName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t readMaxDrives) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t writeMaxDrives) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyVirtualOrganizationMaxFileSize(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxFileSize) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyVirtualOrganizationComment(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyVirtualOrganizationDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &diskInstance) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyArchiveRouteComment(const common::dataStructures::SecurityIdentity& admin, const std::string& storageClassName, const uint32_t copyNb, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyArchiveRouteTapePoolName(const common::dataStructures::SecurityIdentity& admin, const std::string& storageClassName, const uint32_t copyNb, const std::string& tapePoolName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyLogicalLibraryComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyLogicalLibraryDisabledReason(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& disabledReason) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void setLogicalLibraryDisabled(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool disabledValue) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMountPolicyArchiveMinRequestAge(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t minArchiveRequestAge) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMountPolicyArchivePriority(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t archivePriority) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMountPolicyRetrieveMinRequestAge(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t minRetrieveRequestAge) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyMountPolicyRetrievePriority(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t retrievePriority) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyRequesterActivityMountRuleComment(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string &activityRegex, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyRequesteMountRuleComment(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyRequesterGroupMountRuleComment(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterGroupName, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyRequesterGroupMountRulePolicy(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterGroupName, const std::string& mountPolicy) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyRequesterMountRulePolicy(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string& mountPolicy) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyRequesterActivityMountRulePolicy(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string &activityRegex, const std::string& mountPolicy) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyStorageClassComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyStorageClassVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyStorageClassName(const common::dataStructures::SecurityIdentity& admin, const std::string& currentName, const std::string& newName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t nbCopies) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapeComment(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::optional<std::string> &comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& encryptionKeyName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapeVerificationStatus(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& verificationStatus) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapeState(const common::dataStructures::SecurityIdentity &admin,const std::string &vid, const common::dataStructures::Tape::State & state, const std::optional<std::string> & stateReason) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapeMediaType(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& mediaType) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapeVendor(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& vendor) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& logicalLibraryName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapePoolComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapePoolVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapePoolNbPartialTapes(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t nbPartialTapes) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapePoolSupply(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& supply) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapePoolName(const common::dataStructures::SecurityIdentity& admin, const std::string& currentName, const std::string& newName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& tapePoolName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void noSpaceLeftOnTape(const std::string& vid) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void ping() override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void verifySchemaVersion() override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  SchemaVersion getSchemaVersion() const override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  uint64_t checkAndGetNextArchiveFileId(const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+  std::map<std::string, std::string> getVidToLogicalLibrary(const std::set<std::string> &vids) const override;
+  common::dataStructures::Label::Format getTapeLabelFormat(const std::string& vid) const override;
+  std::list<TapeForWriting> getTapesForWriting(const std::string& logicalLibraryName) const;
+  bool isAdmin(const common::dataStructures::SecurityIdentity& admin) const;
+  void modifyAdminUserComment(const common::dataStructures::SecurityIdentity& admin, const std::string& username, const std::string& comment) override;
+  void createVirtualOrganization(const common::dataStructures::SecurityIdentity &admin, const common::dataStructures::VirtualOrganization &vo) override;
+  void deleteVirtualOrganization(const std::string &voName) override;
+  std::list<common::dataStructures::VirtualOrganization> getVirtualOrganizations() const override;
+  common::dataStructures::VirtualOrganization getVirtualOrganizationOfTapepool(const std::string & tapepoolName) const override;
+  common::dataStructures::VirtualOrganization getCachedVirtualOrganizationOfTapepool(const std::string & tapepoolName) const override;
+  void modifyVirtualOrganizationName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentVoName, const std::string &newVoName) override;
+  void modifyVirtualOrganizationReadMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t readMaxDrives) override;
+  void modifyVirtualOrganizationWriteMaxDrives(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t writeMaxDrives) override;
+  void modifyVirtualOrganizationMaxFileSize(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const uint64_t maxFileSize) override;
+  void modifyVirtualOrganizationComment(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &comment) override;
+  void modifyVirtualOrganizationDiskInstanceName(const common::dataStructures::SecurityIdentity &admin, const std::string &voName, const std::string &diskInstance) override;
+  void modifyArchiveRouteComment(const common::dataStructures::SecurityIdentity& admin, const std::string& storageClassName, const uint32_t copyNb, const std::string& comment) override;
+  void modifyArchiveRouteTapePoolName(const common::dataStructures::SecurityIdentity& admin, const std::string& storageClassName, const uint32_t copyNb, const std::string& tapePoolName) override;
+  void modifyLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &currentName, const std::string &newName) override;
+  void modifyLogicalLibraryComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) override;
+  void modifyLogicalLibraryDisabledReason(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& disabledReason) override;
+  void setLogicalLibraryDisabled(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const bool disabledValue) override;
+  void modifyMountPolicyArchiveMinRequestAge(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t minArchiveRequestAge) override;
+  void modifyMountPolicyArchivePriority(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t archivePriority) override;
+  void modifyMountPolicyComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) override;
+  void modifyMountPolicyRetrieveMinRequestAge(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t minRetrieveRequestAge) override;
+  void modifyMountPolicyRetrievePriority(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t retrievePriority) override;
+  void modifyRequesterActivityMountRuleComment(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string &activityRegex, const std::string& comment) override;
+  void modifyRequesteMountRuleComment(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string& comment) override;
+  void modifyRequesterGroupMountRuleComment(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterGroupName, const std::string& comment) override;
+  void modifyRequesterGroupMountRulePolicy(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterGroupName, const std::string& mountPolicy) override;
+  void modifyRequesterMountRulePolicy(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string& mountPolicy) override;
+  void modifyRequesterActivityMountRulePolicy(const common::dataStructures::SecurityIdentity& admin, const std::string& instanceName, const std::string& requesterName, const std::string &activityRegex, const std::string& mountPolicy) override;
+  void modifyStorageClassComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) override;
+  void modifyStorageClassVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) override;
+  void modifyStorageClassName(const common::dataStructures::SecurityIdentity& admin, const std::string& currentName, const std::string& newName) override;
+  void modifyStorageClassNbCopies(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t nbCopies) override;
+  void modifyTapeComment(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::optional<std::string> &comment) override;
+  void modifyTapeEncryptionKeyName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& encryptionKeyName) override;
+  void modifyTapeVerificationStatus(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& verificationStatus) override;
+  void modifyTapeState(const common::dataStructures::SecurityIdentity &admin,const std::string &vid, const common::dataStructures::Tape::State & state, const std::optional<std::string> & stateReason) override;
+  void modifyTapeMediaType(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& mediaType) override;
+  void modifyTapeVendor(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& vendor) override;
+  void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& logicalLibraryName) override;
+  void modifyTapePoolComment(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& comment) override;
+  void modifyTapePoolVo(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &vo) override;
+  void modifyTapePoolNbPartialTapes(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const uint64_t nbPartialTapes) override;
+  void modifyTapePoolSupply(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const std::string& supply) override;
+  void modifyTapePoolName(const common::dataStructures::SecurityIdentity& admin, const std::string& currentName, const std::string& newName) override;
+  void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& tapePoolName) override;
+  void noSpaceLeftOnTape(const std::string& vid) override;
+  void ping() override;
+  void verifySchemaVersion() override;
+  SchemaVersion getSchemaVersion() const override;
+  uint64_t checkAndGetNextArchiveFileId(const std::string &diskInstanceName, const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override;
   common::dataStructures::ArchiveFileQueueCriteria getArchiveFileQueueCriteria(const std::string &diskInstanceName,
-    const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFile(const std::string& diskInstanceName, const uint64_t archiveFileId, const common::dataStructures::RequesterIdentity& user, const std::optional<std::string>& activity, log::LogContext& lc, const std::optional<std::string> &mountPolicyName) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void reclaimTape(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, cta::log::LogContext & lc) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void checkTapeForLabel(const std::string& vid) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  uint64_t getNbFilesOnTape(const std::string& vid) const  override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void setTapeDisabled(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string & reason) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void setTapeFull(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const bool fullValue) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void setTapeDirty(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const bool dirtyValue) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void setTapeDirty(const std::string & vid) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void setTapeIsFromCastorInUnitTests(const std::string &vid) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void setTapePoolEncryption(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const bool encryptionValue) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  bool tapeExists(const std::string& vid) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  bool diskSystemExists(const std::string& name) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void tapeLabelled(const std::string& vid, const std::string& drive) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void tapeMountedForArchive(const std::string& vid, const std::string& drive) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void tapeMountedForRetrieve(const std::string& vid, const std::string& drive) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  bool tapePoolExists(const std::string& tapePoolName) const { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
-  void updateDiskFileId(uint64_t archiveFileId, const std::string &diskInstance, const std::string &diskFileId) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
+    const std::string &storageClassName, const common::dataStructures::RequesterIdentity &user) override;
+  common::dataStructures::RetrieveFileQueueCriteria prepareToRetrieveFile(const std::string& diskInstanceName, const uint64_t archiveFileId, const common::dataStructures::RequesterIdentity& user, const std::optional<std::string>& activity, log::LogContext& lc, const std::optional<std::string> &mountPolicyName) override;
+  void reclaimTape(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, cta::log::LogContext & lc) override;
+  void checkTapeForLabel(const std::string& vid) override;
+  uint64_t getNbFilesOnTape(const std::string& vid) const  override;
+  void setTapeDisabled(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string & reason) override;
+  void setTapeFull(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const bool fullValue) override;
+  void setTapeDirty(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const bool dirtyValue) override;
+  void setTapeDirty(const std::string & vid) override;
+  void setTapeIsFromCastorInUnitTests(const std::string &vid) override;
+  void setTapePoolEncryption(const common::dataStructures::SecurityIdentity& admin, const std::string& name, const bool encryptionValue) override;
+  bool tapeExists(const std::string& vid) const;
+  bool diskSystemExists(const std::string& name) const;
+  void tapeLabelled(const std::string& vid, const std::string& drive) override;
+  void tapeMountedForArchive(const std::string& vid, const std::string& drive) override;
+  void tapeMountedForRetrieve(const std::string& vid, const std::string& drive) override;
+  bool tapePoolExists(const std::string& tapePoolName) const;
+  void updateDiskFileId(uint64_t archiveFileId, const std::string &diskInstance, const std::string &diskFileId) override;
   void moveArchiveFileToRecycleLog(const common::dataStructures::DeleteArchiveRequest &request,
-  log::LogContext & lc) override {throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented");}
-  // Special functions for unit tests.
-  void addEnabledTape(const std::string & vid) {
-    threading::MutexLocker lm(m_tapeEnablingMutex);
-    m_tapeEnabling[vid]=common::dataStructures::Tape::ACTIVE;
-  }
-  void addDisabledTape(const std::string & vid) {
-    threading::MutexLocker lm(m_tapeEnablingMutex);
-    m_tapeEnabling[vid]=common::dataStructures::Tape::DISABLED;
-  }
-  common::dataStructures::VidToTapeMap getTapesByVid(const std::string& vid) const {
-    std::set<std::string> vids = {vid};
-    return getTapesByVid(vids);
-  }
-  common::dataStructures::VidToTapeMap getTapesByVid(const std::set<std::string>& vids) const {
-    // Minimal implementation of VidToMap for retrieve request unit tests. We just support
-    // disabled status for the tapes.
-    // If the tape is not listed, it is listed as enabled in the return value.
-    threading::MutexLocker lm(m_tapeEnablingMutex);
-    common::dataStructures::VidToTapeMap ret;
-    for (const auto & v: vids) {
-      try {
-        ret[v].state = m_tapeEnabling.at(v);
-      } catch (std::out_of_range &) {
-        ret[v].state = common::dataStructures::Tape::ACTIVE;
-      }
-    }
-    return ret;
-  }
-  std::list<common::dataStructures::MountPolicy> getMountPolicies() const {
-    std::list<common::dataStructures::MountPolicy> mountPolicies;
-    common::dataStructures::MountPolicy mp1;
-    mp1.name = "mountPolicy";
-    mp1.archivePriority = 1;
-    mp1.archiveMinRequestAge = 0;
-    mp1.retrievePriority = 1;
-    mp1.retrieveMinRequestAge = 0;
-    mountPolicies.push_back(mp1);
-
-    common::dataStructures::MountPolicy mp2;
-    mp2.name = "moreAdvantageous";
-    mp2.archivePriority = 2;
-    mp2.archiveMinRequestAge = 0;
-    mp2.retrievePriority = 2;
-    mp2.retrieveMinRequestAge = 0;
-    mountPolicies.push_back(mp1);
-    return mountPolicies;
-  }
-
-  std::list<common::dataStructures::MountPolicy> getCachedMountPolicies() const override {
-    std::list<common::dataStructures::MountPolicy> mountPolicies;
-    common::dataStructures::MountPolicy mp1;
-    mp1.name = "mountPolicy";
-    mp1.archivePriority = 1;
-    mp1.archiveMinRequestAge = 0;
-    mp1.retrievePriority = 1;
-    mp1.retrieveMinRequestAge = 0;
-    mountPolicies.push_back(mp1);
-
-    common::dataStructures::MountPolicy mp2;
-    mp2.name = "moreAdvantageous";
-    mp2.archivePriority = 2;
-    mp2.archiveMinRequestAge = 0;
-    mp2.retrievePriority = 2;
-    mp2.retrieveMinRequestAge = 0;
-    mountPolicies.push_back(mp1);
-    return mountPolicies;
-  }
-
-  std::list<std::string> getTapeDriveNames() const {
-    return {m_tapeDriveStatus.driveName};
-  }
+  log::LogContext & lc) override;
 
-  std::optional<common::dataStructures::TapeDrive> getTapeDrive(const std::string &tapeDriveName) const override {
-    if (m_tapeDriveStatus.driveName != "") return m_tapeDriveStatus;
-    common::dataStructures::TapeDrive tapeDriveStatus;
-    const time_t reportTime = time(nullptr);
+  common::dataStructures::VidToTapeMap getTapesByVid(const std::string& vid) const override;
 
-    tapeDriveStatus.driveName = tapeDriveName;
-    tapeDriveStatus.host = "Dummy_Host";
-    tapeDriveStatus.logicalLibrary = "Dummy_Library";
+  common::dataStructures::VidToTapeMap getTapesByVid(const std::set<std::string>& vids) const override;
 
-    tapeDriveStatus.downOrUpStartTime = reportTime;
+  std::list<common::dataStructures::MountPolicy> getMountPolicies() const override;
 
-    tapeDriveStatus.mountType = common::dataStructures::MountType::NoMount;
-    tapeDriveStatus.driveStatus = common::dataStructures::DriveStatus::Down;
-    tapeDriveStatus.desiredUp = false;
-    tapeDriveStatus.desiredForceDown = false;
+  std::list<common::dataStructures::MountPolicy> getCachedMountPolicies() const override;
 
-    tapeDriveStatus.diskSystemName = "Dummy_System";
-    tapeDriveStatus.reservedBytes = 0;
-    tapeDriveStatus.reservationSessionId = 0;
+  std::list<std::string> getTapeDriveNames() const override;
 
+  std::optional<common::dataStructures::TapeDrive> getTapeDrive(const std::string &tapeDriveName) const override;
 
-    return tapeDriveStatus;
-  }
+  std::list<common::dataStructures::TapeDrive> getTapeDrives() const override;
 
-  std::list<common::dataStructures::TapeDrive> getTapeDrives() const override {
-    std::list<common::dataStructures::TapeDrive> tapeDrives;
-    const auto tapeDrive = getTapeDrive(m_tapeDriveStatus.driveName);
-    if (tapeDrive.has_value()) tapeDrives.push_back(tapeDrive.value());
-    return tapeDrives;
-  }
+  void setDesiredTapeDriveState(const std::string&, const common::dataStructures::DesiredDriveState &desiredState) override;
 
-  void setDesiredTapeDriveState(const std::string&,
-      const common::dataStructures::DesiredDriveState &desiredState) override {
-    m_tapeDriveStatus.desiredUp = desiredState.up;
-    m_tapeDriveStatus.desiredForceDown = desiredState.forceDown;
-    m_tapeDriveStatus.reasonUpDown = desiredState.reason;
-  }
-
-  void setDesiredTapeDriveStateComment(const std::string& tapeDriveName,
-    const std::string &comment) override {
-    m_tapeDriveStatus.userComment = comment;
-  }
+  void setDesiredTapeDriveStateComment(const std::string& tapeDriveName, const std::string &comment) override;
 
   void updateTapeDriveStatistics(const std::string& tapeDriveName,
     const std::string& host, const std::string& logicalLibrary,
-    const common::dataStructures::TapeDriveStatistics& statistics) override {
-    m_tapeDriveStatus.driveName = tapeDriveName;
-    m_tapeDriveStatus.host = host;
-    m_tapeDriveStatus.logicalLibrary = logicalLibrary;
-    m_tapeDriveStatus.bytesTransferedInSession = statistics.bytesTransferedInSession;
-    m_tapeDriveStatus.filesTransferedInSession = statistics.filesTransferedInSession;
-    m_tapeDriveStatus.lastModificationLog = statistics.lastModificationLog;
-  }
-
-  void updateTapeDriveStatus(const common::dataStructures::TapeDrive &tapeDrive) {
-    m_tapeDriveStatus = tapeDrive;
-  }
-
-  void modifyTapeDrive(const common::dataStructures::TapeDrive &tapeDrive) {
-    m_tapeDriveStatus = tapeDrive;
-  }
-
-  std::map<std::string, uint64_t> getDiskSpaceReservations() const override {
-    std::map<std::string, uint64_t> ret;
-    const auto tdNames = getTapeDriveNames();
-    for (const auto& driveName : tdNames) {
-      const auto tdStatus = getTapeDrive(driveName);
-      if (tdStatus.value().diskSystemName) {
-        //no need to check key, operator[] initializes missing values at zero for scalar types
-        ret[tdStatus.value().diskSystemName.value()] += tdStatus.value().reservedBytes.value();
-      }
-    }
-    return ret;
-  }
+    const common::dataStructures::TapeDriveStatistics& statistics) override;
 
-  void reserveDiskSpace(const std::string& driveName, const uint64_t mountId, const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) override {
-    if(diskSpaceReservation.empty()) return;
+  void updateTapeDriveStatus(const common::dataStructures::TapeDrive &tapeDrive) override;
 
-    log::ScopedParamContainer params(lc);
-    params.add("driveName", driveName)
-          .add("diskSystem", diskSpaceReservation.begin()->first)
-          .add("reservationBytes", diskSpaceReservation.begin()->second)
-          .add("mountId", mountId);
-    lc.log(log::DEBUG, "In RetrieveMount::reserveDiskSpace(): reservation request.");
+  std::map<std::string, uint64_t> getDiskSpaceReservations() const override;
 
-    auto tdStatus = getTapeDrive(driveName);
-    if (!tdStatus) return;
-
-    if (!tdStatus.value().reservationSessionId) {
-      tdStatus.value().reservationSessionId = mountId;
-      tdStatus.value().reservedBytes = 0;
-    }
-
-    if (tdStatus.value().reservationSessionId != mountId) {
-      tdStatus.value().reservationSessionId = mountId;
-      tdStatus.value().reservedBytes = 0;
-    }
-
-    tdStatus.value().diskSystemName = diskSpaceReservation.begin()->first;
-    tdStatus.value().reservedBytes.value() += diskSpaceReservation.begin()->second;
-    modifyTapeDrive(tdStatus.value());
-  }
-
-  void releaseDiskSpace(const std::string& driveName, const uint64_t mountId, const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) override {
-    if (diskSpaceReservation.empty()) return;
-
-    log::ScopedParamContainer params(lc);
-    params.add("driveName", driveName)
-          .add("diskSystem", diskSpaceReservation.begin()->first)
-          .add("reservationBytes", diskSpaceReservation.begin()->second)
-          .add("mountId", mountId);
-    lc.log(log::DEBUG, "In RetrieveMount::releaseDiskSpace(): reservation release request.");
-
-    auto tdStatus = getTapeDrive(driveName);
-
-    if (!tdStatus) return;
-    if (!tdStatus.value().reservationSessionId) {
-      return;
-    }
-    if (tdStatus.value().reservationSessionId != mountId) {
-      return;
-    }
-    auto& bytes = diskSpaceReservation.begin()->second;
-    if (bytes > tdStatus.value().reservedBytes) throw NegativeDiskSpaceReservationReached(
-      "In DriveState::subtractDiskSpaceReservation(): we would reach a negative reservation size.");
-    tdStatus.value().diskSystemName = diskSpaceReservation.begin()->first;
-    tdStatus.value().reservedBytes.value() -= bytes;
-    modifyTapeDrive(tdStatus.value());
-  }
+  void reserveDiskSpace(const std::string& driveName, const uint64_t mountId, const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) override;
 
+  void releaseDiskSpace(const std::string& driveName, const uint64_t mountId, const DiskSpaceReservationRequest& diskSpaceReservation, log::LogContext & lc) override;
 
   /*
    * Implemented for testing disk space reservation logic
    */
-  disk::DiskSystemList getAllDiskSystems() const override {
-    return m_diskSystemList;
-  }
+  disk::DiskSystemList getAllDiskSystems() const override;
 
-  void createDiskInstance(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override {
-    m_diskInstances[name] = {name, comment, common::dataStructures::EntryLog(), common::dataStructures::EntryLog()};
-  }
+  void createDiskInstance(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &comment) override;
 
-  void createDiskInstanceSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL, const uint64_t refreshInterval, const std::string &comment) override {
-    m_diskInstanceSpaces[name] = {name, diskInstance, freeSpaceQueryURL, refreshInterval, 0, 0, comment, common::dataStructures::EntryLog(), common::dataStructures::EntryLog()};
-  }
+  void createDiskInstanceSpace(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstance, const std::string &freeSpaceQueryURL, const uint64_t refreshInterval, const std::string &comment) override;
 
-  void createDiskSystem(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName, const std::string &diskInstanceSpaceName, const std::string &fileRegexp, const uint64_t targetedFreeSpace, const time_t sleepTime, const std::string &comment)  override {
-    m_diskSystemList.push_back({name, m_diskInstanceSpaces.at(diskInstanceSpaceName), fileRegexp, targetedFreeSpace, sleepTime, common::dataStructures::EntryLog(), common::dataStructures::EntryLog{}, comment});
-  }
+  void createDiskSystem(const common::dataStructures::SecurityIdentity &admin, const std::string &name, const std::string &diskInstanceName, const std::string &diskInstanceSpaceName, const std::string &fileRegexp, const uint64_t targetedFreeSpace, const time_t sleepTime, const std::string &comment) override;
 
-  void modifyDiskInstanceSpaceFreeSpace(const std::string &name, const std::string &diskInstance, const uint64_t freeSpace) override {
-    m_diskInstanceSpaces[name].freeSpace = freeSpace;
-    m_diskInstanceSpaces[name].lastRefreshTime = time(nullptr);
-  }
+  void modifyDiskInstanceSpaceFreeSpace(const std::string &name, const std::string &diskInstance, const uint64_t freeSpace) override;
 
+  // This special funcitons for unit tests should be put in private
+  void addEnabledTape(const std::string & vid);
+  void addDisabledTape(const std::string & vid);
 
 private:
   mutable threading::Mutex m_tapeEnablingMutex;
@@ -433,7 +257,8 @@ private:
   disk::DiskSystemList m_diskSystemList;
   std::map<std::string, common::dataStructures::DiskInstance> m_diskInstances;
   std::map<std::string, common::dataStructures::DiskInstanceSpace> m_diskInstanceSpaces;
-
 };
 
-}} // namespace cta::catalogue.
+}  // namespace catalogue
+}  // namespace cta.
+
diff --git a/catalogue/InMemoryCatalogueFactory.hpp b/catalogue/InMemoryCatalogueFactory.hpp
index 2b116cf49a49946e0741843473ac3b1530001173..3d340fb8ef804e14713dcd58612c6fc3bacfa707 100644
--- a/catalogue/InMemoryCatalogueFactory.hpp
+++ b/catalogue/InMemoryCatalogueFactory.hpp
@@ -18,7 +18,7 @@
 #pragma once
 
 #include "catalogue/CatalogueFactory.hpp"
-#include "rdbms/Login.hpp"
+#include "common/log/Logger.hpp"
 
 namespace cta {
 namespace catalogue {
diff --git a/catalogue/OracleCatalogue.cpp b/catalogue/OracleCatalogue.cpp
index 4c52ce3d7d616604c87c7ea0a24f251f8209d717..8eedc3a3ce8a8a9ea9d2329bc81fe6e93bd6c1c3 100644
--- a/catalogue/OracleCatalogue.cpp
+++ b/catalogue/OracleCatalogue.cpp
@@ -15,14 +15,22 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <algorithm>
+
 #include "catalogue/ArchiveFileRow.hpp"
+#include "catalogue/CatalogueItor.hpp"
+#include "catalogue/InsertFileRecycleLog.hpp"
 #include "catalogue/OracleCatalogue.hpp"
 #include "catalogue/retryOnLostConnection.hpp"
-#include "catalogue/InsertFileRecycleLog.hpp"
+#include "catalogue/TapeItemWrittenPointer.hpp"
+#include "common/dataStructures/DeleteArchiveRequest.hpp"
+#include "common/dataStructures/FileRecycleLog.hpp"
 #include "common/exception/Exception.hpp"
+#include "common/exception/FileSizeMismatch.hpp"
 #include "common/exception/LostDatabaseConnection.hpp"
 #include "common/exception/TapeFseqMismatch.hpp"
 #include "common/exception/UserError.hpp"
+#include "common/log/TimingList.hpp"
 #include "common/threading/MutexLocker.hpp"
 #include "common/Timer.hpp"
 #include "common/utils/utils.hpp"
@@ -30,8 +38,6 @@
 #include "rdbms/rdbms.hpp"
 #include "rdbms/wrapper/OcciColumn.hpp"
 #include "rdbms/wrapper/OcciStmt.hpp"
-#include "common/log/TimingList.hpp"
-#include <algorithm>
 
 namespace cta {
 namespace catalogue {
diff --git a/catalogue/PollDatabaseCmd.cpp b/catalogue/PollDatabaseCmd.cpp
index 82a40e10ae273532f1429c634b7441f6cb5d270f..9fdd98337e836de57c40ef3e1e2df59f67f59bc9 100644
--- a/catalogue/PollDatabaseCmd.cpp
+++ b/catalogue/PollDatabaseCmd.cpp
@@ -15,12 +15,13 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <unistd.h>
+
 #include "catalogue/CatalogueFactoryFactory.hpp"
 #include "catalogue/PollDatabaseCmd.hpp"
 #include "catalogue/PollDatabaseCmdLineArgs.hpp"
 #include "rdbms/ConnPool.hpp"
-
-#include <unistd.h>
+#include "rdbms/Login.hpp"
 
 namespace cta {
 namespace catalogue {
diff --git a/catalogue/PostgresCatalogue.cpp b/catalogue/PostgresCatalogue.cpp
index c0baa09606da8608fca087dca66cea200c54ecd6..031ab83fce094705b2124c2de0e2ab0c92e2107b 100644
--- a/catalogue/PostgresCatalogue.cpp
+++ b/catalogue/PostgresCatalogue.cpp
@@ -15,21 +15,28 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <algorithm>
+
 #include "catalogue/ArchiveFileRow.hpp"
+#include "catalogue/CatalogueItor.hpp"
+#include "catalogue/InsertFileRecycleLog.hpp"
 #include "catalogue/PostgresCatalogue.hpp"
 #include "catalogue/retryOnLostConnection.hpp"
+#include "catalogue/TapeItemWrittenPointer.hpp"
+#include "common/dataStructures/DeleteArchiveRequest.hpp"
+#include "common/dataStructures/FileRecycleLog.hpp"
 #include "common/exception/Exception.hpp"
+#include "common/exception/FileSizeMismatch.hpp"
 #include "common/exception/LostDatabaseConnection.hpp"
+#include "common/exception/TapeFseqMismatch.hpp"
 #include "common/exception/UserError.hpp"
+#include "common/log/TimingList.hpp"
 #include "common/Timer.hpp"
 #include "common/utils/utils.hpp"
 #include "rdbms/AutoRollback.hpp"
 #include "rdbms/rdbms.hpp"
 #include "rdbms/wrapper/PostgresColumn.hpp"
 #include "rdbms/wrapper/PostgresStmt.hpp"
-#include "common/log/TimingList.hpp"
-#include "InsertFileRecycleLog.hpp"
-#include <algorithm>
 
 namespace cta {
 namespace catalogue {
diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp
index be1b28b65942c5ae934d5494690b272d2478d7b3..90fa70a8367391e973c8fc7e4f2cd15856b2fdc0 100644
--- a/catalogue/RdbmsCatalogue.cpp
+++ b/catalogue/RdbmsCatalogue.cpp
@@ -15,38 +15,65 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <algorithm>
+#include <climits>
+#include <ctype.h>
+#include <list>
+#include <memory>
+#include <string>
+#include <time.h>
+#include <tuple>
+#include <utility>
+
 #include "catalogue/ArchiveFileRow.hpp"
 #include "catalogue/ArchiveFileRowWithoutTimestamps.hpp"
+#include "catalogue/CatalogueItor.hpp"
+#include "catalogue/CreateMountPolicyAttributes.hpp"
+#include "catalogue/CreateTapeAttributes.hpp"
+#include "catalogue/MediaType.hpp"
+#include "catalogue/MediaTypeWithLogs.hpp"
 #include "catalogue/RdbmsCatalogue.hpp"
-#include "catalogue/RdbmsCatalogueGetArchiveFilesItor.hpp"
 #include "catalogue/RdbmsCatalogueGetArchiveFilesForRepackItor.hpp"
+#include "catalogue/RdbmsCatalogueGetArchiveFilesItor.hpp"
 #include "catalogue/RdbmsCatalogueTapeContentsItor.hpp"
+#include "catalogue/RecyleTapeFileSearchCriteria.hpp"
 #include "catalogue/SchemaVersion.hpp"
 #include "catalogue/SqliteCatalogueSchema.hpp"
+#include "catalogue/TapeForWriting.hpp"
+#include "catalogue/TapePool.hpp"
+#include "common/dataStructures/AdminUser.hpp"
+#include "common/dataStructures/ArchiveFileQueueCriteria.hpp"
+#include "common/dataStructures/ArchiveFileSummary.hpp"
+#include "common/dataStructures/ArchiveRoute.hpp"
+#include "common/dataStructures/DeleteArchiveRequest.hpp"
+#include "common/dataStructures/DesiredDriveState.hpp"
+#include "common/dataStructures/DiskInstance.hpp"
 #include "common/dataStructures/EntryLog.hpp"
-#include "common/dataStructures/TapeFile.hpp"
+#include "common/dataStructures/FileRecycleLog.hpp"
 #include "common/dataStructures/LabelFormat.hpp"
+#include "common/dataStructures/LogicalLibrary.hpp"
+#include "common/dataStructures/RequesterActivityMountRule.hpp"
+#include "common/dataStructures/RequesterGroupMountRule.hpp"
+#include "common/dataStructures/RequesterMountRule.hpp"
+#include "common/dataStructures/RetrieveFileQueueCriteria.hpp"
+#include "common/dataStructures/SecurityIdentity.hpp"
+#include "common/dataStructures/StorageClass.hpp"
+#include "common/dataStructures/TapeDrive.hpp"
+#include "common/dataStructures/TapeDriveStatistics.hpp"
+#include "common/dataStructures/TapeFile.hpp"
 #include "common/exception/Exception.hpp"
 #include "common/exception/LostDatabaseConnection.hpp"
 #include "common/exception/UserError.hpp"
-#include "common/utils/Regex.hpp"
+#include "common/exception/UserErrorWithCacheInfo.hpp"
 #include "common/log/TimingList.hpp"
 #include "common/threading/MutexLocker.hpp"
 #include "common/Timer.hpp"
+#include "common/utils/Regex.hpp"
 #include "common/utils/utils.hpp"
+#include "disk/DiskSystem.hpp"
 #include "rdbms/AutoRollback.hpp"
-#include "version.h"
 #include "RdbmsCatalogueGetFileRecycleLogItor.hpp"
-
-#include <algorithm>
-#include <climits>
-#include <ctype.h>
-#include <list>
-#include <memory>
-#include <string>
-#include <time.h>
-#include <tuple>
-#include <utility>
+#include "version.h"
 
 namespace cta {
 namespace catalogue {
diff --git a/catalogue/RdbmsCatalogue.hpp b/catalogue/RdbmsCatalogue.hpp
index ea76e97d35f4cb26f57f86b8eb0bdb4ceff25d0f..f0f9e6a73737a622418c5ca836cd145d27a731e7 100644
--- a/catalogue/RdbmsCatalogue.hpp
+++ b/catalogue/RdbmsCatalogue.hpp
@@ -17,49 +17,33 @@
 
 #pragma once
 
+#include <memory>
+#include <string>
+
 #include "catalogue/Catalogue.hpp"
+#include "catalogue/InsertFileRecycleLog.hpp"
 #include "catalogue/RequesterAndGroupMountPolicies.hpp"
 #include "catalogue/TimeBasedCache.hpp"
+#include "common/dataStructures/TapeCopyToPoolMap.hpp"
 #include "common/threading/Mutex.hpp"
 #include "rdbms/ConnPool.hpp"
 #include "rdbms/Login.hpp"
-#include "InsertFileRecycleLog.hpp"
-
-#include <memory>
-#include <string>
 
 namespace cta {
 namespace common {
 namespace dataStructures {
-
-/**
- * Forward declaration.
- */
 class TapeFile;
-
-} // namespace dataStructures
-} // namespace catalogue
-} // namespace cta
+}  // namespace dataStructures
+}  // namespace common
+}  // namespace cta
 
 namespace cta {
 namespace catalogue {
 
-/**
- * Forward declaration.
- */
 class ArchiveFileRow;
-
-class RsetWrapper;
-
-/**
- * Forward declaration.
- */
 class ArchiveFileRowWithoutTimestamps;
-
-/**
- * Forward declaration.
- */
 class RdbmsCatalogueGetArchiveFilesItor;
+class RsetWrapper;
 
 /**
  * CTA catalogue implemented using a relational database backend.
@@ -595,7 +579,7 @@ public:
    * This method will throw an exception if the specified tape is not FULL.
    *
    * This method will throw an exception if there is still at least one tape
-   * file recorded in the cataligue as being on the specified tape.
+   * file recorded in the catalogue as being on the specified tape.
    *
    * @param admin The administrator.
    * @param vid The volume identifier of the tape to be reclaimed.
diff --git a/catalogue/RdbmsCatalogueGetArchiveFilesForRepackItor.cpp b/catalogue/RdbmsCatalogueGetArchiveFilesForRepackItor.cpp
index 46b0067e06e8f2d478e890c4c9937776a04c6297..c944b44c4f84dd874ee1305f98ca194b692d66e6 100644
--- a/catalogue/RdbmsCatalogueGetArchiveFilesForRepackItor.cpp
+++ b/catalogue/RdbmsCatalogueGetArchiveFilesForRepackItor.cpp
@@ -15,6 +15,7 @@
  *               submit itself to any jurisdiction.
  */
 
+#include "catalogue/CatalogueItor.hpp"
 #include "catalogue/RdbmsCatalogueGetArchiveFilesForRepackItor.hpp"
 #include "common/exception/Exception.hpp"
 #include "common/exception/LostDatabaseConnection.hpp"
diff --git a/catalogue/RdbmsCatalogueGetArchiveFilesForRepackItor.hpp b/catalogue/RdbmsCatalogueGetArchiveFilesForRepackItor.hpp
index 7ab12c8e66a673a3d4e05a775f18ad6f15de5dca..b8d8f1b6c5b7a87cbb6866318bb1784c81b2c338 100644
--- a/catalogue/RdbmsCatalogueGetArchiveFilesForRepackItor.hpp
+++ b/catalogue/RdbmsCatalogueGetArchiveFilesForRepackItor.hpp
@@ -19,11 +19,11 @@
 
 #include "catalogue/ArchiveFileBuilder.hpp"
 #include "catalogue/Catalogue.hpp"
+#include "common/dataStructures/ArchiveFile.hpp"
 #include "common/log/Logger.hpp"
 #include "rdbms/ConnPool.hpp"
-#include "rdbms/Stmt.hpp"
 #include "rdbms/Rset.hpp"
-#include "common/dataStructures/ArchiveFile.hpp"
+#include "rdbms/Stmt.hpp"
 
 namespace cta {
 namespace catalogue {
diff --git a/catalogue/RdbmsCatalogueGetArchiveFilesItor.cpp b/catalogue/RdbmsCatalogueGetArchiveFilesItor.cpp
index f6214e58ffb1f5dd499621814e2804cbd9af943b..be4c0bcb4f0b8ec68714b38ded2683b68d942ae5 100644
--- a/catalogue/RdbmsCatalogueGetArchiveFilesItor.cpp
+++ b/catalogue/RdbmsCatalogueGetArchiveFilesItor.cpp
@@ -15,6 +15,7 @@
  *               submit itself to any jurisdiction.
  */
 
+#include "catalogue/CatalogueItor.hpp"
 #include "catalogue/RdbmsCatalogueGetArchiveFilesItor.hpp"
 #include "common/exception/Exception.hpp"
 #include "common/exception/LostDatabaseConnection.hpp"
diff --git a/catalogue/RdbmsCatalogueGetFileRecycleLogItor.cpp b/catalogue/RdbmsCatalogueGetFileRecycleLogItor.cpp
index 324ebdabedb97fe9dd355223c1bd5e792f1df5ee..0a969372b5ec2410a0ba5eb7499867084e077ea0 100644
--- a/catalogue/RdbmsCatalogueGetFileRecycleLogItor.cpp
+++ b/catalogue/RdbmsCatalogueGetFileRecycleLogItor.cpp
@@ -15,13 +15,15 @@
  *               submit itself to any jurisdiction.
  */
 
-#include "RdbmsCatalogueGetFileRecycleLogItor.hpp"
-#include "common/log/LogContext.hpp"
-#include "common/exception/UserError.hpp"
+#include "catalogue/CatalogueItor.hpp"
+#include "catalogue/RdbmsCatalogueGetFileRecycleLogItor.hpp"
 #include "common/dataStructures/FileRecycleLog.hpp"
+#include "common/exception/UserError.hpp"
+#include "common/log/LogContext.hpp"
+
 namespace cta {
 namespace catalogue {
-  
+
 //------------------------------------------------------------------------------
 // constructor
 //------------------------------------------------------------------------------
diff --git a/catalogue/RdbmsCatalogueGetFileRecycleLogItor.hpp b/catalogue/RdbmsCatalogueGetFileRecycleLogItor.hpp
index 58ce5b1ce675c74b6d0d0117d63dac7dc79a875c..5bf51cd53eb9ccdea554e4db7add632ca92699cc 100644
--- a/catalogue/RdbmsCatalogueGetFileRecycleLogItor.hpp
+++ b/catalogue/RdbmsCatalogueGetFileRecycleLogItor.hpp
@@ -17,7 +17,10 @@
 
 #pragma once
 
-#include "Catalogue.hpp"
+#include <string>
+
+#include "catalogue/Catalogue.hpp"
+#include "common/dataStructures/FileRecycleLog.hpp"
 #include "rdbms/ConnPool.hpp"
 
 namespace cta {
@@ -32,9 +35,9 @@ public:
    * @param conn A database connection.
    */
   RdbmsCatalogueGetFileRecycleLogItor(
-    log::Logger &log, 
-    rdbms::Conn &&conn, 
-    const RecycleTapeFileSearchCriteria & searchCriteria, 
+    log::Logger &log,
+    rdbms::Conn &&conn,
+    const RecycleTapeFileSearchCriteria & searchCriteria,
     const std::string &tempDiskFxidsTableName);
 
   /**
@@ -64,7 +67,6 @@ private:
    */
   rdbms::Conn m_conn;
 
-  
   /**
    * The search criteria to be used when listing recycled tape files.
    */
@@ -101,9 +103,9 @@ private:
    * This method is idempotent.
    */
   void releaseDbResources() noexcept;
-  
-  common::dataStructures::FileRecycleLog populateFileRecycleLog();
 
+  common::dataStructures::FileRecycleLog populateFileRecycleLog();
 };
 
-}}
\ No newline at end of file
+}  // namespace catalogue
+}  // namespace cta
\ No newline at end of file
diff --git a/catalogue/RdbmsCatalogueTapeContentsItor.cpp b/catalogue/RdbmsCatalogueTapeContentsItor.cpp
index ff7e7498e03abde09f8c17aeb521071c076e80aa..9b90e56e59a97ca887a36b5f69fdd1ed48779d46 100644
--- a/catalogue/RdbmsCatalogueTapeContentsItor.cpp
+++ b/catalogue/RdbmsCatalogueTapeContentsItor.cpp
@@ -15,6 +15,7 @@
  *               submit itself to any jurisdiction.
  */
 
+#include "catalogue/CatalogueItor.hpp"
 #include "catalogue/RdbmsCatalogueTapeContentsItor.hpp"
 #include "common/exception/Exception.hpp"
 #include "common/exception/LostDatabaseConnection.hpp"
diff --git a/catalogue/SqliteCatalogue.cpp b/catalogue/SqliteCatalogue.cpp
index 8d5b34160ae1973edc21e03ec9bf3f7ba726b9db..6a37ddd140970d128753696a7817b03347a14928 100644
--- a/catalogue/SqliteCatalogue.cpp
+++ b/catalogue/SqliteCatalogue.cpp
@@ -17,9 +17,15 @@
 
 #include "catalogue/ArchiveFileRow.hpp"
 #include "catalogue/ArchiveFileRowWithoutTimestamps.hpp"
-#include "catalogue/SqliteCatalogueSchema.hpp"
+#include "catalogue/CatalogueItor.hpp"
 #include "catalogue/SqliteCatalogue.hpp"
+#include "catalogue/SqliteCatalogueSchema.hpp"
+#include "catalogue/TapeItemWrittenPointer.hpp"
+#include "common/dataStructures/DeleteArchiveRequest.hpp"
+#include "common/dataStructures/FileRecycleLog.hpp"
 #include "common/exception/Exception.hpp"
+#include "common/exception/FileSizeMismatch.hpp"
+#include "common/exception/TapeFseqMismatch.hpp"
 #include "common/exception/UserError.hpp"
 #include "common/log/TimingList.hpp"
 #include "common/threading/MutexLocker.hpp"
diff --git a/catalogue/TapeDrivesCatalogueState.cpp b/catalogue/TapeDrivesCatalogueState.cpp
index 972ac56ffa2c23e50a90d2e88430bf78c9e414e6..59068a292466f67abc8f1801f60c7c2d2e5a8daf 100644
--- a/catalogue/TapeDrivesCatalogueState.cpp
+++ b/catalogue/TapeDrivesCatalogueState.cpp
@@ -18,11 +18,15 @@
 #include <algorithm>
 #include <list>
 
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/TapeDrivesCatalogueState.hpp"
 #include "common/dataStructures/DesiredDriveState.hpp"
 #include "common/dataStructures/DriveInfo.hpp"
+#include "common/dataStructures/SecurityIdentity.hpp"
 #include "common/dataStructures/TapeDrive.hpp"
+#include "common/dataStructures/TapeDriveStatistics.hpp"
+#include "common/log/LogContext.hpp"
 #include "common/log/Logger.hpp"
-#include "TapeDrivesCatalogueState.hpp"
 #include "tapeserver/daemon/TpconfigLine.hpp"
 #include "version.h"
 
diff --git a/catalogue/TapeDrivesCatalogueState.hpp b/catalogue/TapeDrivesCatalogueState.hpp
index e935d28d36b9c4fcb12ea5eef57662dffec156aa..e7605d48099934a7d81c251d036145db924cb5f7 100644
--- a/catalogue/TapeDrivesCatalogueState.hpp
+++ b/catalogue/TapeDrivesCatalogueState.hpp
@@ -20,9 +20,16 @@
 #include <limits>
 #include <string>
 
-#include "catalogue/Catalogue.hpp"
+#include "common/dataStructures/DriveStatus.hpp"
+#include "common/dataStructures/MountType.hpp"
+#include "common/exception/UserError.hpp"
 
 namespace cta {
+
+namespace catalogue {
+class Catalogue;
+}
+
 namespace log {
 class LogContext;
 }
@@ -30,8 +37,9 @@ class LogContext;
 namespace common {
 namespace dataStructures {
 class DesiredDriveState;
-class DriveInfo;
-class TapeDrive;
+struct DriveInfo;
+struct TapeDrive;
+struct SecurityIdentity;
 }
 }
 
@@ -63,7 +71,7 @@ struct ReportDriveStatsInputs {
 
 class TapeDrivesCatalogueState {
 public:
-  TapeDrivesCatalogueState(catalogue::Catalogue &catalogue);
+  explicit TapeDrivesCatalogueState(catalogue::Catalogue &catalogue);
   ~TapeDrivesCatalogueState() = default;
   void createTapeDriveStatus(const common::dataStructures::DriveInfo& driveInfo,
     const common::dataStructures::DesiredDriveState & desiredState, const common::dataStructures::MountType& type,
diff --git a/cmdline/standalone_cli_tools/restore_files/RestoreFilesCmd.hpp b/cmdline/standalone_cli_tools/restore_files/RestoreFilesCmd.hpp
index 512397cd1d11827683fa684c1e0775cfbf81e4db..bfa9a8acb41451ea948c432bcdfd4d96d8cf8a9b 100644
--- a/cmdline/standalone_cli_tools/restore_files/RestoreFilesCmd.hpp
+++ b/cmdline/standalone_cli_tools/restore_files/RestoreFilesCmd.hpp
@@ -17,14 +17,13 @@
 
 #pragma once
 
-#include "cmdline/standalone_cli_tools/common/CmdLineTool.hpp"
+#include <memory>
+#include <optional>
+
 #include "cmdline/standalone_cli_tools/common/CmdLineArgs.hpp"
-#include "eos_grpc_client/GrpcEndpoint.hpp"
-#include "catalogue/Catalogue.hpp"
+#include "cmdline/standalone_cli_tools/common/CmdLineTool.hpp"
 #include "common/log/StdoutLogger.hpp"
-
-#include <optional>
-#include <memory>
+#include "eos_grpc_client/GrpcEndpoint.hpp"
 
 #include "CtaFrontendApi.hpp"
 
diff --git a/common/Configuration.hpp b/common/Configuration.hpp
index 07a4b7eef1fc02aa44ec32f2d22b2bc3281a844a..f60cc990c83f84cbe54fa3cee1c58a4484ac1ddb 100644
--- a/common/Configuration.hpp
+++ b/common/Configuration.hpp
@@ -17,13 +17,14 @@
 
 #pragma once
 
+#include <string>
+#include <map>
+
 #include "common/exception/Exception.hpp"
+#include "common/log/LogContext.hpp"
 #include "common/log/Logger.hpp"
 #include "common/utils/utils.hpp"
 
-#include <string>
-#include <map>
-
 namespace cta { namespace common {
 
     /**
diff --git a/disk/DiskSystem.cpp b/disk/DiskSystem.cpp
index 0fcbd47482ee9200bbc3a24c1a1aaf91f2d60cf8..e4bf79b69ccd7fcddf2d086b516a6a1b0b550269 100644
--- a/disk/DiskSystem.cpp
+++ b/disk/DiskSystem.cpp
@@ -15,15 +15,19 @@
  *               submit itself to any jurisdiction.
  */
 
-#include "DiskSystem.hpp"
-#include "JSONDiskSystem.hpp"
 #include <algorithm>
+#include <map>
+#include <string>
+
+#include "catalogue/Catalogue.hpp"
+#include "common/exception/Errnum.hpp"
 #include "common/exception/Exception.hpp"
+#include "common/json/object/JSONObjectException.hpp"
 #include "common/threading/SubProcess.hpp"
-#include "common/exception/Errnum.hpp"
 #include "common/utils/utils.hpp"
-#include "JSONFreeSpace.hpp"
-#include "common/json/object/JSONObjectException.hpp"
+#include "disk/DiskSystem.hpp"
+#include "disk/JSONDiskSystem.hpp"
+#include "disk/JSONFreeSpace.hpp"
 
 namespace cta {
 namespace disk {
@@ -43,12 +47,12 @@ const DiskSystem& DiskSystemList::at(const std::string& name) const {
 std::string DiskSystemList::getDSName(const std::string& fileURL) const {
   // First if the regexes have not been created yet, do so.
   if (m_pointersAndRegexes.empty() && size()) {
-    for (const auto &ds: *this) {
+    for (const auto &ds : *this) {
       m_pointersAndRegexes.emplace_back(ds, ds.fileRegexp);
     }
   }
   // Try and find the fileURL
-  auto pri = std::find_if(m_pointersAndRegexes.begin(), m_pointersAndRegexes.end(), 
+  auto pri = std::find_if(m_pointersAndRegexes.begin(), m_pointersAndRegexes.end(),
       [&](const PointerAndRegex & pr){ return !pr.regex.exec(fileURL).empty(); });
   if (pri != m_pointersAndRegexes.end()) {
     // We found a match. Let's move the pointer and regex to the front so next file will be faster (most likely).
@@ -62,7 +66,7 @@ std::string DiskSystemList::getDSName(const std::string& fileURL) const {
 //------------------------------------------------------------------------------
 // DiskSystemList::setExternalFreeDiskSpaceScript()
 //------------------------------------------------------------------------------
-void DiskSystemList::setExternalFreeDiskSpaceScript(const std::string& path){
+void DiskSystemList::setExternalFreeDiskSpaceScript(const std::string& path) {
   m_externalFreeDiskSpaceScript = path;
 }
 
@@ -89,13 +93,13 @@ void DiskSystemFreeSpaceList::fetchDiskSystemFreeSpace(const std::set<std::strin
   cta::utils::Regex eosDiskSystem("^eos:(.*):(.*)$");
   // For testing purposes
   cta::utils::Regex constantFreeSpaceDiskSystem("^constantFreeSpace:(.*)");
-  //Key = diskSystemName, Value = failureReason
+  // Key = diskSystemName, Value = failureReason
   std::map<std::string, cta::exception::Exception> failedToFetchDiskSystems;
-  for (auto const & ds: diskSystems) {
+  for (auto const & ds : diskSystems) {
     uint64_t freeSpace = 0;
     bool updateCatalogue = false;
     auto &diskSystem = m_systemList.at(ds);
-    auto &diskInstanceSpace = diskSystem.diskInstanceSpace;  
+    auto &diskInstanceSpace = diskSystem.diskInstanceSpace;
     try {
       std::vector<std::string> regexResult;
       const auto currentTime = static_cast<uint64_t>(time(nullptr));
@@ -108,24 +112,24 @@ void DiskSystemFreeSpaceList::fetchDiskSystemFreeSpace(const std::set<std::strin
       const auto &freeSpaceQueryUrl = getDiskSystemFreeSpaceQueryURL(diskSystem);
       regexResult = eosDiskSystem.exec(freeSpaceQueryUrl);
       if (regexResult.size()) {
-        //Script, then EOS free space query
-        if(!m_systemList.getExternalFreeDiskSpaceScript().empty()){
-          //Script is provided
+        // Script, then EOS free space query
+        if (!m_systemList.getExternalFreeDiskSpaceScript().empty()) {
+          // Script is provided
           try {
             cta::disk::JSONDiskSystem jsoncDiskSystem(diskSystem);
-            freeSpace = fetchFreeDiskSpaceWithScript(m_systemList.getExternalFreeDiskSpaceScript(),jsoncDiskSystem.getJSON(),lc);
+            freeSpace = fetchFreeDiskSpaceWithScript(m_systemList.getExternalFreeDiskSpaceScript(), jsoncDiskSystem.getJSON(), lc);
             goto found;
-          } catch(const cta::disk::FreeDiskSpaceScriptException &ex){
+          } catch (const cta::disk::FreeDiskSpaceScriptException &ex) {
             cta::log::ScopedParamContainer spc(lc);
-            spc.add("exceptionMsg",ex.getMessageValue());
-            std::string errorMsg = "In DiskSystemFreeSpaceList::fetchDiskSystemFreeSpace(), unable to get the EOS free space with the script " 
+            spc.add("exceptionMsg", ex.getMessageValue());
+            std::string errorMsg = "In DiskSystemFreeSpaceList::fetchDiskSystemFreeSpace(), unable to get the EOS free space with the script "
                     + m_systemList.getExternalFreeDiskSpaceScript() + ". Will run eos space ls -m to fetch the free space for backpressure";
-            lc.log(cta::log::INFO,errorMsg);
+            lc.log(cta::log::INFO, errorMsg);
           }
         }
         freeSpace = fetchFreeDiskSpace(regexResult.at(1), regexResult.at(2), lc);
         goto found;
-      } 
+      }
       regexResult = constantFreeSpaceDiskSystem.exec(freeSpaceQueryUrl);
       if (regexResult.size()) {
         freeSpace = fetchConstantFreeSpace(regexResult.at(1), lc);
@@ -136,7 +140,7 @@ void DiskSystemFreeSpaceList::fetchDiskSystemFreeSpace(const std::set<std::strin
       failedToFetchDiskSystems[ds] = ex;
     }
   found:
-    DiskSystemFreeSpace & entry = operator [](ds);
+    DiskSystemFreeSpace & entry = operator[](ds);
     entry.freeSpace = freeSpace;
     entry.fetchTime = ::time(nullptr);
     entry.targetedFreeSpace = m_systemList.at(ds).targetedFreeSpace;
diff --git a/disk/DiskSystem.hpp b/disk/DiskSystem.hpp
index b77683a5cc5cc1e30c96055d006bc5dda96652b3..db4390699866ec55b8538ae87c0de37f45b3060d 100644
--- a/disk/DiskSystem.hpp
+++ b/disk/DiskSystem.hpp
@@ -17,18 +17,17 @@
 
 #pragma once
 
-#include "common/utils/Regex.hpp"
-#include "common/dataStructures/EntryLog.hpp"
-#include "common/dataStructures/DiskInstanceSpace.hpp"
-#include "common/log/LogContext.hpp"
-
-#include "common/exception/Exception.hpp"
-#include "catalogue/Catalogue.hpp"
 #include <list>
 #include <optional>
 #include <set>
 #include <string>
 
+#include "common/dataStructures/DiskInstanceSpace.hpp"
+#include "common/dataStructures/EntryLog.hpp"
+#include "common/exception/Exception.hpp"
+#include "common/log/LogContext.hpp"
+#include "common/utils/Regex.hpp"
+
 namespace cta {
 namespace catalogue {
 
@@ -37,8 +36,8 @@ namespace catalogue {
  */
 class Catalogue;
 
-} // namespace catalogue
-} // namespace cta
+}  // namespace catalogue
+}  // namespace cta
 
 
 namespace cta { namespace disk {
@@ -120,4 +119,4 @@ private:
   uint64_t fetchFreeDiskSpaceWithScript(const std::string & scriptPath, const std::string & jsonInput, log::LogContext &lc);
 };
 
-}} // namespace cta::common
+}}  // namespace cta::common
diff --git a/disk/DiskSystemTest.cpp b/disk/DiskSystemTest.cpp
index 7e42a6061939d253d5a6c82d9e5c22d16fb150e7..fcdd16347bbc2c1144f357d768c6df028c3f92fe 100644
--- a/disk/DiskSystemTest.cpp
+++ b/disk/DiskSystemTest.cpp
@@ -16,10 +16,12 @@
  */
 #include <gtest/gtest.h>
 
-#include "common/utils/Regex.hpp"
-#include "common/log/DummyLogger.hpp"
 #include "catalogue/Catalogue.hpp"
 #include "catalogue/InMemoryCatalogue.hpp"
+#include "common/dataStructures/SecurityIdentity.hpp"
+#include "common/log/DummyLogger.hpp"
+#include "common/utils/Regex.hpp"
+#include "disk/DiskSystem.hpp"
 
 namespace unitTests {
   
diff --git a/frontend-grpc/FrontendGRpcSvc.cpp b/frontend-grpc/FrontendGRpcSvc.cpp
index ed820181f20522d5a6cc74aabbf012409b95c750..6e76a5aa9482fa761468295eab03269738303778 100644
--- a/frontend-grpc/FrontendGRpcSvc.cpp
+++ b/frontend-grpc/FrontendGRpcSvc.cpp
@@ -17,6 +17,7 @@
  */
 #include "FrontendGRpcSvc.h"
 
+#include "catalogue/Catalogue.hpp"
 #include "common/log/LogLevel.hpp"
 #include <common/checksum/ChecksumBlobSerDeser.hpp>
 
diff --git a/frontend-grpc/Main.cpp b/frontend-grpc/Main.cpp
index 2b2bbe47d6ce44371fd18cfa27c90eeb4a13c968..d505c6f38bc7eec7cc06bef1cfb9a23129e6b613 100644
--- a/frontend-grpc/Main.cpp
+++ b/frontend-grpc/Main.cpp
@@ -18,12 +18,15 @@
 #include "FrontendGRpcSvc.h"
 #include "version.h"
 
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/CatalogueFactory.hpp"
 #include "catalogue/CatalogueFactoryFactory.hpp"
-#include <common/Configuration.hpp>
-#include "rdbms/Login.hpp"
-#include "common/log/StdoutLogger.hpp"
+#include "catalogue/SchemaVersion.hpp"
+#include "common/Configuration.hpp"
 #include "common/log/Logger.hpp"
 #include "common/log/LogLevel.hpp"
+#include "common/log/StdoutLogger.hpp"
+#include "rdbms/Login.hpp"
 #ifdef CTA_PGSCHED
 #include "scheduler/PostgresSchedDB/PostgresSchedDBInit.hpp"
 #else
diff --git a/objectstore/ArchiveQueue.hpp b/objectstore/ArchiveQueue.hpp
index 272cbf1842912ec7c1c22360fbbe901c178d6a15..f11a10236b1f1c94c8104320f42e740d2089a706 100644
--- a/objectstore/ArchiveQueue.hpp
+++ b/objectstore/ArchiveQueue.hpp
@@ -17,18 +17,21 @@
 
 #pragma once
 
+#include "Agent.hpp"
+#include "ArchiveRequest.hpp"
+#include "ArchiveRequest.hpp"
 #include "Backend.hpp"
-#include "ObjectOps.hpp"
-#include <string>
-#include "objectstore/cta.pb.h"
 #include "common/CreationLog.hpp"
+#include "common/dataStructures/ArchiveJob.hpp"
 #include "common/MountControl.hpp"
-#include "ArchiveRequest.hpp"
-#include "ArchiveRequest.hpp"
 #include "EntryLogSerDeser.hpp"
-#include "Agent.hpp"
+#include "ObjectOps.hpp"
+#include "objectstore/cta.pb.h"
+#include <string>
+
+namespace cta {
 
-namespace cta { namespace objectstore {
+namespace objectstore {
   
 class GenericObject;
 
diff --git a/objectstore/ArchiveQueueToTransferAlgorithms.cpp b/objectstore/ArchiveQueueToTransferAlgorithms.cpp
index 033724a58fb2ce19c07403af8c7cefa5b5b25363..446d3a3be27c9f214d144630999e9c9966af5b00 100644
--- a/objectstore/ArchiveQueueToTransferAlgorithms.cpp
+++ b/objectstore/ArchiveQueueToTransferAlgorithms.cpp
@@ -15,8 +15,8 @@
  *               submit itself to any jurisdiction.
  */
 
-#include "ArchiveQueueAlgorithms.hpp"
 #include "common/Timer.hpp"
+#include "objectstore/ArchiveQueueAlgorithms.hpp"
 
 namespace cta { namespace objectstore {
 
diff --git a/objectstore/Helpers.hpp b/objectstore/Helpers.hpp
index 2e98d377fa87ef2818d8d539c20d4ec9375f5551..2cc5e4de7317c7085aef7f576cc5349896ddfacf 100644
--- a/objectstore/Helpers.hpp
+++ b/objectstore/Helpers.hpp
@@ -26,9 +26,9 @@
 #include <set>
 #include <string>
 
-#include "catalogue/Catalogue.hpp"
 #include "common/dataStructures/JobQueueType.hpp"
 #include "common/dataStructures/RepackQueueType.hpp"
+#include "common/dataStructures/Tape.hpp"
 #include "common/threading/Mutex.hpp"
 #include "common/threading/MutexLocker.hpp"
 #include "scheduler/OStoreDB/OStoreDB.hpp"
@@ -42,7 +42,13 @@
  * A collection of helper functions for commonly used multi-object operations
  */
 
-namespace cta { namespace objectstore {
+namespace cta {
+
+namespace catalogue {
+class Catalogue;
+}
+
+namespace objectstore {
 
 class ScopedExclusiveLock;
 class AgentReference;
diff --git a/objectstore/ObjectOps.hpp b/objectstore/ObjectOps.hpp
index a973242a59b623ee911fb771e1c29e2b73fe44e5..3da9aae3049d4bb3bdc5a419174bb1632e45ddff 100644
--- a/objectstore/ObjectOps.hpp
+++ b/objectstore/ObjectOps.hpp
@@ -21,12 +21,17 @@
 #include "common/exception/Exception.hpp"
 #include "objectstore/cta.pb.h"
 #include "common/log/LogContext.hpp"
-#include "catalogue/Catalogue.hpp"
 #include <memory>
 #include <stdint.h>
 #include <cryptopp/base64.h>
 
-namespace cta { namespace objectstore {
+namespace cta {
+
+namespace catalogue {
+class Catalogue;
+}
+
+namespace objectstore {
 
 class AgentReference;
 class ScopedLock;
diff --git a/objectstore/RetrieveQueue.hpp b/objectstore/RetrieveQueue.hpp
index bf4139aa8ac2fcb2093bd0d179b03295b7e3d3f4..6e79bac57f7190f6a081008c2df8d86323ef17be 100644
--- a/objectstore/RetrieveQueue.hpp
+++ b/objectstore/RetrieveQueue.hpp
@@ -17,11 +17,12 @@
 
 #pragma once
 
+#include "common/dataStructures/RetrieveJob.hpp"
 #include "ObjectOps.hpp"
 #include "objectstore/cta.pb.h"
+#include "RetrieveActivityCountMap.hpp"
 #include "RetrieveRequest.hpp"
 #include "scheduler/RetrieveRequestDump.hpp"
-#include "RetrieveActivityCountMap.hpp"
 
 namespace cta { namespace objectstore {
   
diff --git a/objectstore/RootEntry.cpp b/objectstore/RootEntry.cpp
index b89ee61e2ff17731be60b0fbb5624808edad3e5e..cf18982171f8c3b1e60123f90eb3c67e881f9b86 100644
--- a/objectstore/RootEntry.cpp
+++ b/objectstore/RootEntry.cpp
@@ -23,6 +23,7 @@
 #include "AgentRegister.hpp"
 #include "ArchiveQueue.hpp"
 #include "common/dataStructures/JobQueueType.hpp"
+#include "common/dataStructures/RetrieveJob.hpp"
 #include "common/exception/NoSuchObject.hpp"
 #include "DriveRegister.hpp"
 #include "GenericObject.hpp"
diff --git a/objectstore/Sorter.hpp b/objectstore/Sorter.hpp
index d0979894282a6d2deee887948d72d09fdee2ade4..76e7f8197d074cb0c463919a263701d87979f9c6 100644
--- a/objectstore/Sorter.hpp
+++ b/objectstore/Sorter.hpp
@@ -21,26 +21,30 @@
 #include <list>
 #include <map>
 #include <memory>
+#include <set>
 #include <string>
 #include <tuple>
 
-#include "Agent.hpp"
-#include "Algorithms.hpp"
-#include "ArchiveQueue.hpp"
-#include "ArchiveQueueAlgorithms.hpp"
-#include "ArchiveRequest.hpp"
-#include "catalogue/Catalogue.hpp"
 #include "common/dataStructures/ArchiveJob.hpp"
 #include "common/dataStructures/JobQueueType.hpp"
 #include "common/log/LogContext.hpp"
 #include "common/threading/Mutex.hpp"
-#include "GenericObject.hpp"
-#include "RetrieveQueue.hpp"
-#include "RetrieveQueueAlgorithms.hpp"
-#include "RetrieveRequest.hpp"
-#include "SorterArchiveJob.hpp"
-
-namespace cta { namespace objectstore {
+#include "objectstore/Agent.hpp"
+#include "objectstore/Algorithms.hpp"
+#include "objectstore/ArchiveQueue.hpp"
+#include "objectstore/ArchiveQueueAlgorithms.hpp"
+#include "objectstore/ArchiveRequest.hpp"
+#include "objectstore/GenericObject.hpp"
+#include "objectstore/RetrieveQueue.hpp"
+#include "objectstore/RetrieveQueueAlgorithms.hpp"
+#include "objectstore/RetrieveRequest.hpp"
+#include "objectstore/SorterArchiveJob.hpp"
+
+namespace cta {
+namespace catalogue {
+class Catalogue;
+}
+namespace objectstore {
 
 // forward declarations
 struct ArchiveJobQueueInfo;
@@ -56,7 +60,7 @@ public:
   Sorter(AgentReference& agentReference, Backend &objectstore, catalogue::Catalogue& catalogue);
   ~Sorter();
 
-  //std::string = containerIdentifier
+  // std::string = containerIdentifier
   typedef std::map<std::tuple<std::string, common::dataStructures::JobQueueType>, std::list<std::shared_ptr<ArchiveJobQueueInfo>>> MapArchive;
   typedef std::map<std::tuple<std::string, common::dataStructures::JobQueueType>, std::list<std::shared_ptr<RetrieveJobQueueInfo>>> MapRetrieve;
 
@@ -79,7 +83,7 @@ public:
    * The Sorter::ArchiveJob have to be created by the user with all fields filled
    * @param archiveRequest The SorterArchiveRequest to insert into the sorter
    */
-  void insertArchiveRequest(const SorterArchiveRequest& archiveRequest,AgentReferenceInterface& previousOwner, log::LogContext& lc);
+  void insertArchiveRequest(const SorterArchiveRequest& archiveRequest, AgentReferenceInterface& previousOwner, log::LogContext& lc);
 
   /**
    * This method will take the first list<ArchiveJobQueueInfo> contained in the MapArchive, queue all Archive jobs contained in it and delete the list from the map
@@ -156,7 +160,7 @@ public:
    * @throws Exception if no ToTransfer jobs are found in the RetrieveRequest passed in parameter (in the case where copyNb == std::nullopt)
    * @throws Exception if the destination queue could not have been determined according to the copyNb passed in parameter
    */
-  void insertRetrieveRequest(SorterRetrieveRequest& retrieveRequest, AgentReferenceInterface &previousOwner,std::optional<uint32_t> copyNb, log::LogContext & lc);
+  void insertRetrieveRequest(SorterRetrieveRequest& retrieveRequest, AgentReferenceInterface &previousOwner, std::optional<uint32_t> copyNb, log::LogContext & lc);
 
   /**
    * This method will take the first list<RetrieveJobQueueInfo> contained in the MapRetrieve, queue all Retrieve jobs contained in it and delete the list from the map
@@ -224,12 +228,12 @@ private:
 };
 
 struct ArchiveJobQueueInfo{
-  std::tuple<SorterArchiveJob,std::promise<void>> jobToQueue;
+  std::tuple<SorterArchiveJob, std::promise<void>> jobToQueue;
   // TODO : Job reporting
 };
 
 struct RetrieveJobQueueInfo{
-  std::tuple<Sorter::RetrieveJob,std::promise<void>> jobToQueue;
+  std::tuple<Sorter::RetrieveJob, std::promise<void>> jobToQueue;
   // TODO : Job reporting
 };
 
diff --git a/objectstore/cta-objectstore-collect-orphaned-object.cpp b/objectstore/cta-objectstore-collect-orphaned-object.cpp
index 5dbaa8c621ec8deb9d409dbac2b9f6247679c29e..8b431ebd84c01decdc62a5271d02bc425b5b97e3 100644
--- a/objectstore/cta-objectstore-collect-orphaned-object.cpp
+++ b/objectstore/cta-objectstore-collect-orphaned-object.cpp
@@ -20,22 +20,26 @@
  * it will be garbage collected.
  */
 
-#include "Agent.hpp"
-#include "AgentReference.hpp"
-#include "ArchiveRequest.hpp"
-#include "BackendFactory.hpp"
-#include "BackendVFS.hpp"
+#include <bits/unique_ptr.h>
+
+#include <iostream>
+#include <stdexcept>
+
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/CatalogueFactory.hpp"
 #include "catalogue/CatalogueFactoryFactory.hpp"
 #include "common/Configuration.hpp"
 #include "common/log/StringLogger.hpp"
 #include "common/utils/utils.hpp"
-#include "GenericObject.hpp"
-#include "RetrieveRequest.hpp"
-#include "RootEntry.hpp"
-
-#include <iostream>
-#include <stdexcept>
-#include <bits/unique_ptr.h>
+#include "objectstore/Agent.hpp"
+#include "objectstore/AgentReference.hpp"
+#include "objectstore/ArchiveRequest.hpp"
+#include "objectstore/BackendFactory.hpp"
+#include "objectstore/BackendVFS.hpp"
+#include "objectstore/GenericObject.hpp"
+#include "objectstore/RetrieveRequest.hpp"
+#include "objectstore/RootEntry.hpp"
+#include "rdbms/Login.hpp"
 
 int main(int argc, char ** argv) {
   try {
diff --git a/scheduler/ArchiveJob.cpp b/scheduler/ArchiveJob.cpp
index ad98c2af2769236db2901d3195294710dfcdbfee..6d87b229e2a63b430410f97b69a12e2b1fab1b5e 100644
--- a/scheduler/ArchiveJob.cpp
+++ b/scheduler/ArchiveJob.cpp
@@ -15,11 +15,15 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <cryptopp/base64.h>
+
+#include <limits>
+
+#include "catalogue/TapeFileWritten.hpp"
+#include "catalogue/TapeItemWrittenPointer.hpp"
+#include "disk/DiskReporterFactory.hpp"
 #include "scheduler/ArchiveJob.hpp"
 #include "scheduler/ArchiveMount.hpp"
-#include "disk/DiskReporterFactory.hpp"
-#include <limits>
-#include <cryptopp/base64.h>
 
 //------------------------------------------------------------------------------
 // destructor
diff --git a/scheduler/ArchiveJob.hpp b/scheduler/ArchiveJob.hpp
index c9e7fd4ab6a622ff83f50d8a3e821635e1c6e564..555a8bedd41166808b437161cd2aff7be88ee926 100644
--- a/scheduler/ArchiveJob.hpp
+++ b/scheduler/ArchiveJob.hpp
@@ -17,18 +17,22 @@
 
 #pragma once
 
+#include <future>
+#include <list>
+#include <memory>
+#include <string>
+
 #include "common/exception/Exception.hpp"
 #include "common/remoteFS/RemotePathAndStatus.hpp"
 #include "common/Timer.hpp"
-#include "scheduler/SchedulerDatabase.hpp"
-#include "catalogue/Catalogue.hpp"
 #include "disk/DiskReporter.hpp"
-
-#include <stdint.h>
-#include <string>
-#include <future>
+#include "scheduler/SchedulerDatabase.hpp"
 
 namespace cta {
+namespace catalogue {
+class Catalogue;
+struct TapeItemWrittenPointer;
+}
 
 // Forward declaration
 class ArchiveMount;
@@ -40,18 +44,16 @@ class DiskReporterFactory;
  * Class representing the transfer of a single copy of a remote file to tape.
  */
 class ArchiveJob {
-
   /**
    * The ArchiveMount class is a friend so that it can call the private
    * constructor of ArchiveJob.
    */
   friend class ArchiveMount;
   friend class Scheduler;
-  
 protected:
   /**
    * Constructor.
-   * 
+   *
    * @param mount the mount that generated this job
    * @param archiveFile informations about the file that we are storing
    * @param remotePathAndStatus location and properties of the remote file
@@ -65,45 +67,44 @@ protected:
   const common::dataStructures::TapeFile &tapeFile);
 
 public:
-
   /**
    * Destructor.
    */
   virtual ~ArchiveJob() throw();
-  
+
   CTA_GENERATE_EXCEPTION_CLASS(BlockIdNotSet);
   CTA_GENERATE_EXCEPTION_CLASS(ChecksumNotSet);
-  
+
   /**
    * Start an asynchronous update for a batch of jobs and then make sure they complete.
    */
   static void asyncSetJobsBatchSucceed(std::list<std::unique_ptr<cta::ArchiveJob>> & jobs);
-  
+
   /**
    * Get the report time (in seconds).
    */
   double reportTime();
-  
+
   /**
    * Validate that archiveFile and tapeFile fields are set correctly for archive
    * request.
    * Throw appropriate exception if there is any problem.
    */
   virtual void validate();
-  
+
   /**
    * Validate that archiveFile and tapeFile fields are set correctly for archive
    * request.
    * @return The tapeFileWritten event for the catalog update.
    */
   virtual cta::catalogue::TapeItemWrittenPointer validateAndGetTapeFileWritten();
-  
+
   /**
    * Triggers a scheduler update following the failure of the job. Retry policy will
    * be applied by the scheduler.
    */
   virtual void transferFailed(const std::string &failureReason, log::LogContext & lc);
-  
+
   /**
    * Get the URL used for reporting
    * @return The URL used to report to the disk system.
@@ -122,27 +123,27 @@ public:
    * @return the type of report (success or failure), as a string
    */
   virtual std::string reportType();
-  
+
   /**
    * Triggers a scheduler update following the failure of the report. Retry policy will
    * be applied by the scheduler. Failure to report success will also be a failure reason.
    */
   virtual void reportFailed(const std::string &failureReason, log::LogContext & lc);
-  
+
 
 private:
   std::unique_ptr<cta::SchedulerDatabase::ArchiveJob> m_dbJob;
-  
+
   /**
    * The reporter for the job. TODO: this should be generic and fed with a factory.
    */
   std::unique_ptr<cta::disk::DiskReporter> m_reporter;
-  
+
   /**
    * Report time measurement.
    */
   utils::Timer m_reporterTimer;
-  
+
   /**
    * The mount that generated this job
    */
@@ -157,36 +158,35 @@ private:
    * Reference to the name server
    */
   catalogue::Catalogue &m_catalogue;
-  
+
   /**
-   * State for the asynchronous report to the client. 
+   * State for the asynchronous report to the client.
    */
   std::promise<void> m_reporterState;
-      
+
 public:
-    
   CTA_GENERATE_EXCEPTION_CLASS(NotImplemented);
-  
+
   /**
    * The NS archive file information
    */
   common::dataStructures::ArchiveFile archiveFile;
-  
+
   /**
    * The remote file information
    */
   std::string srcURL;
-  
+
   /**
    * The file archive result for the NS
    */
   common::dataStructures::TapeFile tapeFile;
-  
+
   /**
    * Wait for the reporterState is set by the reporting thread.
    */
   virtual void waitForReporting();
 
-}; // class ArchiveJob
+};  // class ArchiveJob
 
-} // namespace cta
+}  // namespace cta
diff --git a/scheduler/ArchiveMount.cpp b/scheduler/ArchiveMount.cpp
index ff2a3fd84204bfd9ee1676ba3a76cf8c37d49d18..6cdaafdda7b63397bd8c6c2a3fd038d3eeb6ac93 100644
--- a/scheduler/ArchiveMount.cpp
+++ b/scheduler/ArchiveMount.cpp
@@ -15,8 +15,8 @@
  *               submit itself to any jurisdiction.
  */
 
-#include <iostream>
-
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/TapeItemWrittenPointer.hpp"
 #include "common/exception/NoSuchObject.hpp"
 #include "scheduler/ArchiveMount.hpp"
 
diff --git a/scheduler/ArchiveMount.hpp b/scheduler/ArchiveMount.hpp
index 368860c06d58df56d80dce7e7401a84a028998bc..a1b03d9545173ed7525eae6b98f21622a8a44595 100644
--- a/scheduler/ArchiveMount.hpp
+++ b/scheduler/ArchiveMount.hpp
@@ -17,219 +17,225 @@
 
 #pragma once
 
+#include <atomic>
+#include <list>
+#include <memory>
+#include <queue>
+#include <set>
+#include <string>
+
 #include "common/exception/Exception.hpp"
+#include "disk/DiskReporterFactory.hpp"
 #include "scheduler/ArchiveJob.hpp"
 #include "scheduler/SchedulerDatabase.hpp"
 #include "scheduler/TapeMount.hpp"
-#include "catalogue/Catalogue.hpp"
-#include "disk/DiskReporterFactory.hpp"
-
-#include <memory>
-#include <atomic>
-#include <queue>
 
 namespace cta {
+
+namespace catalogue {
+class Catalogue;
+class TapeItemWritten;
+class TapeItemWrittenPointer;
+}
+
+/**
+  * The class driving an archive mount.
+  * The class only has private constructors as it is instantiated by
+  * the Scheduler class.
+  */
+class ArchiveMount: public TapeMount {
+  friend class Scheduler;
+protected:
+  /**
+    * Constructor.
+    *
+    * @param catalogue The file catalogue interface.
+    */
+  explicit ArchiveMount(catalogue::Catalogue & catalogue);
+
+  /**
+    * Constructor.
+    *
+    * @param catalogue The file catalogue interface.
+    * @param dbMount The database representation of this mount.
+    */
+  ArchiveMount(catalogue::Catalogue & catalogue, std::unique_ptr<cta::SchedulerDatabase::ArchiveMount> dbMount);
+
+public:
+  CTA_GENERATE_EXCEPTION_CLASS(WrongMountType);
+  CTA_GENERATE_EXCEPTION_CLASS(NotImplemented);
+  CTA_GENERATE_EXCEPTION_CLASS(FailedReportCatalogueUpdate);
+  CTA_GENERATE_EXCEPTION_CLASS(FailedReportMoveToQueue);
+
+  /**
+    * Returns The type of this tape mount.
+    *
+    * @return The type of this tape mount.
+    */
+  cta::common::dataStructures::MountType getMountType() const override;
+
+  /**
+    * Returns the volume identifier of the tape to be mounted.
+    *
+    * @return The volume identifier of the tape to be mounted.
+    */
+  std::string getVid() const override;
+
+  /**
+    * Returns the drive name
+    * @return The drive name
+    */
+  std::string getDrive() const;
+
+  /**
+    * Returns the mount transaction id.
+    *
+    * @return The mount transaction id.
+    */
+  std::string getMountTransactionId() const override;
+
+  /**
+    * Return std::nullopt as activities are for retrieve mounts;
+    *
+    * @return std::nullopt.
+    */
+  std::optional<std::string> getActivity() const override { return std::nullopt; }
+
+
+  /**
+    * Indicates that the mount was completed.
+    * This function is overridden in MockArchiveMount for unit tests.
+    */
+  void complete() override;
+
+  /**
+    * Report a drive status change
+    */
+  void setDriveStatus(cta::common::dataStructures::DriveStatus status, const std::optional<std::string> & reason = std::nullopt) override;
+
+  /**
+    * Report a tape session statistics
+    */
+  void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) override;
+
+  /**
+    * Report a tape mounted event
+    * @param logContext
+    */
+  void setTapeMounted(log::LogContext &logContext) const override;
+
+  /**
+    * Report that the tape is full.
+    */
+  void setTapeFull();
+
+  CTA_GENERATE_EXCEPTION_CLASS(SessionNotRunning);
+  /**
+    * Batch job factory
+    *
+    * @param filesRequested the number of files requested
+    * @param bytesRequested the number of bytes requested
+    * @param logContext
+    * @return a list of unique_ptr to the next archive jobs. The list is empty
+    * when no more jobs can be found. Will return jobs (if available) until one
+    * of the 2 criteria is fulfilled.
+    */
+  std::list<std::unique_ptr<ArchiveJob>> getNextJobBatch(uint64_t filesRequested,
+    uint64_t bytesRequested, log::LogContext &logContext);
+
+  /**
+    * Report a batch of jobs successes. The reporting will be asynchronous behind
+    * the scenes.
+    *
+    * @param successfulArchiveJobs the jobs to report
+    * @param logContext
+    */
+  virtual void reportJobsBatchTransferred(std::queue<std::unique_ptr<cta::ArchiveJob> > & successfulArchiveJobs,
+      std::queue<cta::catalogue::TapeItemWritten> & skippedFiles, std::queue<std::unique_ptr<cta::SchedulerDatabase::ArchiveJob>>& failedToReportArchiveJobs, cta::log::LogContext &logContext);
+
+  /**
+    * Returns the tape pool of the tape to be mounted.
+    *
+    * @return The tape pool of the tape to be mounted.
+    */
+  std::string getPoolName() const override;
+
+  /**
+    * Returns the virtual organization of the tape to be mounted
+    * @return the vo of the tape to be mounted
+    */
+  std::string getVo() const override;
+
+  /**
+    * Returns the media type of the tape
+    * @return de media type of the tape
+    */
+  std::string getMediaType() const override;
+
+  /**
+    * Returns the vendor of the tape
+    * @return the vendor of the tape
+    */
+  std::string getVendor() const override;
+
+  /**
+    * Returns the capacity in bytes of the tape
+    * @return the capacity in bytes of the tape
+    */
+  uint64_t getCapacityInBytes() const override;
+
   /**
-   * The class driving an archive mount.
-   * The class only has private constructors as it is instantiated by
-   * the Scheduler class.
-   */
-  class ArchiveMount: public TapeMount {
-    friend class Scheduler;
-  protected:
-
-    /**
-     * Constructor.
-     *
-     * @param catalogue The file catalogue interface.
-     */
-    explicit ArchiveMount(catalogue::Catalogue & catalogue);
-
-    /**
-     * Constructor.
-     *
-     * @param catalogue The file catalogue interface.
-     * @param dbMount The database representation of this mount.
-     */
-    ArchiveMount(catalogue::Catalogue & catalogue, std::unique_ptr<cta::SchedulerDatabase::ArchiveMount> dbMount);
-
-  public:
-
-    CTA_GENERATE_EXCEPTION_CLASS(WrongMountType);
-    CTA_GENERATE_EXCEPTION_CLASS(NotImplemented);
-    CTA_GENERATE_EXCEPTION_CLASS(FailedReportCatalogueUpdate);
-    CTA_GENERATE_EXCEPTION_CLASS(FailedReportMoveToQueue);
-
-    /**
-     * Returns The type of this tape mount.
-     *
-     * @return The type of this tape mount.
-     */
-    cta::common::dataStructures::MountType getMountType() const override;
-
-    /**
-     * Returns the volume identifier of the tape to be mounted.
-     *
-     * @return The volume identifier of the tape to be mounted.
-     */
-    std::string getVid() const override;
-
-    /**
-     * Returns the drive name
-     * @return The drive name
-     */
-    std::string getDrive() const;
-
-    /**
-     * Returns the mount transaction id.
-     *
-     * @return The mount transaction id.
-     */
-    std::string getMountTransactionId() const override;
-
-    /**
-     * Return std::nullopt as activities are for retrieve mounts;
-     *
-     * @return std::nullopt.
-     */
-    std::optional<std::string> getActivity() const override { return std::nullopt; }
-
-
-    /**
-     * Indicates that the mount was completed.
-     * This function is overridden in MockArchiveMount for unit tests.
-     */
-    void complete() override;
-
-    /**
-     * Report a drive status change
-     */
-    void setDriveStatus(cta::common::dataStructures::DriveStatus status, const std::optional<std::string> & reason = std::nullopt) override;
-
-    /**
-     * Report a tape session statistics
-     */
-    void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) override;
-
-    /**
-     * Report a tape mounted event
-     * @param logContext
-     */
-    void setTapeMounted(log::LogContext &logContext) const override;
-
-    /**
-     * Report that the tape is full.
-     */
-    void setTapeFull();
-
-    CTA_GENERATE_EXCEPTION_CLASS(SessionNotRunning);
-    /**
-     * Batch job factory
-     *
-     * @param filesRequested the number of files requested
-     * @param bytesRequested the number of bytes requested
-     * @param logContext
-     * @return a list of unique_ptr to the next archive jobs. The list is empty
-     * when no more jobs can be found. Will return jobs (if available) until one
-     * of the 2 criteria is fulfilled.
-     */
-    std::list<std::unique_ptr<ArchiveJob>> getNextJobBatch(uint64_t filesRequested,
-      uint64_t bytesRequested, log::LogContext &logContext);
-
-    /**
-     * Report a batch of jobs successes. The reporting will be asynchronous behind
-     * the scenes.
-     *
-     * @param successfulArchiveJobs the jobs to report
-     * @param logContext
-     */
-    virtual void reportJobsBatchTransferred (std::queue<std::unique_ptr<cta::ArchiveJob> > & successfulArchiveJobs,
-        std::queue<cta::catalogue::TapeItemWritten> & skippedFiles, std::queue<std::unique_ptr<cta::SchedulerDatabase::ArchiveJob>>& failedToReportArchiveJobs, cta::log::LogContext &logContext);
-
-    /**
-     * Returns the tape pool of the tape to be mounted.
-     *
-     * @return The tape pool of the tape to be mounted.
-     */
-    std::string getPoolName() const override;
-
-    /**
-     * Returns the virtual organization of the tape to be mounted
-     * @return the vo of the tape to be mounted
-     */
-    std::string getVo() const override;
-
-    /**
-     * Returns the media type of the tape
-     * @return de media type of the tape
-     */
-    std::string getMediaType() const override;
-
-    /**
-     * Returns the vendor of the tape
-     * @return the vendor of the tape
-     */
-    std::string getVendor() const override;
-
-    /**
-     * Returns the capacity in bytes of the tape
-     * @return the capacity in bytes of the tape
-     */
-    uint64_t getCapacityInBytes() const override;
-
-    /**
-     * Returns the mount transaction id.
-     *
-     * @return The mount transaction id.
-     */
-    uint32_t getNbFiles() const override;
-
-    /**
-     * Returns the label format of the tape
-     * @return the label format of the tape
-     */
-    cta::common::dataStructures::Label::Format getLabelFormat() const override;
-
-    /**
-     * Creates a disk reporter for the ArchiveJob (this is a wrapper).
-     * @param URL: report address
-     * @param reporterState void promise to be set when the report is done asynchronously.
-     * @return pointer to the reporter created.
-     */
-    disk::DiskReporter * createDiskReporter(std::string & URL);
-
-    /**
-     * Update the catalog with a set of TapeFileWritten events.
-     *
-     * @param tapeFilesWritten The set of report events for the catalog update.
-     */
-    void updateCatalogueWithTapeFilesWritten(const std::set<cta::catalogue::TapeItemWrittenPointer> &tapeFilesWritten);
-
-    /**
-     * Destructor.
-     */
-    ~ArchiveMount() noexcept override;
-
-  protected:
-
-    /**
-     * The database representation of this mount.
-     */
-    std::unique_ptr<cta::SchedulerDatabase::ArchiveMount> m_dbMount;
-
-    /**
-     * A reference to the file catalogue.
-     */
-    catalogue::Catalogue & m_catalogue;
-
-    /**
-     * Internal tracking of the session completion
-     */
-    std::atomic<bool> m_sessionRunning;
-
-  private:
-    /** An initialized-once factory for archive reports (indirectly used by ArchiveJobs) */
-    disk::DiskReporterFactory m_reporterFactory;
-  }; // class ArchiveMount
-
-} // namespace cta
+    * Returns the mount transaction id.
+    *
+    * @return The mount transaction id.
+    */
+  uint32_t getNbFiles() const override;
+
+  /**
+    * Returns the label format of the tape
+    * @return the label format of the tape
+    */
+  cta::common::dataStructures::Label::Format getLabelFormat() const override;
+
+  /**
+    * Creates a disk reporter for the ArchiveJob (this is a wrapper).
+    * @param URL: report address
+    * @param reporterState void promise to be set when the report is done asynchronously.
+    * @return pointer to the reporter created.
+    */
+  disk::DiskReporter * createDiskReporter(std::string & URL);
+
+  /**
+    * Update the catalog with a set of TapeFileWritten events.
+    *
+    * @param tapeFilesWritten The set of report events for the catalog update.
+    */
+  void updateCatalogueWithTapeFilesWritten(const std::set<cta::catalogue::TapeItemWrittenPointer> &tapeFilesWritten);
+
+  /**
+    * Destructor.
+    */
+  ~ArchiveMount() noexcept override;
+
+protected:
+  /**
+    * The database representation of this mount.
+    */
+  std::unique_ptr<cta::SchedulerDatabase::ArchiveMount> m_dbMount;
+
+  /**
+    * A reference to the file catalogue.
+    */
+  catalogue::Catalogue & m_catalogue;
+
+  /**
+    * Internal tracking of the session completion
+    */
+  std::atomic<bool> m_sessionRunning;
+
+private:
+  /** An initialized-once factory for archive reports (indirectly used by ArchiveJobs) */
+  disk::DiskReporterFactory m_reporterFactory;
+};  // class ArchiveMount
+
+}  // namespace cta
diff --git a/scheduler/LabelMount.hpp b/scheduler/LabelMount.hpp
index 4920a5faf088be3dcf01aa2f1d35651727e72ad7..15fde38024ede249038b0d3d76bcfdd1d19329f7 100644
--- a/scheduler/LabelMount.hpp
+++ b/scheduler/LabelMount.hpp
@@ -17,129 +17,130 @@
 
 #pragma once
 
+#include <atomic>
+#include <memory>
+#include <string>
+
 #include "common/exception/Exception.hpp"
 #include "scheduler/SchedulerDatabase.hpp"
 #include "scheduler/TapeMount.hpp"
-#include "catalogue/Catalogue.hpp"
-
-#include <memory>
-#include <atomic>
 
 namespace cta {
+
+namespace catalogue {
+class Catalogue;
+}
+
+/**
+  * The class driving a retrieve mount.
+  * The class only has private constructors as it is instanciated by
+  * the Scheduler class.
+  */
+class LabelMount: public TapeMount {
+  friend class Scheduler;
+protected:
+  /**
+    * Constructor.
+    */
+  explicit LabelMount(catalogue::Catalogue & catalogue);
+
+  /**
+    * Constructor.
+    *
+    * @param dbMount The database representation of this mount.
+    */
+  LabelMount(catalogue::Catalogue & catalogue, std::unique_ptr<cta::SchedulerDatabase::LabelMount> dbMount);
+
+public:
+  CTA_GENERATE_EXCEPTION_CLASS(WrongMountType);
+  CTA_GENERATE_EXCEPTION_CLASS(NotImplemented);
+
+  /**
+    * Returns The type of this tape mount.
+    *
+    * @return The type of this tape mount.
+    */
+  cta::common::dataStructures::MountType getMountType() const override;
+
+  /**
+    * Returns the volume identifier of the tape to be mounted.
+    *
+    * @return The volume identifier of the tape to be mounted.
+    */
+  std::string getVid() const override;
+
+  /**
+    * Returns the mount transaction id.
+    *
+    * @return The mount transaction id.
+    */
+  std::string getMountTransactionId() const override;
+
+  /**
+    * Return std::nullopt as activities are for retrieve mounts;
+    *
+    * @return std::nullopt.
+    */
+  std::optional<std::string> getActivity() const override { return std::nullopt; }
+
+
   /**
-   * The class driving a retrieve mount.
-   * The class only has private constructors as it is instanciated by
-   * the Scheduler class.
-   */
-  class LabelMount: public TapeMount {
-    friend class Scheduler;
-  protected:
-
-    /**
-     * Constructor.
-     */
-    LabelMount(catalogue::Catalogue & catalogue);
-
-    /**
-     * Constructor.
-     *
-     * @param dbMount The database representation of this mount.
-     */
-    LabelMount(catalogue::Catalogue & catalogue, std::unique_ptr<cta::SchedulerDatabase::LabelMount> dbMount);
-
-  public:
-
-    CTA_GENERATE_EXCEPTION_CLASS(WrongMountType);
-    CTA_GENERATE_EXCEPTION_CLASS(NotImplemented);
-
-    /**
-     * Returns The type of this tape mount.
-     *
-     * @return The type of this tape mount.
-     */
-    cta::common::dataStructures::MountType getMountType() const override;
-
-    /**
-     * Returns the volume identifier of the tape to be mounted.
-     *
-     * @return The volume identifier of the tape to be mounted.
-     */
-    std::string getVid() const override;
-
-    /**
-     * Returns the mount transaction id.
-     *
-     * @return The mount transaction id.
-     */
-    std::string getMountTransactionId() const override;
-
-    /**
-     * Return std::nullopt as activities are for retrieve mounts;
-     *
-     * @return std::nullopt.
-     */
-    std::optional<std::string> getActivity() const override { return std::nullopt; }
-
-
-    /**
-     * Indicates that the mount was completed.
-     */
-    void complete() override;
-
-    /**
-     * Report a drive status change
-     */
-    void setDriveStatus(cta::common::dataStructures::DriveStatus status, const std::optional<std::string> & reason = std::nullopt) override;
-
-    /**
-     * Report a tape session statistics
-     */
-    void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) override;
-
-    /**
-     * Report a tape mounted event
-     * @param logContext
-     */
-    void setTapeMounted(log::LogContext &logContext) const override;
-
-    CTA_GENERATE_EXCEPTION_CLASS(SessionNotRunning);
-
-    /**
-     * Returns the tape pool of the tape to be mounted.
-     *
-     * @return The tape pool of the tape to be mounted.
-     */
-    virtual std::string getPoolName() const;
-
-    /**
-     * Returns the mount transaction id.
-     *
-     * @return The mount transaction id.
-     */
-    uint32_t getNbFiles() const override;
-
-    /**
-     * Destructor.
-     */
-    virtual ~LabelMount() throw();
-
-  protected:
-
-    /**
-     * The database representation of this mount.
-     */
-    std::unique_ptr<cta::SchedulerDatabase::ArchiveMount> m_dbMount;
-
-    /**
-     * A reference to the file catalogue.
-     */
-    catalogue::Catalogue & m_catalogue;
-
-    /**
-     * Internal tracking of the session completion
-     */
-    std::atomic<bool> m_sessionRunning;
-
-  }; // class ArchiveMount
-
-} // namespace cta
+    * Indicates that the mount was completed.
+    */
+  void complete() override;
+
+  /**
+    * Report a drive status change
+    */
+  void setDriveStatus(cta::common::dataStructures::DriveStatus status, const std::optional<std::string> & reason = std::nullopt) override;
+
+  /**
+    * Report a tape session statistics
+    */
+  void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) override;
+
+  /**
+    * Report a tape mounted event
+    * @param logContext
+    */
+  void setTapeMounted(log::LogContext &logContext) const override;
+
+  CTA_GENERATE_EXCEPTION_CLASS(SessionNotRunning);
+
+  /**
+    * Returns the tape pool of the tape to be mounted.
+    *
+    * @return The tape pool of the tape to be mounted.
+    */
+  virtual std::string getPoolName() const;
+
+  /**
+    * Returns the mount transaction id.
+    *
+    * @return The mount transaction id.
+    */
+  uint32_t getNbFiles() const override;
+
+  /**
+    * Destructor.
+    */
+  virtual ~LabelMount() throw();
+
+protected:
+  /**
+    * The database representation of this mount.
+    */
+  std::unique_ptr<cta::SchedulerDatabase::ArchiveMount> m_dbMount;
+
+  /**
+    * A reference to the file catalogue.
+    */
+  catalogue::Catalogue & m_catalogue;
+
+  /**
+    * Internal tracking of the session completion
+    */
+  std::atomic<bool> m_sessionRunning;
+};  // class ArchiveMount
+
+}  // namespace cta
diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp
index 88595b5017ab2f4be2d9caa3986c938c36b36703..79c1988476799ba8d41452d36a27c12d9715b0e3 100644
--- a/scheduler/OStoreDB/OStoreDB.cpp
+++ b/scheduler/OStoreDB/OStoreDB.cpp
@@ -27,6 +27,7 @@
 #include <time.h>       /* time */
 #include <tuple>
 
+#include "catalogue/Catalogue.hpp"
 #include "catalogue/TapeDrivesCatalogueState.hpp"
 #include "common/dataStructures/MountPolicy.hpp"
 #include "common/exception/Exception.hpp"
@@ -45,9 +46,9 @@
 #include "objectstore/RepackQueueAlgorithms.hpp"
 #include "objectstore/RepackRequest.hpp"
 #include "objectstore/Sorter.hpp"
-#include "OStoreDB.hpp"
 #include "Scheduler.hpp"
 #include "scheduler/LogicalLibrary.hpp"
+#include "scheduler/OStoreDB/OStoreDB.hpp"
 #include "scheduler/RetrieveJob.hpp"
 #include "tapeserver/castor/tape/tapeserver/daemon/TapeSessionStats.hpp"
 
diff --git a/scheduler/OStoreDB/OStoreDB.hpp b/scheduler/OStoreDB/OStoreDB.hpp
index f9b61f346d0f86442c0559b898eeaa3751de6ae9..3dee520ef5925576fac3166529ceb493a044c683 100644
--- a/scheduler/OStoreDB/OStoreDB.hpp
+++ b/scheduler/OStoreDB/OStoreDB.hpp
@@ -23,7 +23,6 @@
 #include <tuple>
 #include <vector>
 
-#include "catalogue/Catalogue.hpp"
 #include "catalogue/TapeDrivesCatalogueState.hpp"
 #include "common/dataStructures/JobQueueType.hpp"
 #include "common/dataStructures/LabelFormat.hpp"
@@ -48,6 +47,10 @@
 
 namespace cta {
 
+namespace catalogue {
+class Catalogue;
+}
+
 namespace ostoredb {
 template <class, class>
 class MemQueue;
diff --git a/scheduler/OStoreDB/OStoreDBFactory.hpp b/scheduler/OStoreDB/OStoreDBFactory.hpp
index 834b35db4c236d45c654a14034231769a5d93408..ab44b19aaeb6f43058beecf39669a801f35e8ebe 100644
--- a/scheduler/OStoreDB/OStoreDBFactory.hpp
+++ b/scheduler/OStoreDB/OStoreDBFactory.hpp
@@ -17,23 +17,27 @@
 
 #pragma once
 
-#include "scheduler/SchedulerDatabaseFactory.hpp"
-#include "scheduler/OStoreDB/OStoreDB.hpp"
+#include <memory>
+
 #include "common/dataStructures/SecurityIdentity.hpp"
-#include "scheduler/LogicalLibrary.hpp"
-#include "scheduler/RetrieveRequestDump.hpp"
-#include "objectstore/RootEntry.hpp"
+#include "common/log/DummyLogger.hpp"
 #include "objectstore/Agent.hpp"
 #include "objectstore/AgentReference.hpp"
-#include "objectstore/BackendVFS.hpp"
-#include "objectstore/BackendRados.hpp"
 #include "objectstore/BackendFactory.hpp"
-#include "common/log/DummyLogger.hpp"
-#include "catalogue/DummyCatalogue.hpp"
-#include <memory>
+#include "objectstore/BackendRados.hpp"
+#include "objectstore/BackendVFS.hpp"
+#include "objectstore/RootEntry.hpp"
+#include "scheduler/LogicalLibrary.hpp"
+#include "scheduler/OStoreDB/OStoreDB.hpp"
+#include "scheduler/RetrieveRequestDump.hpp"
+#include "scheduler/SchedulerDatabaseFactory.hpp"
 
 namespace cta {
 
+namespace catalogue {
+class Catalogue;
+}
+
 namespace objectstore {
   class Backend;
 
diff --git a/scheduler/OStoreDB/OStoreDBTest.cpp b/scheduler/OStoreDB/OStoreDBTest.cpp
index 60c89820bb4b3599fb2bf72713b77f20ec1d45ed..e4180c96f37fd93320ca7e793a478069a71c91bb 100644
--- a/scheduler/OStoreDB/OStoreDBTest.cpp
+++ b/scheduler/OStoreDB/OStoreDBTest.cpp
@@ -21,18 +21,19 @@
 #include <string>
 #include <utility>
 
+#include "catalogue/DummyCatalogue.hpp"
 #include "catalogue/InMemoryCatalogue.hpp"
 #include "common/exception/Exception.hpp"
 #include "common/log/Logger.hpp"
 #include "common/log/StringLogger.hpp"
-#include "MemQueues.hpp"
 #include "objectstore/BackendPopulator.hpp"
 #include "objectstore/BackendRados.hpp"
 #include "objectstore/BackendRadosTestSwitch.hpp"
 #include "objectstore/BackendVFS.hpp"
-#include "OStoreDB.hpp"
-#include "OStoreDBFactory.hpp"
-#include "OStoreDBTest.hpp"
+#include "scheduler/OStoreDB/MemQueues.hpp"
+#include "scheduler/OStoreDB/OStoreDB.hpp"
+#include "scheduler/OStoreDB/OStoreDBFactory.hpp"
+#include "scheduler/OStoreDB/OStoreDBTest.hpp"
 
 namespace unitTests {
 
diff --git a/scheduler/OStoreDB/QueueItor.cpp b/scheduler/OStoreDB/QueueItor.cpp
index 213cc4d7d6bed494abe572133307f5e11d31fca2..c8288f2effbe39a0640497cdb5e50c6385138d7d 100644
--- a/scheduler/OStoreDB/QueueItor.cpp
+++ b/scheduler/OStoreDB/QueueItor.cpp
@@ -15,11 +15,13 @@
  *               submit itself to any jurisdiction.
  */
 
+#include "common/dataStructures/ArchiveJob.hpp"
 #include "common/exception/NoSuchObject.hpp"
-#include "QueueItor.hpp"
-#include <objectstore/ArchiveQueue.hpp>
-#include <objectstore/RetrieveQueue.hpp>
-#include <objectstore/RootEntry.hpp>
+#include "common/exception/UserError.hpp"
+#include "objectstore/ArchiveQueue.hpp"
+#include "objectstore/RetrieveQueue.hpp"
+#include "objectstore/RootEntry.hpp"
+#include "scheduler/OStoreDB/QueueItor.hpp"
 
 namespace cta {
 
diff --git a/scheduler/PostgresSchedDB/PostgresSchedDB.hpp b/scheduler/PostgresSchedDB/PostgresSchedDB.hpp
index 1b7542b3672636f11c3247702e5fac7c579533a5..8412758b8b82a5a1c175a909b9ce018ff27b50e1 100644
--- a/scheduler/PostgresSchedDB/PostgresSchedDB.hpp
+++ b/scheduler/PostgresSchedDB/PostgresSchedDB.hpp
@@ -17,10 +17,17 @@
 
 #pragma once
 
-#include "catalogue/Catalogue.hpp"
+#include <cstdint>
+#include <map>
+#include <memory>
+#include <set>
+#include <string>
+#include <tuple>
+#include <vector>
+
+#include "common/dataStructures/ArchiveFileQueueCriteriaAndFileId.hpp"
 #include "common/dataStructures/ArchiveJob.hpp"
 #include "common/dataStructures/ArchiveRequest.hpp"
-#include "common/dataStructures/ArchiveFileQueueCriteriaAndFileId.hpp"
 #include "common/dataStructures/CancelRetrieveRequest.hpp"
 #include "common/dataStructures/DeleteArchiveRequest.hpp"
 #include "common/dataStructures/JobQueueType.hpp"
@@ -31,135 +38,132 @@
 #include "common/dataStructures/RetrieveRequest.hpp"
 #include "common/dataStructures/SecurityIdentity.hpp"
 #include "common/log/Logger.hpp"
-#include "scheduler/SchedulerDatabase.hpp"
 #include "scheduler/RetrieveJob.hpp"
-
-#include <map>
-#include <memory>
-#include <string>
-#include <tuple>
-#include <vector>
-#include <cstdint>
+#include "scheduler/SchedulerDatabase.hpp"
 
 namespace cta {
 
+namespace catalogue {
+class Catalogue;
+}
+
 class PostgresSchedDB: public SchedulerDatabase {
  public:
-   PostgresSchedDB(void *pgstuff, catalogue::Catalogue & catalogue, log::Logger &logger);
-   virtual ~PostgresSchedDB() throw();
+  PostgresSchedDB(void *pgstuff, catalogue::Catalogue & catalogue, log::Logger &logger);
+  virtual ~PostgresSchedDB() throw();
 
-   class ArchiveMount;
-   class ArchiveJob;
-   class ArchiveJobQueueItor;
-   class RetrieveMount;
-   class RetrieveJob;
-   class RetrieveJobQueueItor;
-   class RepackRequestPromotionStatistics;
-   class RepackRequest;
-   class RepackReportBatch;
-   class TapeMountDecisionInfo;
+  class ArchiveMount;
+  class ArchiveJob;
+  class ArchiveJobQueueItor;
+  class RetrieveMount;
+  class RetrieveJob;
+  class RetrieveJobQueueItor;
+  class RepackRequestPromotionStatistics;
+  class RepackRequest;
+  class RepackReportBatch;
+  class TapeMountDecisionInfo;
 
-   void waitSubthreadsComplete() override;
+  void waitSubthreadsComplete() override;
 
-   void ping() override;
+  void ping() override;
 
-   std::string queueArchive(const std::string &instanceName, const cta::common::dataStructures::ArchiveRequest &request,
-     const cta::common::dataStructures::ArchiveFileQueueCriteriaAndFileId &criteria, log::LogContext &logContext) override;
+  std::string queueArchive(const std::string &instanceName, const cta::common::dataStructures::ArchiveRequest &request,
+    const cta::common::dataStructures::ArchiveFileQueueCriteriaAndFileId &criteria, log::LogContext &logContext) override;
 
-   std::map<std::string, std::list<common::dataStructures::ArchiveJob>> getArchiveJobs() const override;
+  std::map<std::string, std::list<common::dataStructures::ArchiveJob>> getArchiveJobs() const override;
 
-   std::list<cta::common::dataStructures::ArchiveJob> getArchiveJobs(const std::string& tapePoolName) const override;
+  std::list<cta::common::dataStructures::ArchiveJob> getArchiveJobs(const std::string& tapePoolName) const override;
 
-   std::unique_ptr<IArchiveJobQueueItor> getArchiveJobQueueItor(const std::string &tapePoolName,
-     common::dataStructures::JobQueueType queueType) const override;
+  std::unique_ptr<IArchiveJobQueueItor> getArchiveJobQueueItor(const std::string &tapePoolName,
+    common::dataStructures::JobQueueType queueType) const override;
 
-   std::list<std::unique_ptr<SchedulerDatabase::ArchiveJob> > getNextArchiveJobsToReportBatch(uint64_t filesRequested,
-     log::LogContext & logContext) override;
+  std::list<std::unique_ptr<SchedulerDatabase::ArchiveJob> > getNextArchiveJobsToReportBatch(uint64_t filesRequested,
+    log::LogContext & logContext) override;
 
-   JobsFailedSummary getArchiveJobsFailedSummary(log::LogContext &logContext) override;
+  JobsFailedSummary getArchiveJobsFailedSummary(log::LogContext &logContext) override;
 
-   void setArchiveJobBatchReported(std::list<SchedulerDatabase::ArchiveJob*> & jobsBatch,
-     log::TimingList & timingList, utils::Timer & t, log::LogContext & lc) override;
+  void setArchiveJobBatchReported(std::list<SchedulerDatabase::ArchiveJob*> & jobsBatch,
+    log::TimingList & timingList, utils::Timer & t, log::LogContext & lc) override;
 
-   std::list<RetrieveQueueStatistics> getRetrieveQueueStatistics(
-     const cta::common::dataStructures::RetrieveFileQueueCriteria& criteria, const std::set<std::string>& vidsToConsider) override;
+  std::list<RetrieveQueueStatistics> getRetrieveQueueStatistics(
+    const cta::common::dataStructures::RetrieveFileQueueCriteria& criteria, const std::set<std::string>& vidsToConsider) override;
 
-   SchedulerDatabase::RetrieveRequestInfo queueRetrieve(cta::common::dataStructures::RetrieveRequest& rqst,
-     const cta::common::dataStructures::RetrieveFileQueueCriteria &criteria, const std::optional<std::string> diskSystemName,
-     log::LogContext &logContext) override;
+  SchedulerDatabase::RetrieveRequestInfo queueRetrieve(cta::common::dataStructures::RetrieveRequest& rqst,
+    const cta::common::dataStructures::RetrieveFileQueueCriteria &criteria, const std::optional<std::string> diskSystemName,
+    log::LogContext &logContext) override;
 
-   void cancelRetrieve(const std::string& instanceName, const cta::common::dataStructures::CancelRetrieveRequest& rqst,
-     log::LogContext& lc) override;
+  void cancelRetrieve(const std::string& instanceName, const cta::common::dataStructures::CancelRetrieveRequest& rqst,
+    log::LogContext& lc) override;
 
-   std::map<std::string, std::list<RetrieveRequestDump> > getRetrieveRequests() const override;
+  std::map<std::string, std::list<RetrieveRequestDump> > getRetrieveRequests() const override;
 
-   std::list<RetrieveRequestDump> getRetrieveRequestsByVid(const std::string& vid) const override;
+  std::list<RetrieveRequestDump> getRetrieveRequestsByVid(const std::string& vid) const override;
 
-   std::list<RetrieveRequestDump> getRetrieveRequestsByRequester(const std::string& vid) const override;
+  std::list<RetrieveRequestDump> getRetrieveRequestsByRequester(const std::string& vid) const override;
 
-   void deleteRetrieveRequest(const common::dataStructures::SecurityIdentity& requester,
-     const std::string& remoteFile) override;
+  void deleteRetrieveRequest(const common::dataStructures::SecurityIdentity& requester,
+    const std::string& remoteFile) override;
 
-   virtual void cancelArchive(const common::dataStructures::DeleteArchiveRequest& request, log::LogContext & lc) override;
+  void cancelArchive(const common::dataStructures::DeleteArchiveRequest& request, log::LogContext & lc) override;
 
-   virtual void deleteFailed(const std::string &objectId, log::LogContext &lc) override;
+  void deleteFailed(const std::string &objectId, log::LogContext &lc) override;
 
-   std::map<std::string, std::list<common::dataStructures::RetrieveJob>> getRetrieveJobs() const override;
+  std::map<std::string, std::list<common::dataStructures::RetrieveJob>> getRetrieveJobs() const override;
 
-   std::list<cta::common::dataStructures::RetrieveJob> getRetrieveJobs(const std::string &vid) const override;
+  std::list<cta::common::dataStructures::RetrieveJob> getRetrieveJobs(const std::string &vid) const override;
 
-   std::unique_ptr<IRetrieveJobQueueItor> getRetrieveJobQueueItor(const std::string &vid,
-    common::dataStructures::JobQueueType queueType) const override;
+  std::unique_ptr<IRetrieveJobQueueItor> getRetrieveJobQueueItor(const std::string &vid,
+  common::dataStructures::JobQueueType queueType) const override;
 
-   std::string queueRepack(const SchedulerDatabase::QueueRepackRequest & repackRequest, log::LogContext &logContext) override;
+  std::string queueRepack(const SchedulerDatabase::QueueRepackRequest & repackRequest, log::LogContext &logContext) override;
 
-   std::list<common::dataStructures::RepackInfo> getRepackInfo() override;
+  std::list<common::dataStructures::RepackInfo> getRepackInfo() override;
 
-   common::dataStructures::RepackInfo getRepackInfo(const std::string& vid) override;
+  common::dataStructures::RepackInfo getRepackInfo(const std::string& vid) override;
 
-   void cancelRepack(const std::string& vid, log::LogContext & lc) override;
+  void cancelRepack(const std::string& vid, log::LogContext & lc) override;
 
-   std::unique_ptr<RepackRequestStatistics> getRepackStatistics() override;
+  std::unique_ptr<RepackRequestStatistics> getRepackStatistics() override;
 
-   std::unique_ptr<RepackRequestStatistics> getRepackStatisticsNoLock() override;
+  std::unique_ptr<RepackRequestStatistics> getRepackStatisticsNoLock() override;
 
-   std::unique_ptr<SchedulerDatabase::RepackRequest> getNextRepackJobToExpand() override;
+  std::unique_ptr<SchedulerDatabase::RepackRequest> getNextRepackJobToExpand() override;
 
-   std::list<std::unique_ptr<SchedulerDatabase::RetrieveJob>> getNextRetrieveJobsToReportBatch(
-     uint64_t filesRequested, log::LogContext &logContext) override;
+  std::list<std::unique_ptr<SchedulerDatabase::RetrieveJob>> getNextRetrieveJobsToReportBatch(
+    uint64_t filesRequested, log::LogContext &logContext) override;
 
-   std::list<std::unique_ptr<SchedulerDatabase::RetrieveJob>> getNextRetrieveJobsFailedBatch(
-     uint64_t filesRequested, log::LogContext &logContext) override;
+  std::list<std::unique_ptr<SchedulerDatabase::RetrieveJob>> getNextRetrieveJobsFailedBatch(
+    uint64_t filesRequested, log::LogContext &logContext) override;
 
-   std::unique_ptr<SchedulerDatabase::RepackReportBatch> getNextRepackReportBatch(log::LogContext& lc) override;
+  std::unique_ptr<SchedulerDatabase::RepackReportBatch> getNextRepackReportBatch(log::LogContext& lc) override;
 
-   std::unique_ptr<SchedulerDatabase::RepackReportBatch> getNextSuccessfulRetrieveRepackReportBatch(log::LogContext& lc) override;
+  std::unique_ptr<SchedulerDatabase::RepackReportBatch> getNextSuccessfulRetrieveRepackReportBatch(log::LogContext& lc) override;
 
-   std::unique_ptr<SchedulerDatabase::RepackReportBatch> getNextSuccessfulArchiveRepackReportBatch(log::LogContext& lc) override;
+  std::unique_ptr<SchedulerDatabase::RepackReportBatch> getNextSuccessfulArchiveRepackReportBatch(log::LogContext& lc) override;
 
-   std::unique_ptr<SchedulerDatabase::RepackReportBatch> getNextFailedRetrieveRepackReportBatch(log::LogContext& lc) override;
+  std::unique_ptr<SchedulerDatabase::RepackReportBatch> getNextFailedRetrieveRepackReportBatch(log::LogContext& lc) override;
 
-   std::unique_ptr<SchedulerDatabase::RepackReportBatch> getNextFailedArchiveRepackReportBatch(log::LogContext &lc) override;
+  std::unique_ptr<SchedulerDatabase::RepackReportBatch> getNextFailedArchiveRepackReportBatch(log::LogContext &lc) override;
 
-   std::list<std::unique_ptr<SchedulerDatabase::RepackReportBatch>> getRepackReportBatches(log::LogContext &lc) override;
+  std::list<std::unique_ptr<SchedulerDatabase::RepackReportBatch>> getRepackReportBatches(log::LogContext &lc) override;
 
-   void setRetrieveJobBatchReportedToUser(std::list<SchedulerDatabase::RetrieveJob*> & jobsBatch,
-     log::TimingList & timingList, utils::Timer & t, log::LogContext & lc) override;
+  void setRetrieveJobBatchReportedToUser(std::list<SchedulerDatabase::RetrieveJob*> & jobsBatch,
+    log::TimingList & timingList, utils::Timer & t, log::LogContext & lc) override;
 
-   JobsFailedSummary getRetrieveJobsFailedSummary(log::LogContext &logContext) override;
+  JobsFailedSummary getRetrieveJobsFailedSummary(log::LogContext &logContext) override;
 
-   std::unique_ptr<SchedulerDatabase::TapeMountDecisionInfo> getMountInfo(log::LogContext& logContext) override;
+  std::unique_ptr<SchedulerDatabase::TapeMountDecisionInfo> getMountInfo(log::LogContext& logContext) override;
 
-   void trimEmptyQueues(log::LogContext& lc) override;
+  void trimEmptyQueues(log::LogContext& lc) override;
 
-   std::unique_ptr<SchedulerDatabase::TapeMountDecisionInfo> getMountInfoNoLock(PurposeGetMountInfo purpose,
-     log::LogContext& logContext) override;
+  std::unique_ptr<SchedulerDatabase::TapeMountDecisionInfo> getMountInfoNoLock(PurposeGetMountInfo purpose,
+    log::LogContext& logContext) override;
 
-   void requeueRetrieveJobs(std::list<SchedulerDatabase::RetrieveJob *> &jobs, log::LogContext& logContext) override;
+  void requeueRetrieveJobs(std::list<SchedulerDatabase::RetrieveJob *> &jobs, log::LogContext& logContext) override;
 
-   // these are not in the baseclass but are beeded by XrdSsiCtaServiceProvider
-   void setThreadNumber(uint64_t threadNumber, const std::optional<size_t> &stackSize = std::nullopt);
-   void setBottomHalfQueueSize(uint64_t tasksNumber);
+  // these are not in the baseclass but are beeded by XrdSsiCtaServiceProvider
+  void setThreadNumber(uint64_t threadNumber, const std::optional<size_t> &stackSize = std::nullopt);
+  void setBottomHalfQueueSize(uint64_t tasksNumber);
 
 };
 
diff --git a/scheduler/PostgresSchedDB/PostgresSchedDBFactory.hpp b/scheduler/PostgresSchedDB/PostgresSchedDBFactory.hpp
index 46411d4c939055bbb6f2f740bce7ea918e3eff78..5d60ed1081f8f8900728d876efc2c95825521764 100644
--- a/scheduler/PostgresSchedDB/PostgresSchedDBFactory.hpp
+++ b/scheduler/PostgresSchedDB/PostgresSchedDBFactory.hpp
@@ -17,24 +17,29 @@
 
 #pragma once
 
-#include "scheduler/SchedulerDatabaseFactory.hpp"
-#include "scheduler/PostgresSchedDB/PostgresSchedDB.hpp"
+#include <memory>
+#include <string>
+
 #include "common/dataStructures/SecurityIdentity.hpp"
+#include "common/log/DummyLogger.hpp"
 #include "scheduler/LogicalLibrary.hpp"
+#include "scheduler/PostgresSchedDB/PostgresSchedDB.hpp"
 #include "scheduler/RetrieveRequestDump.hpp"
-#include "common/log/DummyLogger.hpp"
-#include "catalogue/DummyCatalogue.hpp"
-#include <memory>
+#include "scheduler/SchedulerDatabaseFactory.hpp"
 
 namespace cta {
 
+namespace catalogue {
+class Catalogue;
+}
+
 class PostgresSchedDBWrapper: public SchedulerDatabaseDecorator {
 public:
   PostgresSchedDBWrapper(const std::string &context, std::unique_ptr<cta::catalogue::Catalogue>& catalogue, const std::string &URL = "") :
     SchedulerDatabaseDecorator(m_PostgresSchedDB), m_logger(new cta::log::DummyLogger("", "")), m_catalogue(catalogue),
     m_PostgresSchedDB(nullptr, *m_catalogue, *m_logger) {}
 
-  ~PostgresSchedDBWrapper() throw () {}
+  ~PostgresSchedDBWrapper() throw() {}
 
 private:
   std::unique_ptr <cta::log::Logger> m_logger;
@@ -51,7 +56,7 @@ public:
   /**
    * Constructor
    */
-  PostgresSchedDBFactory(const std::string & URL = ""): m_URL(URL) {}
+  explicit PostgresSchedDBFactory(const std::string & URL = ""): m_URL(URL) {}
 
   /**
    * Destructor.
@@ -69,6 +74,6 @@ public:
 
   private:
     std::string m_URL;
-}; // class PostgresSchedDBFactory
+};  // class PostgresSchedDBFactory
 
-} // namespace cta
+}  // namespace cta
diff --git a/scheduler/PostgresSchedDB/PostgresSchedDBInit.hpp b/scheduler/PostgresSchedDB/PostgresSchedDBInit.hpp
index 386a41b570a8f1f09b051cc8bcab0dd408e8be47..c9a40cddb5891bf0b59ed667c7f924e6ccdcec74 100644
--- a/scheduler/PostgresSchedDB/PostgresSchedDBInit.hpp
+++ b/scheduler/PostgresSchedDB/PostgresSchedDBInit.hpp
@@ -17,15 +17,18 @@
 
 #pragma once
 
-#include "PostgresSchedDB.hpp"
-#include "common/log/Logger.hpp"
-#include "catalogue/Catalogue.hpp"
-
 #include <memory>
 #include <string>
 
+#include "catalogue/PostgresSchedDB.hpp"
+#include "common/log/Logger.hpp"
+
 namespace cta {
 
+namespace catalogue {
+class Catalogue;
+}
+
 class PostgresSchedDBGC {
 public:
 
diff --git a/scheduler/RetrieveMount.cpp b/scheduler/RetrieveMount.cpp
index 881593342e0364a390968c4b99e9773bbf51da91..a41736595f7c807c588425e0df24517eea78bc58 100644
--- a/scheduler/RetrieveMount.cpp
+++ b/scheduler/RetrieveMount.cpp
@@ -15,16 +15,17 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <numeric>
+#include <algorithm>
+#include <iterator>
+
+#include "catalogue/Catalogue.hpp"
 #include "common/exception/NoSuchObject.hpp"
 #include "common/log/TimingList.hpp"
 #include "common/Timer.hpp"
 #include "disk/DiskSystem.hpp"
 #include "scheduler/RetrieveMount.hpp"
 
-#include <numeric>
-#include <algorithm>
-#include <iterator>
-
 //------------------------------------------------------------------------------
 // constructor
 //------------------------------------------------------------------------------
diff --git a/scheduler/RetrieveMount.hpp b/scheduler/RetrieveMount.hpp
index 2c30b7a739dc86ce2d86c13db7246be4a35acc62..12bf31305a41fd53fdca93d14300c2f4419c38b8 100644
--- a/scheduler/RetrieveMount.hpp
+++ b/scheduler/RetrieveMount.hpp
@@ -17,281 +17,285 @@
 
 #pragma once
 
+#include <list>
+#include <memory>
+#include <queue>
+#include <set>
+#include <string>
+#include <vector>
+
 #include "common/exception/Exception.hpp"
+#include "disk/DiskReporterFactory.hpp"
 #include "scheduler/RetrieveJob.hpp"
 #include "scheduler/RetrieveMount.hpp"
 #include "scheduler/SchedulerDatabase.hpp"
 #include "scheduler/TapeMount.hpp"
-#include "disk/DiskReporterFactory.hpp"
-#include "catalogue/Catalogue.hpp"
-
-#include <memory>
-#include <queue>
 
 namespace cta {
 
+namespace catalogue {
+class Catalogue;
+}
+
+/**
+  * The class driving a retrieve mount.
+  * The class only has private constructors as it is instanciated by
+  * the Scheduler class.
+  */
+class RetrieveMount: public TapeMount {
+  friend class Scheduler;
+protected:
   /**
-   * The class driving a retrieve mount.
-   * The class only has private constructors as it is instanciated by
-   * the Scheduler class.
-   */
-  class RetrieveMount: public TapeMount {
-    friend class Scheduler;
-  protected:
-    /**
-     * Constructor.
-     * @param catalogue The file catalogue interface.
-     */
-    RetrieveMount(cta::catalogue::Catalogue &catalogue);
-
-    /**
-     * Constructor.
-     * @param catalogue The file catalogue interface.
-     * @param dbMount The database representation of this mount.
-     */
-    RetrieveMount(cta::catalogue::Catalogue &catalogue, std::unique_ptr<cta::SchedulerDatabase::RetrieveMount> dbMount);
+    * Constructor.
+    * @param catalogue The file catalogue interface.
+    */
+  explicit RetrieveMount(cta::catalogue::Catalogue &catalogue);
 
-  public:
+  /**
+    * Constructor.
+    * @param catalogue The file catalogue interface.
+    * @param dbMount The database representation of this mount.
+    */
+  RetrieveMount(cta::catalogue::Catalogue &catalogue, std::unique_ptr<cta::SchedulerDatabase::RetrieveMount> dbMount);
 
-    CTA_GENERATE_EXCEPTION_CLASS(WrongMountType);
-    CTA_GENERATE_EXCEPTION_CLASS(NotImplemented);
+public:
+  CTA_GENERATE_EXCEPTION_CLASS(WrongMountType);
+  CTA_GENERATE_EXCEPTION_CLASS(NotImplemented);
 
-    /**
-     * Returns The type of this tape mount.
-     *
-     * @return The type of this tape mount.
-     */
-    cta::common::dataStructures::MountType getMountType() const override;
-
-    /**
-     * Returns the volume identifier of the tape to be mounted.
-     *
-     * @return The volume identifier of the tape to be mounted.
-     */
-    std::string getVid() const override;
+  /**
+    * Returns The type of this tape mount.
+    *
+    * @return The type of this tape mount.
+    */
+  cta::common::dataStructures::MountType getMountType() const override;
 
-    /**
-     * Returns the (optional) activity for this mount.
-     *
-     * @return
-     */
-    std::optional<std::string> getActivity() const override;
+  /**
+    * Returns the volume identifier of the tape to be mounted.
+    *
+    * @return The volume identifier of the tape to be mounted.
+    */
+  std::string getVid() const override;
 
+  /**
+    * Returns the (optional) activity for this mount.
+    *
+    * @return
+    */
+  std::optional<std::string> getActivity() const override;
 
-    /**
-     * Returns the mount transaction id.
-     *
-     * @return The mount transaction id.
-     */
-    std::string getMountTransactionId() const override;
 
-    /**
-     * Returns the mount transaction id.
-     *
-     * @return The mount transaction id.
-     */
-    uint32_t getNbFiles() const override;
-
-     /**
-     * Returns the tape pool of the tape to be mounted
-     * @return The tape pool of the tape to be mounted
-     */
-    std::string getPoolName() const override;
+  /**
+    * Returns the mount transaction id.
+    *
+    * @return The mount transaction id.
+    */
+  std::string getMountTransactionId() const override;
 
-    /**
-     * Returns the virtual organization in which the tape
-     * belongs
-     * @return the vo in which the tape belongs
-     */
-    std::string getVo() const override;
+  /**
+    * Returns the mount transaction id.
+    *
+    * @return The mount transaction id.
+    */
+  uint32_t getNbFiles() const override;
 
     /**
-     * Returns the media type of the tape
-     * @return de media type of the tape
-     */
-    std::string getMediaType() const override;
+    * Returns the tape pool of the tape to be mounted
+    * @return The tape pool of the tape to be mounted
+    */
+  std::string getPoolName() const override;
 
-    /**
-     * Returns the vendor of the tape
-     * @return the vendor of the tape
-     */
-    std::string getVendor() const override;
+  /**
+    * Returns the virtual organization in which the tape
+    * belongs
+    * @return the vo in which the tape belongs
+    */
+  std::string getVo() const override;
 
-    /**
-     * Returns the tape drive
-     * @return the tape drive
-     */
-    virtual std::string getDrive() const;
+  /**
+    * Returns the media type of the tape
+    * @return de media type of the tape
+    */
+  std::string getMediaType() const override;
 
-    /**
-    * Returns the capacity in bytes of the tape
-    * @return the capacity in bytes of the tape
+  /**
+    * Returns the vendor of the tape
+    * @return the vendor of the tape
     */
-    uint64_t getCapacityInBytes() const override;
+  std::string getVendor() const override;
 
-    /**
-     * Returns the media format of the tape
-     * @return the media format of the tape
-     */
-    cta::common::dataStructures::Label::Format getLabelFormat() const override;
+  /**
+    * Returns the tape drive
+    * @return the tape drive
+    */
+  virtual std::string getDrive() const;
 
-    /**
-     * Report a drive status change
-     */
-    void setDriveStatus(cta::common::dataStructures::DriveStatus status, const std::optional<std::string> & reason = std::nullopt) override;
+  /**
+  * Returns the capacity in bytes of the tape
+  * @return the capacity in bytes of the tape
+  */
+  uint64_t getCapacityInBytes() const override;
 
-    /**
-     * Report a tape session statistics
-     */
-    void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) override;
+  /**
+    * Returns the media format of the tape
+    * @return the media format of the tape
+    */
+  cta::common::dataStructures::Label::Format getLabelFormat() const override;
 
-    /**
-     * Report a tape mounted event
-     * @param logContext
-     */
-    void setTapeMounted(log::LogContext &logContext) const override;
+  /**
+    * Report a drive status change
+    */
+  void setDriveStatus(cta::common::dataStructures::DriveStatus status, const std::optional<std::string> & reason = std::nullopt) override;
 
-    /**
-     * Indicates that the disk thread of the mount was completed. This
-     * will implicitly trigger the transition from DrainingToDisk to Up if necessary.
-     */
-    virtual void diskComplete();
+  /**
+    * Report a tape session statistics
+    */
+  void setTapeSessionStats(const castor::tape::tapeserver::daemon::TapeSessionStats &stats) override;
 
-    /**
-     * Indicates that the tape thread of the mount was completed. This
-     * will implicitly trigger the transition from Unmounting to either Up or
-     * DrainingToDisk, depending on the the disk thread's status.
-     */
-    virtual void tapeComplete();
+  /**
+    * Report a tape mounted event
+    * @param logContext
+    */
+  void setTapeMounted(log::LogContext &logContext) const override;
 
-    /**
-     * Indicates that the we should cancel the mount (equivalent to diskComplete
-     * + tapeComplete).
-     */
-    void complete() override;
+  /**
+    * Indicates that the disk thread of the mount was completed. This
+    * will implicitly trigger the transition from DrainingToDisk to Up if necessary.
+    */
+  virtual void diskComplete();
 
-    /**
-     * Tests whether all threads are complete
-     * @return true if both tape and disk are complete.
-     */
-    virtual bool bothSidesComplete();
+  /**
+    * Indicates that the tape thread of the mount was completed. This
+    * will implicitly trigger the transition from Unmounting to either Up or
+    * DrainingToDisk, depending on the the disk thread's status.
+    */
+  virtual void tapeComplete();
 
-    CTA_GENERATE_EXCEPTION_CLASS(SessionNotRunning);
+  /**
+    * Indicates that the we should cancel the mount (equivalent to diskComplete
+    * + tapeComplete).
+    */
+  void complete() override;
 
-    /**
-     * Batch job factory
-     *
-     * @param filesRequested the number of files requested
-     * @param bytesRequested the number of bytes requested
-     * @param logContext
-     * @return a list of unique_ptr to the next retrieve jobs. The list is empty
-     * when no more jobs can be found. Will return jobs (if available) until one
-     * of the 2 criteria is fulfilled.
-     */
-    virtual std::list<std::unique_ptr<RetrieveJob>> getNextJobBatch(uint64_t filesRequested,
-      uint64_t bytesRequested, log::LogContext &logContext);
+  /**
+    * Tests whether all threads are complete
+    * @return true if both tape and disk are complete.
+    */
+  virtual bool bothSidesComplete();
 
-    /**
-     * Requeues a batch of jobs in their respective queues 
-     * @param jobs The job batch
-     * @param logContext 
-     */
-    virtual void requeueJobBatch(std::vector<std::unique_ptr<cta::RetrieveJob>> &jobs, log::LogContext &logContext);
+  CTA_GENERATE_EXCEPTION_CLASS(SessionNotRunning);
 
-    /**
-     * Puts the queue associated to this retrieve mount to sleep
-     */
-    virtual void putQueueToSleep(const std::string &diskSystemName, const uint64_t sleepTime, log::LogContext &logContext);
+  /**
+    * Batch job factory
+    *
+    * @param filesRequested the number of files requested
+    * @param bytesRequested the number of bytes requested
+    * @param logContext
+    * @return a list of unique_ptr to the next retrieve jobs. The list is empty
+    * when no more jobs can be found. Will return jobs (if available) until one
+    * of the 2 criteria is fulfilled.
+    */
+  virtual std::list<std::unique_ptr<RetrieveJob>> getNextJobBatch(uint64_t filesRequested,
+    uint64_t bytesRequested, log::LogContext &logContext);
 
+  /**
+    * Requeues a batch of jobs in their respective queues
+    * @param jobs The job batch
+    * @param logContext
+    */
+  virtual void requeueJobBatch(std::vector<std::unique_ptr<cta::RetrieveJob>> &jobs, log::LogContext &logContext);
 
-    /**
-     * Reserves space in the disk space buffer to the drive of this mount
-     * @param request the disk space reservation request
-     * @param logContext
-     */
-    virtual bool reserveDiskSpace(const cta::DiskSpaceReservationRequest &request, log::LogContext& logContext);
+  /**
+    * Puts the queue associated to this retrieve mount to sleep
+    */
+  virtual void putQueueToSleep(const std::string &diskSystemName, const uint64_t sleepTime, log::LogContext &logContext);
 
-    /**
-     * Performs the disk space reservation logic for the request and mount, but does not reserve space in the catalogue
-     * @param request the disk space reservation request
-     * @param logContext
-     */
-    virtual bool testReserveDiskSpace(const cta::DiskSpaceReservationRequest &request, log::LogContext& logContext);
 
+  /**
+    * Reserves space in the disk space buffer to the drive of this mount
+    * @param request the disk space reservation request
+    * @param logContext
+    */
+  virtual bool reserveDiskSpace(const cta::DiskSpaceReservationRequest &request, log::LogContext& logContext);
 
-    /**
-     * Wait and complete reporting of a batch of jobs successes. The per jobs handling has
-     * already been launched in the background using cta::RetrieveJob::asyncComplete().
-     * This function will check completion of those async completes and then proceed
-     * with any necessary common handling.
-     *
-     * @param successfulRetrieveJobs the jobs to report
-     * @param logContext
-     */
-    virtual void flushAsyncSuccessReports(std::queue<std::unique_ptr<cta::RetrieveJob> > & successfulRetrieveJobs, cta::log::LogContext &logContext);
+  /**
+    * Performs the disk space reservation logic for the request and mount, but does not reserve space in the catalogue
+    * @param request the disk space reservation request
+    * @param logContext
+    */
+  virtual bool testReserveDiskSpace(const cta::DiskSpaceReservationRequest &request, log::LogContext& logContext);
 
 
-    /**
-     * Creates a disk reporter for the retrieve job (this is a wrapper).
-     * @param URL: report address
-     * @return pointer to the reporter created.
-     */
-    disk::DiskReporter * createDiskReporter(std::string & URL);
+  /**
+    * Wait and complete reporting of a batch of jobs successes. The per jobs handling has
+    * already been launched in the background using cta::RetrieveJob::asyncComplete().
+    * This function will check completion of those async completes and then proceed
+    * with any necessary common handling.
+    *
+    * @param successfulRetrieveJobs the jobs to report
+    * @param logContext
+    */
+  virtual void flushAsyncSuccessReports(std::queue<std::unique_ptr<cta::RetrieveJob> > & successfulRetrieveJobs, cta::log::LogContext &logContext);
 
-    void setExternalFreeDiskSpaceScript(const std::string& name);
 
-    /**
-     * Adds a disk system to the list of disk systems to skip for this mount
-     * @param diskSystem The disk system
-     */
-    virtual void addDiskSystemToSkip(const cta::SchedulerDatabase::RetrieveMount::DiskSystemToSkip &diskSystem);
+  /**
+    * Creates a disk reporter for the retrieve job (this is a wrapper).
+    * @param URL: report address
+    * @return pointer to the reporter created.
+    */
+  disk::DiskReporter * createDiskReporter(std::string & URL);
 
-    /**
-     * Destructor.
-     */
-    virtual ~RetrieveMount() noexcept;
+  void setExternalFreeDiskSpaceScript(const std::string& name);
 
-  private:
+  /**
+    * Adds a disk system to the list of disk systems to skip for this mount
+    * @param diskSystem The disk system
+    */
+  virtual void addDiskSystemToSkip(const cta::SchedulerDatabase::RetrieveMount::DiskSystemToSkip &diskSystem);
 
-    /**
-     * The database representation of this mount.
-     */
-    std::unique_ptr<cta::SchedulerDatabase::RetrieveMount> m_dbMount;
+  /**
+    * Destructor.
+    */
+  virtual ~RetrieveMount() noexcept;
 
-    /**
-     * Internal tracking of the session completion
-     */
-    bool m_sessionRunning;
+private:
+  /**
+    * The database representation of this mount.
+    */
+  std::unique_ptr<cta::SchedulerDatabase::RetrieveMount> m_dbMount;
 
-    /**
-     * Internal tracking of the tape thread
-     */
-    bool m_tapeRunning;
+  /**
+    * Internal tracking of the session completion
+    */
+  bool m_sessionRunning;
 
-    /**
-     * Internal tracking of the disk thread
-     */
-    bool m_diskRunning;
+  /**
+    * Internal tracking of the tape thread
+    */
+  bool m_tapeRunning;
 
-    /** An initialized-once factory for archive reports (indirectly used by ArchiveJobs) */
-    disk::DiskReporterFactory m_reporterFactory;
+  /**
+    * Internal tracking of the disk thread
+    */
+  bool m_diskRunning;
 
-    /**
-     * Internal tracking of the full disk systems. It is one strike out (for the mount duration).
-     */
-    std::set<std::string> m_fullDiskSystems;
+  /** An initialized-once factory for archive reports (indirectly used by ArchiveJobs) */
+  disk::DiskReporterFactory m_reporterFactory;
 
-    /**
-     * A pointer to the file catalogue.
-     */
-    cta::catalogue::Catalogue &m_catalogue;
+  /**
+    * Internal tracking of the full disk systems. It is one strike out (for the mount duration).
+    */
+  std::set<std::string> m_fullDiskSystems;
 
-    /**
-     * The name of the script that will be executed
-     * to get the free disk space in the Retrieve space
-     */
-    std::string m_externalFreeDiskSpaceScript;
+  /**
+    * A pointer to the file catalogue.
+    */
+  cta::catalogue::Catalogue &m_catalogue;
 
-  }; // class RetrieveMount
+  /**
+    * The name of the script that will be executed
+    * to get the free disk space in the Retrieve space
+    */
+  std::string m_externalFreeDiskSpaceScript;
+};  // class RetrieveMount
 
-} // namespace cta
+}  // namespace cta
diff --git a/scheduler/Scheduler.cpp b/scheduler/Scheduler.cpp
index 133c180117dbec60a666b61b9c6048dea2a687b6..bdd26b496a2c9acfeb80554adf21500e8651dbfd 100644
--- a/scheduler/Scheduler.cpp
+++ b/scheduler/Scheduler.cpp
@@ -15,8 +15,27 @@
  *               submit itself to any jurisdiction.
  */
 
-#include "ArchiveMount.hpp"
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <time.h>
+#include <unistd.h>
+
+#include <algorithm>
+#include <chrono>
+#include <cstdlib>
+#include <iomanip>
+#include <iostream>
+#include <random>
+#include <sstream>
+
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/CatalogueItor.hpp"
+#include "catalogue/DriveConfig.hpp"
+#include "catalogue/TapeDrivesCatalogueState.hpp"
+#include "catalogue/TapePool.hpp"
+#include "common/dataStructures/ArchiveFileQueueCriteria.hpp"
 #include "common/dataStructures/ArchiveFileQueueCriteriaAndFileId.hpp"
+#include "common/dataStructures/LogicalLibrary.hpp"
 #include "common/exception/NonRetryableError.hpp"
 #include "common/exception/NoSuchObject.hpp"
 #include "common/exception/UserError.hpp"
@@ -24,24 +43,11 @@
 #include "common/utils/utils.hpp"
 #include "disk/DiskFileImplementations.hpp"
 #include "disk/RadosStriperPool.hpp"
-#include "DiskReportRunner.hpp"
-#include "RetrieveMount.hpp"
-#include "RetrieveRequestDump.hpp"
-#include "Scheduler.hpp"
-#include "catalogue/TapeDrivesCatalogueState.hpp"
-#include "catalogue/DriveConfig.hpp"
-
-#include <iostream>
-#include <sstream>
-#include <iomanip>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <algorithm>
-#include <random>
-#include <chrono>
-#include <cstdlib>
-#include <time.h>
+#include "scheduler/ArchiveMount.hpp"
+#include "scheduler/DiskReportRunner.hpp"
+#include "scheduler/RetrieveMount.hpp"
+#include "scheduler/RetrieveRequestDump.hpp"
+#include "scheduler/Scheduler.hpp"
 
 namespace cta {
 
diff --git a/scheduler/Scheduler.hpp b/scheduler/Scheduler.hpp
index 94cbc3ebb1b135d1085fd16d12ce763aac8f6b95..769367c067eb367305275c917b300fbb7a806dd7 100644
--- a/scheduler/Scheduler.hpp
+++ b/scheduler/Scheduler.hpp
@@ -17,7 +17,13 @@
 
 #pragma once
 
-#include "catalogue/Catalogue.hpp"
+#include <list>
+#include <map>
+#include <memory>
+#include <set>
+#include <string>
+#include <utility>
+
 #include "catalogue/TapeDrivesCatalogueState.hpp"
 
 #include "common/dataStructures/ArchiveFile.hpp"
@@ -28,6 +34,7 @@
 #include "common/dataStructures/DriveInfo.hpp"
 #include "common/dataStructures/DriveState.hpp"
 #include "common/dataStructures/ListStorageClassRequest.hpp"
+#include "common/dataStructures/QueueAndMountSummary.hpp"
 #include "common/dataStructures/ReadTestResult.hpp"
 #include "common/dataStructures/RepackInfo.hpp"
 #include "common/dataStructures/RetrieveJob.hpp"
@@ -37,33 +44,35 @@
 #include "common/dataStructures/TestSourceType.hpp"
 #include "common/dataStructures/UpdateFileStorageClassRequest.hpp"
 #include "common/dataStructures/WriteTestResult.hpp"
-#include "common/dataStructures/QueueAndMountSummary.hpp"
 #include "common/Timer.hpp"
 
+#include "disk/DiskFile.hpp"
+#include "disk/DiskReporter.hpp"
+#include "disk/DiskReporterFactory.hpp"
+
 #include "common/exception/Exception.hpp"
 #include "common/log/LogContext.hpp"
 #include "common/log/TimingList.hpp"
-#include "scheduler/TapeMount.hpp"
-#include "scheduler/SchedulerDatabase.hpp"
 #include "scheduler/RepackRequest.hpp"
+#include "scheduler/SchedulerDatabase.hpp"
+#include "scheduler/TapeMount.hpp"
 
 #include "tapeserver/daemon/TapedConfiguration.hpp"
 
-#include "disk/DiskFile.hpp"
-#include "disk/DiskReporter.hpp"
-#include "disk/DiskReporterFactory.hpp"
-
-#include <list>
-#include <map>
-#include <memory>
-#include <stdint.h>
-#include <string>
-
 namespace cta {
 
+namespace catalogue {
+class Catalogue;
+}
+
 class ArchiveJob;
 class RetrieveJob;
 
+namespace common {
+namespace dataStructures {
+struct LogicalLibrary;
+}
+}
 /**
  * Class implementing a tape resource scheduler. This class is the main entry point
  * for most of the operations on both the tape file catalogue and the object store for
@@ -75,16 +84,14 @@ class RetrieveJob;
 CTA_GENERATE_EXCEPTION_CLASS(ExpandRepackRequestException);
 
 class Scheduler {
-
 public:
-
   /**
    * Constructor.
    */
   Scheduler(
     cta::catalogue::Catalogue &catalogue,
     SchedulerDatabase &db, const uint64_t minFilesToWarrantAMount, const uint64_t minBytesToWarrantAMount);
-    //TODO: we have out the mount policy parameters here temporarily we will remove them once we know where to put them
+    // TODO: we have out the mount policy parameters here temporarily we will remove them once we know where to put them
 
   /**
    * Destructor.
@@ -262,7 +269,6 @@ public:
 
   /*============== Actual mount scheduling and queue status reporting ========*/
 private:
-
   typedef std::pair<std::string, common::dataStructures::MountType> TapePoolMountPair;
   typedef std::pair<std::string, common::dataStructures::MountType> VirtualOrganizationMountPair;
 
@@ -419,7 +425,6 @@ public:
   cta::catalogue::Catalogue & getCatalogue();
 
 private:
-
   /**
    * The catalogue.
    */
@@ -434,6 +439,6 @@ private:
   const uint64_t m_minBytesToWarrantAMount;
 
   std::unique_ptr<TapeDrivesCatalogueState> m_tapeDrivesState;
-}; // class Scheduler
+};  // class Scheduler
 
-} // namespace cta
+}  // namespace cta
diff --git a/scheduler/SchedulerDatabaseFactory.hpp b/scheduler/SchedulerDatabaseFactory.hpp
index d47f3919a5e28bdc072f53d7703d04115fb99e32..59e387c317550531fc4e18e3e28f4ce9a8788be6 100644
--- a/scheduler/SchedulerDatabaseFactory.hpp
+++ b/scheduler/SchedulerDatabaseFactory.hpp
@@ -17,21 +17,28 @@
 
 #pragma once
 
+#include <list>
+#include <map>
 #include <memory>
+#include <set>
+#include <string>
+
 #include "scheduler/SchedulerDatabase.hpp"
 #include "common/dataStructures/SecurityIdentity.hpp"
 #include "scheduler/RetrieveRequestDump.hpp"
-#include "catalogue/Catalogue.hpp"
 
 namespace cta {
 
+namespace catalogue {
+class Catalogue;
+}
+
 /**
  * Asbtract class specifying the interface to a factory of scheduler database
  * objects.
  */
 class SchedulerDatabaseFactory {
 public:
-
   /**
    * Destructor.
    */
@@ -43,8 +50,7 @@ public:
    * @return A newly created scheduler database object.
    */
   virtual std::unique_ptr<SchedulerDatabase> create(std::unique_ptr<cta::catalogue::Catalogue>& catalogue) const = 0;
-
-}; // class SchedulerDatabaseFactory
+};  // class SchedulerDatabaseFactory
 
 /**
  * Base of a wrapper class. This follows the decorator structural pattern. Wrappers are used by
@@ -53,8 +59,7 @@ public:
  */
 class SchedulerDatabaseDecorator : public SchedulerDatabase {
 public:
-
-  SchedulerDatabaseDecorator(SchedulerDatabase &db) : m_SchedDB(&db) { }
+  explicit SchedulerDatabaseDecorator(SchedulerDatabase &db) : m_SchedDB(&db) { }
 
   void waitSubthreadsComplete() override {
     m_SchedDB->waitSubthreadsComplete();
@@ -173,7 +178,7 @@ public:
   }
 
   std::unique_ptr<TapeMountDecisionInfo> getMountInfoNoLock(PurposeGetMountInfo purpose, log::LogContext& logContext) override {
-    return m_SchedDB->getMountInfoNoLock(purpose,logContext);
+    return m_SchedDB->getMountInfoNoLock(purpose, logContext);
   }
 
   std::list<RetrieveQueueStatistics> getRetrieveQueueStatistics(const cta::common::dataStructures::RetrieveFileQueueCriteria& criteria,
@@ -188,7 +193,7 @@ public:
   }
 
   void cancelArchive(const common::dataStructures::DeleteArchiveRequest& request, log::LogContext & lc) override {
-    m_SchedDB->cancelArchive(request,lc);
+    m_SchedDB->cancelArchive(request, lc);
   }
 
   void cancelRetrieve(const std::string& instanceName, const cta::common::dataStructures::CancelRetrieveRequest& rqst,
@@ -234,7 +239,6 @@ public:
 
 protected:
   cta::SchedulerDatabase *m_SchedDB;
+};  // class SchedulerDatabaseDecorator
 
-}; // class SchedulerDatabaseDecorator
-
-} // namespace cta
+}  // namespace cta
diff --git a/scheduler/SchedulerDatabaseTest.cpp b/scheduler/SchedulerDatabaseTest.cpp
index 37fd6df6ed70d0030c0257c6d81fab9d7ce7ce3a..d61ddb797bd4970bf4953070ba0d46c62ab901bf 100644
--- a/scheduler/SchedulerDatabaseTest.cpp
+++ b/scheduler/SchedulerDatabaseTest.cpp
@@ -15,12 +15,20 @@
  *               submit itself to any jurisdiction.
  */
 
-#include "tests/TestsCompileTimeSwitches.hpp"
-#include "scheduler/SchedulerDatabase.hpp"
-#include "scheduler/SchedulerDatabaseFactory.hpp"
-#include "common/dataStructures/SecurityIdentity.hpp"
+#include <gtest/gtest.h>
+#include <uuid/uuid.h>
+
+#include <algorithm>
+#include <exception>
+#include <future>
+
+#include "catalogue/DummyCatalogue.hpp"
 #include "catalogue/InMemoryCatalogue.hpp"
+#include "common/dataStructures/SecurityIdentity.hpp"
 #include "common/log/DummyLogger.hpp"
+#include "scheduler/SchedulerDatabase.hpp"
+#include "scheduler/SchedulerDatabaseFactory.hpp"
+#include "tests/TestsCompileTimeSwitches.hpp"
 
 #ifdef CTA_PGSCHED
 #include "scheduler/PostgresSchedDB/PostgresSchedDBFactory.hpp"
@@ -34,12 +42,6 @@
 #include "common/log/StdoutLogger.hpp"
 #endif
 
-#include <exception>
-#include <gtest/gtest.h>
-#include <algorithm>
-#include <uuid/uuid.h>
-#include <future>
-
 namespace unitTests {
 
 const uint32_t DISK_FILE_OWNER_UID = 9751;
diff --git a/scheduler/SchedulerTest.cpp b/scheduler/SchedulerTest.cpp
index 647737d9a75fbec3c03d103d47b9b0ca32788773..455872aedd8416d9dcc4a858321d17e3c4a33409 100644
--- a/scheduler/SchedulerTest.cpp
+++ b/scheduler/SchedulerTest.cpp
@@ -22,9 +22,16 @@
 #include <memory>
 #include <utility>
 
+#include "catalogue/CreateMountPolicyAttributes.hpp"
+#include "catalogue/CreateTapeAttributes.hpp"
 #include "catalogue/InMemoryCatalogue.hpp"
+#include "catalogue/MediaType.hpp"
 #include "catalogue/SchemaCreatingSqliteCatalogue.hpp"
+#include "catalogue/TapeItemWrittenPointer.hpp"
+#include "common/dataStructures/DiskInstance.hpp"
 #include "common/dataStructures/JobQueueType.hpp"
+#include "common/dataStructures/LogicalLibrary.hpp"
+#include "common/dataStructures/RequesterMountRule.hpp"
 #include "common/exception/NoSuchObject.hpp"
 #include "common/log/DummyLogger.hpp"
 #include "common/Timer.hpp"
diff --git a/scheduler/testingMocks/MockRetrieveMount.hpp b/scheduler/testingMocks/MockRetrieveMount.hpp
index 2352134e5417c98cc073e32da934ae019aab7846..f8f58107e27cd553a3058d5bc8b16e7830d3a379 100644
--- a/scheduler/testingMocks/MockRetrieveMount.hpp
+++ b/scheduler/testingMocks/MockRetrieveMount.hpp
@@ -17,13 +17,24 @@
 
 #pragma once
 
-#include "catalogue/DummyCatalogue.hpp"
+#include <list>
+#include <memory>
+#include <queue>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+
 #include "scheduler/RetrieveJob.hpp"
 #include "scheduler/RetrieveMount.hpp"
 #include "scheduler/testingMocks/MockRetrieveJob.hpp"
-#include <memory>
 
 namespace cta {
+
+namespace catalogue {
+class Catalogue;
+}
+
 class MockRetrieveMount : public cta::RetrieveMount {
 public:
   int getJobs;
diff --git a/tapeserver/castor/tape/tapeserver/RAO/ConfigurableRAOAlgorithmFactory.hpp b/tapeserver/castor/tape/tapeserver/RAO/ConfigurableRAOAlgorithmFactory.hpp
index 319ce9f33c43c079f704491f140b20c9c6075d74..0bfb112bb122c1ad86a28282597a1e74ccff37ed 100644
--- a/tapeserver/castor/tape/tapeserver/RAO/ConfigurableRAOAlgorithmFactory.hpp
+++ b/tapeserver/castor/tape/tapeserver/RAO/ConfigurableRAOAlgorithmFactory.hpp
@@ -17,10 +17,17 @@
 
 #pragma once
 
-#include "RAOParams.hpp"
-#include "RAOAlgorithmFactory.hpp"
+#include <memory>
+
+#include "tapeserver/castor/tape/tapeserver/RAO/RAOParams.hpp"
+#include "tapeserver/castor/tape/tapeserver/RAO/RAOAlgorithmFactory.hpp"
 #include "castor/tape/tapeserver/drive/DriveInterface.hpp"
-#include "catalogue/Catalogue.hpp"
+
+namespace cta {
+namespace catalogue {
+class Catalogue;
+}
+}
 
 namespace castor { namespace tape { namespace tapeserver { namespace rao {
 
@@ -30,44 +37,43 @@ namespace castor { namespace tape { namespace tapeserver { namespace rao {
  */
 class ConfigurableRAOAlgorithmFactory : public RAOAlgorithmFactory{
 public:
+/**
+  * Instanciates a configurable RAO algorithm
+  * @return a unique_ptr to a configurable RAO algorithm
+  */
+std::unique_ptr<RAOAlgorithm> createRAOAlgorithm() override;
+virtual ~ConfigurableRAOAlgorithmFactory();
 
   /**
-   * Instanciates a configurable RAO algorithm
-   * @return a unique_ptr to a configurable RAO algorithm
-   */
-  std::unique_ptr<RAOAlgorithm> createRAOAlgorithm() override;
-  virtual ~ConfigurableRAOAlgorithmFactory();
-  
-  /**
-   * Builder class to build the ConfigurableRAOAlgorithmFactory
-   * @param raoParams the parameters of the Configurable RAOAlgorithm that will be instanciated by this factory
-   */
+    * Builder class to build the ConfigurableRAOAlgorithmFactory
+    * @param raoParams the parameters of the Configurable RAOAlgorithm that will be instanciated by this factory
+    */
   class Builder {
   public:
-    Builder(const RAOParams & raoParams);
+    explicit Builder(const RAOParams & raoParams);
     /**
-     * If the factory need to talk to the drive before instanciating
-     * the RAOAlgorithm, the drive interface should be given by using this method.
-     * @param drive the drive interface to talk to the drive if necessary
-     */
+      * If the factory need to talk to the drive before instanciating
+      * the RAOAlgorithm, the drive interface should be given by using this method.
+      * @param drive the drive interface to talk to the drive if necessary
+      */
     void setDriveInterface(drive::DriveInterface * drive);
     /**
-     * If the factory need to talk to the catalogue before instanciating the RAOAlgorithm,
-     * the catalogue should be given by using this method
-     * @param catalogue the catalogue to talk to it 
-     */
+      * If the factory need to talk to the catalogue before instanciating the RAOAlgorithm,
+      * the catalogue should be given by using this method
+      * @param catalogue the catalogue to talk to it 
+      */
     void setCatalogue(cta::catalogue::Catalogue * catalogue);
     /**
-     * Returns the unique pointer to instance of a ConfigurableRAOAlgorithmFactory
-     * @return the unique pointer to instance of a ConfigurableRAOAlgorithmFactory
-     */
+      * Returns the unique pointer to instance of a ConfigurableRAOAlgorithmFactory
+      * @return the unique pointer to instance of a ConfigurableRAOAlgorithmFactory
+      */
     std::unique_ptr<ConfigurableRAOAlgorithmFactory> build();
   private:
     std::unique_ptr<ConfigurableRAOAlgorithmFactory> m_configurableRAOAlgoFactory;
   };
-  
+
 private:
-  ConfigurableRAOAlgorithmFactory(const RAOParams & raoParams);
+  explicit ConfigurableRAOAlgorithmFactory(const RAOParams & raoParams);
   drive::DriveInterface * m_drive = nullptr;
   cta::catalogue::Catalogue * m_catalogue = nullptr;
   RAOParams m_raoParams;
diff --git a/tapeserver/castor/tape/tapeserver/RAO/FilePositionEstimatorFactory.cpp b/tapeserver/castor/tape/tapeserver/RAO/FilePositionEstimatorFactory.cpp
index 64f667aad48ae7aa84e51f6c69bc8195fd9ad554..39c203515ddf280122fcecb2bbcfe47ac4932671 100644
--- a/tapeserver/castor/tape/tapeserver/RAO/FilePositionEstimatorFactory.cpp
+++ b/tapeserver/castor/tape/tapeserver/RAO/FilePositionEstimatorFactory.cpp
@@ -15,10 +15,11 @@
  *               submit itself to any jurisdiction.
  */
 
-#include "FilePositionEstimatorFactory.hpp"
+#include "catalogue/Catalogue.hpp"
 #include "common/Timer.hpp"
-#include "RAOHelpers.hpp"
+#include "FilePositionEstimatorFactory.hpp"
 #include "InterpolationFilePositionEstimator.hpp"
+#include "RAOHelpers.hpp"
 
 namespace castor { namespace tape { namespace tapeserver { namespace rao {
 
diff --git a/tapeserver/castor/tape/tapeserver/RAO/FilePositionEstimatorFactory.hpp b/tapeserver/castor/tape/tapeserver/RAO/FilePositionEstimatorFactory.hpp
index be6ac5cedc3f2c659526a104ea5781e3e9811e60..06f80cc051bc21928fbd039e3c02217ea53d2ae8 100644
--- a/tapeserver/castor/tape/tapeserver/RAO/FilePositionEstimatorFactory.hpp
+++ b/tapeserver/castor/tape/tapeserver/RAO/FilePositionEstimatorFactory.hpp
@@ -17,10 +17,19 @@
 
 #pragma once
 
-#include "catalogue/Catalogue.hpp"
+#include <memory>
+#include <string>
+#include <vector>
+
 #include "castor/tape/tapeserver/drive/DriveInterface.hpp"
-#include "FilePositionEstimator.hpp"
 #include "common/log/TimingList.hpp"
+#include "tapeserver/castor/tape/tapeserver/RAO/FilePositionEstimator.hpp"
+
+namespace cta {
+namespace catalogue {
+class Catalogue;
+}
+}
 
 namespace castor { namespace tape { namespace tapeserver { namespace rao {
 
diff --git a/tapeserver/castor/tape/tapeserver/RAO/RAOParams.hpp b/tapeserver/castor/tape/tapeserver/RAO/RAOParams.hpp
index 76153007f60d181299d246deb01cbebe9a57e2e9..da2343b6ce87245e53596b8cba52107aea7ec7a2 100644
--- a/tapeserver/castor/tape/tapeserver/RAO/RAOParams.hpp
+++ b/tapeserver/castor/tape/tapeserver/RAO/RAOParams.hpp
@@ -16,106 +16,103 @@
  */
 
 #pragma once
-#include <string>
-#include "tapeserver/castor/tape/tapeserver/daemon/DataTransferConfig.hpp"
-#include "tapeserver/castor/tape/tapeserver/SCSI/Structures.hpp"
+
+#include <map>
 #include <memory>
-#include <common/log/LogContext.hpp>
+#include <string>
 #include <vector>
-#include "catalogue/Catalogue.hpp"
-#include "RAOOptions.hpp"
+
+#include "tapeserver/castor/tape/tapeserver/RAO/RAOOptions.hpp"
 
 namespace castor { namespace tape { namespace tapeserver { namespace rao {
-  
+
+/**
+  * This class contains the configuration of the CTA RAO Algorithm
+  */
+class RAOParams{
+public:
   /**
-   * This class contains the configuration of the CTA RAO Algorithm
-   */
-  class RAOParams{
-  public:
-    /**
-     * This enum represent the RAO algorithm type implemented
-     * by CTA
-     */
-    enum RAOAlgorithmType {
-      linear,
-      random,
-      //Short Locate Time First
-      sltf
-    };
-    
-    /**
-     * Default constructor, sets useRAO to false
-     */
-    RAOParams();
-    
-    /**
-     * Construct an RAOParams object
-     * @param useRAO if set to true, the RAO will be enabled. If false, not enabled.
-     * @param raoAlgorithmName the RAO algorithm that will be executed when called
-     * @param raoAlgorithmOptions the options that could be passed to the RAO algorithm
-     * @param vid the vid of the tape that is currently mounted for retrieval
-     */
-    RAOParams(const bool useRAO, const std::string & raoAlgorithmName, const std::string & raoAlgorithmOptions, const std::string & vid);
-    
-    /**
-     * Copy constructor
-     */
-    RAOParams(const RAOParams & other);
-    
-    /**
-     * Operator =
-     */
-    RAOParams & operator=(const RAOParams & other);
-    
-    /**
-     * Returns true if RAO has to be used, false otherwise
-     */
-    bool useRAO() const;
-    
-    /**
-     * Returns the RAO algorithm name of this RAO data instance
-     */
-    std::string getRAOAlgorithmName() const;
-    
-    /**
-     * Returns the RAO algorithm options of this RAO data instance
-     */
-    RAOOptions getRAOAlgorithmOptions() const;
-    
-    /**
-     * Disable RAO of this configuration
-     */
-    void disableRAO();
-    
-    /**
-     * Returns RAOAlgorithmType object corresopnding to this configration's raoAlgorithmName
-     * @return the RAOAlgorithmType object corresopnding to this configration raoAlgorithmName
-     * @throws cta::exception::Exception in case the algorithm name does not match any RAOAlgorithmType
-     */
-    RAOAlgorithmType getAlgorithmType() const;
-    
-    /**
-     * Returns the CTA RAO algorithm names that can be used
-     */
-    std::string getCTARAOAlgorithmNameAvailable() const;
-    
-    /**
-     * Returns the vid of the tape that is mounted for retrieval
-     */
-    std::string getMountedVid() const;
-    
-  private:
-    bool m_useRAO = false;
-    std::string m_raoAlgorithmName;
-    RAOOptions m_raoAlgorithmOptions;
-    std::string m_vid;
-    
-    
-    /**
-     * Static map in order to match the string representing an algorithm name and its enum type
-     */
-    static const std::map<std::string, RAOAlgorithmType> c_raoAlgoStringTypeMap;
+    * This enum represent the RAO algorithm type implemented
+    * by CTA
+    */
+  enum RAOAlgorithmType {
+    linear,
+    random,
+    // Short Locate Time First
+    sltf
   };
-  
-  
+
+  /**
+    * Default constructor, sets useRAO to false
+    */
+  RAOParams();
+
+  /**
+    * Construct an RAOParams object
+    * @param useRAO if set to true, the RAO will be enabled. If false, not enabled.
+    * @param raoAlgorithmName the RAO algorithm that will be executed when called
+    * @param raoAlgorithmOptions the options that could be passed to the RAO algorithm
+    * @param vid the vid of the tape that is currently mounted for retrieval
+    */
+  RAOParams(const bool useRAO, const std::string & raoAlgorithmName, const std::string & raoAlgorithmOptions, const std::string & vid);
+
+  /**
+    * Copy constructor
+    */
+  RAOParams(const RAOParams & other);
+
+  /**
+    * Operator =
+    */
+  RAOParams & operator=(const RAOParams & other);
+
+  /**
+    * Returns true if RAO has to be used, false otherwise
+    */
+  bool useRAO() const;
+
+  /**
+    * Returns the RAO algorithm name of this RAO data instance
+    */
+  std::string getRAOAlgorithmName() const;
+
+  /**
+    * Returns the RAO algorithm options of this RAO data instance
+    */
+  RAOOptions getRAOAlgorithmOptions() const;
+
+  /**
+    * Disable RAO of this configuration
+    */
+  void disableRAO();
+
+  /**
+    * Returns RAOAlgorithmType object corresopnding to this configration's raoAlgorithmName
+    * @return the RAOAlgorithmType object corresopnding to this configration raoAlgorithmName
+    * @throws cta::exception::Exception in case the algorithm name does not match any RAOAlgorithmType
+    */
+  RAOAlgorithmType getAlgorithmType() const;
+
+  /**
+    * Returns the CTA RAO algorithm names that can be used
+    */
+  std::string getCTARAOAlgorithmNameAvailable() const;
+
+  /**
+    * Returns the vid of the tape that is mounted for retrieval
+    */
+  std::string getMountedVid() const;
+
+private:
+  bool m_useRAO = false;
+  std::string m_raoAlgorithmName;
+  RAOOptions m_raoAlgorithmOptions;
+  std::string m_vid;
+
+  /**
+    * Static map in order to match the string representing an algorithm name and its enum type
+    */
+  static const std::map<std::string, RAOAlgorithmType> c_raoAlgoStringTypeMap;
+};
+
 }}}}
\ No newline at end of file
diff --git a/tapeserver/castor/tape/tapeserver/RAO/RandomRAOAlgorithm.cpp b/tapeserver/castor/tape/tapeserver/RAO/RandomRAOAlgorithm.cpp
index a98bffadb39b836845ea7809e6b1e5073708ccfe..e0e926ad8dfac6c1a0097cd17d90b86380dc4457 100644
--- a/tapeserver/castor/tape/tapeserver/RAO/RandomRAOAlgorithm.cpp
+++ b/tapeserver/castor/tape/tapeserver/RAO/RandomRAOAlgorithm.cpp
@@ -15,10 +15,15 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <memory>
 #include <numeric>
+#include <string>
+#include <vector>
 
-#include "RandomRAOAlgorithm.hpp"
 #include "common/Timer.hpp"
+#include "tapeserver/castor/tape/tapeserver/RAO/RandomRAOAlgorithm.hpp"
+#include "tapeserver/castor/tape/tapeserver/SCSI/Structures.hpp"
+
 
 namespace castor { namespace tape { namespace tapeserver { namespace rao {
 
@@ -28,9 +33,9 @@ RandomRAOAlgorithm::RandomRAOAlgorithm() {
 std::vector<uint64_t> RandomRAOAlgorithm::performRAO(const std::vector<std::unique_ptr<cta::RetrieveJob> >& jobs) {
   std::vector<uint64_t> raoIndices(jobs.size());
   cta::utils::Timer totalTimer;
-  std::iota(raoIndices.begin(),raoIndices.end(),0);
+  std::iota(raoIndices.begin(), raoIndices.end(), 0);
   std::random_shuffle(raoIndices.begin(), raoIndices.end());
-  m_raoTimings.insertAndReset("RAOAlgorithmTime",totalTimer);
+  m_raoTimings.insertAndReset("RAOAlgorithmTime", totalTimer);
   return raoIndices;
 }
 
diff --git a/tapeserver/castor/tape/tapeserver/daemon/CleanerSession.hpp b/tapeserver/castor/tape/tapeserver/daemon/CleanerSession.hpp
index 7cb05873a1569c00b6a12c24e7fda75bb0137fb1..7c4dbc90b37c6a541c7f04196312584ef078b4ad 100644
--- a/tapeserver/castor/tape/tapeserver/daemon/CleanerSession.hpp
+++ b/tapeserver/castor/tape/tapeserver/daemon/CleanerSession.hpp
@@ -20,7 +20,6 @@
 #include <memory>
 #include <string>
 
-#include "catalogue/Catalogue.hpp"
 #include "common/log/LogContext.hpp"
 #include "common/log/Logger.hpp"
 #include "common/processCap/ProcessCap.hpp"
@@ -33,6 +32,12 @@
 #include "tapeserver/castor/tape/tapeserver/SCSI/Device.hpp"
 #include "tapeserver/daemon/TpconfigLine.hpp"
 
+namespace cta {
+namespace catalogue {
+class Catalogue;
+}
+}
+
 namespace castor {
 namespace tape {
 namespace tapeserver {
diff --git a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp
index ce1d6dec90966e9dee28390474d439a4d4afe102..017bc5933cea553921a69e3cb28f625f770fcf13 100644
--- a/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp
+++ b/tapeserver/castor/tape/tapeserver/daemon/DataTransferSessionTest.cpp
@@ -15,13 +15,23 @@
  *               submit itself to any jurisdiction.
  */
 
-#define __STDC_CONSTANT_MACROS // For using stdint macros (stdint is included
+#define __STDC_CONSTANT_MACROS  // For using stdint macros (stdint is included
 // by inttypes.h, so we shoot first)
-#include <stdint.h>
-#include <inttypes.h>
+#include <dirent.h>
+#include <fcntl.h>
 #include <gtest/gtest.h>
+#include <inttypes.h>
+#include <stdint.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <zlib.h>
+
+#include <stdexcept>
 
 #include "castor/messages/TapeserverProxyDummy.hpp"
+#include "castor/tape/tapeserver/daemon/CleanerSession.hpp"
 #include "castor/tape/tapeserver/daemon/DataTransferSession.hpp"
 #include "castor/tape/tapeserver/daemon/VolumeInfo.hpp"
 #include "castor/tape/tapeserver/drive/FakeDrive.hpp"
@@ -30,12 +40,19 @@
 #include "castor/tape/tapeserver/file/LabelSession.hpp"
 #include "castor/tape/tapeserver/file/WriteSession.hpp"
 #include "castor/tape/tapeserver/system/Wrapper.hpp"
+#include "catalogue/CatalogueItor.hpp"
+#include "catalogue/CreateMountPolicyAttributes.hpp"
+#include "catalogue/CreateTapeAttributes.hpp"
 #include "catalogue/InMemoryCatalogue.hpp"
+#include "catalogue/MediaType.hpp"
 #include "catalogue/OracleCatalogue.hpp"
 #include "catalogue/OracleCatalogueSchema.hpp"
+#include "catalogue/TapeItemWrittenPointer.hpp"
+#include "common/dataStructures/DiskInstance.hpp"
+#include "common/dataStructures/LogicalLibrary.hpp"
+#include "common/dataStructures/MountPolicy.hpp"
+#include "common/dataStructures/RequesterMountRule.hpp"
 #include "common/exception/Exception.hpp"
-#include "common/log/DummyLogger.hpp"
-#include "common/log/StdoutLogger.hpp"
 #include "common/log/StringLogger.hpp"
 #include "common/processCap/ProcessCapDummy.hpp"
 #include "common/threading/Thread.hpp"
@@ -43,11 +60,10 @@
 #include "mediachanger/MediaChangerFacade.hpp"
 #include "scheduler/MountType.hpp"
 #include "scheduler/Scheduler.hpp"
-#include "scheduler/testingMocks/MockRetrieveMount.hpp"
 #include "scheduler/testingMocks/MockArchiveJob.hpp"
 #include "scheduler/testingMocks/MockArchiveMount.hpp"
+#include "scheduler/testingMocks/MockRetrieveMount.hpp"
 #include "tests/TempFile.hpp"
-#include "CleanerSession.hpp"
 
 #ifdef CTA_PGSCHED
 #include "scheduler/PostgresSchedDB/PostgresSchedDBFactory.hpp"
@@ -59,19 +75,10 @@
 #ifdef STDOUT_LOGGING
 #include "common/log/StdoutLogger.hpp"
 #else
-
 #include "common/log/DummyLogger.hpp"
-
 #endif
 
-#include <dirent.h>
-#include <fcntl.h>
-#include <stdexcept>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <zlib.h>
+
 
 using namespace castor::tape::tapeserver;
 using namespace castor::tape::tapeserver::daemon;
diff --git a/tapeserver/castor/tape/tapeserver/daemon/DiskWriteTaskTest.cpp b/tapeserver/castor/tape/tapeserver/daemon/DiskWriteTaskTest.cpp
index b35bfa8442a7e9aa809789f0dc667bfd6f6a07af..c8b5bb457c1e132ce28e812575c858d0f90dddcf 100644
--- a/tapeserver/castor/tape/tapeserver/daemon/DiskWriteTaskTest.cpp
+++ b/tapeserver/castor/tape/tapeserver/daemon/DiskWriteTaskTest.cpp
@@ -14,12 +14,16 @@
  *               granted to it by virtue of its status as an Intergovernmental Organization or
  *               submit itself to any jurisdiction.
  */
+#include <gtest/gtest.h>
+
+#include <memory>
 
 #include "castor/tape/tapeserver/daemon/DiskWriteThreadPool.hpp"
 #include "castor/tape/tapeserver/daemon/RecallTaskInjector.hpp"
 #include "castor/tape/tapeserver/daemon/RecallReportPacker.hpp"
 #include "castor/tape/tapeserver/daemon/ReportPackerInterface.hpp"
 #include "common/log/LogContext.hpp"
+#include "catalogue/DummyCatalogue.hpp"
 #include "common/log/StringLogger.hpp"
 #include "castor/tape/tapeserver/daemon/MigrationMemoryManager.hpp"
 #include "castor/tape/tapeserver/daemon/MemBlock.hpp"
@@ -27,12 +31,8 @@
 #include "scheduler/TapeMountDummy.hpp"
 #include "scheduler/SchedulerDatabase.hpp"
 #include "scheduler/Scheduler.hpp"
-#include "scheduler/SchedulerDatabase.hpp"
 #include "scheduler/testingMocks/MockRetrieveMount.hpp"
 
-#include <memory>
-#include <gtest/gtest.h>
-
 namespace unitTests{
   class TestingDatabaseRetrieveMount: public cta::SchedulerDatabase::RetrieveMount {
     const MountInfo & getMountInfo() override { throw std::runtime_error("Not implemented"); }
diff --git a/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp b/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp
index 2c8a34644f1a285ab6c74f0bd9ac89c5f58297db..df1559fb22d32499c542fda001a11b2fa1cae491 100644
--- a/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp
+++ b/tapeserver/castor/tape/tapeserver/daemon/MigrationReportPackerTest.cpp
@@ -15,15 +15,24 @@
  *               submit itself to any jurisdiction.
  */
 
-#include "common/log/DummyLogger.hpp"
-#include "common/log/StringLogger.hpp"
+#include <gtest/gtest.h>
+
 #include "castor/tape/tapeserver/daemon/MigrationReportPacker.hpp"
 #include "castor/tape/tapeserver/drive/DriveInterface.hpp"
+#include <catalogue/Catalogue.hpp>
+#include "catalogue/CatalogueFactory.hpp"
 #include "catalogue/CatalogueFactoryFactory.hpp"
+#include "catalogue/CreateTapeAttributes.hpp"
+#include "catalogue/MediaType.hpp"
+#include "catalogue/TapeFileWritten.hpp"
+#include "catalogue/TapeItemWrittenPointer.hpp"
+#include "common/dataStructures/DiskInstance.hpp"
+#include "common/dataStructures/StorageClass.hpp"
+#include "common/log/DummyLogger.hpp"
+#include "common/log/StringLogger.hpp"
+#include "rdbms/Login.hpp"
 #include "scheduler/testingMocks/MockArchiveMount.hpp"
 
-#include <gtest/gtest.h>
-
 using ::testing::_;
 using ::testing::Invoke;
 using namespace castor::tape;
diff --git a/tapeserver/castor/tape/tapeserver/daemon/RecallReportPackerTest.cpp b/tapeserver/castor/tape/tapeserver/daemon/RecallReportPackerTest.cpp
index 20492b9c518b9ae6b88d5349a640d16668da99e9..a737c1a90cf802e32e6041c8b1d2396b800d3d6e 100644
--- a/tapeserver/castor/tape/tapeserver/daemon/RecallReportPackerTest.cpp
+++ b/tapeserver/castor/tape/tapeserver/daemon/RecallReportPackerTest.cpp
@@ -15,14 +15,15 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
 #include "castor/tape/tapeserver/daemon/RecallReportPacker.hpp"
-#include "common/log/StringLogger.hpp"
+#include "catalogue/DummyCatalogue.hpp"
 #include "common/exception/Exception.hpp"
-#include "scheduler/testingMocks/MockRetrieveMount.hpp"
+#include "common/log/StringLogger.hpp"
 #include "scheduler/testingMocks/MockRetrieveJob.hpp"
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
+#include "scheduler/testingMocks/MockRetrieveMount.hpp"
 
 using ::testing::_;
 using ::testing::Invoke;
diff --git a/tapeserver/castor/tape/tapeserver/daemon/RecallTaskInjectorTest.cpp b/tapeserver/castor/tape/tapeserver/daemon/RecallTaskInjectorTest.cpp
index 293ec5fd8a6572ddce70be08049cadd4839cbd0a..6284bee3ecd9d01ac1dea6e515a92bf88a71e9c7 100644
--- a/tapeserver/castor/tape/tapeserver/daemon/RecallTaskInjectorTest.cpp
+++ b/tapeserver/castor/tape/tapeserver/daemon/RecallTaskInjectorTest.cpp
@@ -15,22 +15,23 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <gtest/gtest.h>
+
 #include "castor/messages/TapeserverProxyDummy.hpp"
 #include "castor/tape/tapeserver/daemon/DiskWriteThreadPool.hpp"
 #include "castor/tape/tapeserver/daemon/RecallTaskInjector.hpp"
-#include "castor/tape/tapeserver/daemon/TapeSessionReporter.hpp"
 #include "castor/tape/tapeserver/daemon/TapeReadSingleThread.hpp"
+#include "castor/tape/tapeserver/daemon/TapeSessionReporter.hpp"
 #include "castor/tape/tapeserver/daemon/TaskWatchDog.hpp"
 #include "castor/tape/tapeserver/drive/FakeDrive.hpp"
+#include "catalogue/DummyCatalogue.hpp"
 #include "common/log/DummyLogger.hpp"
 #include "common/log/StringLogger.hpp"
 #include "common/processCap/ProcessCapDummy.hpp"
 #include "mediachanger/MediaChangerFacade.hpp"
 #include "scheduler/SchedulerDatabase.hpp"
-#include "scheduler/testingMocks/MockRetrieveMount.hpp"
 #include "scheduler/TapeMountDummy.hpp"
-
-#include <gtest/gtest.h>
+#include "scheduler/testingMocks/MockRetrieveMount.hpp"
 
 using namespace castor::tape::tapeserver::daemon;
 using namespace castor::tape;
diff --git a/tapeserver/daemon/DriveHandler.cpp b/tapeserver/daemon/DriveHandler.cpp
index 7a57ee79c01099b9cadf4bc5e6fc92db95615aca..79530d705dfcdb322496f3fa085b7f0cd7cf67fb 100644
--- a/tapeserver/daemon/DriveHandler.cpp
+++ b/tapeserver/daemon/DriveHandler.cpp
@@ -15,29 +15,32 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <unistd.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <sys/prctl.h>
+
+#include <set>
+
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/CatalogueFactory.hpp"
 #include "catalogue/CatalogueFactoryFactory.hpp"
 #include "common/exception/Errnum.hpp"
 #include "common/log/LogContext.hpp"
 #include "common/processCap/ProcessCap.hpp"
-#include "DriveHandler.hpp"
-#include "DriveHandlerProxy.hpp"
 #include "rdbms/Login.hpp"
+#include "tapeserver/castor/tape/tapeserver/daemon/CleanerSession.hpp"
+#include "tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.hpp"
+#include "tapeserver/castor/tape/tapeserver/daemon/Session.hpp"
+#include "tapeserver/daemon/DriveHandler.hpp"
+#include "tapeserver/daemon/DriveHandlerProxy.hpp"
+#include "tapeserver/daemon/WatchdogMessage.pb.h"
 #ifdef CTA_PGSCHED
 #include "scheduler/PostgresSchedDB/PostgresSchedDBInit.hpp"
 #else
 #include "scheduler/OStoreDB/OStoreDBInit.hpp"
 #include "scheduler/OStoreDB/OStoreDBWithAgent.hpp"
 #endif
-#include "tapeserver/castor/tape/tapeserver/daemon/CleanerSession.hpp"
-#include "tapeserver/castor/tape/tapeserver/daemon/DataTransferSession.hpp"
-#include "tapeserver/castor/tape/tapeserver/daemon/Session.hpp"
-#include "tapeserver/daemon/WatchdogMessage.pb.h"
-
-#include <unistd.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include <set>
-#include <sys/prctl.h>
 
 namespace cta {
 namespace tape {
diff --git a/tapeserver/daemon/DriveHandler.hpp b/tapeserver/daemon/DriveHandler.hpp
index 617101e1351b3ce0587689522ed6ae16d028cf7c..200be6dbe430391223db0b74ef93820eeafe018e 100644
--- a/tapeserver/daemon/DriveHandler.hpp
+++ b/tapeserver/daemon/DriveHandler.hpp
@@ -17,18 +17,23 @@
 
 #pragma once
 
-#include "SubprocessHandler.hpp"
-#include "ProcessManager.hpp"
-#include "TapedConfiguration.hpp"
+#include <memory>
+
 #include "common/threading/SocketPair.hpp"
+#include "scheduler/Scheduler.hpp"
+#include "tapeserver/daemon/ProcessManager.hpp"
+#include "tapeserver/daemon/SubprocessHandler.hpp"
+#include "tapeserver/daemon/TapedConfiguration.hpp"
 #include "tapeserver/daemon/WatchdogMessage.pb.h"
 #include "tapeserver/session/SessionState.hpp"
 #include "tapeserver/session/SessionType.hpp"
-#include "catalogue/Catalogue.hpp"
-#include "scheduler/Scheduler.hpp"
-#include <memory>
 
 namespace cta {
+
+namespace catalogue {
+class Catalogue;
+}
+
 namespace tape {
 namespace daemon {
 
diff --git a/tapeserver/daemon/MaintenanceHandler.cpp b/tapeserver/daemon/MaintenanceHandler.cpp
index 04ee94f12358cb4cc34609ec2012fab4105ddce6..e9c97e525bb97aa4a009a2caf74983f2b6f2d449 100644
--- a/tapeserver/daemon/MaintenanceHandler.cpp
+++ b/tapeserver/daemon/MaintenanceHandler.cpp
@@ -15,23 +15,25 @@
  *               submit itself to any jurisdiction.
  */
 
-#include "MaintenanceHandler.hpp"
-#include "common/exception/Errnum.hpp"
+#include <signal.h>
+#include <sys/wait.h>
+#include <sys/prctl.h>
+
 #include "catalogue/Catalogue.hpp"
+#include "catalogue/CatalogueFactory.hpp"
 #include "catalogue/CatalogueFactoryFactory.hpp"
+#include "common/exception/Errnum.hpp"
+#include "rdbms/Login.hpp"
+#include "scheduler/DiskReportRunner.hpp"
+#include "scheduler/RepackRequestManager.hpp"
 #include "scheduler/Scheduler.hpp"
+#include "tapeserver/daemon/MaintenanceHandler.hpp"
+
 #ifdef CTA_PGSCHED
 #include "scheduler/PostgresSchedDB/PostgresSchedDBInit.hpp"
 #else
 #include "scheduler/OStoreDB/OStoreDBInit.hpp"
 #endif
-#include "rdbms/Login.hpp"
-#include "scheduler/DiskReportRunner.hpp"
-#include "scheduler/RepackRequestManager.hpp"
-
-#include <signal.h>
-#include <sys/wait.h>
-#include <sys/prctl.h>
 
 namespace cta { namespace tape { namespace  daemon {
 
diff --git a/tapeserver/readtp/ReadtpCmd.cpp b/tapeserver/readtp/ReadtpCmd.cpp
index b99538d4772fcb94afcd9b334c1ca323f94801a0..778f5bd3f9b9d64b6357bf7034c4508d9ef428e4 100644
--- a/tapeserver/readtp/ReadtpCmd.cpp
+++ b/tapeserver/readtp/ReadtpCmd.cpp
@@ -15,13 +15,18 @@
  *               submit itself to any jurisdiction.
  */
 
+#include "castor/tape/tapeserver/file/FileReaderFactory.hpp"
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/CatalogueFactory.hpp"
+#include "catalogue/CatalogueFactoryFactory.hpp"
+#include "catalogue/CatalogueItor.hpp"
 #include "catalogue/TapeSearchCriteria.hpp"
 #include "common/Constants.hpp"
 #include "common/log/DummyLogger.hpp"
 #include "disk/DiskFile.hpp"
 #include "disk/RadosStriperPool.hpp"
-#include "castor/tape/tapeserver/file/FileReaderFactory.hpp"
 #include "mediachanger/LibrarySlotParser.hpp"
+#include "rdbms/Login.hpp"
 #include "scheduler/RetrieveJob.hpp"
 #include "tapeserver/castor/tape/Constants.hpp"
 #include "tapeserver/castor/tape/tapeserver/daemon/Payload.hpp"
diff --git a/tapeserver/readtp/ReadtpCmd.hpp b/tapeserver/readtp/ReadtpCmd.hpp
index 335bd727b69f3653f6aa5810cc63b2dcf361daff..0f32465f59a83f9003094b120cf4dcd8f3577653 100644
--- a/tapeserver/readtp/ReadtpCmd.hpp
+++ b/tapeserver/readtp/ReadtpCmd.hpp
@@ -17,25 +17,30 @@
 
 #pragma once
 
-#include "common/log/StdoutLogger.hpp"
+#include <memory>
+
+#include "common/dataStructures/LabelFormat.hpp"
 #include "common/log/DummyLogger.hpp"
 #include "common/log/LogContext.hpp"
+#include "common/log/StdoutLogger.hpp"
 #include "common/processCap/ProcessCap.hpp"
-#include "tapeserver/readtp/ReadtpCmdLineArgs.hpp"
-#include "tapeserver/castor/tape/tapeserver/drive/DriveInterface.hpp"
-#include "tapeserver/castor/tape/tapeserver/drive/DriveGeneric.hpp"
+#include "disk/DiskFile.hpp"
+#include "mediachanger/MediaChangerFacade.hpp"
 #include "tapeserver/castor/tape/tapeserver/daemon/EncryptionControl.hpp"
+#include "tapeserver/castor/tape/tapeserver/drive/DriveGeneric.hpp"
+#include "tapeserver/castor/tape/tapeserver/drive/DriveInterface.hpp"
 #include "tapeserver/daemon/Tpconfig.hpp"
 #include "tapeserver/readtp/CmdLineTool.hpp"
+#include "tapeserver/readtp/ReadtpCmdLineArgs.hpp"
 #include "tapeserver/readtp/TapeFseqRange.hpp"
 #include "tapeserver/readtp/TapeFseqRangeListSequence.hpp"
-#include "catalogue/CatalogueFactoryFactory.hpp"
-#include "mediachanger/MediaChangerFacade.hpp"
-#include "disk/DiskFile.hpp"
-
-#include <memory>
 
 namespace cta {
+
+namespace catalogue {
+class Catalogue;
+}
+
 namespace tapeserver {
 namespace readtp {
 
diff --git a/tapeserver/readtp/ReadtpCmdMain.cpp b/tapeserver/readtp/ReadtpCmdMain.cpp
index c065164fde50e0be817d7cbba695f8950ab1ef15..9302c00e5026f531b0c228110a7ad3ab62f8a4bc 100644
--- a/tapeserver/readtp/ReadtpCmdMain.cpp
+++ b/tapeserver/readtp/ReadtpCmdMain.cpp
@@ -15,9 +15,9 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <iostream>
 
 #include "tapeserver/readtp/ReadtpCmd.hpp"
-#include <iostream>
 
 //------------------------------------------------------------------------------
 // main
@@ -25,7 +25,7 @@
 int main(const int argc, char *const *const argv) {
   char buf[256];
   std::string hostName;
-  if(gethostname(buf, sizeof(buf))) {
+  if (gethostname(buf, sizeof(buf))) {
     hostName = "UNKNOWN";
   } else {
     buf[sizeof(buf) - 1] = '\0';
diff --git a/tapeserver/tapelabel/TapeLabelCmd.cpp b/tapeserver/tapelabel/TapeLabelCmd.cpp
index 40c8fc49a3ee1d0297b74a5ca1976f6561e10ac4..d934fe931a07928355270ede7ede3af2491de32e 100644
--- a/tapeserver/tapelabel/TapeLabelCmd.cpp
+++ b/tapeserver/tapelabel/TapeLabelCmd.cpp
@@ -15,8 +15,12 @@
  *               submit itself to any jurisdiction.
  */
 
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/CatalogueFactory.hpp"
+#include "catalogue/CatalogueFactoryFactory.hpp"
 #include "common/Constants.hpp"
 #include "mediachanger/LibrarySlotParser.hpp"
+#include "rdbms/Login.hpp"
 #include "tapeserver/castor/tape/Constants.hpp"
 #include "tapeserver/castor/tape/tapeserver/file/Exceptions.hpp"
 #include "tapeserver/castor/tape/tapeserver/file/HeaderChecker.hpp"
diff --git a/tapeserver/tapelabel/TapeLabelCmd.hpp b/tapeserver/tapelabel/TapeLabelCmd.hpp
index b4d5e0fcba8d18eeccc701450951619a64caefac..1f1bc5b87f0e7d52ce524c443fbc9dc1eddb269f 100644
--- a/tapeserver/tapelabel/TapeLabelCmd.hpp
+++ b/tapeserver/tapelabel/TapeLabelCmd.hpp
@@ -17,19 +17,24 @@
 
 #pragma once
 
-#include "common/log/StdoutLogger.hpp"
+#include <memory>
+
 #include "common/log/LogContext.hpp"
+#include "common/log/StdoutLogger.hpp"
 #include "common/processCap/ProcessCap.hpp"
-#include "tapeserver/castor/tape/tapeserver/drive/DriveInterface.hpp"
-#include "tapeserver/castor/tape/tapeserver/drive/DriveGeneric.hpp"
+#include "mediachanger/MediaChangerFacade.hpp"
 #include "tapeserver/castor/tape/tapeserver/daemon/EncryptionControl.hpp"
+#include "tapeserver/castor/tape/tapeserver/drive/DriveGeneric.hpp"
+#include "tapeserver/castor/tape/tapeserver/drive/DriveInterface.hpp"
 #include "tapeserver/daemon/Tpconfig.hpp"
 #include "tapeserver/tapelabel/CmdLineTool.hpp"
-#include "catalogue/CatalogueFactoryFactory.hpp"
-#include "mediachanger/MediaChangerFacade.hpp"
-#include <memory>
 
 namespace cta {
+
+namespace catalogue {
+class Catalogue;
+}
+
 namespace tapeserver {
 namespace tapelabel {
 
diff --git a/xroot_plugins/XrdCtaAdminLs.hpp b/xroot_plugins/XrdCtaAdminLs.hpp
index 4b0dafe19ee2e2da219c6e7879d6a6e89fb95aef..3063f08a1731f3e7924d3d8d8534ec6777526486 100644
--- a/xroot_plugins/XrdCtaAdminLs.hpp
+++ b/xroot_plugins/XrdCtaAdminLs.hpp
@@ -17,8 +17,11 @@
 
 #pragma once
 
-#include <xroot_plugins/XrdCtaStream.hpp>
-#include <xroot_plugins/XrdSsiCtaRequestMessage.hpp>
+#include <list>
+
+#include "common/dataStructures/AdminUser.hpp"
+#include "xroot_plugins/XrdCtaStream.hpp"
+#include "xroot_plugins/XrdSsiCtaRequestMessage.hpp"
 
 
 namespace cta { namespace xrd {
diff --git a/xroot_plugins/XrdCtaGroupMountRuleLs.hpp b/xroot_plugins/XrdCtaGroupMountRuleLs.hpp
index 1f9c06cc486c1d069a38c389f98a6804b79951a1..8f94f853d32bd8e2abddf9c66c4a0bfeb56e5097 100644
--- a/xroot_plugins/XrdCtaGroupMountRuleLs.hpp
+++ b/xroot_plugins/XrdCtaGroupMountRuleLs.hpp
@@ -17,8 +17,9 @@
 
 #pragma once
 
-#include <xroot_plugins/XrdCtaStream.hpp>
-#include <xroot_plugins/XrdSsiCtaRequestMessage.hpp>
+#include "common/dataStructures/RequesterGroupMountRule.hpp"
+#include "xroot_plugins/XrdCtaStream.hpp"
+#include "xroot_plugins/XrdSsiCtaRequestMessage.hpp"
 
 
 namespace cta { namespace xrd {
diff --git a/xroot_plugins/XrdCtaMediaTypeLs.hpp b/xroot_plugins/XrdCtaMediaTypeLs.hpp
index 2b6f26c1946dbb5cb01c12edf73008ab22f91c85..d24126da5b05df87b8e0606ab6dfce217ecb19a2 100644
--- a/xroot_plugins/XrdCtaMediaTypeLs.hpp
+++ b/xroot_plugins/XrdCtaMediaTypeLs.hpp
@@ -17,9 +17,9 @@
 
 #pragma once
 
-#include <xroot_plugins/XrdCtaStream.hpp>
-#include <xroot_plugins/XrdSsiCtaRequestMessage.hpp>
-
+#include "catalogue/MediaTypeWithLogs.hpp"
+#include "xroot_plugins/XrdCtaStream.hpp"
+#include "xroot_plugins/XrdSsiCtaRequestMessage.hpp"
 
 namespace cta { namespace xrd {
 
diff --git a/xroot_plugins/XrdCtaRecycleTapeFileLs.hpp b/xroot_plugins/XrdCtaRecycleTapeFileLs.hpp
index b5ea5919490bb511a216eac8dcd444814351735c..504dc074ca079da095194b97c2fafda42dba2064 100644
--- a/xroot_plugins/XrdCtaRecycleTapeFileLs.hpp
+++ b/xroot_plugins/XrdCtaRecycleTapeFileLs.hpp
@@ -18,6 +18,7 @@
 #pragma once
 
 #include "catalogue/Catalogue.hpp"
+#include "common/dataStructures/FileRecycleLog.hpp"
 
 namespace cta { namespace xrd {
 
diff --git a/xroot_plugins/XrdCtaRequesterMountRuleLs.hpp b/xroot_plugins/XrdCtaRequesterMountRuleLs.hpp
index 7826f23d9e9eaadd5c12e830c00eb63bde66ba32..199dc63fcd1e019ecd636b0e3a570ec4297f1617 100644
--- a/xroot_plugins/XrdCtaRequesterMountRuleLs.hpp
+++ b/xroot_plugins/XrdCtaRequesterMountRuleLs.hpp
@@ -17,9 +17,9 @@
 
 #pragma once
 
-#include <xroot_plugins/XrdCtaStream.hpp>
-#include <xroot_plugins/XrdSsiCtaRequestMessage.hpp>
-
+#include "common/dataStructures/RequesterMountRule.hpp"
+#include "xroot_plugins/XrdCtaStream.hpp"
+#include "xroot_plugins/XrdSsiCtaRequestMessage.hpp"
 
 namespace cta { namespace xrd {
 
diff --git a/xroot_plugins/XrdCtaTapeFileLs.hpp b/xroot_plugins/XrdCtaTapeFileLs.hpp
index 5f7a8035731d9387181c5a0ee4d8cf3e48eaaa30..6c4b4ea52c26eee5281ccffeec5917a96240f7c9 100644
--- a/xroot_plugins/XrdCtaTapeFileLs.hpp
+++ b/xroot_plugins/XrdCtaTapeFileLs.hpp
@@ -17,10 +17,11 @@
 
 #pragma once
 
+#include "catalogue/CatalogueItor.hpp"
+#include <common/checksum/ChecksumBlobSerDeser.hpp>
+#include <xroot_plugins/GrpcEndpoint.hpp>
 #include <xroot_plugins/XrdCtaStream.hpp>
 #include <xroot_plugins/XrdSsiCtaRequestMessage.hpp>
-#include <xroot_plugins/GrpcEndpoint.hpp>
-#include <common/checksum/ChecksumBlobSerDeser.hpp>
 
 
 namespace cta { namespace xrd {
@@ -28,8 +29,7 @@ namespace cta { namespace xrd {
 /*!
  * Stream object which implements "tapefile ls" command.
  */
-class TapeFileLsStream : public XrdCtaStream
-{
+class TapeFileLsStream : public XrdCtaStream {
 public:
   // Constructor when we need gRPC namespace lookups
   TapeFileLsStream(const RequestMessage &requestMsg, cta::catalogue::Catalogue &catalogue, cta::Scheduler &scheduler,
diff --git a/xroot_plugins/XrdCtaTapePoolLs.hpp b/xroot_plugins/XrdCtaTapePoolLs.hpp
index df31141dd1d86223fb5fbf7a34b993f35161a39e..7478d081f394612baaee28da51fabd7a2c633ad3 100644
--- a/xroot_plugins/XrdCtaTapePoolLs.hpp
+++ b/xroot_plugins/XrdCtaTapePoolLs.hpp
@@ -17,10 +17,10 @@
 
 #pragma once
 
+#include "catalogue/TapePool.hpp"
+#include <catalogue/TapePoolSearchCriteria.hpp>
 #include <xroot_plugins/XrdCtaStream.hpp>
 #include <xroot_plugins/XrdSsiCtaRequestMessage.hpp>
-#include <catalogue/TapePoolSearchCriteria.hpp>
-
 
 namespace cta { namespace xrd {
 
diff --git a/xroot_plugins/XrdSsiCtaRequestMessage.cpp b/xroot_plugins/XrdSsiCtaRequestMessage.cpp
index 7a95c2c23c6f30fb6f509cc0e28cd16294c77975..df5597b5383b1d4f13b81626366dca4df73909dc 100644
--- a/xroot_plugins/XrdSsiCtaRequestMessage.cpp
+++ b/xroot_plugins/XrdSsiCtaRequestMessage.cpp
@@ -15,38 +15,42 @@
  *               submit itself to any jurisdiction.
  */
 
+#include <limits>
+#include <sstream>
+#include <string>
+
 #include <XrdSsiPbException.hpp>
 using XrdSsiPb::PbException;
 
+#include "catalogue/CreateMountPolicyAttributes.hpp"
+#include "catalogue/CreateTapeAttributes.hpp"
+#include "cmdline/CtaAdminCmdParse.hpp"
+#include "common/dataStructures/LogicalLibrary.hpp"
+#include "common/dataStructures/RequesterActivityMountRule.hpp"
 #include "common/utils/Regex.hpp"
-#include <cmdline/CtaAdminCmdParse.hpp>
-#include "XrdSsiCtaRequestMessage.hpp"
+#include "XrdCtaActivityMountRuleLs.hpp"
 #include "XrdCtaAdminLs.hpp"
 #include "XrdCtaArchiveRouteLs.hpp"
 #include "XrdCtaDriveLs.hpp"
 #include "XrdCtaFailedRequestLs.hpp"
 #include "XrdCtaGroupMountRuleLs.hpp"
-#include "XrdCtaActivityMountRuleLs.hpp"
 #include "XrdCtaLogicalLibraryLs.hpp"
-#include "XrdCtaMountPolicyLs.hpp"
 #include "XrdCtaMediaTypeLs.hpp"
+#include "XrdCtaMountPolicyLs.hpp"
 #include "XrdCtaRepackLs.hpp"
+#include "XrdSsiCtaRequestMessage.hpp"
 #include "XrdCtaRequesterMountRuleLs.hpp"
 #include "XrdCtaShowQueues.hpp"
-#include "XrdCtaTapeLs.hpp"
-#include "XrdCtaTapeFileLs.hpp"
+#include "XrdCtaDiskInstanceLs.hpp"
+#include "XrdCtaDiskSystemLs.hpp"
 #include "XrdCtaStorageClassLs.hpp"
+#include "XrdCtaTapeFileLs.hpp"
+#include "XrdCtaTapeLs.hpp"
 #include "XrdCtaTapePoolLs.hpp"
-#include "XrdCtaDiskSystemLs.hpp"
-#include "XrdCtaDiskInstanceLs.hpp"
 #include "XrdCtaDiskInstanceSpaceLs.hpp"
-#include "XrdCtaVirtualOrganizationLs.hpp"
-#include "XrdCtaVersion.hpp"
 #include "XrdCtaRecycleTapeFileLs.hpp"
-
-#include <limits>
-#include <sstream>
-#include <string>
+#include "XrdCtaVersion.hpp"
+#include "XrdCtaVirtualOrganizationLs.hpp"
 
 namespace cta {
 namespace xrd {
diff --git a/xroot_plugins/XrdSsiCtaServiceProvider.cpp b/xroot_plugins/XrdSsiCtaServiceProvider.cpp
index 26ccc01e6228f0f32ecff9f04d61190ea3db9e82..77089bb68be157dfd22fc255ed309a73089bfd0c 100644
--- a/xroot_plugins/XrdSsiCtaServiceProvider.cpp
+++ b/xroot_plugins/XrdSsiCtaServiceProvider.cpp
@@ -18,6 +18,12 @@
 #include "cta_frontend.pb.h"
 #include "version.h"
 
+#include <XrdSsiPbAlert.hpp>
+#include <XrdSsiPbConfig.hpp>
+#include <XrdSsiPbService.hpp>
+
+#include "catalogue/Catalogue.hpp"
+#include "catalogue/CatalogueFactory.hpp"
 #include "catalogue/CatalogueFactoryFactory.hpp"
 #include "common/log/FileLogger.hpp"
 #include "common/log/LogLevel.hpp"
@@ -25,10 +31,7 @@
 #include "common/log/SyslogLogger.hpp"
 #include "common/utils/utils.hpp"
 #include "rdbms/Login.hpp"
-#include "XrdSsiCtaServiceProvider.hpp"
-#include "XrdSsiPbAlert.hpp"
-#include "XrdSsiPbConfig.hpp"
-#include "XrdSsiPbService.hpp"
+#include "xroot_plugins/XrdSsiCtaServiceProvider.hpp"
 
 /*
  * Global pointer to the Service Provider object.
diff --git a/xroot_plugins/XrdSsiCtaServiceProvider.hpp b/xroot_plugins/XrdSsiCtaServiceProvider.hpp
index 5384c38fbe4191d30cdfc6a61f7e2b11e053235a..93f3f134634dc938b6ceac54f0c87d155a3b0a7f 100644
--- a/xroot_plugins/XrdSsiCtaServiceProvider.hpp
+++ b/xroot_plugins/XrdSsiCtaServiceProvider.hpp
@@ -17,8 +17,12 @@
 
 #pragma once
 
+#include <memory>
+#include <string>
+
 #include <XrdSsi/XrdSsiProvider.hh>
 
+#include "catalogue/Catalogue.hpp"
 #include <common/Configuration.hpp>
 #include <common/utils/utils.hpp>
 #include <xroot_plugins/Namespace.hpp>