Commit 91f0beed authored by Eric Cano's avatar Eric Cano
Browse files

Moved parts from scheduler directory out into common, in a move to reduce this too long directory.

Also organised common in subdirectories, and added sub directory for mockDB.
parent af157d49
...@@ -3,21 +3,25 @@ cmake_minimum_required (VERSION 2.6) ...@@ -3,21 +3,25 @@ cmake_minimum_required (VERSION 2.6)
include_directories(/usr/include/shift) include_directories(/usr/include/shift)
set (COMMON_LIB_SRC_FILES set (COMMON_LIB_SRC_FILES
ArchiveDirEntry.cpp admin/AdminHost.cpp
ArchiveDirIterator.cpp admin/AdminUser.cpp
ArchiveFileStatus.cpp archiveRoutes/ArchiveRoute.cpp
ByteArray.cpp archiveRoutes/ArchiveRouteId.cpp
Checksum.cpp archiveNS/ArchiveDirEntry.cpp
archiveNS/ArchiveDirIterator.cpp
archiveNS/ArchiveFileStatus.cpp
archiveNS/TapeCopyLocationAndStatus.cpp
CreationLog.cpp
checksum/ByteArray.cpp
checksum/Checksum.cpp
exception/Backtrace.cpp exception/Backtrace.cpp
exception/Errnum.cpp exception/Errnum.cpp
exception/Exception.cpp exception/Exception.cpp
exception/Serrnum.cpp exception/Serrnum.cpp
RemoteFileStatus.cpp remoteFS/RemoteFileStatus.cpp
RemotePath.cpp remoteFS/RemotePath.cpp
RemotePathAndStatus.cpp remoteFS/RemotePathAndStatus.cpp
SmartFd.cpp
strerror_r_wrapper.cpp strerror_r_wrapper.cpp
TapeCopyLocationAndStatus.cpp
Timer.cpp Timer.cpp
threading/ChildProcess.cpp threading/ChildProcess.cpp
threading/Mutex.cpp threading/Mutex.cpp
...@@ -35,10 +39,9 @@ target_link_libraries (ctacommon ...@@ -35,10 +39,9 @@ target_link_libraries (ctacommon
uuid) uuid)
set (COMMON_UNIT_TESTS_LIB_SRC_FILES set (COMMON_UNIT_TESTS_LIB_SRC_FILES
ByteArrayTest.cpp checksum/ByteArrayTest.cpp
ChecksumTest.cpp checksum/ChecksumTest.cpp
RemotePathTest.cpp remoteFS/RemotePathTest.cpp
SmartFdTest.cpp
UtilsTest.cpp) UtilsTest.cpp)
add_library (ctacommonunittests SHARED add_library (ctacommonunittests SHARED
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <limits> #include <limits>
#include "scheduler/CreationLog.hpp" #include "common/CreationLog.hpp"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// constructor // constructor
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "scheduler/AdminHost.hpp" #include "common/admin/AdminHost.hpp"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// constructor // constructor
...@@ -35,9 +35,5 @@ cta::AdminHost::~AdminHost() throw() { ...@@ -35,9 +35,5 @@ cta::AdminHost::~AdminHost() throw() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
cta::AdminHost::AdminHost( cta::AdminHost::AdminHost(
const std::string &name, const std::string &name,
const UserIdentity &creator, const CreationLog &creationLog):
const std::string &comment, name(name), creationLog(creationLog) {}
const time_t creationTime): \ No newline at end of file
ConfigurationItem(creator, comment, creationTime),
name(name) {
}
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#pragma once #pragma once
#include "common/UserIdentity.hpp" #include "common/UserIdentity.hpp"
#include "scheduler/ConfigurationItem.hpp" #include "common/CreationLog.hpp"
#include <string> #include <string>
...@@ -28,7 +28,7 @@ namespace cta { ...@@ -28,7 +28,7 @@ namespace cta {
/** /**
* An administration host. * An administration host.
*/ */
struct AdminHost: public ConfigurationItem { struct AdminHost {
/** /**
* Constructor. * Constructor.
...@@ -54,14 +54,17 @@ struct AdminHost: public ConfigurationItem { ...@@ -54,14 +54,17 @@ struct AdminHost: public ConfigurationItem {
*/ */
AdminHost( AdminHost(
const std::string &name, const std::string &name,
const UserIdentity &creator, const CreationLog &creationLog);
const std::string &comment,
const time_t creationTime = time(NULL));
/** /**
* The network name of the administration host. * The network name of the administration host.
*/ */
std::string name; std::string name;
/**
* The why, who, when, where of the creation of the admin host
*/
CreationLog creationLog;
}; // struct AdminHost }; // struct AdminHost
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "scheduler/AdminUser.hpp" #include "common/admin/AdminUser.hpp"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// constructor // constructor
...@@ -35,11 +35,8 @@ cta::AdminUser::~AdminUser() throw() { ...@@ -35,11 +35,8 @@ cta::AdminUser::~AdminUser() throw() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
cta::AdminUser::AdminUser( cta::AdminUser::AdminUser(
const UserIdentity &user, const UserIdentity &user,
const UserIdentity &creator, const CreationLog &creationLog):
const std::string &comment, m_user(user), m_creationLog(creationLog) {
const time_t creationTime):
ConfigurationItem(creator, comment, creationTime),
m_user(user) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -48,3 +45,11 @@ cta::AdminUser::AdminUser( ...@@ -48,3 +45,11 @@ cta::AdminUser::AdminUser(
const cta::UserIdentity &cta::AdminUser::getUser() const throw() { const cta::UserIdentity &cta::AdminUser::getUser() const throw() {
return m_user; return m_user;
} }
//------------------------------------------------------------------------------
// getCreationLog
//------------------------------------------------------------------------------
const cta::CreationLog &cta::AdminUser::getCreationLog() const throw() {
return m_creationLog;
}
\ No newline at end of file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#pragma once #pragma once
#include "common/UserIdentity.hpp" #include "common/UserIdentity.hpp"
#include "scheduler/ConfigurationItem.hpp" #include "common/CreationLog.hpp"
#include <string> #include <string>
...@@ -28,7 +28,7 @@ namespace cta { ...@@ -28,7 +28,7 @@ namespace cta {
/** /**
* Class representing an administrator. * Class representing an administrator.
*/ */
class AdminUser: public ConfigurationItem { class AdminUser {
public: public:
/** /**
...@@ -55,9 +55,7 @@ public: ...@@ -55,9 +55,7 @@ public:
*/ */
AdminUser( AdminUser(
const UserIdentity &user, const UserIdentity &user,
const UserIdentity &creator, const CreationLog &creationLog);
const std::string &comment,
const time_t creationTime = time(NULL));
/** /**
* Returns the identity of the administrator. * Returns the identity of the administrator.
...@@ -65,6 +63,12 @@ public: ...@@ -65,6 +63,12 @@ public:
* @return The identity of the administrator. * @return The identity of the administrator.
*/ */
const UserIdentity &getUser() const throw(); const UserIdentity &getUser() const throw();
/**
* Return the creation log
* @return the creation log
*/
const CreationLog &getCreationLog() const throw();
private: private:
...@@ -72,6 +76,11 @@ private: ...@@ -72,6 +76,11 @@ private:
* The identity of the administrator. * The identity of the administrator.
*/ */
UserIdentity m_user; UserIdentity m_user;
/**
* The who, when, why, where of the creation of the admin user
*/
CreationLog m_creationLog;
}; // class AdminUser }; // class AdminUser
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "common/ArchiveDirEntry.hpp" #include "common/archiveNS/ArchiveDirEntry.hpp"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// entryTypeToStr // entryTypeToStr
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#pragma once #pragma once
#include "common/ArchiveFileStatus.hpp" #include "common/archiveNS/ArchiveFileStatus.hpp"
#include <string> #include <string>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "common/ArchiveDirIterator.hpp" #include "common/archiveNS/ArchiveDirIterator.hpp"
#include "common/exception/Exception.hpp" #include "common/exception/Exception.hpp"
using cta::exception::Exception; using cta::exception::Exception;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#pragma once #pragma once
#include "common/ArchiveDirEntry.hpp" #include "common/archiveNS/ArchiveDirEntry.hpp"
#include <list> #include <list>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "common/ArchiveFileStatus.hpp" #include "common/archiveNS/ArchiveFileStatus.hpp"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// constructor // constructor
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#pragma once #pragma once
#include "common/Checksum.hpp" #include "common/checksum/Checksum.hpp"
#include "common/UserIdentity.hpp" #include "common/UserIdentity.hpp"
#include <stdint.h> #include <stdint.h>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "common/TapeCopyLocationAndStatus.hpp" #include "common/archiveNS/TapeCopyLocationAndStatus.hpp"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// constructor // constructor
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include "common/ArchiveFileStatus.hpp" #include "common/archiveNS/ArchiveFileStatus.hpp"
namespace cta { namespace cta {
...@@ -50,6 +50,6 @@ struct TapeCopyLocationAndStatus { ...@@ -50,6 +50,6 @@ struct TapeCopyLocationAndStatus {
uint64_t size; /**< The tape copy's size */ uint64_t size; /**< The tape copy's size */
uint64_t fileId; /**< The file ID as recorded in the tape copy's header */ uint64_t fileId; /**< The file ID as recorded in the tape copy's header */
Checksum checksum;/**< The tape copy's checksum */ Checksum checksum;/**< The tape copy's checksum */
}; // class RemotePathAndStatus }; // class TapeCopyLocationAndStatus
} // namespace cta } // namespace cta
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "scheduler/ArchiveRoute.hpp" #include "common/archiveRoutes/ArchiveRoute.hpp"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// constructor // constructor
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#pragma once #pragma once
#include "common/UserIdentity.hpp" #include "common/UserIdentity.hpp"
#include "scheduler/CreationLog.hpp" #include "common/CreationLog.hpp"
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "scheduler/ArchiveRouteId.hpp" #include "common/archiveRoutes/ArchiveRouteId.hpp"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// constructor // constructor
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "common/ByteArray.hpp" #include "common/checksum/ByteArray.hpp"
#include <ostream> #include <ostream>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment