| 184 | | DEBUG(1, AppFact, "loading " << component->getLocalFileName()) |
| 185 | | |
| 186 | | CF::FileSystem_ptr fs = CF::FileSystem::_narrow(dmnMgr->fileMgr()); |
| 187 | | device->load (fs, component->getLocalFileName(), component->getCodeType()); |
| 188 | | |
| | 184 | DEBUG(1, AppFact, "loading " << component->getLocalFileName()) |
| | 185 | |
| | 186 | int idx = 0; |
| | 187 | |
| | 188 | CF::FileManager_var fileMgr = dmnMgr->fileMgr(); |
| | 189 | |
| | 190 | CF::FileManager::MountSequence_var mts = fileMgr->getMounts(); |
| | 191 | |
| | 192 | for( int i = 0; i < mts->length(); i++ ) |
| | 193 | { |
| | 194 | try |
| | 195 | { |
| | 196 | if( mts[i].fs->exists( component->getLocalFileName() ) ) idx = i; |
| | 197 | } catch( CF::InvalidFileName &_ex ) { |
| | 198 | std::cout << "[ApplicationFactory::create] Searching for FileSys containing " << component->getLocalFileName() << "\n"; |
| | 199 | } catch( CF::FileException &_ex ) { |
| | 200 | std::cout << "[ApplicationFactory::create] Searching for FileSys containing " << component->getLocalFileName() << "\n"; |
| | 201 | } catch( ... ) { |
| | 202 | } |
| | 203 | } |
| | 204 | |
| | 205 | try |
| | 206 | { |
| | 207 | device->load (mts[idx].fs, component->getLocalFileName(), component->getCodeType()); |
| | 208 | } catch( CF::InvalidFileName &_ex ) { |
| | 209 | std::cout << "[ApplicationFactory::create] While loading ExecDev: " << _ex.msg << "\n"; |
| | 210 | exit(EXIT_FAILURE); |
| | 211 | } catch( CF::Device::InvalidState &_ex ) { |
| | 212 | std::cout << "[ApplicationFactory::create] While loading ExecDev: " << _ex.msg << "\n"; |
| | 213 | exit(EXIT_FAILURE); |
| | 214 | } catch( ... ) { |
| | 215 | std::cout << "[ApplicationFactory::create] While loading ExecDev: Unknown Exception\n"; |
| | 216 | exit(EXIT_FAILURE); |
| | 217 | } |
| 210 | | component->addExecParameter(&dt); |
| 211 | | |
| 212 | | CF::ExecutableDevice::ProcessID_Type tempPid = device-> |
| 213 | | execute (component->getLocalFileName(), |
| 214 | | component->getOptions(), |
| 215 | | component->getExecParameters()); |
| 216 | | |
| 217 | | if (tempPid < 0) { |
| 218 | | /// \TODO throw exception here |
| 219 | | } else { |
| 220 | | _pidSeq->length (_pidSeq->length() + 1); |
| 221 | | (* _pidSeq)[_pidSeq->length() - 1].processId = tempPid; |
| 222 | | (* _pidSeq)[_pidSeq->length() - 1].componentId = |
| 223 | | CORBA::string_dup(component->getIdentifier()); |
| 224 | | } |
| 225 | | // NOTE: The PID returned by execute is not handled |
| 226 | | // An exception shall be thrown when PID = -1 |
| 227 | | } |
| 228 | | } |
| | 240 | component->addExecParameter(&dt); |
| | 241 | CF::ExecutableDevice::ProcessID_Type tempPid; |
| | 242 | try |
| | 243 | { |
| | 244 | tempPid = device->execute (component->getLocalFileName(), component->getOptions(), component->getExecParameters()); |
| | 245 | } catch( CF::InvalidFileName &_ex ) { |
| | 246 | std::cout << "[ApplicationFactory::create] When calling 'execute' on a device: " << _ex.msg << "\n"; |
| | 247 | exit(EXIT_FAILURE); |
| | 248 | } catch( CF::Device::InvalidState &_ex ) { |
| | 249 | std::cout << "[ApplicationFactory::create] When calling 'execute' on a device: " << _ex.msg << "\n"; |
| | 250 | exit(EXIT_FAILURE); |
| | 251 | } catch( ... ) { |
| | 252 | std::cout << "[ApplicationFactory::create] When calling 'execute' on a device: Unknown Exception\n"; |
| | 253 | exit(EXIT_FAILURE); |
| | 254 | } |
| | 255 | |
| | 256 | if (tempPid < 0) { |
| | 257 | /// \TODO throw exception here |
| | 258 | } else { |
| | 259 | _pidSeq->length (_pidSeq->length() + 1); |
| | 260 | (* _pidSeq)[_pidSeq->length() - 1].processId = tempPid; |
| | 261 | (* _pidSeq)[_pidSeq->length() - 1].componentId = |
| | 262 | CORBA::string_dup(component->getIdentifier()); |
| | 263 | } |
| | 264 | // NOTE: The PID returned by execute is not handled |
| | 265 | // An exception shall be thrown when PID = -1 |
| | 266 | } |
| | 267 | } |