diff --git a/xroot_clients/CTACmd.cpp b/xroot_clients/CTACmd.cpp index 92c390b9bc6633f8df76afeacfa1e8a9b8f7ca02..104d3045b9133e7bf9988f9b5b5dd4aabb2139c9 100644 --- a/xroot_clients/CTACmd.cpp +++ b/xroot_clients/CTACmd.cpp @@ -21,7 +21,9 @@ void CTACmd::usage(std::ostream &os) const throw() { "Usage:\n" "\t" << m_programName << " archive <source_file1> [<source_file2> [<source_file3> [...]]] <destination_path>\n" "\t" << m_programName << " create-storage-class <storage_class_name> <number_of_tape_copies>\n" + "\t" << m_programName << " change-storage-class <directory_name> <storage_class_name>\n" "\t" << m_programName << " delete-storage-class <storage_class_name>\n" + "\t" << m_programName << " list-storage-class\n" "\t" << m_programName << " mkdir <directory_name>\n" "\t" << m_programName << " rmdir <directory_name>\n"; } @@ -30,7 +32,7 @@ void CTACmd::usage(std::ostream &os) const throw() { // main //------------------------------------------------------------------------------ int CTACmd::main(const int argc, char **argv) throw() { - if(argc < 3) { + if(argc < 2) { usage(std::cerr); return 1; } diff --git a/xroot_plugins/CMakeLists.txt b/xroot_plugins/CMakeLists.txt index 1b76e31e46d954cf9ddcc161eca3ff7472b4d17c..5e4ee8eec8b79b90ecb1c836cd6d13f473ed1fa4 100644 --- a/xroot_plugins/CMakeLists.txt +++ b/xroot_plugins/CMakeLists.txt @@ -4,4 +4,4 @@ list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) find_package (xrootd REQUIRED) include_directories (${XROOTD_INCLUDE_DIR} ${XROOTD_PRIVATE_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}) -add_library (XrdProFst MODULE XrdProFilesystem.cpp ParsedArchiveCmdLine.cpp ParsedCreateStorageClassCmdLine.cpp ParsedDeleteStorageClassCmdLine.cpp ParsedMkdirCmdLine.cpp ParsedRmdirCmdLine.cpp ParsedChangeStorageClassCmdLine.cpp) +add_library (XrdProFst MODULE XrdProFilesystem.cpp ParsedArchiveCmdLine.cpp ParsedCreateStorageClassCmdLine.cpp ParsedDeleteStorageClassCmdLine.cpp ParsedListStorageClassCmdLine.cpp ParsedMkdirCmdLine.cpp ParsedRmdirCmdLine.cpp ParsedChangeStorageClassCmdLine.cpp) diff --git a/xroot_plugins/ParsedListStorageClassCmdLine.cpp b/xroot_plugins/ParsedListStorageClassCmdLine.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3cb98be9d6eb50396a74ccb4bd43f8ae77a79500 --- /dev/null +++ b/xroot_plugins/ParsedListStorageClassCmdLine.cpp @@ -0,0 +1,9 @@ +#include "ParsedListStorageClassCmdLine.hpp" + +//------------------------------------------------------------------------------ +// constructor +//------------------------------------------------------------------------------ +ParsedListStorageClassCmdLine::ParsedListStorageClassCmdLine() throw() +{ + +} diff --git a/xroot_plugins/ParsedListStorageClassCmdLine.hpp b/xroot_plugins/ParsedListStorageClassCmdLine.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e52d4d593afca68f577cb2304e0c3507bb7cea1b --- /dev/null +++ b/xroot_plugins/ParsedListStorageClassCmdLine.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include "XrdOuc/XrdOucString.hh" + +#include <list> +#include <string> + +/** + * Data type used to store the results of parsing the list-storage-class command-line. + */ +struct ParsedListStorageClassCmdLine { + + /** + * Constructor. + */ + ParsedListStorageClassCmdLine() throw(); + +}; // struct ParsedListStorageClassCmdLine + diff --git a/xroot_plugins/XrdProFilesystem.cpp b/xroot_plugins/XrdProFilesystem.cpp index 9b71f49d6aa064db3842e08f5981b6e7e0ea0602..4cd594f32462e0c5e7f6f68999172f335948d417 100644 --- a/xroot_plugins/XrdProFilesystem.cpp +++ b/xroot_plugins/XrdProFilesystem.cpp @@ -195,6 +195,21 @@ int XrdProFilesystem::executeDeleteStorageClassCommand(ParsedDeleteStorageClassC return SFS_OK; } +//------------------------------------------------------------------------------ +// parseListStorageClassRequest +//------------------------------------------------------------------------------ +int XrdProFilesystem::parseListStorageClassRequest(const XrdSfsFSctl &args, ParsedListStorageClassCmdLine &cmdLine, XrdOucErrInfo &eInfo) { + return SFS_OK; +} + +//------------------------------------------------------------------------------ +// executeListStorageClassCommand +//------------------------------------------------------------------------------ +int XrdProFilesystem::executeListStorageClassCommand(ParsedListStorageClassCmdLine &cmdLine, XrdOucErrInfo &eInfo) { + std::cout << "list-storage-class request received:\n"; + return SFS_OK; +} + //------------------------------------------------------------------------------ // parseMkdirRequest //------------------------------------------------------------------------------ @@ -301,6 +316,19 @@ int XrdProFilesystem::dispatchRequest(XrdSfsFSctl &args, XrdOucErrInfo &eInfo) { } return SFS_OK; } + else if(strncmp(args.Arg1, "/list-storage-class?", strlen("/list-storage-class?")) == 0) + { + ParsedListStorageClassCmdLine cmdLine; + int checkParse = parseListStorageClassRequest(args, cmdLine, eInfo); + if(SFS_OK!=checkParse) { + return checkParse; + } + int checkExecute = executeListStorageClassCommand(cmdLine, eInfo); + if(SFS_OK!=checkExecute) { + return checkExecute; + } + return SFS_OK; + } else if(strncmp(args.Arg1, "/mkdir?", strlen("/mkdir?")) == 0) { ParsedMkdirCmdLine cmdLine; diff --git a/xroot_plugins/XrdProFilesystem.hpp b/xroot_plugins/XrdProFilesystem.hpp index 2cd194ea4f9b49749c6b19e6e01fa11f1253d950..e1ed5c0b22c775f25290025726c17b7d36b90ddc 100644 --- a/xroot_plugins/XrdProFilesystem.hpp +++ b/xroot_plugins/XrdProFilesystem.hpp @@ -6,6 +6,7 @@ #include "ParsedCreateStorageClassCmdLine.hpp" #include "ParsedDeleteStorageClassCmdLine.hpp" #include "ParsedChangeStorageClassCmdLine.hpp" +#include "ParsedListStorageClassCmdLine.hpp" #include "ParsedMkdirCmdLine.hpp" #include "ParsedRmdirCmdLine.hpp" @@ -128,6 +129,25 @@ protected: */ int executeDeleteStorageClassCommand(ParsedDeleteStorageClassCmdLine &cmdLine, XrdOucErrInfo &eInfo); + /** + * Parses the list-storage-class request into the command line structure + * + * @param args the request string + * @param cmdLine the resulting command line structure + * @param eInfo Error information + * @return SFS_OK in case parsing is done correctly, SFS_ERROR otherwise + */ + int parseListStorageClassRequest(const XrdSfsFSctl &args, ParsedListStorageClassCmdLine &cmdLine, XrdOucErrInfo &eInfo); + + /** + * Executes the command contained within the command line structure + * + * @param cmdLine command to execute + * @param eInfo Error information + * @return SFS_OK in case executed correctly, SFS_ERROR otherwise + */ + int executeListStorageClassCommand(ParsedListStorageClassCmdLine &cmdLine, XrdOucErrInfo &eInfo); + /** * Parses the mkdir request into the command line structure *