client-cpp  0.10.0
KaaClientProperties.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef KAACLIENTPROPERTIES_HPP_
18 #define KAACLIENTPROPERTIES_HPP_
19 
20 #include <string>
21 #include <unordered_map>
22 
23 namespace kaa {
24 
26 public:
28  {
29  initByDefaults();
30  }
31 
46  void setClientId(const std::string& clientId);
47 
53  std::string getClientId() const
54  {
56  }
57 
65  void setLogFileName(const std::string& logFileName);
66 
73  std::string getLogFileName() const
74  {
76  return fileName.empty() ? fileName : getWorkingDirectoryPath() + fileName;
77  }
78 
88  void setWorkingDirectoryPath(const std::string& path);
89 
95  std::string getWorkingDirectoryPath() const
96  {
98  }
99 
107  void setStateFileName(const std::string& fileName);
108 
114  std::string getStateFileName() const
115  {
117  }
118 
125  void setPublicKeyFileName(const std::string& fileName);
126 
132  std::string getPublicKeyFileName() const
133  {
135  }
136 
143  void setPrivateKeyFileName(const std::string& fileName);
144 
150  std::string getPrivateKeyFileName() const
151  {
153  }
154 
161  void setLogsDatabaseFileName(const std::string& fileName);
162 
168  std::string getLogsDatabaseFileName() const
169  {
171  }
172 
178  void setConfigurationFileName(const std::string& fileName);
179 
185  std::string getConfigurationFileName() const
186  {
188  }
189 
196  void setProperty(const std::string& name, const std::string& value);
197 
205  std::string getProperty(const std::string& name, const std::string& defaultValue = std::string()) const;
206 
207 public:
208  static const std::string PROP_WORKING_DIR;
209  static const std::string PROP_STATE_FILE;
210  static const std::string PROP_PUB_KEY_FILE;
211  static const std::string PROP_PRIV_KEY_FILE;
212  static const std::string PROP_LOGS_DB;
213  static const std::string PROP_CONF_FILE;
214  static const std::string PROP_CLIENT_ID;
215  static const std::string PROP_LOG_FILE_NAME;
216 
217  static const std::string DEFAULT_WORKING_DIR;
218  static const std::string DEFAULT_STATE_FILE;
219  static const std::string DEFAULT_PUB_KEY_FILE;
220  static const std::string DEFAULT_PRIV_KEY_FILE;
221  static const std::string DEFAULT_LOGS_DB;
222  static const std::string DEFAULT_CONF_FILE;
223  static const std::string DEFAULT_CLIENT_ID;
224  static const std::string DEFAULT_LOG_FILE_NAME;
225 
226 private:
227  void initByDefaults();
228 
229 private:
230  std::unordered_map<std::string, std::string> properties_;
231 };
232 
233 } /* namespace kaa */
234 
235 #endif /* KAACLIENTPROPERTIES_HPP_ */
static const std::string PROP_PRIV_KEY_FILE
void setLogFileName(const std::string &logFileName)
Set file name logs will be written to.
std::string getLogsDatabaseFileName() const
Returns the path to the database's name where the logs are stored.
void setConfigurationFileName(const std::string &fileName)
Sets configuration file name.
static const std::string PROP_LOGS_DB
static const std::string DEFAULT_WORKING_DIR
std::string getWorkingDirectoryPath() const
Returns a path to the client's working directory.
static const std::string PROP_CONF_FILE
void setStateFileName(const std::string &fileName)
Sets state file name.
std::string getStateFileName() const
Returns the path to the state file name.
static const std::string DEFAULT_PRIV_KEY_FILE
void setPublicKeyFileName(const std::string &fileName)
Sets public key file name.
void setProperty(const std::string &name, const std::string &value)
Sets property.
std::string getLogFileName() const
Returns current path to the file which contains logs.
void setWorkingDirectoryPath(const std::string &path)
Sets working directory path.
static const std::string PROP_WORKING_DIR
std::string getPublicKeyFileName() const
Returns the path to the client's public key file.
static const std::string PROP_LOG_FILE_NAME
static const std::string DEFAULT_LOGS_DB
std::string getPrivateKeyFileName() const
Returns the path to the client's private key file.
static const std::string DEFAULT_CLIENT_ID
static const std::string PROP_CLIENT_ID
static const std::string PROP_STATE_FILE
static const std::string DEFAULT_STATE_FILE
std::string getProperty(const std::string &name, const std::string &defaultValue=std::string()) const
Returns propety value.
static const std::string PROP_PUB_KEY_FILE
void setClientId(const std::string &clientId)
Set client ID.
void setLogsDatabaseFileName(const std::string &fileName)
Sets database file name.
static const std::string DEFAULT_CONF_FILE
void setPrivateKeyFileName(const std::string &fileName)
Sets private key file name.
std::string getConfigurationFileName() const
Returns the path to the configuration file.
static const std::string DEFAULT_LOG_FILE_NAME
std::string getClientId() const
Returns client id.
static const std::string DEFAULT_PUB_KEY_FILE