29 const std::string &endpoint,
const std::string &facility) {
50 throw std::runtime_error(
"You are not currently logged into a catalog.");
52 if (sessionID.empty()) {
53 auto composite = std::make_shared<CompositeCatalog>();
55 composite->add(activeCatalog.second);
62 [&sessionID](
const auto &catalog) { return catalog.first->getSessionId() == sessionID; });
64 throw std::runtime_error(
"The session ID you have provided is invalid.");
77 if (sessionID.empty()) {
79 activeCatalog.second->logout();
85 if (sessionID == iter->first->getSessionId()) {
86 iter->second->logout();
98 std::vector<CatalogSession_sptr> sessions;
102 [](
const auto &activeCatalog) { return activeCatalog.first; });
void destroyCatalog(const std::string &sessionID)
Destroy a specific catalog (if session provided), otherwise destroys all active catalogs.
CatalogSession_sptr login(const std::string &username, const std::string &password, const std::string &endpoint, const std::string &facility)
Creates a new catalog and session, and adds it to the activeCatalogs container.
std::map< CatalogSession_sptr, ICatalog_sptr > m_activeCatalogs
std::vector< CatalogSession_sptr > getActiveSessions()
Obtains a list of the current active catalog sessions.
ICatalog_sptr getCatalog(const std::string &sessionID)
Get a specific catalog using the sessionID.
size_t numberActiveSessions() const
Returns the number of active sessions.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< CatalogSession > CatalogSession_sptr
std::shared_ptr< ICatalog > ICatalog_sptr