Skip to content
Snippets Groups Projects
Commit 91a0438d authored by Steven Murray's avatar Steven Murray
Browse files

Added the UserRequest class and its sub-classes

parent 6337f975
Branches
Tags
No related merge requests found
Showing
with 739 additions and 2 deletions
......@@ -10,8 +10,11 @@ set (MIDDLE_TIER_LIB_SRC_FILES
cta/ArchivalJobQueues.cpp
cta/ArchivalJobState.cpp
cta/ArchivalMount.cpp
cta/ArchivalRequest.cpp
cta/ArchiveRoute.cpp
cta/ArchiveRouteId.cpp
cta/ArchiveToDirRequest.cpp
cta/ArchiveToFileRequest.cpp
cta/DirectoryEntry.cpp
cta/DirectoryIterator.cpp
cta/DiskException.cpp
......@@ -29,6 +32,9 @@ set (MIDDLE_TIER_LIB_SRC_FILES
cta/RetrievalJobQueues.cpp
cta/RetrievalJobState.cpp
cta/RetrievalMount.cpp
cta/RetrievalRequest.cpp
cta/RetrieveToDirRequest.cpp
cta/RetrieveToFileRequest.cpp
cta/SecurityIdentity.cpp
cta/SqliteDatabase.cpp
cta/SqliteMiddleTierAdmin.cpp
......@@ -38,6 +44,7 @@ set (MIDDLE_TIER_LIB_SRC_FILES
cta/TapeException.cpp
cta/TapePool.cpp
cta/UserIdentity.cpp
cta/UserRequest.cpp
cta/Utils.cpp
cta/Vfs.cpp)
......
#include "cta/ArchivalRequest.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::ArchivalRequest::ArchivalRequest() {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::ArchivalRequest::~ArchivalRequest() throw() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::ArchivalRequest::ArchivalRequest(const std::string &tapePoolName,
const uint64_t priority):
m_tapePoolName(tapePoolName),
m_priority(priority) {
}
//------------------------------------------------------------------------------
// getTapePoolName
//------------------------------------------------------------------------------
const std::string &cta::ArchivalRequest::getTapePoolName() const throw() {
return m_tapePoolName;
}
//------------------------------------------------------------------------------
// getTapePoolName
//------------------------------------------------------------------------------
uint64_t cta::ArchivalRequest::getPriority() const throw() {
return m_priority;
}
#pragma once
#include "cta/UserRequest.hpp"
#include <stdint.h>
namespace cta {
/**
* Abstract class representing a user request to archive some data.
*/
class ArchivalRequest: public UserRequest {
public:
/**
* Constructor.
*/
ArchivalRequest();
/**
* Destructor.
*/
virtual ~ArchivalRequest() throw() = 0;
/**
* Constructor.
*
* @param tapePoolName The name of the destination tape pool.
* @param priority The priority of the request.
*/
ArchivalRequest(const std::string &tapePoolName, const uint64_t priority);
/**
* Returns the name of the destination tape pool.
*
* @return The name of the destination tape pool.
*/
const std::string &getTapePoolName() const throw();
/**
* Returns the priority of the request.
*
* @return The priority of the request.
*/
uint64_t getPriority() const throw();
private:
/**
* The name of the destination tape pool.
*/
std::string m_tapePoolName;
/**
* The priority of the request.
*/
uint64_t m_priority;
}; // class ArchivalRequest
} // namespace cta
#pragma once
namespace cta {
class ArchivalRequestHandler {
public:
void createArchivalRequest();
}; // class ArchivalRequestHandler
} // namespace cta
#include "cta/ArchiveToDirRequest.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::ArchiveToDirRquest::ArchiveToDirRquest() {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::ArchiveToDirRquest::~ArchiveToDirRquest() throw() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::ArchiveToDirRquest::ArchiveToDirRquest(const std::string &archiveDir):
m_archiveDir(archiveDir) {
}
//------------------------------------------------------------------------------
// getArchiveToFileRequests
//------------------------------------------------------------------------------
const std::list<cta::ArchiveToFileRequest> &cta::ArchiveToDirRquest::
getArchiveToFileRequests() const throw() {
return m_archiveToFileRequests;
}
//------------------------------------------------------------------------------
// getArchiveToFileRequests
//------------------------------------------------------------------------------
std::list<cta::ArchiveToFileRequest> &cta::ArchiveToDirRquest::
getArchiveToFileRequests() throw() {
return m_archiveToFileRequests;
}
#pragma once
#include "cta/ArchivalRequest.hpp"
#include "cta/ArchiveToFileRequest.hpp"
#include <list>
#include <string>
namespace cta {
/**
* Class representing a user request to archive one or more remote files to an
* archive directory.
*/
class ArchiveToDirRquest: public ArchivalRequest {
public:
/**
* Constructor.
*/
ArchiveToDirRquest();
/**
* Destructor.
*/
~ArchiveToDirRquest() throw();
/**
* Constructor.
*
* @param archiveDir The full path of the destination archive directory.
*/
ArchiveToDirRquest(const std::string &archiveDir);
/**
* Returns the full path of the destination archive directory.
*
* @return The full path of the destination archive directory.
*/
const std::string &getArchiveDir() const throw();
/**
* Returns the list of the individual archive to individual file requests
* that make up this archive to directory request.
*
* @return The list of the individual archive to file requests that make up
* this archive to directory request.
*/
const std::list<ArchiveToFileRequest> &getArchiveToFileRequests() const
throw();
/**
* Returns the list of the individual archive to file requests that make up
* this archive to directory request.
*
* @return The list of the individual archive to file requests that make up
* this archive to directory request.
*/
std::list<ArchiveToFileRequest> &getArchiveToFileRequests() throw();
private:
/**
* The full path of the destination archive directory.
*/
std::string m_archiveDir;
/**
* The list of the individual archive to file requests that make up this
* archive to directory request.
*/
std::list<ArchiveToFileRequest> m_archiveToFileRequests;
}; // class ArchiveToDirRquest
} // namespace cta
#include "cta/ArchiveToFileRequest.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::ArchiveToFileRequest::ArchiveToFileRequest() {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::ArchiveToFileRequest::~ArchiveToFileRequest() throw() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::ArchiveToFileRequest::ArchiveToFileRequest(const std::string &remoteFile,
const std::string &archiveFile, const uint32_t nbCopies):
m_remoteFile(remoteFile),
m_archiveFile(archiveFile),
m_nbCopies(nbCopies) {
}
//------------------------------------------------------------------------------
// getRemoteFile
//------------------------------------------------------------------------------
const std::string &cta::ArchiveToFileRequest::getRemoteFile() const throw() {
return m_remoteFile;
}
//------------------------------------------------------------------------------
// getArchiveFile
//------------------------------------------------------------------------------
const std::string &cta::ArchiveToFileRequest::getArchiveFile() const throw() {
return m_archiveFile;
}
//------------------------------------------------------------------------------
// getNbCopies
//------------------------------------------------------------------------------
uint32_t cta::ArchiveToFileRequest::getNbCopies() const throw() {
return m_nbCopies;
}
#pragma once
#include "cta/ArchivalRequest.hpp"
#include <stdint.h>
#include <string>
namespace cta {
/**
* Class representing a user request to archive to a single remote file to a
* single destination archive file.
*/
class ArchiveToFileRequest: public ArchivalRequest {
public:
/**
* Constructor.
*/
ArchiveToFileRequest();
/**
* Destructor.
*/
~ArchiveToFileRequest() throw();
/**
* Constructor.
*
* @param remoteFile The URL of the source remote file to be archived.
* @param archiveFile The full path of the destination archive file.
* @param nbCopies The number of archive copies to be created.
*/
ArchiveToFileRequest(const std::string &remoteFile,
const std::string &archiveFile, const uint32_t nbCopies);
/**
* Returns the URL of the source remote file to be archived.
*
* @return The URL of the source remote file to be archived.
*/
const std::string &getRemoteFile() const throw();
/**
* Returns the full path of the destination archive file.
*
* @return The full path of the destination archive file.
*/
const std::string &getArchiveFile() const throw();
/**
* Returns the number of archive copies to be created.
*
* @return The number of archive copies to be created.
*/
uint32_t getNbCopies() const throw();
private:
/**
* The URL of the destination remote file to be archived.
*/
std::string m_remoteFile;
/**
* The full path of the source archive file.
*/
std::string m_archiveFile;
/**
* The number of archive copies to be created.
*/
uint32_t m_nbCopies;
}; // class ArchiveToFileRequest
} // namespace cta
......@@ -80,8 +80,8 @@ public:
*
* @param mountId The identifier of the mount.
*/
virtual std::list<RetrievalJob> getNextJobsForMount(const std::string &mountId)
= 0;
virtual std::list<RetrievalJob> getNextJobsForMount(
const std::string &mountId) = 0;
/**
* Requests this object to execute any time dependent and asynchronous logic.
......
#include "cta/RetrievalRequest.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::RetrievalRequest::RetrievalRequest() {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::RetrievalRequest::~RetrievalRequest() throw() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::RetrievalRequest::RetrievalRequest(const uint64_t priority):
m_priority(priority) {
}
//------------------------------------------------------------------------------
// getPriority
//------------------------------------------------------------------------------
uint64_t cta::RetrievalRequest::getPriority() const throw() {
return m_priority;
}
#pragma once
#include "cta/UserRequest.hpp"
#include <stdint.h>
namespace cta {
/**
* Abstract class representing a user request to retrieve some data.
*/
class RetrievalRequest: public UserRequest {
public:
/**
* Constructor.
*/
RetrievalRequest();
/**
* Destructor.
*/
virtual ~RetrievalRequest() throw();
/**
* Constructor.
*
* @param priority The priority of the request.
*/
RetrievalRequest(const uint64_t priority);
/**
* Returns the priority of the request.
*
* @return The priority of the request.
*/
uint64_t getPriority() const throw();
private:
/**
* The priority of the request.
*/
uint64_t m_priority;
}; // class RetrievalRequest
} // namespace cta
#include "cta/RetrieveToDirRequest.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::RetrieveToDirRquest::RetrieveToDirRquest() {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::RetrieveToDirRquest::~RetrieveToDirRquest() throw() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::RetrieveToDirRquest::RetrieveToDirRquest(const std::string &remoteDir):
m_remoteDir(remoteDir) {
}
//------------------------------------------------------------------------------
// getRemoteDir
//------------------------------------------------------------------------------
const std::string &cta::RetrieveToDirRquest::getRemoteDir() const throw() {
return m_remoteDir;
}
//------------------------------------------------------------------------------
// getRetrieveToFileRequests
//------------------------------------------------------------------------------
const std::list<cta::RetrieveToFileRequest> &cta::RetrieveToDirRquest::
getRetrieveToFileRequests() const throw() {
return m_retrieveToFileRequests;
}
//------------------------------------------------------------------------------
// getRetrieveToFileRequests
//------------------------------------------------------------------------------
std::list<cta::RetrieveToFileRequest> &cta::RetrieveToDirRquest::
getRetrieveToFileRequests() throw() {
return m_retrieveToFileRequests;
}
#pragma once
#include "cta/RetrievalRequest.hpp"
#include "cta/RetrieveToFileRequest.hpp"
#include <list>
#include <string>
namespace cta {
/**
* Class representing a user request to retrieve one or more archived files to a
* remote directory.
*/
class RetrieveToDirRquest: public RetrievalRequest {
public:
/**
* Constructor.
*/
RetrieveToDirRquest();
/**
* Destructor.
*/
~RetrieveToDirRquest() throw();
/**
* Constructor.
*
* @param remoteDir The URL of the destination remote directory.
*/
RetrieveToDirRquest(const std::string &remoteDir);
/**
* Returns the URL of the destination remote directory.
*
* @return The URL of the destination remote directory.
*/
const std::string &getRemoteDir() const throw();
/**
* Returns the list of the individual retrieve to file requests that make up
* this retrieve to directory request.
*
* @return the list of the individual retrieve to file requests that make up
* this retrieve to directory request.
*/
const std::list<RetrieveToFileRequest> &getRetrieveToFileRequests() const
throw();
/**
* Returns the list of the individual retrieve to file requests that make up
* this retrieve to directory request.
*
* @return the list of the individual retrieve to file requests that make up
* this retrieve to directory request.
*/
std::list<RetrieveToFileRequest> &getRetrieveToFileRequests() throw();
private:
/**
* The URL of the destination remote directory.
*/
std::string m_remoteDir;
/**
* The list of the individual retrieve to file requests that make up this
* retrieve to directory request.
*/
std::list<RetrieveToFileRequest> m_retrieveToFileRequests;
}; // class RetrieveToDirRquest
} // namespace cta
#include "cta/RetrieveToFileRequest.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::RetrieveToFileRequest::RetrieveToFileRequest() {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::RetrieveToFileRequest::~RetrieveToFileRequest() throw() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::RetrieveToFileRequest::RetrieveToFileRequest(const std::string &archiveFile,
const std::string &remoteFile):
m_archiveFile(archiveFile),
m_remoteFile(remoteFile) {
}
//------------------------------------------------------------------------------
// getArchiveFile
//------------------------------------------------------------------------------
const std::string &cta::RetrieveToFileRequest::getArchiveFile() const throw() {
return m_archiveFile;
}
//------------------------------------------------------------------------------
// getRemoteFile
//------------------------------------------------------------------------------
const std::string &cta::RetrieveToFileRequest::getRemoteFile() const throw() {
return m_remoteFile;
}
#pragma once
#include "cta/RetrievalRequest.hpp"
#include <string>
namespace cta {
/**
* Class representing a user request to retrieve a single archived file to a
* single remote file.
*/
class RetrieveToFileRequest: public RetrievalRequest {
public:
/**
* Constructor.
*/
RetrieveToFileRequest();
/**
* Destructor.
*/
~RetrieveToFileRequest() throw();
/**
* Constructor.
*
* @param archiveFile The full path of the source archive file.
* @param remoteFile The URL of the destination remote file.
*/
RetrieveToFileRequest(const std::string &archiveFile,
const std::string &remoteFile);
/**
* Returns the full path of the source archive file.
*
* @return The full path of the source archive file.
*/
const std::string &getArchiveFile() const throw();
/**
* Returns the URL of the destination remote file.
*
* @return The URL of the destination remote file.
*/
const std::string &getRemoteFile() const throw();
private:
/**
* The full path of the source archive file.
*/
std::string m_archiveFile;
/**
* The URL of the destination remote file.
*/
std::string m_remoteFile;
}; // class RetrieveToFileRequest
} // namespace cta
#include "cta/UserRequest.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::UserRequest::UserRequest() {
}
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta::UserRequest::UserRequest(const std::string &id,
const SecurityIdentity &user):
m_id(id),
m_user(user) {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
cta::UserRequest::~UserRequest() throw() {
}
//------------------------------------------------------------------------------
// getId
//------------------------------------------------------------------------------
const std::string &cta::UserRequest::getId() const throw() {
return m_id;
}
//------------------------------------------------------------------------------
// getUser
//------------------------------------------------------------------------------
const cta::SecurityIdentity &cta::UserRequest::getUser() const throw() {
return m_user;
}
#pragma once
#include "cta/SecurityIdentity.hpp"
#include <string>
namespace cta {
/**
* Abstract class representing a user request.
*/
class UserRequest {
public:
/**
* Constructor.
*/
UserRequest();
/**
* Destructor.
*/
virtual ~UserRequest() throw();
/**
* Constructor.
*
* @param id The identifier of the request.
* @param user The identity of the user who made the request.
*/
UserRequest(const std::string &id, const SecurityIdentity &user);
/**
* Returns the identifier of the request.
*
* @return The identifier of the request.
*/
const std::string &getId() const throw();
/**
* Returns the identity of the user who made the request.
*
* @return The identity of the user who made the request.
*/
const SecurityIdentity &getUser() const throw();
private:
/**
* The identifier of the request.
*/
std::string m_id;
/**
* The identity of the user who made the request.
*/
SecurityIdentity m_user;
}; // class UserRequest
} // namespace cta
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment