diff --git a/catalogue/CMakeLists.txt b/catalogue/CMakeLists.txt index 2e12c3bf6e40255a0af88cf4a583a7a8cfffdcf6..00c806ad778631e0a0647bd464d69a0a69762366 100644 --- a/catalogue/CMakeLists.txt +++ b/catalogue/CMakeLists.txt @@ -43,12 +43,7 @@ file (GLOB CATALOGUE_LIB_SRC_FILES CmdLineTool.cpp DriveConfig.cpp dummy/*.cpp - InMemoryCatalogue.cpp - InMemoryCatalogueFactory.cpp - PostgresqlCatalogueFactory.cpp rdbms/*.cpp - rdbms/postgres/*.cpp - rdbms/sqlite/*.cpp retrywrappers/*.cpp TapeDrivesCatalogueState.cpp TapeFileWritten.cpp @@ -57,14 +52,6 @@ file (GLOB CATALOGUE_LIB_SRC_FILES TapePool.cpp ) -if (OCCI_SUPPORT) - file (GLOB CATALOGUE_LIB_SRC_FILES - ${CATALOGUE_LIB_SRC_FILES} - OracleCatalogueFactory.cpp - rdbms/oracle/*.cpp - ) -endif() - # It use set because it was giving linking error set (CATALOGUE_LIB_SRC_FILES ${CATALOGUE_LIB_SRC_FILES} @@ -73,6 +60,72 @@ set (CATALOGUE_LIB_SRC_FILES SqliteCatalogueSchema.cpp ) +# OCCI +if (OCCI_SUPPORT) + file (GLOB CATALOGUE_OCCI_LIB_SRC_FILES + OracleCatalogueFactory.cpp + rdbms/oracle/*.cpp + ) + + add_library (ctacatalogueocci SHARED + ${CATALOGUE_OCCI_LIB_SRC_FILES}) + set_property(TARGET ctacatalogueocci PROPERTY SOVERSION "${CTA_SOVERSION}") + set_property(TARGET ctacatalogueocci PROPERTY VERSION "${CTA_LIBVERSION}") + + target_link_libraries (ctacatalogueocci + ctardbmsocci + ) + + install(TARGETS ctacatalogueocci DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) +endif() + +# IN_MEMORY +file (GLOB CATALOGUE_IN_MEMORY_LIB_SRC_FILES + InMemoryCatalogue.cpp + InMemoryCatalogueFactory.cpp +) + +add_library (ctacatalogueinmemory SHARED + ${CATALOGUE_IN_MEMORY_LIB_SRC_FILES}) +set_property(TARGET ctacatalogueinmemory PROPERTY SOVERSION "${CTA_SOVERSION}") +set_property(TARGET ctacatalogueinmemory PROPERTY VERSION "${CTA_LIBVERSION}") + +install(TARGETS ctacatalogueinmemory DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) + +# SQLITE - Sqlite file based databases are not supported +file (GLOB CATALOGUE_SQLITE_LIB_SRC_FILES + rdbms/sqlite/*.cpp +) + +add_library (ctacataloguesqlite SHARED + ${CATALOGUE_SQLITE_LIB_SRC_FILES}) +set_property(TARGET ctacataloguesqlite PROPERTY SOVERSION "${CTA_SOVERSION}") +set_property(TARGET ctacataloguesqlite PROPERTY VERSION "${CTA_LIBVERSION}") + +target_link_libraries (ctacataloguesqlite + ctardbmssqlite +) + +install(TARGETS ctacataloguesqlite DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) + +# POSTGRES +file (GLOB CATALOGUE_POSTGRES_LIB_SRC_FILES + PostgresqlCatalogueFactory.cpp + rdbms/postgres/*.cpp +) + +add_library (ctacataloguepostrgres SHARED + ${CATALOGUE_POSTGRES_LIB_SRC_FILES}) +set_property(TARGET ctacataloguepostrgres PROPERTY SOVERSION "${CTA_SOVERSION}") +set_property(TARGET ctacataloguepostrgres PROPERTY VERSION "${CTA_LIBVERSION}") + +target_link_libraries (ctacataloguepostrgres + ctardbmspostgres +) + +install(TARGETS ctacataloguepostrgres DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) + +# COMMON add_library (ctacatalogue SHARED ${CATALOGUE_LIB_SRC_FILES} ) @@ -85,8 +138,16 @@ install (TARGETS ctacatalogue DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) target_link_libraries (ctacatalogue ctacommon ctardbms + ctacataloguepostrgres + ctacatalogueinmemory + ctacataloguesqlite ) +if (OCCI_SUPPORT) + target_link_libraries (ctacatalogue ctacatalogueocci +) +endif() + add_custom_command( OUTPUT AllCatalogueSchema.hpp COMMAND ${CMAKE_COMMAND} -E env "LC_ALL=C" sh ${CMAKE_CURRENT_SOURCE_DIR}/CreateAllSchemasCppFile.sh ${CMAKE_CURRENT_SOURCE_DIR} @@ -242,9 +303,6 @@ install (TARGETS ctaschemachecker DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) target_link_libraries (cta-catalogue-schema-create ctacatalogue) set_property(TARGET cta-catalogue-schema-create APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property(TARGET cta-catalogue-schema-create APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif() install (TARGETS cta-catalogue-schema-create DESTINATION /usr/bin) install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-catalogue-schema-create.1cta DESTINATION /usr/share/man/man1) @@ -263,9 +321,6 @@ add_executable(cta-catalogue-schema-drop DropSchemaCmdMain.cpp) target_link_libraries (cta-catalogue-schema-drop ctacatalogue ctadropschemacmd) set_property(TARGET cta-catalogue-schema-drop APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property(TARGET cta-catalogue-schema-drop APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif () install (TARGETS cta-catalogue-schema-drop DESTINATION /usr/bin) install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-catalogue-schema-drop.1cta DESTINATION /usr/share/man/man1) @@ -278,9 +333,6 @@ add_executable(cta-catalogue-schema-set-production target_link_libraries (cta-catalogue-schema-set-production ctacatalogue ctaschemachecker) set_property(TARGET cta-catalogue-schema-set-production APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property(TARGET cta-catalogue-schema-set-production APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif () install (TARGETS cta-catalogue-schema-set-production DESTINATION /usr/bin) install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-catalogue-schema-set-production.1cta DESTINATION /usr/share/man/man1) @@ -292,9 +344,6 @@ add_executable(cta-database-poll target_link_libraries (cta-database-poll ctacatalogue) set_property(TARGET cta-database-poll APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property(TARGET cta-database-poll APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif () install (TARGETS cta-database-poll DESTINATION /usr/bin) install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-database-poll.1cta DESTINATION /usr/share/man/man1) @@ -306,9 +355,6 @@ add_executable(cta-catalogue-admin-user-create target_link_libraries(cta-catalogue-admin-user-create ctacatalogue) set_property(TARGET cta-catalogue-admin-user-create APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property(TARGET cta-catalogue-admin-user-create APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif () install(TARGETS cta-catalogue-admin-user-create DESTINATION /usr/bin) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-catalogue-admin-user-create.1cta DESTINATION /usr/share/man/man1) @@ -320,9 +366,6 @@ add_executable(cta-catalogue-schema-verify target_link_libraries(cta-catalogue-schema-verify ctacatalogue ctaschemachecker) set_property(TARGET cta-catalogue-schema-verify APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property(TARGET cta-catalogue-schema-verify APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif () install (TARGETS cta-catalogue-schema-verify DESTINATION /usr/bin) install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-catalogue-schema-verify.1cta DESTINATION /usr/share/man/man1) diff --git a/catalogue/CatalogueFactoryFactory.cpp b/catalogue/CatalogueFactoryFactory.cpp index cd1be2b81290256832830f4bf27f90da5c9f6abe..3c42feec63ab8e76b99969367295dc43a599e83c 100644 --- a/catalogue/CatalogueFactoryFactory.cpp +++ b/catalogue/CatalogueFactoryFactory.cpp @@ -18,16 +18,12 @@ #include <string> #include "catalogue/CatalogueFactoryFactory.hpp" -#include "catalogue/InMemoryCatalogueFactory.hpp" -#include "catalogue/PostgresqlCatalogueFactory.hpp" +#include "catalogue/CatalogueFactory.hpp" #include "common/exception/Exception.hpp" #include "common/exception/NoSupportedDB.hpp" #include "common/log/Logger.hpp" - -#ifdef SUPPORT_OCCI - #include "catalogue/OracleCatalogueFactory.hpp" -#endif - +#include "rdbms/Login.hpp" +#include "plugin-manager/PluginManager.hpp" namespace cta::catalogue { @@ -40,19 +36,44 @@ std::unique_ptr<CatalogueFactory> CatalogueFactoryFactory::create( const uint64_t nbConns, const uint64_t nbArchiveFileListingConns, const uint32_t maxTriesToConnect) { + + static cta::plugin::Manager<cta::catalogue::CatalogueFactory, + cta::plugin::Args< + cta::log::Logger&, + const uint64_t, + const uint64_t, + const uint32_t>, + cta::plugin::Args< + cta::log::Logger&, + const cta::rdbms::Login&, + const uint64_t, + const uint64_t, + const uint32_t>> pm; + try { switch (login.dbType) { case rdbms::Login::DBTYPE_IN_MEMORY: - return std::make_unique<InMemoryCatalogueFactory>(log, nbConns, nbArchiveFileListingConns, maxTriesToConnect); + pm.load("libctacatalogueinmemory.so"); + if (!pm.isRegistered("ctacatalogueinmemory")) { + pm.bootstrap("factory"); + } + return pm.plugin("ctacatalogueinmemory").make("InMemoryCatalogueFactory", log, nbConns, nbArchiveFileListingConns, maxTriesToConnect); case rdbms::Login::DBTYPE_ORACLE: #ifdef SUPPORT_OCCI - return std::make_unique<OracleCatalogueFactory>(log, login, nbConns, nbArchiveFileListingConns, - maxTriesToConnect); + pm.load("libctacatalogueocci.so"); + if (!pm.isRegistered("ctacatalogueocci")) { + pm.bootstrap("factory"); + } + return pm.plugin("ctacatalogueocci").make("OracleCatalogueFactory", log, login, nbConns, nbArchiveFileListingConns, maxTriesToConnect); #else throw exception::NoSupportedDB("Oracle Catalogue Schema is not supported. Compile CTA with Oracle support."); #endif case rdbms::Login::DBTYPE_POSTGRESQL: - return std::make_unique<PostgresqlCatalogueFactory>(log, login, nbConns, nbArchiveFileListingConns, maxTriesToConnect); + pm.load("libctacataloguepostrgres.so"); + if (!pm.isRegistered("ctacataloguepostgres")) { + pm.bootstrap("factory"); + } + return pm.plugin("ctacataloguepostgres").make("PostgresqlCatalogueFactory", log, login, nbConns, nbArchiveFileListingConns, maxTriesToConnect); case rdbms::Login::DBTYPE_SQLITE: throw exception::Exception("Sqlite file based databases are not supported"); case rdbms::Login::DBTYPE_NONE: diff --git a/catalogue/InMemoryCatalogueFactory.cpp b/catalogue/InMemoryCatalogueFactory.cpp index 4b6f1d901d958d7c8024011d80aa49a8c0c4a5da..03c179a867575b17aa6c4b44f41303664334f8ca 100644 --- a/catalogue/InMemoryCatalogueFactory.cpp +++ b/catalogue/InMemoryCatalogueFactory.cpp @@ -23,6 +23,7 @@ #include "catalogue/InMemoryCatalogueFactory.hpp" #include "catalogue/retrywrappers/CatalogueRetryWrapper.hpp" #include "common/exception/Exception.hpp" +#include "plugin-manager/PluginInterface.hpp" namespace cta::catalogue { @@ -53,3 +54,24 @@ std::unique_ptr<Catalogue> InMemoryCatalogueFactory::create() { } } // namespace cta::catalogue + +extern "C" { + +void factory(cta::plugin::Interface<cta::catalogue::CatalogueFactory, + cta::plugin::Args< + cta::log::Logger&, + const u_int64_t, + const u_int64_t, + const u_int64_t>, + cta::plugin::Args< + cta::log::Logger&, + const cta::rdbms::Login&, + const u_int64_t, + const u_int64_t, + const u_int64_t>>& interface) { + + interface.SET<cta::plugin::DATA::PLUGIN_NAME>("ctacatalogueinmemory") + .CLASS<cta::catalogue::InMemoryCatalogueFactory>("InMemoryCatalogueFactory"); +} + +}// extern "C" diff --git a/catalogue/OracleCatalogueFactory.cpp b/catalogue/OracleCatalogueFactory.cpp index d74698024d038ed5989cf11aeb182feed77b5ca6..9ab38800c4bd76664baf01f4c3fd618fa0d9cb52 100644 --- a/catalogue/OracleCatalogueFactory.cpp +++ b/catalogue/OracleCatalogueFactory.cpp @@ -23,6 +23,7 @@ #include "catalogue/rdbms/oracle/OracleCatalogue.hpp" #include "catalogue/retrywrappers/CatalogueRetryWrapper.hpp" #include "common/exception/Exception.hpp" +#include "plugin-manager/PluginInterface.hpp" namespace cta::catalogue { @@ -62,3 +63,24 @@ std::unique_ptr<Catalogue> OracleCatalogueFactory::create() { } } // namespace cta::catalogue + +extern "C" { + +void factory(cta::plugin::Interface<cta::catalogue::CatalogueFactory, + cta::plugin::Args< + cta::log::Logger&, + const u_int64_t, + const u_int64_t, + const u_int64_t>, + cta::plugin::Args< + cta::log::Logger&, + const cta::rdbms::Login&, + const u_int64_t, + const u_int64_t, + const u_int64_t>>& interface) { + + interface.SET<cta::plugin::DATA::PLUGIN_NAME>("ctacatalogueocci") + .CLASS<cta::catalogue::OracleCatalogueFactory>("OracleCatalogueFactory"); +} + +}// extern "C" diff --git a/catalogue/PostgresqlCatalogueFactory.cpp b/catalogue/PostgresqlCatalogueFactory.cpp index e79103a13e55d3ddb2fecaf4b9d8122de04ee2c4..fa4436186399405e2b378a575cbef37ccf5fb6f4 100644 --- a/catalogue/PostgresqlCatalogueFactory.cpp +++ b/catalogue/PostgresqlCatalogueFactory.cpp @@ -21,6 +21,7 @@ #include "common/dataStructures/VirtualOrganization.hpp" #include "common/exception/Exception.hpp" #include "common/log/LogContext.hpp" +#include "plugin-manager/PluginInterface.hpp" namespace cta::catalogue { @@ -59,3 +60,25 @@ std::unique_ptr<Catalogue> PostgresqlCatalogueFactory::create() { } } // namespace cta::catalogue + +extern "C" { + +void factory(cta::plugin::Interface<cta::catalogue::CatalogueFactory, + cta::plugin::Args< + cta::log::Logger&, + const u_int64_t, + const u_int64_t, + const u_int64_t>, + cta::plugin::Args< + cta::log::Logger&, + const cta::rdbms::Login&, + const u_int64_t, + const u_int64_t, + const u_int64_t>>& interface) { + + interface.SET<cta::plugin::DATA::PLUGIN_NAME>("ctacataloguepostgres") + .CLASS<cta::catalogue::PostgresqlCatalogueFactory>("PostgresqlCatalogueFactory"); +} + +}// extern "C" + diff --git a/cta.spec.in b/cta.spec.in index 727256200d8f635bba22db003f542809f20a9b54..6c1848480d5c8f558e5fe448a8b8c01e3da91e9a 100644 --- a/cta.spec.in +++ b/cta.spec.in @@ -303,8 +303,15 @@ Shared libraries required to access the CTA catalogue %files -n cta-lib-catalogue %defattr(0755,root,root,-) %{_libdir}/libctacatalogue.so* +%{_libdir}/libctacatalogueocci.so* +%{_libdir}/libctacataloguesqlite.so* +%{_libdir}/libctacatalogueinmemory.so* +%{_libdir}/libctacataloguepostrgres.so* %{_libdir}/libctadropschemacmd.so* %{_libdir}/libctardbms.so* +%{_libdir}/libctardbmsocci.so* +%{_libdir}/libctardbmssqlite.so* +%{_libdir}/libctardbmspostgres.so* %{_libdir}/libctardbmswrapper.so* %{_libdir}/libctaschemachecker.so* %{_libdir}/libctastatistics.so* diff --git a/plugin-manager/PluginInterface.hpp b/plugin-manager/PluginInterface.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2c13066bf5b4cbd838832f3b54d9fa5a1b7c8f74 --- /dev/null +++ b/plugin-manager/PluginInterface.hpp @@ -0,0 +1,110 @@ +/* + * @project The CERN Tape Archive (CTA) + * @copyright Copyright © 2024 CERN + * @copyright Copyright © 2024 DESY + * @license This program is free software, distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". You can + * redistribute it and/or modify it under the terms of the GPL Version 3, 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. + * + * In applying this licence, CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization or + * submit itself to any jurisdiction. + */ + +#pragma once + +#include <stdexcept> +#include <type_traits> +#include <memory> +#include <functional> +#include <tuple> +#include <variant> +#include <unordered_map> +#include <string> + +namespace cta::plugin { + +enum class DATA { + FILE_NAME = 0, + API_VERSION, + PLUGIN_NAME, + PLUGIN_VERSION +}; + +template<typename... ARGS> using Args = std::tuple<ARGS...>; + +template<typename BASE_TYPE, typename... IARGS> +class Interface { + +public: + + template<plugin::DATA D> + Interface& SET(const std::string& strValue) { + m_umapData.emplace(D, strValue); + return *this; + } + + template<plugin::DATA D> + const std::string& GET() const { + return m_umapData.at(D); + } + + template<typename TYPE> + Interface& CLASS(const std::string& strClassName) { + static_assert(std::is_base_of<BASE_TYPE, TYPE>::value, "Plugin type not supported."); + + m_umapFactories.emplace(strClassName, [](const std::variant<IARGS...>& varaintPluginArgs) -> std::unique_ptr<TYPE> { + try { + std::unique_ptr<TYPE> upType = std::visit([](auto&& tuplePluginArgs) -> + std::unique_ptr<TYPE> { + // unpack parameter pack (IARGS...) + return std::apply([](auto&&... unpackedPluginArgs) -> std::unique_ptr<TYPE> { + return make<TYPE>(unpackedPluginArgs...); + }, tuplePluginArgs); + }, varaintPluginArgs); + + return upType; + + } catch (const std::bad_variant_access& e) { + throw std::logic_error("Invalid plugin interface."); + } + }); + + return *this; + } + + template<typename... ARGS> + constexpr + std::unique_ptr<BASE_TYPE> make(const std::string& strClassName, ARGS&&... args) const { + return m_umapFactories.at(strClassName)(std::forward_as_tuple(args...)); + } + +private: + std::unordered_map<DATA, std::string> m_umapData; + std::unordered_map<std::string, std::function<std::unique_ptr<BASE_TYPE> (const std::variant<IARGS...>&)>> m_umapFactories; + + /** + * A static partial specialized template for instantiating a class + * to be captured by the lambda function if a class can be constructible + */ + template<typename TYPE, typename... ARGS> + static std::enable_if_t<std::is_constructible_v<TYPE, ARGS&&...>, std::unique_ptr<TYPE>> make(ARGS&&... args) { + return std::make_unique<TYPE>(args...); + } + /** + * A static partial specialized template for instantiating a class + * to be captured by the lambda function if a class cannot be constructible + */ + template<typename TYPE, typename... ARGS> + static std::enable_if_t<!std::is_constructible_v<TYPE, ARGS&&...>, std::unique_ptr<TYPE>> make(ARGS&&... ) { + throw std::logic_error("The class cannot be instantiated. No constructor has been implemented for the given parameter set."); + } + +}; + +} // namespace cta::plugin diff --git a/plugin-manager/PluginManager.hpp b/plugin-manager/PluginManager.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9217ee2bfc7b39cda3ea65a6f3fb720687752ee2 --- /dev/null +++ b/plugin-manager/PluginManager.hpp @@ -0,0 +1,194 @@ +/* + * @project The CERN Tape Archive (CTA) + * @copyright Copyright © 2024 CERN + * @copyright Copyright © 2024 DESY + * @license This program is free software, distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". You can + * redistribute it and/or modify it under the terms of the GPL Version 3, 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. + * + * In applying this licence, CERN does not waive the privileges and immunities + * granted to it by virtue of its status as an Intergovernmental Organization or + * submit itself to any jurisdiction. + */ + +#pragma once + +#include "PluginInterface.hpp" + +#include <stdexcept> +#include <string> +#include <memory> +#include <unordered_map> +#include <dlfcn.h> + +namespace cta::plugin { + +class Loader { + +public: + Loader() = default; + + ~Loader() { + unload(); + } + + Loader& load(const std::string& strFile) { + m_strFile = strFile; + if (m_pHandler) { + throw std::logic_error("An attempt to load a library before unloading the previous one."); + } + // RTLD_NOW ensures that all the symbols are resolved immediately. This means that + // if a symbol cannot be found, the program will crash now instead of later. + // RTLD_LAZY - + m_pHandler = dlopen(strFile.c_str(), RTLD_NOW); + + if (!m_pHandler) { + throw std::runtime_error(dlerror()); + } + return *this; + } + + Loader& unload() { + if (m_pHandler) { + dlclose(m_pHandler); + m_pHandler = nullptr; + m_strFile = ""; + } + return *this; + } + + Loader& attach(const std::string& strEntryPointName) { + if (!m_pHandler) { + throw std::runtime_error("Null pointer exception."); + } + + dlerror(); // to clear any old error conditions + m_pFun = dlsym(m_pHandler, strEntryPointName.c_str()); + char* pcError = dlerror(); + if (pcError) { + throw std::runtime_error(pcError); + } + return *this; + } + + const std::string& File() { + return m_strFile; + } + + template<typename HANDLER, typename RETURN, typename... ARGS> + RETURN call(ARGS&... args) { + if (!m_pFun) { + throw std::runtime_error("Null pointer exception: an entry funcrion is not attached."); + } + HANDLER pFun = reinterpret_cast<HANDLER>(m_pFun); + return pFun(args...); + } + +private: + + void* m_pHandler = nullptr; + void* m_pFun = nullptr; + std::string m_strFile; + +}; + +template <typename BASE_TYPE, typename... IARGS> +class Manager { + +public: + + ~Manager() { + unloadAll(); + } + + bool isRegistered(const std::string& strPluginName) const { + return m_umapPlugins.find(strPluginName) != m_umapPlugins.end(); + } + + void registerPlugin(std::unique_ptr<plugin::Interface<BASE_TYPE, IARGS...>> upInterface) { + const std::string strPluginName = upInterface->template GET<plugin::DATA::PLUGIN_NAME>(); + if (isRegistered(strPluginName)) { + throw std::logic_error("A plugin with the name: " + strPluginName + " is already registered."); + } + m_umapPlugins.emplace(strPluginName, std::move(upInterface)); + } + + const plugin::Interface<BASE_TYPE, IARGS...>& plugin(const std::string& strPluginName) const { + if (!isRegistered(strPluginName)) { + throw std::logic_error("A plugin with the name: " + strPluginName + " is not registered."); + } + return *m_umapPlugins.at(strPluginName); + } + + std::vector<std::reference_wrapper<const std::unique_ptr<plugin::Interface<BASE_TYPE, IARGS...>>>> plugins() { + std::vector<std::reference_wrapper<const std::unique_ptr<plugin::Interface<BASE_TYPE, IARGS...>>>> vPlugins; + + for (auto& iter : m_umapPlugins) { + vPlugins.push_back(std::cref<std::unique_ptr<plugin::Interface<BASE_TYPE, IARGS...>>>(iter.second)); + } + return vPlugins; + } + + Manager& load(const std::string& strFile) { + m_strActiveLoader = strFile; + if (m_umapLoaders.find(m_strActiveLoader) == m_umapLoaders.end()) { + m_umapLoaders.emplace(m_strActiveLoader, Loader {}); + m_umapLoaders.at(m_strActiveLoader).load(strFile); + } + return *this; + } + + Manager& unloadAll() { + m_umapPlugins.clear(); + m_umapLoaders.clear(); + return *this; + } + + Manager& unload(const std::string& strFile) { + for (auto iter = m_umapPlugins.begin() ; iter != m_umapPlugins.end(); ) { + if(iter->second->template GET<plugin::DATA::FILE_NAME>() == strFile) { + iter = m_umapPlugins.erase(iter); + } else { + iter++; + } + } + m_umapLoaders.erase(strFile); + return *this; + } + + template<typename... ARGS> + Manager& bootstrap(const std::string& strEntryPoint, ARGS&... args) { + loader().attach(strEntryPoint); + std::unique_ptr<plugin::Interface<BASE_TYPE, IARGS...>> upInterface = std::make_unique<plugin::Interface<BASE_TYPE, IARGS...>>(); + + loader().template call<void (*)(plugin::Interface<BASE_TYPE, IARGS...>&), void>(*upInterface, args...); + // Set / overload plugin file name + upInterface->template SET<plugin::DATA::FILE_NAME>(m_strActiveLoader); + + // Try to register the plugin + registerPlugin(std::move(upInterface)); + + return *this; + } + +private: + std::string m_strActiveLoader; + std::unordered_map<std::string, plugin::Loader> m_umapLoaders; + std::unordered_map<std::string, std::unique_ptr<plugin::Interface<BASE_TYPE, IARGS...>>> m_umapPlugins; + + Loader& loader() { + try { + return m_umapLoaders.at(m_strActiveLoader); + } catch(const std::out_of_range& oor) { + throw std::runtime_error("Loader " + m_strActiveLoader + " does not exists."); + } + } + +}; + +} // namespace cta::plugin diff --git a/rdbms/CMakeLists.txt b/rdbms/CMakeLists.txt index 87917b65b1e4bb47502f4e3cefb64c11022888c2..e7ed8e2f84178b67ab8dea10c231f8de523318fc 100644 --- a/rdbms/CMakeLists.txt +++ b/rdbms/CMakeLists.txt @@ -36,7 +36,8 @@ set (RDBMS_LIB_SRC_FILES Rset.cpp Stmt.cpp StmtPool.cpp - UniqueConstraintError.cpp) + UniqueConstraintError.cpp +) add_library (ctardbms SHARED ${RDBMS_LIB_SRC_FILES}) diff --git a/rdbms/wrapper/CMakeLists.txt b/rdbms/wrapper/CMakeLists.txt index d9fdb0f7b58f5eb2d45cd39d758ce142beae4b0c..14747ee3d8923439c4a1efeb5e57400db95c5ebd 100644 --- a/rdbms/wrapper/CMakeLists.txt +++ b/rdbms/wrapper/CMakeLists.txt @@ -29,21 +29,22 @@ endif() set (RDBMS_WRAPPER_LIB_SRC_FILES ColumnNameToIdx.cpp ColumnNameToIdxAndType.cpp - ConnFactory.cpp ConnFactoryFactory.cpp ConnWrapper.cpp ParamNameToIdx.cpp RsetWrapper.cpp + StmtWrapper.cpp +) + +set (RDBMS_SQLITE_LIB_SRC_FILES Sqlite.cpp SqliteConn.cpp SqliteConnFactory.cpp SqliteRset.cpp SqliteStmt.cpp - StmtWrapper.cpp ) -set (RDBMS_WRAPPER_LIB_SRC_FILES - ${RDBMS_WRAPPER_LIB_SRC_FILES} +set (RDBMS_POSTGRES_LIB_SRC_FILES PostgresConn.cpp PostgresConnFactory.cpp PostgresRset.cpp @@ -51,8 +52,7 @@ set (RDBMS_WRAPPER_LIB_SRC_FILES PostgresColumn.cpp) if (OCCI_SUPPORT) - set (RDBMS_WRAPPER_LIB_SRC_FILES - ${RDBMS_WRAPPER_LIB_SRC_FILES} + set (RDBMS_OCCI_LIB_SRC_FILES OcciColumn.cpp OcciConn.cpp OcciConnFactory.cpp @@ -62,6 +62,45 @@ if (OCCI_SUPPORT) OcciStmt.cpp) endif() +# SQLITE +## For a plugin that may not be linked by other targets, +## but may be dynamically loaded at runtime using dlopen-like functionality: +## add_library (ctardbmssqlite MODULE +## +add_library (ctardbmssqlite SHARED + ${RDBMS_SQLITE_LIB_SRC_FILES}) +set_property(TARGET ctardbmssqlite PROPERTY SOVERSION "${CTA_SOVERSION}") +set_property(TARGET ctardbmssqlite PROPERTY VERSION "${CTA_LIBVERSION}") + +target_link_libraries (ctardbmssqlite + ${SQLITE_LIBRARIES}) + +install(TARGETS ctardbmssqlite DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) + +# POSTGRES +add_library (ctardbmspostgres SHARED + ${RDBMS_POSTGRES_LIB_SRC_FILES}) +set_property(TARGET ctardbmspostgres PROPERTY SOVERSION "${CTA_SOVERSION}") +set_property(TARGET ctardbmspostgres PROPERTY VERSION "${CTA_LIBVERSION}") + +target_link_libraries (ctardbmspostgres + ${POSTGRES_LIBRARIES}) + +install(TARGETS ctardbmspostgres DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) + +# OCCI +if (OCCI_SUPPORT) + add_library (ctardbmsocci SHARED + ${RDBMS_OCCI_LIB_SRC_FILES}) + set_property(TARGET ctardbmsocci PROPERTY SOVERSION "${CTA_SOVERSION}") + set_property(TARGET ctardbmsocci PROPERTY VERSION "${CTA_LIBVERSION}") + + target_link_libraries (ctardbmsocci + ${ORACLE-INSTANTCLIENT_LIBRARIES}) + + install(TARGETS ctardbmsocci DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) +endif() + add_library (ctardbmswrapper SHARED ${RDBMS_WRAPPER_LIB_SRC_FILES}) set_property(TARGET ctardbmswrapper PROPERTY SOVERSION "${CTA_SOVERSION}") @@ -69,11 +108,10 @@ set_property(TARGET ctardbmswrapper PROPERTY VERSION "${CTA_LIBVERSION}") target_link_libraries (ctardbmswrapper ctacommon - ${SQLITE_LIBRARIES} - ${POSTGRES_LIBRARIES}) +) if (OCCI_SUPPORT) - target_link_libraries (ctardbmswrapper ${ORACLE-INSTANTCLIENT_LIBRARIES}) + set_property (TARGET ctardbmswrapper APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) endif() install (TARGETS ctardbmswrapper DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) diff --git a/rdbms/wrapper/ConnFactory.cpp b/rdbms/wrapper/ConnFactory.cpp deleted file mode 100644 index 888df3a063712ba17f14ac6969e9b1968b4c17fe..0000000000000000000000000000000000000000 --- a/rdbms/wrapper/ConnFactory.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * @project The CERN Tape Archive (CTA) - * @copyright Copyright © 2021-2022 CERN - * @license This program is free software, distributed under the terms of the GNU General Public - * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". You can - * redistribute it and/or modify it under the terms of the GPL Version 3, 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. - * - * In applying this licence, CERN does not waive the privileges and immunities - * granted to it by virtue of its status as an Intergovernmental Organization or - * submit itself to any jurisdiction. - */ - -#include "rdbms/wrapper/ConnFactory.hpp" - -namespace cta::rdbms::wrapper { - -//------------------------------------------------------------------------------ -// destructor -//------------------------------------------------------------------------------ -ConnFactory::~ConnFactory() = default; - -} // namespace cta::rdbms::wrapper diff --git a/rdbms/wrapper/ConnFactory.hpp b/rdbms/wrapper/ConnFactory.hpp index 603b450ec5e0ecd696ab7867e7ebe91e4051442b..98597d47e73a474f955668baca2fc720ece5f61d 100644 --- a/rdbms/wrapper/ConnFactory.hpp +++ b/rdbms/wrapper/ConnFactory.hpp @@ -32,7 +32,7 @@ public: /** * Destructor. */ - virtual ~ConnFactory() = 0; + virtual ~ConnFactory() = default; /** * Returns a newly created database connection. diff --git a/rdbms/wrapper/ConnFactoryFactory.cpp b/rdbms/wrapper/ConnFactoryFactory.cpp index eb8ad23b3807bffed141c8b67e2e44e6e4039095..de7b01f2629102fd539ded63ca718c18b44a70f9 100644 --- a/rdbms/wrapper/ConnFactoryFactory.cpp +++ b/rdbms/wrapper/ConnFactoryFactory.cpp @@ -20,12 +20,7 @@ #include "common/exception/Exception.hpp" #include "common/exception/NoSupportedDB.hpp" #include "rdbms/wrapper/ConnFactoryFactory.hpp" -#include "rdbms/wrapper/PostgresConnFactory.hpp" -#include "rdbms/wrapper/SqliteConnFactory.hpp" - -#ifdef SUPPORT_OCCI - #include "rdbms/wrapper/OcciConnFactory.hpp" -#endif +#include "plugin-manager/PluginManager.hpp" namespace cta::rdbms::wrapper { @@ -34,19 +29,42 @@ namespace cta::rdbms::wrapper { //------------------------------------------------------------------------------ std::unique_ptr<ConnFactory> ConnFactoryFactory::create(const Login &login) { try { + static cta::plugin::Manager<rdbms::wrapper::ConnFactory, + cta::plugin::Args<const std::string&>, + cta::plugin::Args<const std::string&, const std::string&, const std::string&>> pm; + switch (login.dbType) { case Login::DBTYPE_IN_MEMORY: - return std::make_unique<SqliteConnFactory>("file::memory:?cache=shared"); + { + const std::string FILE_NAME = "file::memory:?cache=shared"; + pm.load("libctardbmssqlite.so"); + if (!pm.isRegistered("ctardbmssqlite")) { + pm.bootstrap("factory"); + } + return pm.plugin("ctardbmssqlite").make("SqliteConnFactory", FILE_NAME); + } case Login::DBTYPE_ORACLE: #ifdef SUPPORT_OCCI - return std::make_unique<OcciConnFactory>(login.username, login.password, login.database); + pm.load("libctardbmsocci.so"); + if (!pm.isRegistered("ctardbmsocci")) { + pm.bootstrap("factory"); + } + return pm.plugin("ctardbmsocci").make("OcciConnFactory", login.username, login.password, login.database); #else throw exception::NoSupportedDB("Oracle Catalogue Schema is not supported. Compile CTA with Oracle support."); #endif case Login::DBTYPE_SQLITE: - return std::make_unique<SqliteConnFactory>(login.database); + pm.load("libctardbmssqlite.so"); + if (!pm.isRegistered("ctardbmssqlite")) { + pm.bootstrap("factory"); + } + return pm.plugin("ctardbmssqlite").make("SqliteConnFactory", login.database); case Login::DBTYPE_POSTGRESQL: - return std::make_unique<PostgresConnFactory>(login.database); + pm.load("libctardbmspostgres.so"); + if (!pm.isRegistered("ctardbmspostgres")) { + pm.bootstrap("factory"); + } + return pm.plugin("ctardbmspostgres").make("PostgresConnFactory", login.database); case Login::DBTYPE_NONE: throw exception::Exception("Cannot create a catalogue without a database type"); default: diff --git a/rdbms/wrapper/OcciConnFactory.cpp b/rdbms/wrapper/OcciConnFactory.cpp index 24c2d3ac1386af043efead01aa295e54448b014d..a6f4a2f3af9d346f23ec5ec0aba3e85a1f5e7d2f 100644 --- a/rdbms/wrapper/OcciConnFactory.cpp +++ b/rdbms/wrapper/OcciConnFactory.cpp @@ -18,6 +18,7 @@ #include "common/exception/Exception.hpp" #include "rdbms/wrapper/OcciConnFactory.hpp" #include "rdbms/wrapper/OcciEnvSingleton.hpp" +#include "plugin-manager/PluginInterface.hpp" namespace cta::rdbms::wrapper { @@ -45,3 +46,15 @@ std::unique_ptr<ConnWrapper> OcciConnFactory::create() { } } // namespace cta::rdbms::wrapper + +extern "C" { + +void factory(cta::plugin::Interface<cta::rdbms::wrapper::ConnFactory, + cta::plugin::Args<const std::string&>, + cta::plugin::Args<const std::string&, const std::string&, const std::string&>>& interface) { + + interface.SET<cta::plugin::DATA::PLUGIN_NAME>("ctardbmsocci") + .CLASS<cta::rdbms::wrapper::OcciConnFactory>("OcciConnFactory"); +} + +}// extern "C" diff --git a/rdbms/wrapper/PostgresConnFactory.cpp b/rdbms/wrapper/PostgresConnFactory.cpp index a99265742fa0d196db5acfb3cea2344bb30c9a6e..cee15e10753f3df288338b8f680893707af8216e 100644 --- a/rdbms/wrapper/PostgresConnFactory.cpp +++ b/rdbms/wrapper/PostgresConnFactory.cpp @@ -18,6 +18,7 @@ #include "common/exception/Exception.hpp" #include "rdbms/wrapper/PostgresConn.hpp" #include "rdbms/wrapper/PostgresConnFactory.hpp" +#include "plugin-manager/PluginInterface.hpp" #include <sstream> @@ -42,3 +43,15 @@ std::unique_ptr<ConnWrapper> PostgresConnFactory::create() { } } // namespace cta::rdbms::wrapper + +extern "C" { + +void factory(cta::plugin::Interface<cta::rdbms::wrapper::ConnFactory, + cta::plugin::Args<const std::string&>, + cta::plugin::Args<const std::string&, const std::string&, const std::string&>>& interface) { + + interface.SET<cta::plugin::DATA::PLUGIN_NAME>("ctardbmspostgres") + .CLASS<cta::rdbms::wrapper::PostgresConnFactory>("PostgresConnFactory"); +} + +}// extern "C" diff --git a/rdbms/wrapper/SqliteConnFactory.cpp b/rdbms/wrapper/SqliteConnFactory.cpp index 90c90692d377d3135e8a86c119989f2c8c95655f..23aeae7585faf09889be351386ea638586a9f6f5 100644 --- a/rdbms/wrapper/SqliteConnFactory.cpp +++ b/rdbms/wrapper/SqliteConnFactory.cpp @@ -18,6 +18,7 @@ #include "common/exception/Exception.hpp" #include "rdbms/wrapper/SqliteConn.hpp" #include "rdbms/wrapper/SqliteConnFactory.hpp" +#include "plugin-manager/PluginInterface.hpp" namespace cta::rdbms::wrapper { @@ -40,3 +41,15 @@ std::unique_ptr<ConnWrapper> SqliteConnFactory::create() { } } // namespace cta::rdbms::wrapper + +extern "C" { + +void factory(cta::plugin::Interface<cta::rdbms::wrapper::ConnFactory, + cta::plugin::Args<const std::string&>, + cta::plugin::Args<const std::string&, const std::string&, const std::string&>>& interface) { + + interface.SET<cta::plugin::DATA::PLUGIN_NAME>("ctardbmssqlite") + .CLASS<cta::rdbms::wrapper::SqliteConnFactory>("SqliteConnFactory"); +} + +}// extern "C" diff --git a/statistics/CMakeLists.txt b/statistics/CMakeLists.txt index 681ba5cf4bb8d74c3f79d7898d918367d0e510cf..e295cd8d7552ed8adf36d0504d8d505d3ec83f93 100644 --- a/statistics/CMakeLists.txt +++ b/statistics/CMakeLists.txt @@ -56,7 +56,6 @@ add_executable(cta-statistics-save target_link_libraries (cta-statistics-save ctastatistics) set_property(TARGET cta-statistics-save APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -set_property(TARGET cta-statistics-save APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) install (TARGETS cta-statistics-save DESTINATION /usr/bin) @@ -69,6 +68,5 @@ add_executable(cta-statistics-update target_link_libraries (cta-statistics-update ctastatistics) set_property(TARGET cta-statistics-update APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -set_property(TARGET cta-statistics-update APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) install (TARGETS cta-statistics-update DESTINATION /usr/bin) diff --git a/tapeserver/CMakeLists.txt b/tapeserver/CMakeLists.txt index 390083797afb56746d1105860de12b416254d613..55109737672ec740a1e3e132b79ea6655b93daa1 100644 --- a/tapeserver/CMakeLists.txt +++ b/tapeserver/CMakeLists.txt @@ -31,9 +31,6 @@ find_package(Protobuf3 REQUIRED) target_link_libraries(cta-taped ctatapedaemon ctacommon ${PROTOBUF3_LIBRARIES}) set_property (TARGET cta-taped APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property (TARGET cta-taped APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif (OCCI_SUPPORT) install (TARGETS cta-taped DESTINATION usr/bin) install (FILES cta-taped.1cta DESTINATION /usr/share/man/man1) install (FILES cta-taped.logrotate DESTINATION /etc/logrotate.d RENAME cta-taped) diff --git a/tapeserver/readtp/CMakeLists.txt b/tapeserver/readtp/CMakeLists.txt index 0623eaed684a31482d01089273de658399893e1b..1fa2945a69c3ae75d7837f0b9f14fa2038cadecb 100644 --- a/tapeserver/readtp/CMakeLists.txt +++ b/tapeserver/readtp/CMakeLists.txt @@ -39,9 +39,6 @@ target_link_libraries (cta-readtp # need to be removed when drop dependencies to taped find_package(Protobuf3 REQUIRED) set_property (TARGET cta-readtp APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property (TARGET cta-readtp APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif (OCCI_SUPPORT) install (TARGETS cta-readtp DESTINATION /usr/bin) install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-readtp.1cta DESTINATION /usr/share/man/man1) diff --git a/tapeserver/tapelabel/CMakeLists.txt b/tapeserver/tapelabel/CMakeLists.txt index 31a807c31c4afe6896a62bd8b0c26ad8c3a2fe13..f817d4d25e652e5377b28028d17a61ef72ebbc83 100644 --- a/tapeserver/tapelabel/CMakeLists.txt +++ b/tapeserver/tapelabel/CMakeLists.txt @@ -30,9 +30,6 @@ target_link_libraries (cta-tape-label # need to be removed when drop dependencies to taped find_package(Protobuf3 REQUIRED) set_property (TARGET cta-tape-label APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property (TARGET cta-tape-label APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif (OCCI_SUPPORT) install (TARGETS cta-tape-label DESTINATION /usr/bin) install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/cta-tape-label.1cta DESTINATION /usr/share/man/man1) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 75d40c58e6a6b4307f2d2ffce22de4068a7b7572..a75963b60b70e2b0306d9c8cb8942512cdda5015 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -58,9 +58,6 @@ endif() target_link_libraries(cta-unitTests ${CTA_UNIT_TEST_LIBS}) set_property (TARGET cta-unitTests APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property (TARGET cta-unitTests APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif (OCCI_SUPPORT) add_executable(cta-rdbmsUnitTests GlobalCatalogueFactoryForUnitTests.cpp @@ -80,9 +77,6 @@ target_link_libraries(cta-rdbmsUnitTests ${PROTOBUF3_LIBRARIES}) set_property (TARGET cta-rdbmsUnitTests APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property (TARGET cta-rdbmsUnitTests APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif (OCCI_SUPPORT) add_executable(cta-unitTests-multiProcess unit_tests.cpp) @@ -97,9 +91,6 @@ target_link_libraries(cta-unitTests-multiProcess sqlite3) set_property (TARGET cta-unitTests-multiProcess APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property (TARGET cta-unitTests-multiProcess APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif (OCCI_SUPPORT) add_library(unitTestHelper TempFile.cpp TempDirectory.cpp) diff --git a/xroot_plugins/CMakeLists.txt b/xroot_plugins/CMakeLists.txt index 1685ad2c2ebea15cfd421856454597efcc9471b0..69eb8747dcb94d87a59351addeb2ce211230c398 100644 --- a/xroot_plugins/CMakeLists.txt +++ b/xroot_plugins/CMakeLists.txt @@ -50,9 +50,6 @@ else() EosCtaGrpc ${GRPC_LIBRARY} ${GRPC_GRPC++_LIBRARY}) endif() set_property (TARGET XrdSsiCta APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH}) -if (OCCI_SUPPORT) - set_property (TARGET XrdSsiCta APPEND PROPERTY INSTALL_RPATH ${ORACLE-INSTANTCLIENT_RPATH}) -endif (OCCI_SUPPORT) install(TARGETS XrdSsiCta DESTINATION usr/${CMAKE_INSTALL_LIBDIR}) install(FILES cta-frontend-xrootd.conf.example DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/cta)