| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2004, Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE Core Framework. |
|---|
| 6 | |
|---|
| 7 | OSSIE Core Framework is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the Lesser GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2.1 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE Core Framework is distributed in the hope that it will be useful |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | Lesser GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the Lesser GNU General Public License |
|---|
| 18 | along with OSSIE Core Framework; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | ****************************************************************************/ |
|---|
| 22 | |
|---|
| 23 | /* SCA */ |
|---|
| 24 | /* Include files */ |
|---|
| 25 | |
|---|
| 26 | #include <iostream> |
|---|
| 27 | #include <string> |
|---|
| 28 | #include <vector> |
|---|
| 29 | |
|---|
| 30 | #include <string.h> |
|---|
| 31 | |
|---|
| 32 | #ifdef HAVE_OMNIEVENTS |
|---|
| 33 | #include "omniEvents.hh" |
|---|
| 34 | #endif |
|---|
| 35 | |
|---|
| 36 | #include "ossie/StandardEvent.h" // from idl |
|---|
| 37 | |
|---|
| 38 | #include "ossie/DomainManager_impl.h" |
|---|
| 39 | #include "ossie/ossieSupport.h" |
|---|
| 40 | |
|---|
| 41 | #include "ossie/orb_wrap.h" |
|---|
| 42 | |
|---|
| 43 | #ifdef MS_dotNET |
|---|
| 44 | #pragma warning( disable : 4290 ) // there's an annoying VC7 warning that I wanted to make go away |
|---|
| 45 | #endif |
|---|
| 46 | |
|---|
| 47 | using namespace std; |
|---|
| 48 | |
|---|
| 49 | DomainManager_impl::DomainManager_impl (int argc, char **argv) |
|---|
| 50 | { |
|---|
| 51 | init(argc, argv); |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | DomainManager_impl::~DomainManager_impl () |
|---|
| 56 | { |
|---|
| 57 | /// \todo uncomment destroyEventChannels (); |
|---|
| 58 | |
|---|
| 59 | cout << "Domain Manager destructor called" << endl; |
|---|
| 60 | |
|---|
| 61 | /************************************************** |
|---|
| 62 | * Save current state for configuration recall * |
|---|
| 63 | * this is not supported by this version * |
|---|
| 64 | **************************************************/ |
|---|
| 65 | |
|---|
| 66 | // clean char* |
|---|
| 67 | if (_identifier!=NULL) delete []_identifier; |
|---|
| 68 | if (_domainManagerProfile!=NULL) delete []_domainManagerProfile; |
|---|
| 69 | |
|---|
| 70 | unsigned int i; |
|---|
| 71 | for (i=0; i<_pendingConnections.size(); i++) |
|---|
| 72 | { |
|---|
| 73 | delete _pendingConnections[i]; |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | for (i=0; i<_registeredDevices.size();i++) |
|---|
| 77 | { |
|---|
| 78 | delete _registeredDevices[i]; |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | for (i=0; i<_registeredServices.size();i++) |
|---|
| 82 | { |
|---|
| 83 | delete _registeredServices[i]; |
|---|
| 84 | } |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | void |
|---|
| 89 | DomainManager_impl::init (int argc, char **argv) |
|---|
| 90 | { |
|---|
| 91 | |
|---|
| 92 | std::string dmdFile = "DomainManager.dmd.xml"; |
|---|
| 93 | |
|---|
| 94 | _numApps = 0; |
|---|
| 95 | |
|---|
| 96 | _numDevMgrs = 0; |
|---|
| 97 | |
|---|
| 98 | _applications.length (_numApps); |
|---|
| 99 | |
|---|
| 100 | _deviceManagers.length (_numDevMgrs); |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | if (argc == 2) |
|---|
| 104 | dmdFile = argv[1]; |
|---|
| 105 | |
|---|
| 106 | // Create file manager |
|---|
| 107 | FileManager_impl *_fileMgrImpl = new FileManager_impl (); |
|---|
| 108 | |
|---|
| 109 | _fileMgr = _fileMgrImpl->_this (); |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | // find available DMD |
|---|
| 113 | CF::FileSystem::FileInformationSequence_var _dmdProfiles |
|---|
| 114 | = _fileMgr->list (".dmd.xml"); |
|---|
| 115 | |
|---|
| 116 | if (_dmdProfiles->length() == 0) { |
|---|
| 117 | throw CF::FileException(CF::CFENOENT, "*.dmd.xml File not found"); |
|---|
| 118 | } |
|---|
| 119 | |
|---|
| 120 | // FileSystem returns filename with leading /, this is bad becaue the parserbypasses the FileSystem |
|---|
| 121 | // _domainManagerProfile = CORBA::string_dup((*_dmdProfiles)[0].name); |
|---|
| 122 | |
|---|
| 123 | //DMDParser _DMDParser ("DomainManager.dmd.xml"); |
|---|
| 124 | DMDParser _DMDParser (dmdFile.c_str()); |
|---|
| 125 | |
|---|
| 126 | this->_identifier = CORBA::string_dup(_DMDParser.getID()); |
|---|
| 127 | |
|---|
| 128 | /// \todo lookup and install any services specified in the DMD |
|---|
| 129 | |
|---|
| 130 | /// \todo Discuss using filename + path directly from xml and screwing with FileSystem |
|---|
| 131 | CF::FileSystem::FileInformationSequence_var _dmdSoftPkg |
|---|
| 132 | = _fileMgr->list (_DMDParser.getDomainManagerSoftPkg ()); |
|---|
| 133 | |
|---|
| 134 | SPDParser _DM_SPD_Parser (_DMDParser.getDomainManagerSoftPkg()); |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | /******************************************************* |
|---|
| 138 | |
|---|
| 139 | At some point, memory has to be added to the system, |
|---|
| 140 | where the domainmanager recalls the last configuration |
|---|
| 141 | |
|---|
| 142 | *******************************************************/ |
|---|
| 143 | |
|---|
| 144 | // create Incoming Domain Management and Outgoing Domain Management event channels |
|---|
| 145 | createEventChannels (); |
|---|
| 146 | |
|---|
| 147 | // Create the event channel conusmer object to send events to |
|---|
| 148 | #ifdef HAVE_OMNIEVENTS |
|---|
| 149 | ODM_Channel_consumer = connectEventChannel(ODM_channel); |
|---|
| 150 | #endif |
|---|
| 151 | } |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | char * |
|---|
| 155 | DomainManager_impl::identifier (void) |
|---|
| 156 | throw (CORBA::SystemException) |
|---|
| 157 | { |
|---|
| 158 | return CORBA::string_dup(_identifier); |
|---|
| 159 | } |
|---|
| 160 | |
|---|
| 161 | |
|---|
| 162 | char * |
|---|
| 163 | DomainManager_impl::domainManagerProfile (void) |
|---|
| 164 | throw (CORBA::SystemException) |
|---|
| 165 | { |
|---|
| 166 | return CORBA::string_dup(_domainManagerProfile); |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | |
|---|
| 170 | CF::FileManager_ptr DomainManager_impl::fileMgr (void) throw (CORBA:: |
|---|
| 171 | SystemException) |
|---|
| 172 | { |
|---|
| 173 | |
|---|
| 174 | return CF::FileManager::_duplicate(_fileMgr); |
|---|
| 175 | } |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | CF::DomainManager::ApplicationFactorySequence * |
|---|
| 179 | DomainManager_impl::applicationFactories (void) throw (CORBA:: |
|---|
| 180 | SystemException) |
|---|
| 181 | { |
|---|
| 182 | CF::DomainManager::ApplicationFactorySequence_var result = new CF::DomainManager::ApplicationFactorySequence(_applicationFactories); |
|---|
| 183 | |
|---|
| 184 | return result._retn(); |
|---|
| 185 | } |
|---|
| 186 | |
|---|
| 187 | |
|---|
| 188 | CF::DomainManager::ApplicationSequence * |
|---|
| 189 | DomainManager_impl::applications (void) throw (CORBA::SystemException) |
|---|
| 190 | { |
|---|
| 191 | |
|---|
| 192 | CF::DomainManager::ApplicationSequence_var result = new CF::DomainManager::ApplicationSequence(_applications); |
|---|
| 193 | return result._retn(); |
|---|
| 194 | } |
|---|
| 195 | |
|---|
| 196 | |
|---|
| 197 | CF::DomainManager::DeviceManagerSequence * |
|---|
| 198 | DomainManager_impl::deviceManagers (void) throw (CORBA::SystemException) |
|---|
| 199 | { |
|---|
| 200 | |
|---|
| 201 | CF::DomainManager::DeviceManagerSequence_var result = new CF::DomainManager::DeviceManagerSequence(_deviceManagers); |
|---|
| 202 | return result._retn(); |
|---|
| 203 | } |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | void |
|---|
| 207 | DomainManager_impl::registerDeviceManager (CF::DeviceManager_ptr deviceMgr) |
|---|
| 208 | throw (CORBA::SystemException, CF::InvalidObjectReference, CF::InvalidProfile, |
|---|
| 209 | CF::DomainManager::RegisterError) |
|---|
| 210 | { |
|---|
| 211 | |
|---|
| 212 | if (CORBA::is_nil (deviceMgr)) |
|---|
| 213 | { |
|---|
| 214 | //writeLogRecord(FAILURE_ALARM,invalid reference input parameter.); |
|---|
| 215 | |
|---|
| 216 | throw (CF:: |
|---|
| 217 | InvalidObjectReference |
|---|
| 218 | ("Cannot register Device. DeviceMgr is a nil reference.")); |
|---|
| 219 | } |
|---|
| 220 | |
|---|
| 221 | // add device manager to list |
|---|
| 222 | |
|---|
| 223 | addDeviceMgr (CF::DeviceManager::_duplicate (deviceMgr)); |
|---|
| 224 | |
|---|
| 225 | ossieSupport::sendObjAdded_event(_identifier, deviceMgr->identifier(), deviceMgr->label(), (CORBA::Object_var) NULL, StandardEvent::DEVICE_MANAGER); |
|---|
| 226 | |
|---|
| 227 | // mount filesystem under "/DomainName1/<deviceMgr.label>" |
|---|
| 228 | |
|---|
| 229 | string mountPoint = "/"; |
|---|
| 230 | mountPoint += deviceMgr->label(); |
|---|
| 231 | |
|---|
| 232 | _fileMgr->mount (mountPoint.c_str(), deviceMgr->fileSys ()); |
|---|
| 233 | |
|---|
| 234 | // add all devices under device manager to registereddevice att. |
|---|
| 235 | // associate input deviceMgr with registeredDevices |
|---|
| 236 | addDeviceMgrDevices (deviceMgr); |
|---|
| 237 | |
|---|
| 238 | // add all services under device manager to registeredservices |
|---|
| 239 | // associate input deviceMgr with registeredservices |
|---|
| 240 | addDeviceMgrServices (deviceMgr); |
|---|
| 241 | |
|---|
| 242 | //NOTE: The SCA V2.2 describes that all service connections should be established at this point. |
|---|
| 243 | //That step has been performed by the registerDevice operation (called by addDeviceMgrDevices) and by |
|---|
| 244 | //registerService ( called by addDeviceMgrServices). |
|---|
| 245 | //The registerDevice function establish all the connections requiered for the registering device and stores |
|---|
| 246 | //any connection when the requested service is not registered yet. |
|---|
| 247 | //The registerService function will establish any pending connection with the registering service. |
|---|
| 248 | //These two functions together will establish all service connections required. |
|---|
| 249 | |
|---|
| 250 | //Note: In the event of an internal error that prevents the device Mgr registration from success, the |
|---|
| 251 | //RegisterError exception shuld be raised and a FAILURE_ALARM log record written to a DomainManagerÃs Log |
|---|
| 252 | } |
|---|
| 253 | |
|---|
| 254 | |
|---|
| 255 | void |
|---|
| 256 | DomainManager_impl::addDeviceMgr (CF::DeviceManager_ptr deviceMgr) |
|---|
| 257 | { |
|---|
| 258 | |
|---|
| 259 | if (!deviceMgrIsRegistered (deviceMgr)) |
|---|
| 260 | { |
|---|
| 261 | _deviceManagers.length (_deviceManagers.length () + 1); |
|---|
| 262 | _deviceManagers[_deviceManagers.length () - 1] = deviceMgr; |
|---|
| 263 | } |
|---|
| 264 | } |
|---|
| 265 | |
|---|
| 266 | |
|---|
| 267 | void |
|---|
| 268 | DomainManager_impl::addDeviceMgrDevices (CF::DeviceManager_ptr deviceMgr) |
|---|
| 269 | { |
|---|
| 270 | CF::DeviceSequence * devices; |
|---|
| 271 | devices = deviceMgr->registeredDevices (); |
|---|
| 272 | |
|---|
| 273 | //Call registerDevice for each device in the DeviceMgr |
|---|
| 274 | for (unsigned int i = 0; i < devices->length (); i++) |
|---|
| 275 | { |
|---|
| 276 | CF::Device_ptr _dev = (*devices)[i]; //(CF::Device_ptr)&devices[i]; |
|---|
| 277 | registerDevice (_dev, deviceMgr); |
|---|
| 278 | } |
|---|
| 279 | //The registerDevice operation will try to establish any service connections specified in the |
|---|
| 280 | //deviceMgr's DCD for each device. |
|---|
| 281 | } |
|---|
| 282 | |
|---|
| 283 | |
|---|
| 284 | void |
|---|
| 285 | DomainManager_impl::addDeviceMgrServices (CF::DeviceManager_ptr deviceMgr) |
|---|
| 286 | { |
|---|
| 287 | CF::DeviceManager::ServiceSequence *services; |
|---|
| 288 | services = deviceMgr->registeredServices (); |
|---|
| 289 | |
|---|
| 290 | //Call registerService for each service in the DeviceMgr |
|---|
| 291 | for (unsigned int i = 0; i < services->length (); i++ ) |
|---|
| 292 | { |
|---|
| 293 | //(CF::Device_ptr)&devices[i]; |
|---|
| 294 | CF::DeviceManager::ServiceType _serv = (*services)[i]; |
|---|
| 295 | registerService ( _serv.serviceObject, deviceMgr, _serv.serviceName); |
|---|
| 296 | } |
|---|
| 297 | |
|---|
| 298 | //The registerDeviceManager operation shall add the input deviceMgrÃs registeredServices and |
|---|
| 299 | //each registeredServiceÃs names to the DomainManager. The registerDeviceManager operation |
|---|
| 300 | //associates the input deviceMgrÃs with the input deviceMgrÃs registeredServices in the |
|---|
| 301 | //DomainManager in order to support the unregisterDeviceManager operation. |
|---|
| 302 | |
|---|
| 303 | //Note: The registerService operation will establish any pending connection for the registering service |
|---|
| 304 | } |
|---|
| 305 | |
|---|
| 306 | |
|---|
| 307 | void |
|---|
| 308 | DomainManager_impl::unregisterDeviceManager (CF::DeviceManager_ptr deviceMgr) |
|---|
| 309 | throw (CORBA::SystemException, CF::InvalidObjectReference, |
|---|
| 310 | CF::DomainManager::UnregisterError) |
|---|
| 311 | { |
|---|
| 312 | //The unregisterDeviceManager operation shall raise the CF InvalidObjectReference when the |
|---|
| 313 | //input parameter DeviceManager contains an invalid reference to a DeviceManager interface. |
|---|
| 314 | // make sure that the pointer is valid |
|---|
| 315 | if (CORBA::is_nil (deviceMgr)) |
|---|
| 316 | { |
|---|
| 317 | /*writeLogRecord(FAILURE_ALARM,invalid reference input parameter.); */ |
|---|
| 318 | |
|---|
| 319 | throw (CF:: |
|---|
| 320 | InvalidObjectReference |
|---|
| 321 | ("Cannot unregister Device. DeviceMgr is a nil reference.")); |
|---|
| 322 | return; |
|---|
| 323 | } |
|---|
| 324 | |
|---|
| 325 | //NOTE: All disconnections of service event channels are performed by unregisterDevice |
|---|
| 326 | //(called by removeDeviceMgrDevices) |
|---|
| 327 | |
|---|
| 328 | //release all device(s) and service(s) |
|---|
| 329 | removeDeviceMgrDevices (deviceMgr); |
|---|
| 330 | |
|---|
| 331 | removeDeviceMgrServices (deviceMgr); |
|---|
| 332 | |
|---|
| 333 | //The unregisterDeviceManager operation shall unmount all DeviceManagerÃs FileSystems from |
|---|
| 334 | //its File Manager. |
|---|
| 335 | //Unmount filesystem from "/DomainName1/<deviceMgr.label>" |
|---|
| 336 | string mountPoint = "/"; |
|---|
| 337 | mountPoint += _identifier; |
|---|
| 338 | mountPoint += "/"; |
|---|
| 339 | mountPoint += deviceMgr->label(); |
|---|
| 340 | |
|---|
| 341 | _fileMgr->unmount (mountPoint.c_str()); |
|---|
| 342 | |
|---|
| 343 | //The unregisterDeviceManager operation shall unregister a DeviceManager component from the |
|---|
| 344 | //DomainManager. |
|---|
| 345 | removeDeviceMgr (deviceMgr); |
|---|
| 346 | |
|---|
| 347 | //Write log record upon successful registration of Device Manager |
|---|
| 348 | /*writeLogRecord(ADMINISTRATIVE_EVENT, successful unregistration of DeviceManager); */ |
|---|
| 349 | |
|---|
| 350 | //The unregisterDeviceManager operation shall, upon successful unregistration, send an event to |
|---|
| 351 | //the Outgoing Domain Management event channel with event data consisting of a |
|---|
| 352 | //DomainManagementObjectRemovedEventType. The event data will be populated as follows: |
|---|
| 353 | // 1. The producerId shall be the identifier attribute of the DomainManager. |
|---|
| 354 | // 2. The sourceId shall be the identifier attribute of the unregistered DeviceManager. |
|---|
| 355 | // 3. The sourceName shall be the label attribute of the unregistered DeviceManager. |
|---|
| 356 | // 4. The sourceCategory shall be DEVICE_MANAGER. |
|---|
| 357 | |
|---|
| 358 | |
|---|
| 359 | /// \todo Fix event sending |
|---|
| 360 | // StandardEvent::DomainManagementObjectRemovedEventType _objRemovedEvent; |
|---|
| 361 | |
|---|
| 362 | // _objRemovedEvent.producerId = CORBA::string_dup (this->_identifier); |
|---|
| 363 | |
|---|
| 364 | // _objRemovedEvent.sourceId = CORBA::string_dup (deviceMgr->identifier ()); |
|---|
| 365 | |
|---|
| 366 | // _objRemovedEvent.sourceName = CORBA::string_dup (deviceMgr->label ()); |
|---|
| 367 | |
|---|
| 368 | // _objRemovedEvent.sourceCategory = StandardEvent::DEVICE_MANAGER; |
|---|
| 369 | |
|---|
| 370 | // CORBA::Any _anyObjRemovedEvent; |
|---|
| 371 | |
|---|
| 372 | // _anyObjRemovedEvent <<= _objRemovedEvent; |
|---|
| 373 | |
|---|
| 374 | // sendEventToOutgoingChannel (_anyObjRemovedEvent); |
|---|
| 375 | |
|---|
| 376 | //Note: In the event of an internal error that prevents the deviceMgr unregistration from success, the |
|---|
| 377 | //RegisterError exception shuld be raised and a FAILURE_ALARM log record written to a DomainManagerÃs Log |
|---|
| 378 | } |
|---|
| 379 | |
|---|
| 380 | |
|---|
| 381 | void |
|---|
| 382 | DomainManager_impl::removeDeviceMgrDevices (CF::DeviceManager_ptr deviceMgr) |
|---|
| 383 | { |
|---|
| 384 | //The unregisterDeviceManager operation shall release all device(s) associated with |
|---|
| 385 | //the DeviceManager that is being unregistered. |
|---|
| 386 | CF::DeviceSequence * devices; |
|---|
| 387 | devices = deviceMgr->registeredDevices (); |
|---|
| 388 | |
|---|
| 389 | //Call unregisterDevice for each device in the DeviceMgr |
|---|
| 390 | for (unsigned int i = 0; i < devices->length (); i++) |
|---|
| 391 | { |
|---|
| 392 | CF::Device_ptr _dev = (*devices)[i]; |
|---|
| 393 | unregisterDevice (_dev); |
|---|
| 394 | } |
|---|
| 395 | |
|---|
| 396 | } |
|---|
| 397 | |
|---|
| 398 | |
|---|
| 399 | void |
|---|
| 400 | DomainManager_impl::removeDeviceMgrServices (CF::DeviceManager_ptr deviceMgr) |
|---|
| 401 | { |
|---|
| 402 | //The unregisterDeviceManager operation shall release all service(s) associated with |
|---|
| 403 | //the DeviceManager that is being unregistered. |
|---|
| 404 | CF::DeviceManager::ServiceSequence* services; |
|---|
| 405 | services = deviceMgr->registeredServices (); |
|---|
| 406 | |
|---|
| 407 | //Call unregisterDevice for each device in the DeviceMgr |
|---|
| 408 | for (unsigned int i = 0; i < services->length (); i++) |
|---|
| 409 | { |
|---|
| 410 | unregisterService ( (*services)[i].serviceObject, (*services)[i].serviceName ); |
|---|
| 411 | } |
|---|
| 412 | |
|---|
| 413 | } |
|---|
| 414 | |
|---|
| 415 | |
|---|
| 416 | void |
|---|
| 417 | DomainManager_impl::removeDeviceMgr (CF::DeviceManager_ptr deviceMgr) |
|---|
| 418 | { |
|---|
| 419 | //Look for registeredDeviceMgr in _deviceManagers |
|---|
| 420 | //if deviceMgr is not registered, do nothing |
|---|
| 421 | for (unsigned int i = 0; i < _deviceManagers.length (); i++) |
|---|
| 422 | { |
|---|
| 423 | if (strcmp (_deviceManagers[i]->label (), deviceMgr->label ()) == 0) |
|---|
| 424 | { |
|---|
| 425 | //_deviceManagers.remove(i); |
|---|
| 426 | for (unsigned int j = i; j < _deviceManagers.length () - 1; j++) |
|---|
| 427 | { |
|---|
| 428 | _deviceManagers[j] = _deviceManagers[j + 1]; |
|---|
| 429 | } |
|---|
| 430 | _deviceManagers.length (_deviceManagers.length () - 1); |
|---|
| 431 | break; |
|---|
| 432 | } |
|---|
| 433 | } |
|---|
| 434 | |
|---|
| 435 | } |
|---|
| 436 | |
|---|
| 437 | |
|---|
| 438 | void |
|---|
| 439 | DomainManager_impl::registerDevice (CF::Device_ptr registeringDevice, |
|---|
| 440 | CF::DeviceManager_ptr registeredDeviceMgr) |
|---|
| 441 | throw (CORBA::SystemException, CF::InvalidObjectReference, CF::InvalidProfile, |
|---|
| 442 | CF::DomainManager::DeviceManagerNotRegistered, |
|---|
| 443 | CF::DomainManager::RegisterError) |
|---|
| 444 | { |
|---|
| 445 | //Verify they are not a nil reference |
|---|
| 446 | if (CORBA::is_nil (registeringDevice) |
|---|
| 447 | || CORBA::is_nil (registeredDeviceMgr)) |
|---|
| 448 | { |
|---|
| 449 | /*writeLogRecord(FAILURE_ALARM,invalid reference input parameter.); */ |
|---|
| 450 | throw (CF:: |
|---|
| 451 | InvalidObjectReference |
|---|
| 452 | ("Cannot register Device. Either Device or DeviceMgr is a nil reference.")); |
|---|
| 453 | return; |
|---|
| 454 | } |
|---|
| 455 | |
|---|
| 456 | //Verify that input is a registered DeviceManager |
|---|
| 457 | if (!deviceMgrIsRegistered (registeredDeviceMgr)) |
|---|
| 458 | { |
|---|
| 459 | /*writeLogRecord(FAILURE_ALARM,the device could not register because the DeviceManager is not registered with the DomainManager.); */ |
|---|
| 460 | |
|---|
| 461 | throw CF::DomainManager::DeviceManagerNotRegistered (); |
|---|
| 462 | return; |
|---|
| 463 | } |
|---|
| 464 | |
|---|
| 465 | //Add registeringDevice and its attributes to domain manager |
|---|
| 466 | if (storeDeviceInDomainMgr (registeringDevice, registeredDeviceMgr) != |
|---|
| 467 | NULL_ERROR) |
|---|
| 468 | { |
|---|
| 469 | /*writeLogRecord(FAILURE_ALARM,the registeringDevice has an invalid profile.); */ |
|---|
| 470 | //The registerDevice operation shall raise the CF InvalidProfile exception when: |
|---|
| 471 | // 1. The Device's SPD file and the SPDÃs referenced files do not exist or cannot be processed |
|---|
| 472 | // due to the file not being compliant with XML syntax, or |
|---|
| 473 | // 2. The DeviceÃs SPD does not reference allocation properties. |
|---|
| 474 | // throw( CF::InvalidProfile() ); |
|---|
| 475 | throw CF::InvalidProfile (); |
|---|
| 476 | return; |
|---|
| 477 | } |
|---|
| 478 | |
|---|
| 479 | //Check the DCD for connections and establish them |
|---|
| 480 | establishServiceConnections(registeringDevice, registeredDeviceMgr); |
|---|
| 481 | |
|---|
| 482 | ossieSupport::sendObjAdded_event(_identifier, registeringDevice->identifier(), registeringDevice->label(), (CORBA::Object_var) NULL, StandardEvent::DEVICE); |
|---|
| 483 | |
|---|
| 484 | //write a log record when registration is successful |
|---|
| 485 | /*writeLogRecord(ADMINISTRATIVE_EVENT,the device has successfully registered with the DomainManager); */ |
|---|
| 486 | |
|---|
| 487 | //NOTE: This function only checks that the input references are valid and the device manager is registered. |
|---|
| 488 | //No other sanity test is performed. In the event of any internal error that impedes a succesful registration, |
|---|
| 489 | // a FAILURE_ALARM log record should be written and the RegisterError exception should be raised |
|---|
| 490 | } |
|---|
| 491 | |
|---|
| 492 | |
|---|
| 493 | //This function adds the registeringDevice and its atributes to the DomainMgr. |
|---|
| 494 | //if the device already exists it does nothing |
|---|
| 495 | DomainManager_impl::ErrorCode DomainManager_impl::storeDeviceInDomainMgr (CF:: |
|---|
| 496 | Device_ptr |
|---|
| 497 | registeringDevice, |
|---|
| 498 | CF:: |
|---|
| 499 | DeviceManager_ptr |
|---|
| 500 | registeredDeviceMgr) |
|---|
| 501 | { |
|---|
| 502 | ErrorCode parserResult; |
|---|
| 503 | |
|---|
| 504 | //check if device is already registered |
|---|
| 505 | if (deviceIsRegistered (registeringDevice)) |
|---|
| 506 | { |
|---|
| 507 | return NULL_ERROR; //if registeringDevice exists already, do nothing |
|---|
| 508 | } |
|---|
| 509 | //If this part is reached, the registering device has to be added |
|---|
| 510 | //Get read-only attributes from registeringDevice |
|---|
| 511 | DeviceNode * |
|---|
| 512 | newDeviceNode = new DeviceNode; |
|---|
| 513 | |
|---|
| 514 | newDeviceNode->devicePtr = registeringDevice; |
|---|
| 515 | newDeviceNode->devMgrPtr = registeredDeviceMgr; |
|---|
| 516 | newDeviceNode->label = CORBA::string_dup (registeringDevice->label ()); |
|---|
| 517 | newDeviceNode->softwareProfile = |
|---|
| 518 | CORBA::string_dup (registeringDevice->softwareProfile ()); |
|---|
| 519 | |
|---|
| 520 | //parse and get device properties from SPD |
|---|
| 521 | parserResult = getDeviceProperties (*newDeviceNode); |
|---|
| 522 | if (parserResult != NULL_ERROR) |
|---|
| 523 | { |
|---|
| 524 | //There was an error |
|---|
| 525 | return parserResult; |
|---|
| 526 | } |
|---|
| 527 | else |
|---|
| 528 | { |
|---|
| 529 | //add registeringDevice to DomainManager's registeredDevices |
|---|
| 530 | _registeredDevices.push_back (newDeviceNode); |
|---|
| 531 | return NULL_ERROR; |
|---|
| 532 | } |
|---|
| 533 | } |
|---|
| 534 | |
|---|
| 535 | |
|---|
| 536 | DomainManager_impl::ErrorCode DomainManager_impl:: |
|---|
| 537 | getDeviceProperties (DeviceNode & registeringDeviceNode) |
|---|
| 538 | { |
|---|
| 539 | /*PRFProperty parsedProperties; |
|---|
| 540 | //parse SPD |
|---|
| 541 | SPDParser SPDFile( registeringDeviceNode.softwareProfile ); |
|---|
| 542 | |
|---|
| 543 | if( SPDFile.isScaCompliant() ) |
|---|
| 544 | { |
|---|
| 545 | //Parse PRF file to get device's properties |
|---|
| 546 | PRFParser PRFFile( SPDFile.getPRFFile() ); |
|---|
| 547 | parsedProperties = PRFFile.getProperties(); |
|---|
| 548 | //store properties in registeringDeviceNode |
|---|
| 549 | CORBA::Any anyVar; |
|---|
| 550 | for(int i = 0; i < parsedProperties.size(); i++) |
|---|
| 551 | { |
|---|
| 552 | registeringDeviceNode.properties[i].id = CORBA::string_dup( parsedProperties[i]->getID() ); |
|---|
| 553 | ORB_WRAP::anyType( parsedProperties[i]->getType(), parsedProperties[i]->getValue(), anyVar ); |
|---|
| 554 | registeringDeviceNode.properties[i].value = anyVar; |
|---|
| 555 | } |
|---|
| 556 | //return result |
|---|
| 557 | return NULL_ERROR; |
|---|
| 558 | } |
|---|
| 559 | else |
|---|
| 560 | { |
|---|
| 561 | return NOT_SCA_COMPLIANT; |
|---|
| 562 | } */ |
|---|
| 563 | return NULL_ERROR; |
|---|
| 564 | } |
|---|
| 565 | |
|---|
| 566 | |
|---|
| 567 | //This function adds the registeringService and its name to the DomainMgr. |
|---|
| 568 | //if the service already exists it does nothing |
|---|
| 569 | void |
|---|
| 570 | DomainManager_impl::storeServiceInDomainMgr (CORBA::Object_ptr registeringService, CF::DeviceManager_ptr registeredDeviceMgr,const char * name) |
|---|
| 571 | { |
|---|
| 572 | //check if device is already registered |
|---|
| 573 | if (serviceIsRegistered (name)) |
|---|
| 574 | { |
|---|
| 575 | return ; //if registeringDevice exists already, do nothing |
|---|
| 576 | } |
|---|
| 577 | //If this part is reached, the registering device has to be added |
|---|
| 578 | //Get read-only attributes from registeringDevice |
|---|
| 579 | ServiceNode* newServiceNode = new ServiceNode; |
|---|
| 580 | |
|---|
| 581 | newServiceNode->objectPtr = registeringService; |
|---|
| 582 | newServiceNode->devMgrPtr = registeredDeviceMgr; |
|---|
| 583 | newServiceNode->name = CORBA::string_dup (name); |
|---|
| 584 | |
|---|
| 585 | //add registeringService to DomainManager's registeredServices |
|---|
| 586 | _registeredServices.push_back (newServiceNode); |
|---|
| 587 | } |
|---|
| 588 | |
|---|
| 589 | |
|---|
| 590 | //This function removes the registeringService and its name to the DomainMgr. |
|---|
| 591 | //if the service already exists it does nothing |
|---|
| 592 | void |
|---|
| 593 | DomainManager_impl::removeServiceFromDomainMgr (CORBA::Object_ptr registeringService, const char * name) |
|---|
| 594 | { |
|---|
| 595 | vector<ServiceNode*>::iterator p = _registeredServices.begin (); |
|---|
| 596 | //check if service is already registered |
|---|
| 597 | while (p != _registeredServices.end ()) |
|---|
| 598 | { |
|---|
| 599 | ServiceNode* _tmp = *p; |
|---|
| 600 | if (strcmp (name, _tmp->name) == 0) |
|---|
| 601 | { |
|---|
| 602 | _registeredServices.erase (p); |
|---|
| 603 | return; //unregisteringDevice has been removed |
|---|
| 604 | } |
|---|
| 605 | else |
|---|
| 606 | { |
|---|
| 607 | p++; |
|---|
| 608 | } |
|---|
| 609 | } |
|---|
| 610 | //If this part is reached, unregisteringDevice was not registered |
|---|
| 611 | return; |
|---|
| 612 | |
|---|
| 613 | } |
|---|
| 614 | |
|---|
| 615 | |
|---|
| 616 | void |
|---|
| 617 | DomainManager_impl::unregisterDevice (CF::Device_ptr unregisteringDevice) |
|---|
| 618 | throw (CORBA::SystemException, CF::InvalidObjectReference, |
|---|
| 619 | CF::DomainManager::UnregisterError) |
|---|
| 620 | { |
|---|
| 621 | //verify valid reference for a device |
|---|
| 622 | |
|---|
| 623 | if (CORBA::is_nil (unregisteringDevice) |
|---|
| 624 | || !deviceIsRegistered (unregisteringDevice)) |
|---|
| 625 | { |
|---|
| 626 | /*writeLogRecord(FAILURE_ALARM,Device reference is not valid); */ |
|---|
| 627 | |
|---|
| 628 | //The unregisterDevice operation shall raise the CF InvalidObjectReference exception when the |
|---|
| 629 | //input parameter contains an invalid reference to a Device interface. |
|---|
| 630 | throw (CF:: |
|---|
| 631 | InvalidObjectReference |
|---|
| 632 | ("Cannot Unregister Device. Invalid reference")); |
|---|
| 633 | return; |
|---|
| 634 | } |
|---|
| 635 | |
|---|
| 636 | |
|---|
| 637 | ///\todo Figure out what should go and what should be implemented |
|---|
| 638 | |
|---|
| 639 | //disconnect the DeviceÃs consumers and producers Event Service event channel based upon the software profile. |
|---|
| 640 | //The unregisterDevice operation may destroy the Event Service event channel when no more consumers and |
|---|
| 641 | //producers are connected to it. |
|---|
| 642 | // disconectEventService (); |
|---|
| 643 | |
|---|
| 644 | //The unregisterDevice operation shall release (client-side CORBA release) the |
|---|
| 645 | //unregisteringDevice from the Domain Manager. |
|---|
| 646 | removeDeviceFromDomainMgr (unregisteringDevice); |
|---|
| 647 | |
|---|
| 648 | /*writeLogRecord(ADMINISTRATIVE_EVENT, Device was successfuly unregistered); */ |
|---|
| 649 | |
|---|
| 650 | //The unregisterDevice operation shall, upon successful Device unregistration, send an event to the |
|---|
| 651 | //Outgoing Domain Management event channel with event data consisting of a |
|---|
| 652 | //DomainManagementObjectRemovedEventType. The event data will be populated as follows: |
|---|
| 653 | //1. The producerId shall be the identifier attribute of the DomainManager. |
|---|
| 654 | //2. The sourceId shall be the identifier attribute of the unregistered Device. |
|---|
| 655 | //3. The sourceName shall be the lable attribute of the unregistered Device. |
|---|
| 656 | //4. The sourceCategory shall be DEVICE. |
|---|
| 657 | |
|---|
| 658 | /// \todo Fix event sending |
|---|
| 659 | |
|---|
| 660 | // StandardEvent::DomainManagementObjectRemovedEventType _objRemovedEvent; |
|---|
| 661 | |
|---|
| 662 | // _objRemovedEvent.producerId = CORBA::string_dup (this->_identifier); |
|---|
| 663 | |
|---|
| 664 | //_objRemovedEvent.sourceId = CORBA::string_dup( unregisteringDevice->identifier() );//Devices don't have identifiers |
|---|
| 665 | |
|---|
| 666 | // _objRemovedEvent.sourceName = |
|---|
| 667 | // CORBA::string_dup (unregisteringDevice->label ()); |
|---|
| 668 | |
|---|
| 669 | // _objRemovedEvent.sourceCategory = StandardEvent::DEVICE; |
|---|
| 670 | |
|---|
| 671 | // CORBA::Any _anyObjRemovedEvent; |
|---|
| 672 | |
|---|
| 673 | // _anyObjRemovedEvent <<= _objRemovedEvent; |
|---|
| 674 | |
|---|
| 675 | // sendEventToOutgoingChannel (_anyObjRemovedEvent); |
|---|
| 676 | |
|---|
| 677 | //NOTE: This function only checks that the input reference is valid. |
|---|
| 678 | //No other sanity test is performed. In the event of any internal error that impedes a succesful unregistration, |
|---|
| 679 | // a FAILURE_ALARM log record should be written and the UnregisterError exception should be raised |
|---|
| 680 | } |
|---|
| 681 | |
|---|
| 682 | |
|---|
| 683 | //This function removes the registeringDevice and its atributes from the DomainMgr. |
|---|
| 684 | //if the device doesn't exist, it does nothing |
|---|
| 685 | void |
|---|
| 686 | DomainManager_impl::removeDeviceFromDomainMgr (CF:: |
|---|
| 687 | Device_ptr unregisteringDevice) |
|---|
| 688 | { |
|---|
| 689 | vector < DeviceNode * >::iterator p = _registeredDevices.begin (); |
|---|
| 690 | //check if device is already registered |
|---|
| 691 | while (p != _registeredDevices.end ()) |
|---|
| 692 | { |
|---|
| 693 | DeviceNode *_tmp = *p; |
|---|
| 694 | if (!strcmp (unregisteringDevice->label (), _tmp->devicePtr->label ())) |
|---|
| 695 | { |
|---|
| 696 | _registeredDevices.erase (p); |
|---|
| 697 | return; //unregisteringDevice has been removed |
|---|
| 698 | } |
|---|
| 699 | else |
|---|
| 700 | { |
|---|
| 701 | p++; |
|---|
| 702 | } |
|---|
| 703 | } |
|---|
| 704 | |
|---|
| 705 | //If this part is reached, unregisteringDevice was not registered |
|---|
| 706 | return; |
|---|
| 707 | |
|---|
| 708 | } |
|---|
| 709 | |
|---|
| 710 | |
|---|
| 711 | //This function returns TRUE if the input registeredDevice is contained in the _registeredDevices |
|---|
| 712 | bool DomainManager_impl::deviceIsRegistered (CF::Device_ptr registeredDevice) |
|---|
| 713 | { |
|---|
| 714 | for (unsigned int i = 0; i < _registeredDevices.size (); i++) |
|---|
| 715 | { |
|---|
| 716 | registeredDevice->label (); |
|---|
| 717 | _registeredDevices[i]->devicePtr->label (); |
|---|
| 718 | if (strcmp |
|---|
| 719 | (_registeredDevices[i]->devicePtr->label (), |
|---|
| 720 | registeredDevice->label ()) == 0) |
|---|
| 721 | { |
|---|
| 722 | return true; |
|---|
| 723 | } |
|---|
| 724 | } |
|---|
| 725 | return false; |
|---|
| 726 | } |
|---|
| 727 | |
|---|
| 728 | |
|---|
| 729 | bool DomainManager_impl::serviceIsRegistered (const char *serviceName) |
|---|
| 730 | { |
|---|
| 731 | for (unsigned int i = 0; i < _registeredServices.size (); i++) |
|---|
| 732 | { |
|---|
| 733 | if (strcmp (_registeredServices[i]->name, serviceName) == 0) |
|---|
| 734 | { |
|---|
| 735 | return true; |
|---|
| 736 | } |
|---|
| 737 | } |
|---|
| 738 | return false; |
|---|
| 739 | } |
|---|
| 740 | |
|---|
| 741 | |
|---|
| 742 | //This function returns TRUE if the input registeredDeviceMgr is contained in the _deviceManagers list attribute |
|---|
| 743 | bool |
|---|
| 744 | DomainManager_impl::deviceMgrIsRegistered (CF:: |
|---|
| 745 | DeviceManager_ptr |
|---|
| 746 | registeredDeviceMgr) |
|---|
| 747 | { |
|---|
| 748 | //Look for registeredDeviceMgr in _deviceManagers |
|---|
| 749 | for (unsigned int i = 0; i < _deviceManagers.length (); i++) |
|---|
| 750 | { |
|---|
| 751 | if (strcmp |
|---|
| 752 | (_deviceManagers[i]->identifier (), |
|---|
| 753 | registeredDeviceMgr->identifier ()) == 0) |
|---|
| 754 | { |
|---|
| 755 | return true; |
|---|
| 756 | } |
|---|
| 757 | } |
|---|
| 758 | return false; |
|---|
| 759 | } |
|---|
| 760 | |
|---|
| 761 | |
|---|
| 762 | void |
|---|
| 763 | DomainManager_impl::establishServiceConnections (CF::Device_ptr registeringDevice, CF::DeviceManager_ptr registeredDeviceMgr) |
|---|
| 764 | { |
|---|
| 765 | //There are no services for this release. This determination may change though. |
|---|
| 766 | |
|---|
| 767 | //Parse DCD. Obtain all software profiles from deviceManager's fileSys |
|---|
| 768 | |
|---|
| 769 | //The registerDeviceManager operation shall perform the connections specified in the connections |
|---|
| 770 | //element of the deviceMgrÃs Device Configuration Descriptor (DCD) file. If the |
|---|
| 771 | //DeviceManagerÃs DCD describes a connection for a service that has not been registered with the |
|---|
| 772 | //DomainManager, the registerDeviceManager operation shall establish any pending connection |
|---|
| 773 | //when the service registers with the DomainManager by the registerDeviceManager operation. |
|---|
| 774 | |
|---|
| 775 | //get DCD's connections |
|---|
| 776 | |
|---|
| 777 | DCDParser _dcdParser( registeredDeviceMgr->deviceConfigurationProfile() ); |
|---|
| 778 | |
|---|
| 779 | std::vector<Connection*>* _connection = _dcdParser.getConnections(); |
|---|
| 780 | |
|---|
| 781 | for( int _numConnections = _connection->size() - 1; _numConnections >= 0; _numConnections-- ) |
|---|
| 782 | { |
|---|
| 783 | UsesPort* _usesPortParser = (*_connection)[ _numConnections ]->getUsesPort(); |
|---|
| 784 | |
|---|
| 785 | FindBy* _findUsesPortBy = _usesPortParser->getFindBy(); |
|---|
| 786 | |
|---|
| 787 | ProvidesPort* _providesPortParser = NULL; |
|---|
| 788 | |
|---|
| 789 | FindBy* _findProvidesPortBy = NULL; |
|---|
| 790 | |
|---|
| 791 | //ComponentSupportInterface* _componentSuppInterface = NULL: |
|---|
| 792 | |
|---|
| 793 | if( (*_connection)[ _numConnections ]->isProvidesPort() ) |
|---|
| 794 | _providesPortParser = (*_connection)[ _numConnections ]->getProvidesPort(); |
|---|
| 795 | else if( (*_connection)[ _numConnections ]->isFindBy() ) |
|---|
| 796 | _findProvidesPortBy = (*_connection)[ _numConnections ]->getFindBy(); |
|---|
| 797 | // else if( _connection[ _numConnections ]->isComponentSupportedInterface() ) |
|---|
| 798 | else |
|---|
| 799 | { |
|---|
| 800 | //throw an exception? |
|---|
| 801 | } |
|---|
| 802 | |
|---|
| 803 | //get the connections that involve this device |
|---|
| 804 | int deviceIsUsing = -1; |
|---|
| 805 | if( !strcmp( _usesPortParser->getID(), registeringDevice->label() ) ) deviceIsUsing = 1; |
|---|
| 806 | else if( !strcmp( _providesPortParser->getID(), registeringDevice->label() ) ) deviceIsUsing = 0; |
|---|
| 807 | |
|---|
| 808 | char serviceName[128]; |
|---|
| 809 | if( deviceIsUsing >= 0) |
|---|
| 810 | { |
|---|
| 811 | //verify that the service is registered |
|---|
| 812 | if(deviceIsUsing) |
|---|
| 813 | { |
|---|
| 814 | strcpy( serviceName, _providesPortParser->getID() ); |
|---|
| 815 | } |
|---|
| 816 | else |
|---|
| 817 | { |
|---|
| 818 | strcpy( serviceName, _usesPortParser->getID() ); |
|---|
| 819 | } |
|---|
| 820 | if( serviceIsRegistered( serviceName ) ) |
|---|
| 821 | { |
|---|
| 822 | //get object pointers |
|---|
| 823 | //establish the connection |
|---|
| 824 | CORBA::Object_var _usesObj; |
|---|
| 825 | |
|---|
| 826 | CORBA::Object_var _providesObj; |
|---|
| 827 | |
|---|
| 828 | if( _providesPortParser != NULL ) |
|---|
| 829 | _findProvidesPortBy = _providesPortParser->getFindBy(); |
|---|
| 830 | |
|---|
| 831 | if( _findUsesPortBy->isFindByNamingService() ) |
|---|
| 832 | { |
|---|
| 833 | while( CORBA::is_nil( _usesObj ) ) |
|---|
| 834 | ///\todo When services are implemented fix this _usesObj = _orb_wrap->lookup( _findUsesPortBy->getFindByNamingServiceName() ); |
|---|
| 835 | ; |
|---|
| 836 | } |
|---|
| 837 | |
|---|
| 838 | if( _findProvidesPortBy->isFindByNamingService() ) |
|---|
| 839 | { |
|---|
| 840 | while( CORBA::is_nil( _providesObj ) ) |
|---|
| 841 | ///\todo When services are implemented fix this _providesObj = _orb_wrap->lookup( _findProvidesPortBy->getFindByNamingServiceName() ); |
|---|
| 842 | ; |
|---|
| 843 | } |
|---|
| 844 | |
|---|
| 845 | CF::PortSupplier_ptr _usesPort = CF::PortSupplier::_narrow( _usesObj ); |
|---|
| 846 | |
|---|
| 847 | CF::Port_ptr _port = CF::Port::_narrow( _usesPort->getPort( _usesPortParser->getID() ) ); |
|---|
| 848 | |
|---|
| 849 | _port->connectPort( _providesObj, CORBA::string_dup( (*_connection)[ _numConnections ]->getID() ) ); |
|---|
| 850 | |
|---|
| 851 | CORBA::release(_usesPort); |
|---|
| 852 | CORBA::release(_port); |
|---|
| 853 | } |
|---|
| 854 | else |
|---|
| 855 | { |
|---|
| 856 | _pendingConnections.push_back(new Connection( *(*_connection)[ _numConnections ] )); |
|---|
| 857 | } |
|---|
| 858 | } |
|---|
| 859 | } |
|---|
| 860 | |
|---|
| 861 | //For connections established for a CORBA Event ServiceÃs event channel, the |
|---|
| 862 | //registerDeviceManager operation shall connect a CosEventComm PushConsumer or |
|---|
| 863 | //PushSupplier object to the event channel as specified in the DCDÃs domainfinder element. If the |
|---|
| 864 | //event channel does not exist, the registerDeviceManager operation shall create the event |
|---|
| 865 | //channel. |
|---|
| 866 | /*connectToEventChannel(); */ |
|---|
| 867 | |
|---|
| 868 | } |
|---|
| 869 | |
|---|
| 870 | |
|---|
| 871 | void |
|---|
| 872 | DomainManager_impl::establishPendingServiceConnections (const char * serviceName) |
|---|
| 873 | { |
|---|
| 874 | for (int _numConnections = _pendingConnections.size () - 1; _numConnections >= 0; _numConnections--) |
|---|
| 875 | { |
|---|
| 876 | UsesPort* _usesPortParser = _pendingConnections[ _numConnections ]->getUsesPort (); |
|---|
| 877 | |
|---|
| 878 | FindBy* _findUsesPortBy = _usesPortParser->getFindBy (); |
|---|
| 879 | |
|---|
| 880 | ProvidesPort* _providesPortParser = NULL; |
|---|
| 881 | |
|---|
| 882 | FindBy* _findProvidesPortBy = NULL; |
|---|
| 883 | |
|---|
| 884 | //ComponentSupportInterface* _componentSuppInterface = NULL: |
|---|
| 885 | |
|---|
| 886 | if (_pendingConnections[ _numConnections ]->isProvidesPort ()) |
|---|
| 887 | _providesPortParser = _pendingConnections[ _numConnections ]->getProvidesPort (); |
|---|
| 888 | else if ( _pendingConnections[ _numConnections ]->isFindBy ()) |
|---|
| 889 | _findProvidesPortBy = _pendingConnections[ _numConnections ]->getFindBy (); |
|---|
| 890 | // else if( _connection[ _numConnections ]->isComponentSupportedInterface() ) |
|---|
| 891 | else |
|---|
| 892 | { |
|---|
| 893 | //throw an exception? |
|---|
| 894 | } |
|---|
| 895 | |
|---|
| 896 | //get the connections that involve this device |
|---|
| 897 | if (!strcmp (_usesPortParser->getID (), serviceName) || |
|---|
| 898 | !strcmp (_providesPortParser->getID (), serviceName)) |
|---|
| 899 | { |
|---|
| 900 | |
|---|
| 901 | //get object pointers |
|---|
| 902 | //establish the connection |
|---|
| 903 | CORBA::Object_var _usesObj; |
|---|
| 904 | |
|---|
| 905 | CORBA::Object_var _providesObj; |
|---|
| 906 | |
|---|
| 907 | if (_providesPortParser != NULL) |
|---|
| 908 | _findProvidesPortBy = _providesPortParser->getFindBy (); |
|---|
| 909 | |
|---|
| 910 | if (_findUsesPortBy->isFindByNamingService ()) |
|---|
| 911 | { |
|---|
| 912 | while (CORBA::is_nil (_usesObj)) |
|---|
| 913 | ///\todo When services are implemented fix this _usesObj = _orb_wrap->lookup ( _findUsesPortBy->getFindByNamingServiceName ()); |
|---|
| 914 | ; |
|---|
| 915 | } |
|---|
| 916 | |
|---|
| 917 | if (_findProvidesPortBy->isFindByNamingService ()) |
|---|
| 918 | { |
|---|
| 919 | while (CORBA::is_nil (_providesObj)) |
|---|
| 920 | ///\todo When services are implemented fix this _providesObj = _orb_wrap->lookup (_findProvidesPortBy->getFindByNamingServiceName ()); |
|---|
| 921 | ; |
|---|
| 922 | } |
|---|
| 923 | |
|---|
| 924 | CF::PortSupplier_ptr _usesPort = CF::PortSupplier::_narrow (_usesObj); |
|---|
| 925 | |
|---|
| 926 | CF::Port_ptr _port = CF::Port::_narrow (_usesPort->getPort (_usesPortParser->getID ())); |
|---|
| 927 | |
|---|
| 928 | _port->connectPort (_providesObj, CORBA::string_dup (_pendingConnections[ _numConnections ]->getID ())); |
|---|
| 929 | |
|---|
| 930 | CORBA::release(_usesPort); |
|---|
| 931 | CORBA::release(_port); |
|---|
| 932 | } |
|---|
| 933 | } |
|---|
| 934 | |
|---|
| 935 | } |
|---|
| 936 | |
|---|
| 937 | |
|---|
| 938 | void |
|---|
| 939 | DomainManager_impl::disconnectThisService (const char * serviceName) |
|---|
| 940 | { |
|---|
| 941 | //search registered devices to obtain the deviceManager of this service |
|---|
| 942 | CF::DeviceManager_ptr devMgr; |
|---|
| 943 | for (unsigned int i = 0; i < _registeredServices.size (); i++ ) |
|---|
| 944 | if (!strcmp (serviceName, _registeredServices[i]->name)) |
|---|
| 945 | devMgr = _registeredServices[i]->devMgrPtr; |
|---|
| 946 | |
|---|
| 947 | //get the DCD |
|---|
| 948 | DCDParser _dcdParser (devMgr->deviceConfigurationProfile ()); |
|---|
| 949 | |
|---|
| 950 | //parse connections of this DCD |
|---|
| 951 | std::vector<Connection*>* _connection = _dcdParser.getConnections (); |
|---|
| 952 | |
|---|
| 953 | //Find the connections that involve this service |
|---|
| 954 | //disconnect the ports the are using this service |
|---|
| 955 | for (int _numConnections = _connection->size () - 1; _numConnections >= 0; _numConnections--) |
|---|
| 956 | { |
|---|
| 957 | UsesPort* _usesPortParser = (*_connection)[ _numConnections ]->getUsesPort (); |
|---|
| 958 | |
|---|
| 959 | FindBy* _findUsesPortBy = _usesPortParser->getFindBy (); |
|---|
| 960 | |
|---|
| 961 | ProvidesPort* _providesPortParser = NULL; |
|---|
| 962 | |
|---|
| 963 | FindBy* _findProvidesPortBy = NULL; |
|---|
| 964 | |
|---|
| 965 | //ComponentSupportInterface* _componentSuppInterface = NULL: |
|---|
| 966 | |
|---|
| 967 | if ((*_connection)[ _numConnections ]->isProvidesPort ()) |
|---|
| 968 | _providesPortParser = (*_connection)[ _numConnections ]->getProvidesPort (); |
|---|
| 969 | else if ((*_connection)[ _numConnections ]->isFindBy ()) |
|---|
| 970 | _findProvidesPortBy = (*_connection)[ _numConnections ]->getFindBy (); |
|---|
| 971 | // else if ( _connection[ _numConnections ]->isComponentSupportedInterface ()) |
|---|
| 972 | else |
|---|
| 973 | { |
|---|
| 974 | //throw an exception? |
|---|
| 975 | } |
|---|
| 976 | |
|---|
| 977 | //get the connections that involve this device |
|---|
| 978 | if (!strcmp (_providesPortParser->getID (), serviceName)) |
|---|
| 979 | { |
|---|
| 980 | CORBAOBJ _usesObj = CORBA::Object::_nil (); |
|---|
| 981 | |
|---|
| 982 | if (_findUsesPortBy->isFindByNamingService ()) |
|---|
| 983 | { |
|---|
| 984 | while (CORBA::is_nil (_usesObj)) |
|---|
| 985 | ///\todo When services are implemented fix this _usesObj = _orb_wrap->lookup (_findUsesPortBy->getFindByNamingServiceName ()); |
|---|
| 986 | ; |
|---|
| 987 | } |
|---|
| 988 | |
|---|
| 989 | CF::PortSupplier_ptr _usesPort = CF::PortSupplier::_narrow (_usesObj); |
|---|
| 990 | |
|---|
| 991 | CF::Port_ptr _port = CF::Port::_narrow (_usesPort->getPort (_usesPortParser->getID ())); |
|---|
| 992 | |
|---|
| 993 | _port->disconnectPort (CORBA::string_dup ((*_connection)[ _numConnections ]->getID ())); |
|---|
| 994 | |
|---|
| 995 | //store this connection in pendingConnections so it is established |
|---|
| 996 | //again when this service registers again |
|---|
| 997 | _pendingConnections.push_back ( new Connection ( *(*_connection)[ _numConnections ])); |
|---|
| 998 | CORBA::release(_usesPort); |
|---|
| 999 | CORBA::release(_port); |
|---|
| 1000 | } |
|---|
| 1001 | } |
|---|
| 1002 | } |
|---|
| 1003 | |
|---|
| 1004 | |
|---|
| 1005 | |
|---|
| 1006 | |
|---|
| 1007 | |
|---|
| 1008 | /*void DomainManager_impl::writeLogRecord(CF::LogLevelType logLevelType) |
|---|
| 1009 | { |
|---|
| 1010 | //There are no services considered in this release |
|---|
| 1011 | }*/ |
|---|
| 1012 | |
|---|
| 1013 | // METHOD: installApplication |
|---|
| 1014 | // PURPOSE: verify that all application file dependencies are available within |
|---|
| 1015 | // the domain managers file manager |
|---|
| 1016 | // EXCEPTIONS: |
|---|
| 1017 | // -- InvalidProfile |
|---|
| 1018 | // -- InvalidFileName |
|---|
| 1019 | // -- ApplicationInstallationError |
|---|
| 1020 | |
|---|
| 1021 | void |
|---|
| 1022 | DomainManager_impl::installApplication (const char *profileFileName) |
|---|
| 1023 | throw (CORBA::SystemException, CF::InvalidProfile, CF::InvalidFileName, |
|---|
| 1024 | CF::DomainManager::ApplicationInstallationError) |
|---|
| 1025 | { |
|---|
| 1026 | // NOTE: the <softwareassembly> name attribute is the name of the App Factory |
|---|
| 1027 | // that is currently installed because it is the installed factory that |
|---|
| 1028 | // provides the value of profileFileName |
|---|
| 1029 | cout << "Entering installApplication" << endl; |
|---|
| 1030 | try { |
|---|
| 1031 | // check the profile ends with .sad.xml, warn if it doesn't |
|---|
| 1032 | if ((strstr (profileFileName, ".sad.xml")) == NULL) |
|---|
| 1033 | cerr << "File " << profileFileName << " should end with .sad.xml." << endl; |
|---|
| 1034 | |
|---|
| 1035 | this->validate (profileFileName); |
|---|
| 1036 | |
|---|
| 1037 | /// \todo verify that SAD conforms to DTD by allowing parser to throw an exception |
|---|
| 1038 | // then the DomainManager throws a CF::InvalidProfile if the SAD does not conform |
|---|
| 1039 | SADParser *sadParser = new SADParser (profileFileName); |
|---|
| 1040 | |
|---|
| 1041 | // check if application factory already exists for this profile |
|---|
| 1042 | for (unsigned int i = 0; i < appFact_servants.size(); i++) |
|---|
| 1043 | { |
|---|
| 1044 | if (!strcmp(sadParser->getID (), appFact_servants[i]->identifier())) |
|---|
| 1045 | { |
|---|
| 1046 | delete sadParser; |
|---|
| 1047 | return; |
|---|
| 1048 | } |
|---|
| 1049 | } |
|---|
| 1050 | |
|---|
| 1051 | // query the SAD for all ComponentPlacement's |
|---|
| 1052 | vector < SADComponentPlacement * >*sadComponents = |
|---|
| 1053 | sadParser->getComponents (); |
|---|
| 1054 | |
|---|
| 1055 | // query each ComponentPlacement for its SPD file |
|---|
| 1056 | //sadComponents.begin(); |
|---|
| 1057 | vector < SADComponentPlacement * >::iterator _iterator = sadComponents->begin (); |
|---|
| 1058 | |
|---|
| 1059 | while (_iterator != sadComponents->end ()) |
|---|
| 1060 | { |
|---|
| 1061 | this->validateSPD ((*_iterator)->getSPDFile ()); |
|---|
| 1062 | ++_iterator; |
|---|
| 1063 | } |
|---|
| 1064 | |
|---|
| 1065 | appFact_servants.push_back(new ApplicationFactory_impl (profileFileName, &_applications)); |
|---|
| 1066 | |
|---|
| 1067 | unsigned int appFactIndex = appFact_servants.size()-1; |
|---|
| 1068 | |
|---|
| 1069 | _applicationFactories.length(appFactIndex+1); ///\todo Preallocate based on number of apps in init() |
|---|
| 1070 | _applicationFactories[appFactIndex] = appFact_servants[appFactIndex]->_this(); |
|---|
| 1071 | |
|---|
| 1072 | ossieSupport::sendObjAdded_event(_identifier, sadParser->getID(), sadParser->getName(), (CORBA::Object_var) NULL, StandardEvent::APPLICATION_FACTORY); |
|---|
| 1073 | |
|---|
| 1074 | |
|---|
| 1075 | delete sadParser; |
|---|
| 1076 | |
|---|
| 1077 | } catch (CF::FileException ex) { |
|---|
| 1078 | throw CF::DomainManager::ApplicationInstallationError (CF::CFEBADF, ex.msg); |
|---|
| 1079 | } |
|---|
| 1080 | |
|---|
| 1081 | cout << "Leaving installApplication" << endl; |
|---|
| 1082 | } |
|---|
| 1083 | |
|---|
| 1084 | |
|---|
| 1085 | void |
|---|
| 1086 | DomainManager_impl::uninstallApplication (const char *applicationId) |
|---|
| 1087 | throw (CORBA::SystemException, CF::DomainManager::InvalidIdentifier, |
|---|
| 1088 | CF::DomainManager::ApplicationUninstallationError) |
|---|
| 1089 | { |
|---|
| 1090 | // NOTE: applicationId is the value of the <softwareassembly> name attribute |
|---|
| 1091 | // for the App Factory's SAD profile |
|---|
| 1092 | |
|---|
| 1093 | int appNum = -1; |
|---|
| 1094 | |
|---|
| 1095 | { ///\bug Figure out MSVC flags to corectly scope for loops |
|---|
| 1096 | for (unsigned int i = 0; i < appFact_servants.size(); i++) |
|---|
| 1097 | { |
|---|
| 1098 | if (strcmp (applicationId, |
|---|
| 1099 | appFact_servants[i]->identifier ()) == 0) |
|---|
| 1100 | { |
|---|
| 1101 | appNum = i; |
|---|
| 1102 | break; |
|---|
| 1103 | } |
|---|
| 1104 | } |
|---|
| 1105 | } |
|---|
| 1106 | |
|---|
| 1107 | if (appNum == -1) |
|---|
| 1108 | throw CF::DomainManager::InvalidIdentifier (); |
|---|
| 1109 | |
|---|
| 1110 | SADParser sadParser (appFact_servants[appNum]->softwareProfile ()); |
|---|
| 1111 | |
|---|
| 1112 | // remove all files associated with the Application |
|---|
| 1113 | std::vector < SADComponentPlacement * >*sadComponents = |
|---|
| 1114 | sadParser.getComponents (); |
|---|
| 1115 | |
|---|
| 1116 | std::vector < SADComponentPlacement * >::iterator _iterator = |
|---|
| 1117 | sadComponents->begin (); |
|---|
| 1118 | |
|---|
| 1119 | while (_iterator != sadComponents->end ()) |
|---|
| 1120 | { |
|---|
| 1121 | //this->removeSPD( (*_iterator)->getSPDFile() ); // technically, this is supposed to happen |
|---|
| 1122 | // however, we don't think so, so we took it out. |
|---|
| 1123 | ++_iterator; |
|---|
| 1124 | } |
|---|
| 1125 | ///\todo Finish vectorization of uninstallApplication if double free fixed |
|---|
| 1126 | // installedApplicationFactories.erase(appNum); |
|---|
| 1127 | |
|---|
| 1128 | // if SUCCESS, write an ADMINISTRATIVE_EVENT to the DomainMgr's Log |
|---|
| 1129 | |
|---|
| 1130 | // send event to Outgoing Domain Management channel consisting of: |
|---|
| 1131 | // DomainManager identifier attribute |
|---|
| 1132 | // this->_identifier |
|---|
| 1133 | // uninstalled AppFactory identifier |
|---|
| 1134 | // sadParser.getId() |
|---|
| 1135 | // uninstalled AppFactory name |
|---|
| 1136 | // sadParser.getName() |
|---|
| 1137 | // uninstalled AppFactory IOR |
|---|
| 1138 | // ask the ORB |
|---|
| 1139 | // sourceCategory = APPLICATION_FACTORY |
|---|
| 1140 | // StandardEvent enumeration |
|---|
| 1141 | |
|---|
| 1142 | /// \todo Fix event sending |
|---|
| 1143 | |
|---|
| 1144 | // StandardEvent::DomainManagementObjectRemovedEventType _objRemovedEvent; |
|---|
| 1145 | |
|---|
| 1146 | // _objRemovedEvent.producerId = CORBA::string_dup (this->_identifier); |
|---|
| 1147 | |
|---|
| 1148 | // _objRemovedEvent.sourceId = CORBA::string_dup (sadParser.getID ()); |
|---|
| 1149 | |
|---|
| 1150 | // _objRemovedEvent.sourceName = CORBA::string_dup (sadParser.getName ()); |
|---|
| 1151 | |
|---|
| 1152 | // _objRemovedEvent.sourceCategory = StandardEvent::APPLICATION_FACTORY; |
|---|
| 1153 | |
|---|
| 1154 | // CORBA::Any _anyObjRemovedEvent; |
|---|
| 1155 | |
|---|
| 1156 | // _anyObjRemovedEvent <<= _objRemovedEvent; |
|---|
| 1157 | |
|---|
| 1158 | // sendEventToOutgoingChannel (_anyObjRemovedEvent); |
|---|
| 1159 | } |
|---|
| 1160 | |
|---|
| 1161 | |
|---|
| 1162 | void |
|---|
| 1163 | DomainManager_impl::registerWithEventChannel (CORBA:: |
|---|
| 1164 | Object_ptr registeringObject, |
|---|
| 1165 | const char *registeringId, |
|---|
| 1166 | const char *eventChannelName) |
|---|
| 1167 | throw (CORBA::SystemException, CF::InvalidObjectReference, |
|---|
| 1168 | CF::DomainManager::InvalidEventChannelName, |
|---|
| 1169 | CF::DomainManager::AlreadyConnected) |
|---|
| 1170 | { |
|---|
| 1171 | #if 0 ///\todo uncommment |
|---|
| 1172 | // connect input registeringObject to an event channel as specified by the eventChannelName |
|---|
| 1173 | // Narrow the object to the CosEventComm::PushConsumer interface |
|---|
| 1174 | CosEventComm::PushConsumer_var consumer = |
|---|
| 1175 | CosEventComm::PushConsumer::_narrow (registeringObject); |
|---|
| 1176 | |
|---|
| 1177 | if (CORBA::is_nil (consumer)) |
|---|
| 1178 | { |
|---|
| 1179 | // Raise the CF::InvalidObjectReference exception |
|---|
| 1180 | //cerr << "Invalid PushConsumer Object Reference" << endl; |
|---|
| 1181 | throw CF::InvalidObjectReference (); |
|---|
| 1182 | } |
|---|
| 1183 | |
|---|
| 1184 | // Get the ConsumerAdmin object from the event channel |
|---|
| 1185 | CosEventChannelAdmin::ConsumerAdmin_var consumerAdmin; |
|---|
| 1186 | |
|---|
| 1187 | // Any registerWithEventChannel request received should be for the ODM_Channel only. |
|---|
| 1188 | if (strcmp (eventChannelName, "ODM_Channel") == 0) |
|---|
| 1189 | consumerAdmin = _odmEventChannel->for_consumers (); |
|---|
| 1190 | else if (strcmp (eventChannelName, "IDM_Channel") == 0) |
|---|
| 1191 | consumerAdmin = _idmEventChannel->for_consumers (); |
|---|
| 1192 | else |
|---|
| 1193 | { |
|---|
| 1194 | // Raise the CF::InvalidEventChannelName exception |
|---|
| 1195 | //cerr << "Invalid Event Channel Name: " << eventChannelName << endl; |
|---|
| 1196 | throw CF::DomainManager::InvalidEventChannelName (); |
|---|
| 1197 | } |
|---|
| 1198 | |
|---|
| 1199 | CosEventChannelAdmin::ProxyPushSupplier_var supplier = |
|---|
| 1200 | consumerAdmin->obtain_push_supplier (); |
|---|
| 1201 | |
|---|
| 1202 | // Connect to the Push supplier: Raises AlreadyConnected |
|---|
| 1203 | supplier->connect_push_consumer (consumer); |
|---|
| 1204 | #endif |
|---|
| 1205 | } |
|---|
| 1206 | |
|---|
| 1207 | |
|---|
| 1208 | void |
|---|
| 1209 | DomainManager_impl::unregisterFromEventChannel (const char *unregisteringId, |
|---|
| 1210 | const char *eventChannelName) |
|---|
| 1211 | throw (CORBA::SystemException, CF::DomainManager::InvalidEventChannelName, |
|---|
| 1212 | CF::DomainManager::NotConnected) |
|---|
| 1213 | { |
|---|
| 1214 | #if 0 /// \todo uncomment |
|---|
| 1215 | // Any registerWithEventChannel request received should be for the IDM_Channel only. |
|---|
| 1216 | if (!(strcmp (eventChannelName, "IDM_Channel") == 0)) |
|---|
| 1217 | { |
|---|
| 1218 | // Raise the CF::InvalidEventChannelName exception |
|---|
| 1219 | //cerr << "Invalid Event Channel Name: " << eventChannelName << endl; |
|---|
| 1220 | throw CF::DomainManager::InvalidEventChannelName (); |
|---|
| 1221 | } |
|---|
| 1222 | |
|---|
| 1223 | // Get the ConsumerAdmin object from the event channel |
|---|
| 1224 | CosEventChannelAdmin::ConsumerAdmin_var consumerAdmin = |
|---|
| 1225 | _idmEventChannel->for_consumers (); |
|---|
| 1226 | |
|---|
| 1227 | CosEventChannelAdmin::ProxyPushSupplier_var supplier = |
|---|
| 1228 | consumerAdmin->obtain_push_supplier (); |
|---|
| 1229 | |
|---|
| 1230 | // Connect to the Push supplier: Raises NotConnected |
|---|
| 1231 | |
|---|
| 1232 | // get the reference from the "unregisteringId" |
|---|
| 1233 | |
|---|
| 1234 | CORBA::Object_var obj = ORB_WRAP::orb->string_to_object (unregisteringId); |
|---|
| 1235 | |
|---|
| 1236 | if (CORBA::is_nil (obj.in ())) { |
|---|
| 1237 | //cerr << "Object " << unregisteringId << " is invalid!!" << endl; |
|---|
| 1238 | throw CF::InvalidObjectReference (); |
|---|
| 1239 | } |
|---|
| 1240 | |
|---|
| 1241 | CosEventComm::PushConsumer_var consumer = |
|---|
| 1242 | CosEventComm::PushConsumer::_narrow (obj.in ()); |
|---|
| 1243 | |
|---|
| 1244 | consumer->disconnect_push_consumer (); |
|---|
| 1245 | #endif |
|---|
| 1246 | } |
|---|
| 1247 | |
|---|
| 1248 | |
|---|
| 1249 | void DomainManager_impl::registerService( |
|---|
| 1250 | CORBA::Object_ptr registeringService, |
|---|
| 1251 | CF::DeviceManager_ptr registeredDeviceMgr, |
|---|
| 1252 | const char * name) |
|---|
| 1253 | throw ( |
|---|
| 1254 | CF::DomainManager::RegisterError, |
|---|
| 1255 | CF::DomainManager::DeviceManagerNotRegistered, |
|---|
| 1256 | CF::InvalidObjectReference, |
|---|
| 1257 | CORBA::SystemException) |
|---|
| 1258 | { |
|---|
| 1259 | //The registerService operation shall verify the input registeringService and registeredDeviceMgr |
|---|
| 1260 | //are valid object references. |
|---|
| 1261 | |
|---|
| 1262 | //Verify they are not a nil reference |
|---|
| 1263 | if ( CORBA::is_nil(registeringService) || CORBA::is_nil(registeredDeviceMgr) ) |
|---|
| 1264 | { |
|---|
| 1265 | //The registerService operation shall raise the CF InvalidObjectReference exception when input |
|---|
| 1266 | //parameters registeringService or registeredDeviceMgr contains an invalid reference. |
|---|
| 1267 | |
|---|
| 1268 | /*writeLogRecord(FAILURE_ALARM,invalid reference input parameter.);*/ |
|---|
| 1269 | throw( CF::InvalidObjectReference("Cannot register Service. Either registeringService or DeviceMgr is a nil reference.") ); |
|---|
| 1270 | } |
|---|
| 1271 | |
|---|
| 1272 | //The registerService operation shall verify the input registeredDeviceMgr has been previously |
|---|
| 1273 | //registered with the DomainManager. |
|---|
| 1274 | |
|---|
| 1275 | //Verify that input is a registered DeviceManager |
|---|
| 1276 | if (!deviceMgrIsRegistered (registeredDeviceMgr)) |
|---|
| 1277 | { |
|---|
| 1278 | //The registerService operation shall raise a DeviceManagerNotRegistered exception when the |
|---|
| 1279 | //input registeredDeviceMgr parameter is not a nil reference and is not registered with the |
|---|
| 1280 | //DomainManager. |
|---|
| 1281 | |
|---|
| 1282 | /*writeLogRecord(FAILURE_ALARM,the service could not register because |
|---|
| 1283 | the DeviceManager is not registered with the DomainManager.);*/ |
|---|
| 1284 | //throw( CF::DomainManager::DeviceManagerNotRegistered() ); |
|---|
| 1285 | } |
|---|
| 1286 | |
|---|
| 1287 | //The registerService operation shall add the registeringServices object reference and the |
|---|
| 1288 | //registeringServices name to the DomainManager, if the name for the type of service being |
|---|
| 1289 | //registered does not exist within the DomainManager. However, if the name of the registering |
|---|
| 1290 | //service is a duplicate of a registered service of the same type, then the new service shall not be |
|---|
| 1291 | //registered with the DomainManager. |
|---|
| 1292 | |
|---|
| 1293 | //The registerService operation shall associate the input registeringService parameter with the |
|---|
| 1294 | //input registeredDeviceMgr parameter in the DomainManagers, when the registeredDeviceMgr |
|---|
| 1295 | //parameter indicates a DeviceManager registered with the DomainManager. |
|---|
| 1296 | |
|---|
| 1297 | //Add registeringService and its name to domain manager |
|---|
| 1298 | storeServiceInDomainMgr(registeringService, registeredDeviceMgr, name); |
|---|
| 1299 | |
|---|
| 1300 | //The registerService operation shall, upon successful service registration, establish any pending |
|---|
| 1301 | //connection requests for the registeringService. The registerService operation shall, upon |
|---|
| 1302 | //successful service registration, write an ADMINISTRATIVE_EVENT log record to a |
|---|
| 1303 | //DomainManagers Log. |
|---|
| 1304 | |
|---|
| 1305 | establishPendingServiceConnections(name); |
|---|
| 1306 | |
|---|
| 1307 | //The registerService operation shall, upon unsuccessful service registration, write a |
|---|
| 1308 | //FAILURE_ALARM log record to a DomainManagers Log. |
|---|
| 1309 | |
|---|
| 1310 | //The registerService operation shall, upon successful service registration, send an event to the |
|---|
| 1311 | //Outgoing Domain Management event channel with event data consisting of a |
|---|
| 1312 | //DomainManagementObjectAddedEventType. The event data will be populated as follows: |
|---|
| 1313 | //1. The producerId shall be the identifier attribute of the DomainManager. |
|---|
| 1314 | //2. The sourceId shall be the identifier attribute from the componentinstantiation element |
|---|
| 1315 | //associated with the registered service. |
|---|
| 1316 | //3. The sourceName shall be the input name parameter for the registering service. |
|---|
| 1317 | //4. The sourceIOR shall be the registered service object reference. |
|---|
| 1318 | //5. The sourceCategory shall be SERVICE. |
|---|
| 1319 | |
|---|
| 1320 | //The registerService operation shall raise the RegisterError exception when an internal error |
|---|
| 1321 | //exists which causes an unsuccessful registration. |
|---|
| 1322 | } |
|---|
| 1323 | |
|---|
| 1324 | |
|---|
| 1325 | void DomainManager_impl::unregisterService(CORBA::Object_ptr unregisteringService,const char * name) |
|---|
| 1326 | throw (CF::DomainManager::UnregisterError, CF::InvalidObjectReference,CORBA::SystemException) |
|---|
| 1327 | { |
|---|
| 1328 | |
|---|
| 1329 | //The unregisterService operation shall raise the CF InvalidObjectReference exception when the |
|---|
| 1330 | //input parameter contains an invalid reference to a Service interface. |
|---|
| 1331 | if( CORBA::is_nil(unregisteringService) || !serviceIsRegistered(name) ) |
|---|
| 1332 | { |
|---|
| 1333 | /*writeLogRecord(FAILURE_ALARM,Device reference is not valid);*/ |
|---|
| 1334 | |
|---|
| 1335 | //The unregisterDevice operation shall raise the CF InvalidObjectReference exception when the |
|---|
| 1336 | //input parameter contains an invalid reference to a Device interface. |
|---|
| 1337 | throw( CF::InvalidObjectReference("Cannot Unregister Service. Invalid reference") ); |
|---|
| 1338 | return; |
|---|
| 1339 | } |
|---|
| 1340 | |
|---|
| 1341 | //The unregisterService operation shall remove the unregisteringService entry specified by the |
|---|
| 1342 | //input name parameter from the DomainManager. |
|---|
| 1343 | |
|---|
| 1344 | //The unregisterService operation shall release (client-side CORBA release) the |
|---|
| 1345 | //unregisteringService from the DomainManager. |
|---|
| 1346 | |
|---|
| 1347 | disconnectThisService(name); |
|---|
| 1348 | |
|---|
| 1349 | removeServiceFromDomainMgr(unregisteringService, name); |
|---|
| 1350 | |
|---|
| 1351 | //The unregisterService operation shall, upon the successful unregistration of a Service, write an |
|---|
| 1352 | //ADMINISTRATIVE_EVENT log record to a DomainManagers Log. |
|---|
| 1353 | |
|---|
| 1354 | //The unregisterService operation shall, upon unsuccessful unregistration of a Service, write a |
|---|
| 1355 | //FAILURE_ALARM log record to a DomainManagers Log. |
|---|
| 1356 | |
|---|
| 1357 | //The unregisterService operation shall, upon successful service unregistration, send an event to |
|---|
| 1358 | //the Outgoing Domain Management event channel with event data consisting of a |
|---|
| 1359 | //DomainManagementObjectRemovedEventType. The event data will be populated as follows: |
|---|
| 1360 | //1. The producerId shall be the identifier attribute of the DomainManager. |
|---|
| 1361 | //2. The sourceId shall be the ID attribute from the componentinstantiation element |
|---|
| 1362 | //associated with the unregistered service. |
|---|
| 1363 | //3. The sourceName shall be the input name parameter for the unregistering service. |
|---|
| 1364 | //4. The sourceCategory shall be SERVICE. |
|---|
| 1365 | |
|---|
| 1366 | //The unregisterService operation shall raise the UnregisterError exception when an internal error |
|---|
| 1367 | //exists which causes an unsuccessful unregistration. |
|---|
| 1368 | |
|---|
| 1369 | } |
|---|
| 1370 | |
|---|
| 1371 | |
|---|
| 1372 | void |
|---|
| 1373 | DomainManager_impl::validate (const char *_profile) |
|---|
| 1374 | { |
|---|
| 1375 | if (_profile == NULL) |
|---|
| 1376 | return; |
|---|
| 1377 | |
|---|
| 1378 | // verify the application's SAD exists in DomainManager FileSystem |
|---|
| 1379 | if (!_fileMgr->exists (_profile)) { |
|---|
| 1380 | string msg = "File "; |
|---|
| 1381 | msg += _profile; |
|---|
| 1382 | msg += " does not exist."; |
|---|
| 1383 | |
|---|
| 1384 | throw CF::FileException (CF::CFENOENT, msg.c_str()); |
|---|
| 1385 | } |
|---|
| 1386 | } |
|---|
| 1387 | |
|---|
| 1388 | |
|---|
| 1389 | void |
|---|
| 1390 | DomainManager_impl::validateSPD (const char *_spdProfile, int _cnt) |
|---|
| 1391 | { |
|---|
| 1392 | if (_spdProfile == NULL) |
|---|
| 1393 | return; |
|---|
| 1394 | |
|---|
| 1395 | /// \todo Figure out checks for xml conforming to dtd, through suitable exception if it doesn't. Possibly CF::InvalidProfile |
|---|
| 1396 | |
|---|
| 1397 | try |
|---|
| 1398 | { |
|---|
| 1399 | this->validate (_spdProfile); |
|---|
| 1400 | |
|---|
| 1401 | // check the filename ends with the extension given in the spec |
|---|
| 1402 | if ((strstr (_spdProfile, ".spd.xml")) == NULL) |
|---|
| 1403 | cerr << "File " << _spdProfile << " should end with .spd.xml" << endl; |
|---|
| 1404 | |
|---|
| 1405 | SPDParser spdParser (_spdProfile); |
|---|
| 1406 | |
|---|
| 1407 | // query SPD for PRF |
|---|
| 1408 | this->validate (spdParser.getPRFFile ()); |
|---|
| 1409 | |
|---|
| 1410 | // check the file name ends with the extension given in the spec |
|---|
| 1411 | if ((strstr (spdParser.getPRFFile (), ".prf.xml")) == NULL && strlen(spdParser.getPRFFile())) |
|---|
| 1412 | cerr << "File " << spdParser.getPRFFile() << " should end in .prf.xml." << endl; |
|---|
| 1413 | |
|---|
| 1414 | PRFParser prfParser (spdParser.getPRFFile ()); |
|---|
| 1415 | |
|---|
| 1416 | // query SPD for SCD |
|---|
| 1417 | this->validate (spdParser.getSCDFile ()); |
|---|
| 1418 | |
|---|
| 1419 | // Check the filename ends with the extension given in the spec |
|---|
| 1420 | if ((strstr (spdParser.getSCDFile (), ".scd.xml")) == NULL) |
|---|
| 1421 | cerr << "File " << spdParser.getSCDFile() << " should end with .scd.xml." << endl; |
|---|
| 1422 | |
|---|
| 1423 | |
|---|
| 1424 | SCDParser scdParser (spdParser.getSCDFile ()); |
|---|
| 1425 | |
|---|
| 1426 | /// \todo Figure out if this should go: this->validateSPD( spdParser.getSPDFile(), ++_cnt ); |
|---|
| 1427 | |
|---|
| 1428 | } catch (CF::InvalidFileName ex) { |
|---|
| 1429 | throw CF::DomainManager::ApplicationInstallationError (CF::CFEBADF, ex.msg); |
|---|
| 1430 | } |
|---|
| 1431 | |
|---|
| 1432 | } |
|---|
| 1433 | |
|---|
| 1434 | |
|---|
| 1435 | void |
|---|
| 1436 | DomainManager_impl::removeSPD (const char *_spdProfile, int _cnt) |
|---|
| 1437 | { |
|---|
| 1438 | if (_spdProfile == NULL) |
|---|
| 1439 | return; |
|---|
| 1440 | |
|---|
| 1441 | SPDParser *_spdParser = new SPDParser (_spdProfile); |
|---|
| 1442 | |
|---|
| 1443 | try |
|---|
| 1444 | { |
|---|
| 1445 | _fileMgr->remove (_spdParser->getPRFFile ()); |
|---|
| 1446 | } |
|---|
| 1447 | catch (CF::InvalidFileName &) |
|---|
| 1448 | { |
|---|
| 1449 | // TODO: write FAILURE_ALARM |
|---|
| 1450 | // TODO: output the error message from the invalid file name |
|---|
| 1451 | |
|---|
| 1452 | delete _spdParser; |
|---|
| 1453 | _spdParser = NULL; |
|---|
| 1454 | |
|---|
| 1455 | throw CF::DomainManager::ApplicationUninstallationError (CF::CFEBADF, |
|---|
| 1456 | "[DomainManager:removeSPD] invalid PRF file"); |
|---|
| 1457 | } |
|---|
| 1458 | catch (CF::FileException &) |
|---|
| 1459 | { |
|---|
| 1460 | // TODO: write FAILURE_ALARM |
|---|
| 1461 | // TODO: output the error message from the file exception |
|---|
| 1462 | |
|---|
| 1463 | delete _spdParser; |
|---|
| 1464 | _spdParser = NULL; |
|---|
| 1465 | |
|---|
| 1466 | throw CF::DomainManager::ApplicationUninstallationError (CF::CFEBADF, |
|---|
| 1467 | "[DomainManager:removeSPD] PRF file exception"); |
|---|
| 1468 | } |
|---|
| 1469 | |
|---|
| 1470 | try |
|---|
| 1471 | { |
|---|
| 1472 | _fileMgr->remove (_spdParser->getSCDFile ()); |
|---|
| 1473 | } |
|---|
| 1474 | catch (CF::InvalidFileName &) |
|---|
| 1475 | { |
|---|
| 1476 | // TODO: write FAILURE_ALARM |
|---|
| 1477 | // TODO: output the error message from the invalid file name |
|---|
| 1478 | |
|---|
| 1479 | delete _spdParser; |
|---|
| 1480 | _spdParser = NULL; |
|---|
| 1481 | |
|---|
| 1482 | throw CF::DomainManager::ApplicationUninstallationError (CF::CFEBADF, |
|---|
| 1483 | "[DomainManager:removeSPD] invalid SCD file"); |
|---|
| 1484 | } |
|---|
| 1485 | catch (CF::FileException &) |
|---|
| 1486 | { |
|---|
| 1487 | // TODO: write FAILURE_ALARM |
|---|
| 1488 | // TODO: output the error message from the file exception |
|---|
| 1489 | |
|---|
| 1490 | delete _spdParser; |
|---|
| 1491 | _spdParser = NULL; |
|---|
| 1492 | |
|---|
| 1493 | throw CF::DomainManager::ApplicationUninstallationError (CF::CFEBADF, |
|---|
| 1494 | "[DomainManager:removeSPD] SCD file exception"); |
|---|
| 1495 | } |
|---|
| 1496 | |
|---|
| 1497 | removeSPD (_spdParser->getSPDFile (), ++_cnt); |
|---|
| 1498 | |
|---|
| 1499 | delete _spdParser; |
|---|
| 1500 | _spdParser = NULL; |
|---|
| 1501 | |
|---|
| 1502 | try |
|---|
| 1503 | { |
|---|
| 1504 | _fileMgr->remove (_spdProfile); |
|---|
| 1505 | } |
|---|
| 1506 | catch (CF::InvalidFileName &) |
|---|
| 1507 | { |
|---|
| 1508 | /// \todo write FAILURE_ALARM |
|---|
| 1509 | /// \todo output the error message from the invalid file name |
|---|
| 1510 | throw CF::DomainManager::ApplicationUninstallationError (CF::CFEBADF, |
|---|
| 1511 | "[DomainManager:removeSPD] invalid SPD file"); |
|---|
| 1512 | } |
|---|
| 1513 | catch (CF::FileException &) |
|---|
| 1514 | { |
|---|
| 1515 | /// \todo write FAILURE_ALARM |
|---|
| 1516 | /// \todo output the error message from the file exception |
|---|
| 1517 | throw CF::DomainManager::ApplicationUninstallationError (CF::CFEBADF, |
|---|
| 1518 | "[DomainManager:removeSPD] SPD file exception"); |
|---|
| 1519 | } |
|---|
| 1520 | } |
|---|
| 1521 | |
|---|
| 1522 | |
|---|
| 1523 | void DomainManager_impl::createEventChannels (void) |
|---|
| 1524 | { |
|---|
| 1525 | // This code is very likely omniEvent specific. See pp -- in --. |
|---|
| 1526 | /// \todo break into smaller chuncks and make error handling better |
|---|
| 1527 | /// \todo Have this routine take the Event Channel name as an argument and return the object |
|---|
| 1528 | |
|---|
| 1529 | |
|---|
| 1530 | // Get the Name Service root context |
|---|
| 1531 | #ifdef HAVE_OMNIEVENTS |
|---|
| 1532 | CORBA::Object_var obj = ORB_WRAP::orb->resolve_initial_references("NameService"); |
|---|
| 1533 | CosNaming::NamingContext_var rootContext = CosNaming::NamingContext::_nil(); |
|---|
| 1534 | |
|---|
| 1535 | rootContext = CosNaming::NamingContext::_narrow(obj); |
|---|
| 1536 | if (CORBA::is_nil(rootContext)) |
|---|
| 1537 | throw CORBA::OBJECT_NOT_EXIST(); |
|---|
| 1538 | |
|---|
| 1539 | // Find the object reference for the Event Channel factory |
|---|
| 1540 | CosNaming::Name name; |
|---|
| 1541 | name.length(1); |
|---|
| 1542 | name[0].id = CORBA::string_dup("EventChannelFactory"); |
|---|
| 1543 | |
|---|
| 1544 | |
|---|
| 1545 | obj = rootContext->resolve(name); |
|---|
| 1546 | |
|---|
| 1547 | omniEvents::EventChannelFactory_var factory = omniEvents::EventChannelFactory::_narrow(obj); |
|---|
| 1548 | |
|---|
| 1549 | if (CORBA::is_nil(factory)) |
|---|
| 1550 | throw CORBA::OBJECT_NOT_EXIST(); /// \todo throw something better |
|---|
| 1551 | |
|---|
| 1552 | // Check that object support EventChannel object interface |
|---|
| 1553 | CosLifeCycle::Key key; |
|---|
| 1554 | key.length(1); |
|---|
| 1555 | key[0].id = CORBA::string_dup("EventChannel"); |
|---|
| 1556 | key[0].kind = CORBA::string_dup("object interface"); |
|---|
| 1557 | |
|---|
| 1558 | if (!factory->supports(key)) { |
|---|
| 1559 | cerr << "Factory does not support Event Channel interface, dying" << endl; |
|---|
| 1560 | exit (-1); |
|---|
| 1561 | } |
|---|
| 1562 | |
|---|
| 1563 | // Create the IDM Event Channel Object |
|---|
| 1564 | CosLifeCycle::Criteria criteria; // I think this passes options to the channel PJB |
|---|
| 1565 | |
|---|
| 1566 | CORBA::Object_var IDM_channelObj = factory->create_object(key, criteria); |
|---|
| 1567 | if (CORBA::is_nil(IDM_channelObj)) |
|---|
| 1568 | exit(-1); |
|---|
| 1569 | |
|---|
| 1570 | IDM_channel = CosEventChannelAdmin::EventChannel::_narrow(IDM_channelObj); |
|---|
| 1571 | if (CORBA::is_nil(IDM_channel)) |
|---|
| 1572 | exit (-1); |
|---|
| 1573 | |
|---|
| 1574 | CosNaming::Name idm_name; |
|---|
| 1575 | |
|---|
| 1576 | ORB_WRAP::getCosName (idm_name, "/DomainName1/IDM_Channel"); |
|---|
| 1577 | rootContext->rebind(idm_name, IDM_channel.in()); |
|---|
| 1578 | |
|---|
| 1579 | // Create the ODM Event Channel object |
|---|
| 1580 | |
|---|
| 1581 | CORBA::Object_var ODM_channelObj = factory->create_object(key, criteria); |
|---|
| 1582 | if (CORBA::is_nil(ODM_channelObj)) |
|---|
| 1583 | exit(-1); |
|---|
| 1584 | |
|---|
| 1585 | ODM_channel = CosEventChannelAdmin::EventChannel::_narrow(ODM_channelObj); |
|---|
| 1586 | if (CORBA::is_nil(ODM_channel)) |
|---|
| 1587 | exit (-1); |
|---|
| 1588 | |
|---|
| 1589 | CosNaming::Name odm_name; |
|---|
| 1590 | |
|---|
| 1591 | ORB_WRAP::getCosName (odm_name, "/DomainName1/ODM_Channel"); |
|---|
| 1592 | |
|---|
| 1593 | |
|---|
| 1594 | rootContext->rebind(odm_name, ODM_channel.in()); |
|---|
| 1595 | #endif |
|---|
| 1596 | } |
|---|
| 1597 | |
|---|
| 1598 | |
|---|
| 1599 | #ifdef HAVE_OMNIEVENTS |
|---|
| 1600 | CosEventChannelAdmin::ProxyPushConsumer_var DomainManager_impl::connectEventChannel(CosEventChannelAdmin::EventChannel_var eventChannel) |
|---|
| 1601 | { |
|---|
| 1602 | |
|---|
| 1603 | /// \todo Add exception handling |
|---|
| 1604 | CosEventChannelAdmin::SupplierAdmin_var supplier_admin; |
|---|
| 1605 | |
|---|
| 1606 | supplier_admin = eventChannel->for_suppliers(); |
|---|
| 1607 | |
|---|
| 1608 | CosEventChannelAdmin::ProxyPushConsumer_var proxy_consumer; |
|---|
| 1609 | |
|---|
| 1610 | proxy_consumer = supplier_admin->obtain_push_consumer(); |
|---|
| 1611 | |
|---|
| 1612 | return proxy_consumer; |
|---|
| 1613 | } |
|---|
| 1614 | |
|---|
| 1615 | DomainManagerEventHandler::DomainManagerEventHandler (DomainManager_impl * |
|---|
| 1616 | _dmn) |
|---|
| 1617 | { |
|---|
| 1618 | _dmnMgr = _dmn; |
|---|
| 1619 | } |
|---|
| 1620 | |
|---|
| 1621 | |
|---|
| 1622 | void |
|---|
| 1623 | DomainManagerEventHandler::push (const CORBA::Any & _any) |
|---|
| 1624 | throw (CORBA::SystemException, CosEventComm::Disconnected) |
|---|
| 1625 | { |
|---|
| 1626 | _dmnMgr->_applications[0] = CF::Application::_nil (); |
|---|
| 1627 | } |
|---|
| 1628 | |
|---|
| 1629 | |
|---|
| 1630 | void |
|---|
| 1631 | DomainManagerEventHandler::disconnect_push_consumer () |
|---|
| 1632 | throw (CORBA::SystemException) |
|---|
| 1633 | { |
|---|
| 1634 | CORBAOBJ _obj = ORB_WRAP::orb->resolve_initial_references ("POACurrent"); |
|---|
| 1635 | |
|---|
| 1636 | PortableServer::Current_var _current = |
|---|
| 1637 | PortableServer::Current::_narrow (_obj); |
|---|
| 1638 | |
|---|
| 1639 | PortableServer::POA_var _poa = _current->get_POA (); |
|---|
| 1640 | |
|---|
| 1641 | PortableServer::ObjectId_var _oid = _current->get_object_id (); |
|---|
| 1642 | |
|---|
| 1643 | _poa->deactivate_object (_oid); |
|---|
| 1644 | } |
|---|
| 1645 | #endif |
|---|
| 1646 | |
|---|
| 1647 | #ifdef AUTOMATIC_TEST |
|---|
| 1648 | |
|---|
| 1649 | void DomainManager_impl::displayAttributes(void) |
|---|
| 1650 | { |
|---|
| 1651 | printf("\n\nDomain Manager Identifier: %s \n", _identifier); |
|---|
| 1652 | printf("\nDomain Manager Profile: %s \n\n", _domainManagerProfile); |
|---|
| 1653 | } |
|---|
| 1654 | |
|---|
| 1655 | |
|---|
| 1656 | void DomainManager_impl::displayDeviceManagers(void) |
|---|
| 1657 | { |
|---|
| 1658 | //CF::DeviceManager_ptr myDevMgr_ptr; |
|---|
| 1659 | if(_deviceManagers.length() > 0) |
|---|
| 1660 | { |
|---|
| 1661 | printf("\nDevice Managers registered in %s Domain Manager\n", this->identifier()); |
|---|
| 1662 | for (int i = 0; i < _deviceManagers.length(); i++) |
|---|
| 1663 | { |
|---|
| 1664 | printf( "\n %s\n", _deviceManagers[i]->label()); |
|---|
| 1665 | } |
|---|
| 1666 | } |
|---|
| 1667 | else |
|---|
| 1668 | { |
|---|
| 1669 | printf("\nThere are no Device Managers registered in %s Domain Manager\n", this->identifier()); |
|---|
| 1670 | } |
|---|
| 1671 | |
|---|
| 1672 | } |
|---|
| 1673 | |
|---|
| 1674 | |
|---|
| 1675 | void DomainManager_impl::displayRegisteredDevices(void) |
|---|
| 1676 | { |
|---|
| 1677 | |
|---|
| 1678 | //CF::DeviceManager_ptr myDevMgr_ptr; |
|---|
| 1679 | if(_registeredDevices.size() > 0) |
|---|
| 1680 | { |
|---|
| 1681 | printf("\nDevices registered in %s Domain Manager\n", this->identifier()); |
|---|
| 1682 | for (int i = 0; i < _registeredDevices.size(); i++) |
|---|
| 1683 | { |
|---|
| 1684 | printf( "\n %s\n", _registeredDevices[i]->devicePtr->label()); |
|---|
| 1685 | } |
|---|
| 1686 | } |
|---|
| 1687 | else |
|---|
| 1688 | { |
|---|
| 1689 | printf("\nThere are no registered Devices in %s Domain Manager\n", this->identifier()); |
|---|
| 1690 | } |
|---|
| 1691 | |
|---|
| 1692 | } |
|---|
| 1693 | |
|---|
| 1694 | |
|---|
| 1695 | void DomainManager_impl::displayRegisteredServices (void) |
|---|
| 1696 | { |
|---|
| 1697 | if(_registeredServices.size() > 0) |
|---|
| 1698 | { |
|---|
| 1699 | printf("\nServices registered in %s Domain Manager\n", this->identifier()); |
|---|
| 1700 | for (int i = 0; i < _registeredServices.size(); i++) |
|---|
| 1701 | { |
|---|
| 1702 | if( !CORBA::is_nil(_registeredServices[i]->objectPtr) ) |
|---|
| 1703 | printf("\n%s\n", _registeredServices[i]->name); |
|---|
| 1704 | else |
|---|
| 1705 | printf("\nInvalid object reference for %s\n",_registeredServices[i]->name); |
|---|
| 1706 | |
|---|
| 1707 | } |
|---|
| 1708 | } |
|---|
| 1709 | else |
|---|
| 1710 | { |
|---|
| 1711 | printf("\nThere are no registered devices in %s Domain Manager\n", this->identifier()); |
|---|
| 1712 | } |
|---|
| 1713 | } |
|---|
| 1714 | #endif |
|---|