Commit a89d399c authored by Steven Murray's avatar Steven Murray
Browse files

Added MEDIA_TYPE and VENDOR columns to TAPE table and upgraded...

Added MEDIA_TYPE and VENDOR columns to TAPE table and upgraded xrootd-ssi-protobuf-interface to v0.29
parent 06cc2377
......@@ -48,9 +48,11 @@ set (CATALOGUE_LIB_SRC_FILES
UserSpecifiedAnEmptyStringComment.cpp
UserSpecifiedAnEmptyStringDiskInstanceName.cpp
UserSpecifiedAnEmptyStringLogicalLibraryName.cpp
UserSpecifiedAnEmptyStringMediaType.cpp
UserSpecifiedAnEmptyStringStorageClassName.cpp
UserSpecifiedAnEmptyStringTapePoolName.cpp
UserSpecifiedAnEmptyStringUsername.cpp
UserSpecifiedAnEmptyStringVendor.cpp
UserSpecifiedAnEmptyStringVid.cpp
UserSpecifiedAnEmptyStringVo.cpp
UserSpecifiedAZeroCapacity.cpp
......
......@@ -287,12 +287,15 @@ public:
virtual void createTape(
const common::dataStructures::SecurityIdentity &admin,
const std::string &vid,
const std::string &mediaType,
const std::string &vendor,
const std::string &logicalLibraryName,
const std::string &tapePoolName,
const uint64_t capacityInBytes,
const bool disabled,
const bool full,
const std::string &comment) = 0;
virtual void deleteTape(const std::string &vid) = 0;
/**
......@@ -337,6 +340,8 @@ public:
*/
virtual void reclaimTape(const common::dataStructures::SecurityIdentity &admin, const std::string &vid) = 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;
virtual void modifyTapeLogicalLibraryName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName) = 0;
virtual void modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) = 0;
virtual void modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const uint64_t capacityInBytes) = 0;
......
......@@ -201,8 +201,8 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->modifyLogicalLibraryComment(admin, name, comment);}, m_maxTriesToConnect);
}
void createTape(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &logicalLibraryName, const std::string &tapePoolName, const uint64_t capacityInBytes, const bool disabled, const bool full, const std::string &comment) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->createTape(admin, vid, logicalLibraryName, tapePoolName, capacityInBytes, disabled, full, comment);}, m_maxTriesToConnect);
void createTape(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &mediaType, const std::string &vendor, const std::string &logicalLibraryName, const std::string &tapePoolName, const uint64_t capacityInBytes, const bool disabled, const bool full, const std::string &comment) override {
return retryOnLostConnection(m_log, [&]{return m_catalogue->createTape(admin, vid, mediaType, vendor, logicalLibraryName, tapePoolName, capacityInBytes, disabled, full, comment);}, m_maxTriesToConnect);
}
void deleteTape(const std::string &vid) override {
......@@ -225,6 +225,14 @@ public:
return retryOnLostConnection(m_log, [&]{return m_catalogue->reclaimTape(admin, vid);}, m_maxTriesToConnect);
}
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 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 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);
}
......
This diff is collapsed.
......@@ -41,7 +41,7 @@ public:
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 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 std::string& vid, const std::string& logicalLibraryName, const std::string& tapePoolName, const uint64_t capacityInBytes, const bool disabled, const bool full, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void createTape(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string &mediaType, const std::string &vendor, const std::string& logicalLibraryName, const std::string& tapePoolName, const uint64_t capacityInBytes, const bool disabled, const bool full, 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::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 deleteArchiveFile(const std::string& instanceName, const uint64_t archiveFileId, log::LogContext &lc) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
......@@ -89,6 +89,8 @@ public:
void modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const uint64_t capacityInBytes) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeComment(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
void modifyTapeEncryptionKey(const common::dataStructures::SecurityIdentity& admin, const std::string& vid, const std::string& encryptionKey) 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"); }
......
......@@ -26,9 +26,11 @@
#include "catalogue/UserSpecifiedAnEmptyStringComment.hpp"
#include "catalogue/UserSpecifiedAnEmptyStringDiskInstanceName.hpp"
#include "catalogue/UserSpecifiedAnEmptyStringLogicalLibraryName.hpp"
#include "catalogue/UserSpecifiedAnEmptyStringMediaType.hpp"
#include "catalogue/UserSpecifiedAnEmptyStringStorageClassName.hpp"
#include "catalogue/UserSpecifiedAnEmptyStringTapePoolName.hpp"
#include "catalogue/UserSpecifiedAnEmptyStringUsername.hpp"
#include "catalogue/UserSpecifiedAnEmptyStringVendor.hpp"
#include "catalogue/UserSpecifiedAnEmptyStringVid.hpp"
#include "catalogue/UserSpecifiedAnEmptyStringVo.hpp"
#include "catalogue/UserSpecifiedAZeroCapacity.hpp"
......@@ -1624,6 +1626,8 @@ void RdbmsCatalogue::modifyLogicalLibraryComment(const common::dataStructures::S
void RdbmsCatalogue::createTape(
const common::dataStructures::SecurityIdentity &admin,
const std::string &vid,
const std::string &mediaType,
const std::string &vendor,
const std::string &logicalLibraryName,
const std::string &tapePoolName,
const uint64_t capacityInBytes,
......@@ -1635,6 +1639,14 @@ void RdbmsCatalogue::createTape(
throw UserSpecifiedAnEmptyStringVid("Cannot create tape because the VID is an empty string");
}
if(mediaType.empty()) {
throw UserSpecifiedAnEmptyStringMediaType("Cannot create tape because the media type is an empty string");
}
if(vendor.empty()) {
throw UserSpecifiedAnEmptyStringVendor("Cannot create tape because the vendor is an empty string");
}
if(logicalLibraryName.empty()) {
throw UserSpecifiedAnEmptyStringLogicalLibraryName("Cannot create tape because the logical library name is an"
" empty string");
......@@ -1669,6 +1681,8 @@ void RdbmsCatalogue::createTape(
const char *const sql =
"INSERT INTO TAPE("
"VID,"
"MEDIA_TYPE,"
"VENDOR,"
"LOGICAL_LIBRARY_NAME,"
"TAPE_POOL_NAME,"
"CAPACITY_IN_BYTES,"
......@@ -1688,6 +1702,8 @@ void RdbmsCatalogue::createTape(
"LAST_UPDATE_TIME)"
"VALUES("
":VID,"
":MEDIA_TYPE,"
":VENDOR,"
":LOGICAL_LIBRARY_NAME,"
":TAPE_POOL_NAME,"
":CAPACITY_IN_BYTES,"
......@@ -1708,6 +1724,8 @@ void RdbmsCatalogue::createTape(
auto stmt = conn.createStmt(sql);
stmt.bindString(":VID", vid);
stmt.bindString(":MEDIA_TYPE", mediaType);
stmt.bindString(":VENDOR", vendor);
stmt.bindString(":LOGICAL_LIBRARY_NAME", logicalLibraryName);
stmt.bindString(":TAPE_POOL_NAME", tapePoolName);
stmt.bindUint64(":CAPACITY_IN_BYTES", capacityInBytes);
......@@ -1834,6 +1852,8 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(rdbms::Conn &co
std::string sql =
"SELECT "
"VID AS VID,"
"MEDIA_TYPE AS MEDIA_TYPE,"
"VENDOR AS VENDOR,"
"LOGICAL_LIBRARY_NAME AS LOGICAL_LIBRARY_NAME,"
"TAPE_POOL_NAME AS TAPE_POOL_NAME,"
"ENCRYPTION_KEY AS ENCRYPTION_KEY,"
......@@ -1865,12 +1885,14 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(rdbms::Conn &co
"FROM "
"TAPE";
if(searchCriteria.vid||
searchCriteria.logicalLibrary||
searchCriteria.tapePool||
searchCriteria.capacityInBytes||
searchCriteria.disabled||
searchCriteria.full||
if(searchCriteria.vid ||
searchCriteria.mediaType ||
searchCriteria.vendor ||
searchCriteria.logicalLibrary ||
searchCriteria.tapePool ||
searchCriteria.capacityInBytes ||
searchCriteria.disabled ||
searchCriteria.full ||
searchCriteria.lbp) {
sql += " WHERE ";
}
......@@ -1881,6 +1903,16 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(rdbms::Conn &co
sql += " VID = :VID";
addedAWhereConstraint = true;
}
if(searchCriteria.mediaType) {
if(addedAWhereConstraint) sql += " AND ";
sql += " MEDIA_TYPE = :MEDIA_TYPE";
addedAWhereConstraint = true;
}
if(searchCriteria.vendor) {
if(addedAWhereConstraint) sql += " AND ";
sql += " VENDOR = :VENDOR";
addedAWhereConstraint = true;
}
if(searchCriteria.logicalLibrary) {
if(addedAWhereConstraint) sql += " AND ";
sql += " LOGICAL_LIBRARY_NAME = :LOGICAL_LIBRARY_NAME";
......@@ -1916,6 +1948,8 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(rdbms::Conn &co
auto stmt = conn.createStmt(sql);
if(searchCriteria.vid) stmt.bindString(":VID", searchCriteria.vid.value());
if(searchCriteria.mediaType) stmt.bindString(":MEDIA_TYPE", searchCriteria.mediaType.value());
if(searchCriteria.vendor) stmt.bindString(":VENDOR", searchCriteria.vendor.value());
if(searchCriteria.logicalLibrary) stmt.bindString(":LOGICAL_LIBRARY_NAME", searchCriteria.logicalLibrary.value());
if(searchCriteria.tapePool) stmt.bindString(":TAPE_POOL_NAME", searchCriteria.tapePool.value());
if(searchCriteria.capacityInBytes) stmt.bindUint64(":CAPACITY_IN_BYTES", searchCriteria.capacityInBytes.value());
......@@ -1928,6 +1962,8 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(rdbms::Conn &co
common::dataStructures::Tape tape;
tape.vid = rset.columnString("VID");
tape.mediaType = rset.columnString("MEDIA_TYPE");
tape.vendor = rset.columnString("VENDOR");
tape.logicalLibraryName = rset.columnString("LOGICAL_LIBRARY_NAME");
tape.tapePoolName = rset.columnString("TAPE_POOL_NAME");
tape.encryptionKey = rset.columnOptionalString("ENCRYPTION_KEY");
......@@ -1971,6 +2007,8 @@ common::dataStructures::VidToTapeMap RdbmsCatalogue::getTapesByVid(const std::se
std::string sql =
"SELECT "
"VID AS VID,"
"MEDIA_TYPE AS MEDIA_TYPE,"
"VENDOR AS VENDOR,"
"LOGICAL_LIBRARY_NAME AS LOGICAL_LIBRARY_NAME,"
"TAPE_POOL_NAME AS TAPE_POOL_NAME,"
"ENCRYPTION_KEY AS ENCRYPTION_KEY,"
......@@ -2031,6 +2069,8 @@ common::dataStructures::VidToTapeMap RdbmsCatalogue::getTapesByVid(const std::se
common::dataStructures::Tape tape;
tape.vid = rset.columnString("VID");
tape.mediaType = rset.columnString("MEDIA_TYPE");
tape.vendor = rset.columnString("VENDOR");
tape.logicalLibraryName = rset.columnString("LOGICAL_LIBRARY_NAME");
tape.tapePoolName = rset.columnString("TAPE_POOL_NAME");
tape.encryptionKey = rset.columnOptionalString("ENCRYPTION_KEY");
......@@ -2078,6 +2118,8 @@ common::dataStructures::VidToTapeMap RdbmsCatalogue::getAllTapes() const {
std::string sql =
"SELECT "
"VID AS VID,"
"MEDIA_TYPE AS MEDIA_TYPE,"
"VENDOR AS VENDOR,"
"LOGICAL_LIBRARY_NAME AS LOGICAL_LIBRARY_NAME,"
"TAPE_POOL_NAME AS TAPE_POOL_NAME,"
"ENCRYPTION_KEY AS ENCRYPTION_KEY,"
......@@ -2117,6 +2159,8 @@ common::dataStructures::VidToTapeMap RdbmsCatalogue::getAllTapes() const {
common::dataStructures::Tape tape;
tape.vid = rset.columnString("VID");
tape.mediaType = rset.columnString("MEDIA_TYPE");
tape.vendor = rset.columnString("VENDOR");
tape.logicalLibraryName = rset.columnString("LOGICAL_LIBRARY_NAME");
tape.tapePoolName = rset.columnString("TAPE_POOL_NAME");
tape.encryptionKey = rset.columnOptionalString("ENCRYPTION_KEY");
......@@ -2246,6 +2290,76 @@ optional<common::dataStructures::TapeLog> RdbmsCatalogue::getTapeLogFromRset(con
}
}
//------------------------------------------------------------------------------
// modifyTapeMediaType
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyTapeMediaType(const common::dataStructures::SecurityIdentity &admin,
const std::string &vid, const std::string &mediaType) {
try {
const time_t now = time(nullptr);
const char *const sql =
"UPDATE TAPE SET "
"MEDIA_TYPE = :MEDIA_TYPE,"
"LAST_UPDATE_USER_NAME = :LAST_UPDATE_USER_NAME,"
"LAST_UPDATE_HOST_NAME = :LAST_UPDATE_HOST_NAME,"
"LAST_UPDATE_TIME = :LAST_UPDATE_TIME "
"WHERE "
"VID = :VID";
auto conn = m_connPool.getConn();
auto stmt = conn.createStmt(sql);
stmt.bindString(":MEDIA_TYPE", mediaType);
stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username);
stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host);
stmt.bindUint64(":LAST_UPDATE_TIME", now);
stmt.bindString(":VID", vid);
stmt.executeNonQuery(rdbms::AutocommitMode::AUTOCOMMIT_ON);
if(0 == stmt.getNbAffectedRows()) {
throw exception::UserError(std::string("Cannot modify tape ") + vid + " because it does not exist");
}
} catch(exception::UserError &) {
throw;
} catch(exception::Exception &ex) {
ex.getMessage().str(std::string(__FUNCTION__) + ": " + ex.getMessage().str());
throw;
}
}
//------------------------------------------------------------------------------
// modifyTapeVendor
//------------------------------------------------------------------------------
void RdbmsCatalogue::modifyTapeVendor(const common::dataStructures::SecurityIdentity &admin,
const std::string &vid, const std::string &vendor) {
try {
const time_t now = time(nullptr);
const char *const sql =
"UPDATE TAPE SET "
"VENDOR = :VENDOR,"
"LAST_UPDATE_USER_NAME = :LAST_UPDATE_USER_NAME,"
"LAST_UPDATE_HOST_NAME = :LAST_UPDATE_HOST_NAME,"
"LAST_UPDATE_TIME = :LAST_UPDATE_TIME "
"WHERE "
"VID = :VID";
auto conn = m_connPool.getConn();
auto stmt = conn.createStmt(sql);
stmt.bindString(":VENDOR", vendor);
stmt.bindString(":LAST_UPDATE_USER_NAME", admin.username);
stmt.bindString(":LAST_UPDATE_HOST_NAME", admin.host);
stmt.bindUint64(":LAST_UPDATE_TIME", now);
stmt.bindString(":VID", vid);
stmt.executeNonQuery(rdbms::AutocommitMode::AUTOCOMMIT_ON);
if(0 == stmt.getNbAffectedRows()) {
throw exception::UserError(std::string("Cannot modify tape ") + vid + " because it does not exist");
}
} catch(exception::UserError &) {
throw;
} catch(exception::Exception &ex) {
ex.getMessage().str(std::string(__FUNCTION__) + ": " + ex.getMessage().str());
throw;
}
}
//------------------------------------------------------------------------------
// modifyTapeLogicalLibraryName
//------------------------------------------------------------------------------
......@@ -4749,6 +4863,8 @@ std::list<TapeForWriting> RdbmsCatalogue::getTapesForWriting(const std::string &
const char *const sql =
"SELECT "
"VID AS VID,"
"MEDIA_TYPE AS MEDIA_TYPE,"
"VENDOR AS VENDOR,"
"TAPE_POOL_NAME AS TAPE_POOL_NAME,"
"CAPACITY_IN_BYTES AS CAPACITY_IN_BYTES,"
"DATA_IN_BYTES AS DATA_IN_BYTES,"
......@@ -4770,6 +4886,8 @@ std::list<TapeForWriting> RdbmsCatalogue::getTapesForWriting(const std::string &
while (rset.next()) {
TapeForWriting tape;
tape.vid = rset.columnString("VID");
tape.mediaType = rset.columnString("MEDIA_TYPE");
tape.vendor = rset.columnString("VENDOR");
tape.tapePool = rset.columnString("TAPE_POOL_NAME");
tape.capacityInBytes = rset.columnUint64("CAPACITY_IN_BYTES");
tape.dataOnTapeInBytes = rset.columnUint64("DATA_IN_BYTES");
......
......@@ -284,6 +284,8 @@ public:
void createTape(
const common::dataStructures::SecurityIdentity &admin,
const std::string &vid,
const std::string &mediaType,
const std::string &vendor,
const std::string &logicalLibraryName,
const std::string &tapePoolName,
const uint64_t capacityInBytes,
......@@ -334,6 +336,8 @@ public:
*/
void reclaimTape(const common::dataStructures::SecurityIdentity &admin, const std::string &vid) 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 modifyTapeTapePoolName(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const std::string &tapePoolName) override;
void modifyTapeCapacityInBytes(const common::dataStructures::SecurityIdentity &admin, const std::string &vid, const uint64_t capacityInBytes) override;
......
......@@ -55,6 +55,16 @@ struct TapeForWriting {
* The volume identifier of the tape.
*/
std::string vid;
/**
* The media type of the tape.
*/
std::string mediaType;
/**
* The vendor of the tape.
*/
std::string vendor;
/**
* The name of the tape pool.
......
......@@ -41,6 +41,16 @@ struct TapeSearchCriteria {
*/
optional<std::string> vid;
/**
* The media type of a tape.
*/
optional<std::string> mediaType;
/**
* The vendor of a tape.
*/
optional<std::string> vendor;
/**
* The name of a logical library.
*/
......
/*
* 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 "catalogue/UserSpecifiedAnEmptyStringMediaType.hpp"
namespace cta {
namespace catalogue {
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
UserSpecifiedAnEmptyStringMediaType::UserSpecifiedAnEmptyStringMediaType(const std::string &context,
const bool embedBacktrace): cta::exception::UserError(context, embedBacktrace) {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
UserSpecifiedAnEmptyStringMediaType::~UserSpecifiedAnEmptyStringMediaType() {
}
} // namespace catalogue
} // 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/>.
*/
#pragma once
#include "common/exception/UserError.hpp"
namespace cta {
namespace catalogue {
/**
* User specified an empty string for a media type when this is not permitted.
*/
class UserSpecifiedAnEmptyStringMediaType: public exception::UserError {
public:
/**
* Constructor.
*
* @param context optional context string added to the message
* at initialisation time.
* @param embedBacktrace whether to embed a backtrace of where the
* exception was throw in the message
*/
UserSpecifiedAnEmptyStringMediaType(const std::string &context = "", const bool embedBacktrace = true);
/**
* Destructor.
*/
~UserSpecifiedAnEmptyStringMediaType() override;
}; // class UserSpecifiedAnEmptyStringMediaType
} // namespace catalogue
} // 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 "catalogue/UserSpecifiedAnEmptyStringVendor.hpp"
namespace cta {
namespace catalogue {
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
UserSpecifiedAnEmptyStringVendor::UserSpecifiedAnEmptyStringVendor(const std::string &context,
const bool embedBacktrace): cta::exception::UserError(context, embedBacktrace) {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
UserSpecifiedAnEmptyStringVendor::~UserSpecifiedAnEmptyStringVendor() {
}
} // namespace catalogue
} // 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/>.
*/
#pragma once
#include "common/exception/UserError.hpp"
namespace cta {
namespace catalogue {
/**
* User specified an empty string for a vendor when this is not permitted.
*/
class UserSpecifiedAnEmptyStringVendor: public exception::UserError {
public:
/**
* Constructor.
*
* @param context optional context string added to the message
* at initialisation time.
* @param embedBacktrace whether to embed a backtrace of where the
* exception was throw in the message
*/
UserSpecifiedAnEmptyStringVendor(const std::string &context = "", const bool embedBacktrace = true);
/**
* Destructor.
*/
~UserSpecifiedAnEmptyStringVendor() override;
}; // class UserSpecifiedAnEmptyStringVendor
} // namespace catalogue
} // namespace cta
......@@ -73,6 +73,8 @@ CREATE TABLE LOGICAL_LIBRARY(
);
CREATE TABLE TAPE(
VID VARCHAR(100) CONSTRAINT TAPE_V_UN NOT NULL,
MEDIA_TYPE VARCHAR(100) CONSTRAINT TAPE_MT_NN NOT NULL,
VENDOR VARCHAR(100) CONSTRAINT TAPE_V2_NN NOT NULL,
LOGICAL_LIBRARY_NAME VARCHAR(100) CONSTRAINT TAPE_LLN_UN NOT NULL,
TAPE_POOL_NAME VARCHAR(100) CONSTRAINT TAPE_TPN_UN NOT NULL,
ENCRYPTION_KEY VARCHAR(100),
......
......@@ -298,6 +298,7 @@ const std::map<std::string, OptionString::Key> strOptions = {
{ "--input", OptionString::INPUT },
{ "--instance", OptionString::INSTANCE },
{ "--logicallibrary", OptionString::LOGICAL_LIBRARY },
{ "--mediatype", OptionString::MEDIA_TYPE },
{ "--mountpolicy", OptionString::MOUNT_POLICY },
{ "--output", OptionString::OUTPUT },
{ "--owner", OptionString::OWNER },
......@@ -305,6 +306,7 @@ const std::map<std::string, OptionString::Key> strOptions = {