Elements  6.2
A C++ base framework for the Euclid Software.
ConnectionConfiguration.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2020 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
24 #ifndef ELEMENTSSERVICES_ELEMENTSSERVICES_DATASYNC_CONNECTIONCONFIGURATION_H_
25 #define ELEMENTSSERVICES_ELEMENTSSERVICES_DATASYNC_CONNECTIONCONFIGURATION_H_
26 
27 #include <string>
28 
29 #include "ElementsKernel/Export.h"
30 
32 
33 namespace Elements {
34 inline namespace Services {
35 namespace DataSync {
36 
41 enum DataHost {
44 };
45 
52 };
53 
60 public:
61  virtual ~UnknownHost() = default;
62  UnknownHost() : std::runtime_error("I don't know this hosting solution!") {}
63  explicit UnknownHost(const std::string& hostName)
64  : std::runtime_error("I don't know this hosting solution: " + hostName) {}
65 };
66 
76 
77 public:
78  virtual ~ConnectionConfiguration() = default;
79 
83  explicit ConnectionConfiguration(const path& configFile);
84 
88  bool overwritingAllowed() const;
89 
90 protected:
91  void parseConfigurationFile(const path& filename);
92 
93  void parseHost(const std::string& name);
94 
95  void parseOverwritingPolicy(const std::string& policy);
96 
97 public:
103  size_t tries;
106 };
107 
108 } // namespace DataSync
109 } // namespace Services
110 } // namespace Elements
111 
113 
114 #endif // ELEMENTSSERVICES_ELEMENTSSERVICES_DATASYNC_CONNECTIONCONFIGURATION_H_
115 
Export.h
defines the macros to be used for explicit export of the symbols
Elements::Services::DataSync::WEBDAV
@ WEBDAV
Definition: ConnectionConfiguration.h:43
std::string
STL class.
Elements::Services::DataSync::ConnectionConfiguration::password
std::string password
Definition: ConnectionConfiguration.h:101
Elements::Services::DataSync::DataHost
DataHost
The test data hosting solution.
Definition: ConnectionConfiguration.h:41
Elements::Services::DataSync::ConnectionConfiguration::tries
size_t tries
Definition: ConnectionConfiguration.h:103
Elements::Services::DataSync::ABORT
@ ABORT
Definition: ConnectionConfiguration.h:50
Elements::Services::DataSync::ConnectionConfiguration::localRoot
path localRoot
Definition: ConnectionConfiguration.h:105
Elements::Services::DataSync::ConnectionConfiguration::user
std::string user
Definition: ConnectionConfiguration.h:100
Elements::Services::DataSync::OverwritingPolicy
OverwritingPolicy
The overwriting policy if the local file already exists.
Definition: ConnectionConfiguration.h:49
Elements::Services::DataSync::DataSync
A class to download test data from a data repository prior to the unit test run.
Definition: DataSync.h:47
ELEMENTS_API
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition: Export.h:74
Elements::System::hostName
const ELEMENTS_API std::string & hostName()
Host name.
Definition: System.cpp:278
Elements::Services::DataSync::OVERWRITE
@ OVERWRITE
Definition: ConnectionConfiguration.h:51
Elements::Services::DataSync::ConnectionConfiguration::overwritingPolicy
OverwritingPolicy overwritingPolicy
Definition: ConnectionConfiguration.h:102
std::runtime_error
STL class.
DataSyncUtils.h
Elements::Services::DataSync::ConnectionConfiguration::distantRoot
path distantRoot
Definition: ConnectionConfiguration.h:104
std
STL namespace.
Elements::Services
Definition: ConnectionConfiguration.h:34
Elements::Services::DataSync::ConnectionConfiguration::hostUrl
std::string hostUrl
Definition: ConnectionConfiguration.h:99
Elements::Services::DataSync::UnknownHost::UnknownHost
UnknownHost(const std::string &hostName)
Definition: ConnectionConfiguration.h:63
Elements::Services::DataSync::ConnectionConfiguration::host
DataHost host
Definition: ConnectionConfiguration.h:98
Elements::Services::DataSync::IRODS
@ IRODS
Definition: ConnectionConfiguration.h:42
Elements::Services::DataSync::UnknownHost
Exception raised when a hosting solution is not supported by the tool.
Definition: ConnectionConfiguration.h:59
Elements::Services::DataSync::UnknownHost::UnknownHost
UnknownHost()
Definition: ConnectionConfiguration.h:62
Elements::Services::DataSync::ConnectionConfiguration
The connection configuration mainly holds:
Definition: ConnectionConfiguration.h:75
Elements
Definition: callBackExample.h:35
Elements::Services::DataSync::path
Path::Item path
importing the path item from ElementsKernel
Definition: DataSyncUtils.h:41