Commit 54175510 authored by Eric Cano's avatar Eric Cano
Browse files

Merge branch 'master' of https://git.cern.ch/kerberos/CTA

parents 713e1cd4 34f53883
......@@ -3,7 +3,6 @@ cmake_minimum_required (VERSION 2.6)
set (CLIENT_LIB_SRC_FILES
ArchiveJob.cpp
ClientAPI.cpp
DeviceGroup.cpp
DirectoryEntry.cpp
DirectoryIterator.cpp
Exception.cpp
......@@ -12,7 +11,7 @@ set (CLIENT_LIB_SRC_FILES
FileSystemNode.cpp
FileSystemStorageClass.cpp
FileSystemStorageClasses.cpp
Library.cpp
LogicalLibrary.cpp
MigrationRoute.cpp
MigrationRouteId.cpp
MigrationRoutes.cpp
......
#pragma once
#include "ArchiveJob.hpp"
#include "DeviceGroup.hpp"
#include "DirectoryIterator.hpp"
#include "Library.hpp"
#include "LogicalLibrary.hpp"
#include "MigrationRoute.hpp"
#include "SecurityIdentity.hpp"
#include "StorageClass.hpp"
......@@ -86,7 +85,7 @@ public:
* @param requester The identity of the user requesting the list.
*/
virtual std::list<std::string> getAdminHosts(const SecurityIdentity &requester)
const = 0;
const = 0;
/**
* Creates the specified storage class.
......@@ -130,11 +129,18 @@ public:
* @param requester The identity of the user requesting the creation of the
* tape pool.
* @param name The name of the tape pool.
* @param nbDrives The maximum number of drives that can be concurrently
* assigned to this pool independent of whether they are archiving or
* retrieving files.
* @param nbPartialTapes The maximum number of tapes that can be partially
* full at any moment in time.
* @param comment The comment describing the tape pool.
*/
virtual void createTapePool(
const SecurityIdentity &requester,
const std::string &name,
const uint16_t nbDrives,
const uint32_t nbPartialTapes,
const std::string &comment) = 0;
/**
......@@ -270,63 +276,26 @@ public:
const std::string &dirPath) const = 0;
/**
* Creates a device group with the specified name.
*
* @param requester The identity of the user requesting the creation of the
* device group.
* @param name The name of the device group.
* @param comment The comment describing the device group.
*/
virtual void createDeviceGroup(
const SecurityIdentity &requester,
const std::string &name,
const std::string &comment) = 0;
/**
* Delete the device group with the specified name.
*
* @param requester The identity of the user requesting the deletion of the
* device group.
* @param name The name of the device group.
*/
virtual void deleteDeviceGroup(
const SecurityIdentity &requester,
const std::string &name) = 0;
/**
* Returns the current list of device groups in lexicographical order.
*
* @param requester The identity of the user requesting the list.
* @return The current list of device groups in lexicographical order.
*/
virtual std::list<DeviceGroup> getDeviceGroups(
const SecurityIdentity &requester) = 0;
/**
* Creates a library with the specified name and device group.
* Creates a logical library with the specified name and device group.
*
* @param requester The identity of the user requesting the creation of the
* library.
* @param name The name of the library.
* @param deviceGroupName The name of the device group to which the library
* belongs. An empty string means that the library does not belong to any
* device group.
* @param comment The comment describing the library.
* logical library.
* @param name The name of the logical library.
* @param comment The comment describing the logical library.
*/
virtual void createLibrary(
virtual void createLogicalLibrary(
const SecurityIdentity &requester,
const std::string &name,
const std::string &deviceGroupName,
const std::string &comment) = 0;
/**
* Deletes the library with the specified name.
* Deletes the logical library with the specified name.
*
* @param requester The identity of the user requesting the deletion of the
* library.
* @param name The name of the library.
* logical library.
* @param name The name of the logical library.
*/
virtual void deleteLibrary(
virtual void deleteLogicalLibrary(
const SecurityIdentity &requester,
const std::string &name) = 0;
......@@ -336,8 +305,8 @@ public:
* @param requester The identity of the user requesting the list.
* @return The current list of libraries in lexicographical order.
*/
virtual std::list<Library> getLibraries(
const SecurityIdentity &requester) = 0;
virtual std::list<LogicalLibrary> getLogicalLibraries(
const SecurityIdentity &requester) const = 0;
/**
* Archives the specified list of source files to the specified destination
......@@ -367,13 +336,13 @@ public:
* group.
*
* @param requester The identity of the user requesting the list.
* @param deviceGroupName The name of the device groupdevice group.
* @param tapePoolName The name of the tape pool.
* @return The list of jobs sorted by creation time in ascending order
* (oldest first).
*/
virtual std::list<ArchiveJob> getArchiveJobs(
const SecurityIdentity &requester,
const std::string &deviceGroupName) = 0;
const std::string &tapePoolName) = 0;
}; // class ClientAPI
......
#include "Library.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::Library::Library():
m_creationTime(time(NULL)) {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::Library::Library(
const std::string &name,
const std::string &deviceGroupName,
const UserIdentity &creator,
const std::string &comment):
m_name(name),
m_deviceGroupName(deviceGroupName),
m_creationTime(time(NULL)),
m_creator(creator),
m_comment(comment) {
}
//------------------------------------------------------------------------------
// getName
//------------------------------------------------------------------------------
const std::string &cta::Library::getName() const throw() {
return m_name;
}
//------------------------------------------------------------------------------
// getDeviceGroupName
//------------------------------------------------------------------------------
const std::string &cta::Library::getDeviceGroupName() const throw() {
return m_deviceGroupName;
}
//------------------------------------------------------------------------------
// getCreationTime
//------------------------------------------------------------------------------
time_t cta::Library::getCreationTime() const throw() {
return m_creationTime;
}
//------------------------------------------------------------------------------
// getCreator
//------------------------------------------------------------------------------
const cta::UserIdentity &cta::Library::getCreator()
const throw() {
return m_creator;
}
//------------------------------------------------------------------------------
// getComment
//------------------------------------------------------------------------------
const std::string &cta::Library::getComment() const throw() {
return m_comment;
}
#pragma once
#include "UserIdentity.hpp"
#include <string>
namespace cta {
/**
* Class representing a library.
*/
class Library {
public:
/**
* Constructor.
*/
Library();
/**
* Constructor.
*
* @param name The name of the library.
* @param deviceGroupName The name of the device group to which the library
* belongs. An empty string means the library does not belong to any device
* group.
* @param creator The identity of the user that created the library.
* @param comment The comment describing the library.
*/
Library(
const std::string &name,
const std::string &deviceGroupName,
const UserIdentity &creator,
const std::string &comment);
/**
* Returns the name of the library.
*
* @return The name of the library.
*/
const std::string &getName() const throw();
/**
* Returns the name of the device group.
*
* @return The name of the device group.
*/
const std::string &getDeviceGroupName() const throw();
/**
* Returns the time when the library was created.
*
* @return The time when the library was created.
*/
time_t getCreationTime() const throw();
/**
* Returns the identity of the user that created the library.
*
* @return The identity of the user that created the library.
*/
const UserIdentity &getCreator() const throw();
/**
* Returns the comment describing the library.
*
* @return The comment describing the library.
*/
const std::string &getComment() const throw();
private:
/**
* The name of the library.
*/
std::string m_name;
/**
* The name of the device group to which the library belongs. An empty
* string means the library does not belong to any device group.
*/
std::string m_deviceGroupName;
/**
* The time when the library was created.
*/
time_t m_creationTime;
/**
* The identity of the user that created the library.
*/
UserIdentity m_creator;
/**
* Comment describing the library.
*/
std::string m_comment;
}; // class Library
} // namespace cta
#include "DeviceGroup.hpp"
#include "LogicalLibrary.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::DeviceGroup::DeviceGroup():
cta::LogicalLibrary::LogicalLibrary():
m_creationTime(time(NULL)) {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::DeviceGroup::DeviceGroup(
cta::LogicalLibrary::LogicalLibrary(
const std::string &name,
const UserIdentity &creator,
const std::string &comment):
......@@ -23,21 +23,21 @@ cta::DeviceGroup::DeviceGroup(
//------------------------------------------------------------------------------
// getName
//------------------------------------------------------------------------------
const std::string &cta::DeviceGroup::getName() const throw() {
const std::string &cta::LogicalLibrary::getName() const throw() {
return m_name;
}
//------------------------------------------------------------------------------
// getCreationTime
//------------------------------------------------------------------------------
time_t cta::DeviceGroup::getCreationTime() const throw() {
time_t cta::LogicalLibrary::getCreationTime() const throw() {
return m_creationTime;
}
//------------------------------------------------------------------------------
// getCreator
//------------------------------------------------------------------------------
const cta::UserIdentity &cta::DeviceGroup::getCreator()
const cta::UserIdentity &cta::LogicalLibrary::getCreator()
const throw() {
return m_creator;
}
......@@ -45,6 +45,6 @@ const cta::UserIdentity &cta::DeviceGroup::getCreator()
//------------------------------------------------------------------------------
// getComment
//------------------------------------------------------------------------------
const std::string &cta::DeviceGroup::getComment() const throw() {
const std::string &cta::LogicalLibrary::getComment() const throw() {
return m_comment;
}
......@@ -7,78 +7,85 @@
namespace cta {
/**
* Class representing a device group.
* Class representing a logical library.
*/
class DeviceGroup {
class LogicalLibrary {
public:
/**
* Constructor.
*/
DeviceGroup();
LogicalLibrary();
/**
* Constructor.
*
* @param name The name of the device group.
* @param creator The identity of the user that created the device group.
* @param comment The comment describing the device group.
* @param name The name of the logical library.
* @param creator The identity of the user that created the logical library.
* @param comment The comment describing the logical library.
*/
DeviceGroup(
LogicalLibrary(
const std::string &name,
const UserIdentity &creator,
const std::string &comment);
/**
* Returns the name of the logical library.
*
* @return The name of the logical library.
*/
const std::string &getName() const throw();
/**
* Returns the name of the device group.
*
* @return The name of the device group.
*/
const std::string &getName() const throw();
const std::string &getDeviceGroupName() const throw();
/**
* Returns the time when the device group was created.
* Returns the time when the logical library was created.
*
* @return The time when the device group was created.
* @return The time when the logical library was created.
*/
time_t getCreationTime() const throw();
/**
* Returns the identity of the user that created the device group.
* Returns the identity of the user that created the logical library.
*
* @return The identity of the user that created the device group.
* @return The identity of the user that created the logical library.
*/
const UserIdentity &getCreator() const throw();
/**
* Returns the comment describing the device group.
* Returns the comment describing the logical library.
*
* @return The comment describing the device group.
* @return The comment describing the logical library.
*/
const std::string &getComment() const throw();
private:
/**
* The name of the device group.
* The name of the logical library.
*/
std::string m_name;
/**
* The time when the device group was created.
* The time when the logical library was created.
*/
time_t m_creationTime;
/**
* The identity of the user that created the device group.
* The identity of the user that created the logical library.
*/
UserIdentity m_creator;
/**
* Comment describing the device group.
* Comment describing the logical library.
*/
std::string m_comment;
}; // class DeviceGroup
}; // class LogicalLibrary
} // namespace cta
......@@ -167,17 +167,21 @@ std::list<cta::StorageClass> cta::MockClientAPI::getStorageClasses(
//------------------------------------------------------------------------------
// createTapePool
//------------------------------------------------------------------------------
void cta::MockClientAPI::createTapePool(const SecurityIdentity &requester,
const std::string &name, const std::string &comment) {
checkTapePoolDoesNotAlreadyExists(name);
TapePool tapePool(name, requester.user, comment);
void cta::MockClientAPI::createTapePool(
const SecurityIdentity &requester,
const std::string &name,
const uint16_t nbDrives,
const uint32_t nbPartialTapes,
const std::string &comment) {
checkTapePoolDoesNotAlreadyExist(name);
TapePool tapePool(name, nbDrives, nbPartialTapes,requester.user, comment);
m_tapePools[name] = tapePool;
}
//------------------------------------------------------------------------------
// checkTapePoolDoesNotAlreadyExists
// checkTapePoolDoesNotAlreadyExist
//------------------------------------------------------------------------------
void cta::MockClientAPI::checkTapePoolDoesNotAlreadyExists(
void cta::MockClientAPI::checkTapePoolDoesNotAlreadyExist(
const std::string &name) const {
std::map<std::string, TapePool>::const_iterator itor = m_tapePools.find(name);
if(itor != m_tapePools.end()) {
......@@ -612,55 +616,28 @@ std::string cta::MockClientAPI::getDirectoryStorageClass(
}
//------------------------------------------------------------------------------
// createDeviceGroup
// createLogicalLibrary
//------------------------------------------------------------------------------
void cta::MockClientAPI::createDeviceGroup(
void cta::MockClientAPI::createLogicalLibrary(
const SecurityIdentity &requester,
const std::string &name,
const std::string &comment) {
}
//------------------------------------------------------------------------------
// deleteDeviceGroup
// deleteLogicalLibrary
//------------------------------------------------------------------------------
void cta::MockClientAPI::deleteDeviceGroup(
void cta::MockClientAPI::deleteLogicalLibrary(
const SecurityIdentity &requester,
const std::string &name) {
}
//------------------------------------------------------------------------------
// getDeviceGroups
//------------------------------------------------------------------------------
std::list<cta::DeviceGroup> cta::MockClientAPI::getDeviceGroups(
const SecurityIdentity &requester) {
std::list<DeviceGroup> groups;
return groups;
}
// getLogicalLibraries
//------------------------------------------------------------------------------
// createLibrary
//------------------------------------------------------------------------------
void cta::MockClientAPI::createLibrary(
const SecurityIdentity &requester,
const std::string &name,
const std::string &deviceGroupName,
const std::string &comment) {
}
//------------------------------------------------------------------------------
// deleteLibrary
//------------------------------------------------------------------------------
void cta::MockClientAPI::deleteLibrary(
const SecurityIdentity &requester,
const std::string &name) {
}
//------------------------------------------------------------------------------
// getLibraries
//------------------------------------------------------------------------------
std::list<cta::Library> cta::MockClientAPI::getLibraries(
const SecurityIdentity &requester) {
std::list<Library> libraries;
std::list<cta::LogicalLibrary> cta::MockClientAPI::getLogicalLibraries(
const SecurityIdentity &requester) const {
std::list<LogicalLibrary> libraries;
return libraries;
}
......@@ -740,7 +717,7 @@ void cta::MockClientAPI::checkUserIsAuthorisedToArchive(
//------------------------------------------------------------------------------
std::list<cta::ArchiveJob> cta::MockClientAPI::getArchiveJobs(
const SecurityIdentity &requester,
const std::string &deviceGroupName) {
const std::string &tapePoolName) {
std::list<cta::ArchiveJob> jobs;
return jobs;
}
......@@ -129,11 +129,18 @@ public:
* @param requester The identity of the user requesting the creation of the
* tape pool.
* @param name The name of the tape pool.
* @param nbDrives The maximum number of drives that can be concurrently
* assigned to this pool independent of whether they are archiving or
* retrieving files.
* @param nbPartialTapes The maximum number of tapes that can be partially
* full at any moment in time.
* @param comment The comment describing the tape pool.
*/
void createTapePool(
const SecurityIdentity &requester,
const std::string &name,
const uint16_t nbDrives,
const uint32_t nbPartialTapes,
const std::string &comment);
/**
......@@ -269,63 +276,26 @@ public:
const std::string &dirPath) const;
/**
* Creates a device group with the specified name.
* Creates a logical library with the specified name and device group.
*
* @param requester The identity of the user requesting the creation of the
* device group.
* @param name The name of the device group.
* @param comment The comment describing the device group.
* logical library.
* @param name The name of the logical library.
* @param comment The comment describing the logical library.
*/
void createDeviceGroup(
void createLogicalLibrary(
const SecurityIdentity &requester,
const std::string &name,
const std::string &comment);
/**
* Deletes the device group with the specified name.
* Deletes the logical library with the specified name.
*
* @param requester The identity of the user requesting the deletion of the
* device group.
* @param name The name of the device group.
* logical library.
* @param name The name of the logical library.
*/
void deleteDeviceGroup(
const SecurityIdentity &requester,
const std::string &name);