Commit 50365bbc authored by Daniele Kruse's avatar Daniele Kruse
Browse files

Major commit including all new data structures and corresponding Catalogue interface

parent f0ed5558
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,6 +3,37 @@ cmake_minimum_required (VERSION 2.6)
include_directories(/usr/include/shift)
set (COMMON_LIB_SRC_FILES
dataStructures/AdminHost.cpp
dataStructures/AdminUser.cpp
dataStructures/ArchiveFile.cpp
dataStructures/ArchiveJob.cpp
dataStructures/ArchiveMount.cpp
dataStructures/ArchiveRequest.cpp
dataStructures/ArchiveRoute.cpp
dataStructures/CancelRetrieveRequest.cpp
dataStructures/Dedication.cpp
dataStructures/DeleteArchiveRequest.cpp
dataStructures/DRData.cpp
dataStructures/EntryLog.cpp
dataStructures/ListStorageClassRequest.cpp
dataStructures/ReadTestResult.cpp
dataStructures/RepackInfo.cpp
dataStructures/Requester.cpp
dataStructures/RetrieveJob.cpp
dataStructures/RetrieveMount.cpp
dataStructures/RetrieveRequest.cpp
dataStructures/SecurityIdentity.cpp
dataStructures/StorageClass.cpp
dataStructures/Tape.cpp
dataStructures/TapeFileLocation.cpp
dataStructures/TapeMount.cpp
dataStructures/TapePool.cpp
dataStructures/UpdateFileInfoRequest.cpp
dataStructures/User.cpp
dataStructures/UserGroup.cpp
dataStructures/UserIdentity.cpp
dataStructures/VerifyInfo.cpp
dataStructures/WriteTestResult.cpp
admin/AdminHost.cpp
admin/AdminUser.cpp
archiveRoutes/ArchiveRoute.cpp
......
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/dataStructures/AdminHost.hpp"
#include "common/exception/Exception.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::dataStructures::AdminHost::AdminHost() {
m_commentSet = false;
m_creationLogSet = false;
m_lastModificationLogSet = false;
m_nameSet = false;
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::dataStructures::AdminHost::~AdminHost() throw() {
}
//------------------------------------------------------------------------------
// allFieldsSet
//------------------------------------------------------------------------------
bool cta::dataStructures::AdminHost::allFieldsSet() const {
return m_commentSet
&& m_creationLogSet
&& m_lastModificationLogSet
&& m_nameSet;
}
//------------------------------------------------------------------------------
// setComment
//------------------------------------------------------------------------------
void cta::dataStructures::AdminHost::setComment(const std::string &comment) {
m_comment = comment;
m_commentSet = true;
}
//------------------------------------------------------------------------------
// getComment
//------------------------------------------------------------------------------
std::string cta::dataStructures::AdminHost::getComment() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the AdminHost have been set!");
}
return m_comment;
}
//------------------------------------------------------------------------------
// setCreationLog
//------------------------------------------------------------------------------
void cta::dataStructures::AdminHost::setCreationLog(const cta::dataStructures::EntryLog &creationLog) {
m_creationLog = creationLog;
m_creationLogSet = true;
}
//------------------------------------------------------------------------------
// getCreationLog
//------------------------------------------------------------------------------
cta::dataStructures::EntryLog cta::dataStructures::AdminHost::getCreationLog() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the AdminHost have been set!");
}
return m_creationLog;
}
//------------------------------------------------------------------------------
// setLastModificationLog
//------------------------------------------------------------------------------
void cta::dataStructures::AdminHost::setLastModificationLog(const cta::dataStructures::EntryLog &lastModificationLog) {
m_lastModificationLog = lastModificationLog;
m_lastModificationLogSet = true;
}
//------------------------------------------------------------------------------
// getLastModificationLog
//------------------------------------------------------------------------------
cta::dataStructures::EntryLog cta::dataStructures::AdminHost::getLastModificationLog() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the AdminHost have been set!");
}
return m_lastModificationLog;
}
//------------------------------------------------------------------------------
// setName
//------------------------------------------------------------------------------
void cta::dataStructures::AdminHost::setName(const std::string &name) {
m_name = name;
m_nameSet = true;
}
//------------------------------------------------------------------------------
// getName
//------------------------------------------------------------------------------
std::string cta::dataStructures::AdminHost::getName() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the AdminHost have been set!");
}
return m_name;
}
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <list>
#include <map>
#include <stdint.h>
#include <string>
#include "common/dataStructures/EntryLog.hpp"
namespace cta {
namespace dataStructures {
class AdminHost {
public:
/**
* Constructor
*/
AdminHost();
/**
* Destructor
*/
~AdminHost() throw();
void setComment(const std::string &comment);
std::string getComment() const;
void setCreationLog(const cta::dataStructures::EntryLog &creationLog);
cta::dataStructures::EntryLog getCreationLog() const;
void setLastModificationLog(const cta::dataStructures::EntryLog &lastModificationLog);
cta::dataStructures::EntryLog getLastModificationLog() const;
void setName(const std::string &name);
std::string getName() const;
private:
/**
* @return true if all fields have been set, false otherwise
*/
bool allFieldsSet() const;
std::string m_comment;
bool m_commentSet;
cta::dataStructures::EntryLog m_creationLog;
bool m_creationLogSet;
cta::dataStructures::EntryLog m_lastModificationLog;
bool m_lastModificationLogSet;
std::string m_name;
bool m_nameSet;
}; // class AdminHost
} // namespace dataStructures
} // namespace cta
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/dataStructures/AdminUser.hpp"
#include "common/exception/Exception.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::dataStructures::AdminUser::AdminUser() {
m_commentSet = false;
m_creationLogSet = false;
m_lastModificationLogSet = false;
m_userSet = false;
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::dataStructures::AdminUser::~AdminUser() throw() {
}
//------------------------------------------------------------------------------
// allFieldsSet
//------------------------------------------------------------------------------
bool cta::dataStructures::AdminUser::allFieldsSet() const {
return m_commentSet
&& m_creationLogSet
&& m_lastModificationLogSet
&& m_userSet;
}
//------------------------------------------------------------------------------
// setComment
//------------------------------------------------------------------------------
void cta::dataStructures::AdminUser::setComment(const std::string &comment) {
m_comment = comment;
m_commentSet = true;
}
//------------------------------------------------------------------------------
// getComment
//------------------------------------------------------------------------------
std::string cta::dataStructures::AdminUser::getComment() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the AdminUser have been set!");
}
return m_comment;
}
//------------------------------------------------------------------------------
// setCreationLog
//------------------------------------------------------------------------------
void cta::dataStructures::AdminUser::setCreationLog(const cta::dataStructures::EntryLog &creationLog) {
m_creationLog = creationLog;
m_creationLogSet = true;
}
//------------------------------------------------------------------------------
// getCreationLog
//------------------------------------------------------------------------------
cta::dataStructures::EntryLog cta::dataStructures::AdminUser::getCreationLog() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the AdminUser have been set!");
}
return m_creationLog;
}
//------------------------------------------------------------------------------
// setLastModificationLog
//------------------------------------------------------------------------------
void cta::dataStructures::AdminUser::setLastModificationLog(const cta::dataStructures::EntryLog &lastModificationLog) {
m_lastModificationLog = lastModificationLog;
m_lastModificationLogSet = true;
}
//------------------------------------------------------------------------------
// getLastModificationLog
//------------------------------------------------------------------------------
cta::dataStructures::EntryLog cta::dataStructures::AdminUser::getLastModificationLog() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the AdminUser have been set!");
}
return m_lastModificationLog;
}
//------------------------------------------------------------------------------
// setUser
//------------------------------------------------------------------------------
void cta::dataStructures::AdminUser::setUser(const cta::dataStructures::UserIdentity &user) {
m_user = user;
m_userSet = true;
}
//------------------------------------------------------------------------------
// getUser
//------------------------------------------------------------------------------
cta::dataStructures::UserIdentity cta::dataStructures::AdminUser::getUser() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the AdminUser have been set!");
}
return m_user;
}
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <list>
#include <map>
#include <stdint.h>
#include <string>
#include "common/dataStructures/EntryLog.hpp"
#include "common/dataStructures/UserIdentity.hpp"
namespace cta {
namespace dataStructures {
class AdminUser {
public:
/**
* Constructor
*/
AdminUser();
/**
* Destructor
*/
~AdminUser() throw();
void setComment(const std::string &comment);
std::string getComment() const;
void setCreationLog(const cta::dataStructures::EntryLog &creationLog);
cta::dataStructures::EntryLog getCreationLog() const;
void setLastModificationLog(const cta::dataStructures::EntryLog &lastModificationLog);
cta::dataStructures::EntryLog getLastModificationLog() const;
void setUser(const cta::dataStructures::UserIdentity &user);
cta::dataStructures::UserIdentity getUser() const;
private:
/**
* @return true if all fields have been set, false otherwise
*/
bool allFieldsSet() const;
std::string m_comment;
bool m_commentSet;
cta::dataStructures::EntryLog m_creationLog;
bool m_creationLogSet;
cta::dataStructures::EntryLog m_lastModificationLog;
bool m_lastModificationLogSet;
cta::dataStructures::UserIdentity m_user;
bool m_userSet;
}; // class AdminUser
} // namespace dataStructures
} // namespace cta
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/dataStructures/ArchiveFile.hpp"
#include "common/exception/Exception.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::dataStructures::ArchiveFile::ArchiveFile() {
m_archiveFileIDSet = false;
m_checksumTypeSet = false;
m_checksumValueSet = false;
m_drDataSet = false;
m_eosFileIDSet = false;
m_fileSizeSet = false;
m_storageClassSet = false;
m_tapeCopiesSet = false;
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::dataStructures::ArchiveFile::~ArchiveFile() throw() {
}
//------------------------------------------------------------------------------
// allFieldsSet
//------------------------------------------------------------------------------
bool cta::dataStructures::ArchiveFile::allFieldsSet() const {
return m_archiveFileIDSet
&& m_checksumTypeSet
&& m_checksumValueSet
&& m_drDataSet
&& m_eosFileIDSet
&& m_fileSizeSet
&& m_storageClassSet
&& m_tapeCopiesSet;
}
//------------------------------------------------------------------------------
// setArchiveFileID
//------------------------------------------------------------------------------
void cta::dataStructures::ArchiveFile::setArchiveFileID(const std::string &archiveFileID) {
m_archiveFileID = archiveFileID;
m_archiveFileIDSet = true;
}
//------------------------------------------------------------------------------
// getArchiveFileID
//------------------------------------------------------------------------------
std::string cta::dataStructures::ArchiveFile::getArchiveFileID() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the ArchiveFile have been set!");
}
return m_archiveFileID;
}
//------------------------------------------------------------------------------
// setChecksumType
//------------------------------------------------------------------------------
void cta::dataStructures::ArchiveFile::setChecksumType(const std::string &checksumType) {
m_checksumType = checksumType;
m_checksumTypeSet = true;
}
//------------------------------------------------------------------------------
// getChecksumType
//------------------------------------------------------------------------------
std::string cta::dataStructures::ArchiveFile::getChecksumType() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the ArchiveFile have been set!");
}
return m_checksumType;
}
//------------------------------------------------------------------------------
// setChecksumValue
//------------------------------------------------------------------------------
void cta::dataStructures::ArchiveFile::setChecksumValue(const std::string &checksumValue) {
m_checksumValue = checksumValue;
m_checksumValueSet = true;
}
//------------------------------------------------------------------------------
// getChecksumValue
//------------------------------------------------------------------------------
std::string cta::dataStructures::ArchiveFile::getChecksumValue() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the ArchiveFile have been set!");
}
return m_checksumValue;
}
//------------------------------------------------------------------------------
// setDrData
//------------------------------------------------------------------------------
void cta::dataStructures::ArchiveFile::setDrData(const cta::dataStructures::DRData &drData) {
m_drData = drData;
m_drDataSet = true;
}
//------------------------------------------------------------------------------
// getDrData
//------------------------------------------------------------------------------
cta::dataStructures::DRData cta::dataStructures::ArchiveFile::getDrData() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the ArchiveFile have been set!");
}
return m_drData;
}
//------------------------------------------------------------------------------
// setEosFileID
//------------------------------------------------------------------------------
void cta::dataStructures::ArchiveFile::setEosFileID(const std::string &eosFileID) {
m_eosFileID = eosFileID;
m_eosFileIDSet = true;
}
//------------------------------------------------------------------------------
// getEosFileID
//------------------------------------------------------------------------------
std::string cta::dataStructures::ArchiveFile::getEosFileID() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the ArchiveFile have been set!");
}
return m_eosFileID;
}
//------------------------------------------------------------------------------
// setFileSize
//------------------------------------------------------------------------------
void cta::dataStructures::ArchiveFile::setFileSize(const uint64_t fileSize) {
m_fileSize = fileSize;
m_fileSizeSet = true;
}
//------------------------------------------------------------------------------
// getFileSize
//------------------------------------------------------------------------------
uint64_t cta::dataStructures::ArchiveFile::getFileSize() const {
if(!allFieldsSet()) {
throw cta::exception::Exception(std::string(__FUNCTION__)+" Error: not all fields of the ArchiveFile have been set!");
}
return m_fileSize;
}
//------------------------------------------------------------------------------
// setStorageClass
//------------------------------------------------------------------------------
void cta::dataStructures::ArchiveFile::setStorageClass(const std::string &storageClass) {
m_storageClass = storageClass;