| 220 | } |
| 221 | |
| 222 | void |
| 223 | Config::processFile() |
| 224 | { |
| 225 | if (::OpenDDS::DCPS::DCPS_debug_level > 0) { |
| 226 | ACE_DEBUG((LM_DEBUG, |
| 227 | ACE_TEXT("(%P|%t) INFO: Federator::Config::process()\n"))); |
| 228 | } |
| 229 | |
| 230 | if (this->configFile_.empty()) { |
| 231 | // No filename, no processing. |
| 232 | return; |
| 233 | } |
| 234 | |
| 235 | // Grab a spot to stick the configuration. |
| 236 | ACE_Configuration_Heap heap; |
| 237 | |
| 238 | if (0 != heap.open()) { |
| 239 | ACE_ERROR((LM_ERROR, |
| 240 | ACE_TEXT("(%P|%t) ERROR: Federator::Config::process - ") |
| 241 | ACE_TEXT("unable to open configuration heap.\n"))); |
| 242 | return; |
| 243 | } |
| 244 | |
| 245 | // Import the file into our shiny new spot. |
| 246 | ACE_Ini_ImpExp import(heap); |
| 247 | |
| 248 | if (0 != import.import_config(this->configFile_.c_str())) { |
| 249 | ACE_ERROR((LM_ERROR, |
| 250 | ACE_TEXT("(%P|%t) ERROR: Federator::Config::process - ") |
| 251 | ACE_TEXT("unable to import configuration file.\n"))); |
| 252 | return; |
| 253 | } |
| 254 | |
| 255 | // Configuration file format: |
| 256 | // |
| 257 | // FederationDomain = <number> (REQUIRED) |
| 258 | // FederationId = <number> (REQUIRED) |
| 259 | // FederationPort = <number> (REQUIRED) |
| 260 | // |
| 261 | |
| 262 | // Grab the common configuration settings. |
| 263 | const ACE_Configuration_Section_Key &root = heap.root_section(); |
| 264 | |
| 265 | // Federation Domain value - REQUIRED |
| 266 | ACE_TString federationDomainString; |
| 267 | |
| 268 | if (0 != heap.get_string_value(root, FEDERATION_DOMAIN_KEY, federationDomainString)) { |
| 269 | ACE_ERROR((LM_ERROR, |
| 270 | ACE_TEXT("(%P|%t) ERROR: Federator::Config::process - ") |
| 271 | ACE_TEXT("Unable to obtain value for FederationDomain in root section\n"))); |
| 272 | return; |
| 273 | } |
| 274 | |
| 275 | // Convert to numeric repository key value. |
| 276 | this->federationDomain_ = ACE_OS::atoi(federationDomainString.c_str()); |
| 277 | |
| 278 | if (::OpenDDS::DCPS::DCPS_debug_level > 0) { |
| 279 | ACE_DEBUG((LM_DEBUG, |
no test coverage detected