RTI Web Integration Service Version 7.7.0
ServiceProperty.hpp
1/*
2 * (c) Copyright, Real-Time Innovations, 2022.
3 * All rights reserved.
4 *
5 * No duplications, whole or partial, manual or electronic, may be made
6 * without express written permission. Any such copies, or
7 * revisions thereof, must display this notice unaltered.
8 * This code contains trade secrets of Real-Time Innovations, Inc.
9 */
10
11#ifndef SERVICE_PROPERTY_H
12#define SERVICE_PROPERTY_H
13
14#define SERVICE_DEFAULT_VERBOSITY 1
15#define WEBSERVER_DEFAULT_PORT_STR "8080"
16
17#include <dds/core/macros.hpp>
18#include <rti/core/NativeValueType.hpp>
19
20#include <rti/webdds/Dll.hpp>
21
22namespace rti { namespace webdds {
23
24// Forward declaration
25class AccessController;
26class LoggerDevice;
27
33class WSDDSDllExport ServiceProperty {
34public:
40
41 ServiceProperty(const ServiceProperty&) = delete;
42 ServiceProperty& operator=(const ServiceProperty&) = delete;
44 ServiceProperty& operator=(ServiceProperty&&) = default;
45
51
60
65
66
75
79 bool enable_websockets() const;
80
84 bool list_api_keys() const;
85
99
104
111
115 bool use_custom_logger() const;
116
117 /*i
118 * @brief Set the Access Control List.
119 *
120 * @default nullptr
121 */
122 ServiceProperty& acl(std::unique_ptr<AccessController> acl);
123
124 /*i
125 * @brief Getter (see setter with the same name).
126 */
127 AccessController *acl() const;
128
129 /*i
130 * This method enters a key-value pair into the webserver_options_ array.
131 *
132 * @param key Name of the option to be set.
133 * @param value Value of the option.
134 */
135 ServiceProperty& webserver_option(
136 const std::string& option,
137 const std::string& value);
138
145 const std::string *webserver_option(const std::string& option) const;
146
153 const std::vector<std::string>& webserver_options() const;
154
160 ServiceProperty& cfgfile(const std::string& cfgfile);
161
165 const std::string& cfgfile() const;
166
176 ServiceProperty& cfgname(const std::string& cfgname);
177
181 const std::string& cfgname() const;
182
194 ServiceProperty& acl_file(const std::string& acl_file);
195
199 const std::string& acl_file() const;
200
206 ServiceProperty& create_api_key(const std::string& api_key);
207
211 const std::string& create_api_key() const;
212
223
229 ServiceProperty& delete_api_key(const std::string& api_key);
230
234 const std::string& delete_api_key() const;
235
236 /*i
237 * @brief Set the verbosity level param, must be used with
238 * setup_verbosity_level() to apply the passed value.
239 */
240 ServiceProperty& param_verbosity(int verbosity);
241
242 /*i
243 * @brief Getter (see setter with the same name).
244 */
245 int param_verbosity();
246
247 /*i
248 * @brief Getter (see setter with the same name).
249 */
250 int dds_verbosity();
251
252 /*i
253 * @brief Getter (see setter with the same name).
254 */
255 int wsdds_verbosity();
256
264 ServiceProperty& max_objects_per_thread(int max_objects_per_thread);
265
270
289
295
296
303
308
309private:
310 // Arguments flags
311 bool list_api_keys_;
312 bool enable_resource_caching_;
313 bool enable_builtin_topics_;
314 bool enable_websockets_;
315
316 // DDS Options
317 std::string cfgfile_;
318 std::string cfgname_;
319 std::string acl_file_;
320 std::string create_api_key_;
321 std::string delete_api_key_;
322 std::string heap_snapshot_dir_;
323 int verbosity_;
324 int dds_verbosity_;
325 int wsdds_verbosity_;
326 int max_objects_per_thread_;
327
328 // WebServer options
329 std::vector<std::string> webserver_options_;
330
331 // Logger device
332 bool use_custom_logger_;
333 std::unique_ptr<LoggerDevice> logger_device_;
334
335 // Access Controller
336 std::unique_ptr<AccessController> acl_;
337};
338
339}} // namespace rti::webdds
340
341#endif // SERVICE_PROPERTY_H
Configuration properties for a RTI Web Integration Service object.
Definition: ServiceProperty.hpp:33
const std::vector< std::string > & webserver_options() const
This method return the webserver_options_ array. the values are used as pairs of key-value each 2 val...
const std::string & acl_file() const
Getter (see setter with the same name).
ServiceProperty & use_custom_logger(bool value)
Enables the use of a custom logger.
ServiceProperty()
Construct a new Service Property object.
ServiceProperty & cfgname(const std::string &cfgname)
The name of the RTI Web Integration Service configuration to run.
ServiceProperty & list_api_keys(bool value)
Set it to true to list all the API keys available in an Access Control List file.
~ServiceProperty()
Destroy the Service Property object.
ServiceProperty & create_api_key(const std::string &api_key)
Add a new api key to the list of api keys.
ServiceProperty & setup_verbosity_level()
Set the up verbosity level that is in verbosity_ atributte.
bool enable_builtin_topics() const
Getter (see setter with the same name).
int max_objects_per_thread()
Getter (see setter with the same name).
ServiceProperty & enable_builtin_topics(bool value)
Set it to true to enable the Builtin Topics REST API.
const std::string * webserver_option(const std::string &option) const
Get the value of the webserver option.
bool enable_resource_caching() const
Getter (see setter with the same name).
ServiceProperty & delete_api_key(const std::string &api_key)
Delete an api key from the list of api keys.
ServiceProperty & enable_resource_caching(bool value)
Caches entities thread-specific storage.
bool enable_websockets() const
Getter (see setter with the same name).
const std::string & create_api_key() const
Getter (see setter with the same name).
bool list_api_keys() const
Getter (see setter with the same name).
ServiceProperty & cfgfile(const std::string &cfgfile)
Specifies a configuration file to be loaded.
const std::string & cfgfile() const
Getter (see setter with the same name).
ServiceProperty & max_objects_per_thread(int max_objects_per_thread)
Use this attribute to increase the maximum number of objects per thread of RTI Data Distribution Serv...
ServiceProperty & setup_verbosity_level(int verbosity_level)
Controls what type of messages are logged.
ServiceProperty & enable_websockets(bool value)
Set it to true to enable the WebSockets REST API.
ServiceProperty & acl_file(const std::string &acl_file)
The name of the Access Control List file.
bool use_custom_logger() const
Getter (see setter with the same name).
const std::string & delete_api_key() const
Getter (see setter with the same name).
const std::string & cfgname() const
Getter (see setter with the same name).