| 1094 | | try |
| 1095 | | { |
| 1096 | | // check the profile for "_SAD.xml", throw exception otherwise |
| 1097 | | if ((strstr (profileFileName, "_SAD.xml")) == NULL) |
| 1098 | | throw CF::InvalidFileName (CF::CFEEXIST, |
| 1099 | | "[DomainManager:installApplication] ambiguous file name"); |
| 1100 | | this->validate (profileFileName); |
| 1101 | | } |
| 1102 | | catch (CF::InvalidFileName &) |
| 1103 | | { |
| 1104 | | /// \todo write FAILURE_ALARM |
| 1105 | | /// \todo output the error message from the invalid file name |
| 1106 | | throw CF::DomainManager::ApplicationInstallationError (CF::CFEBADF, |
| 1107 | | "[DomainManager:installApplication] invalid SAD file"); |
| 1108 | | } |
| 1109 | | |
| | 1094 | try { |
| | 1095 | // check the profile ends with .sad.xml, warn if it doesn't |
| | 1096 | if ((strstr (profileFileName, ".sad.xml")) == NULL) |
| | 1097 | cerr << "File " << profileFileName << " should end with .sad.xml." << endl; |
| | 1098 | |
| | 1099 | this->validate (profileFileName); |
| | 1100 | } catch (CF::FileException ex) { |
| | 1101 | throw CF::DomainManager::ApplicationInstallationError (CF::CFEBADF, ex.msg); |
| | 1102 | } |
| | 1103 | |
| 1488 | | if (_spdProfile == NULL) |
| 1489 | | return; |
| 1490 | | |
| 1491 | | try |
| 1492 | | { |
| 1493 | | this->validate (_spdProfile); |
| 1494 | | |
| 1495 | | /// \bug This section needs to change depending on resolution of bug 35 |
| 1496 | | // check the profile for "_SPD.xml", throw exception otherwise |
| 1497 | | /// \todo continue fixing error handling from here |
| 1498 | | if ((strstr (_spdProfile, "_SPD.xml")) == NULL) |
| 1499 | | throw CF::InvalidFileName (CF::CFEEXIST, |
| 1500 | | "[DomainManager:validateSPD] file name should be of the form _SPD.xml"); |
| 1501 | | } |
| 1502 | | catch (CF::FileException ex) |
| 1503 | | { |
| 1504 | | throw CF::DomainManager::ApplicationInstallationError (CF::CFEBADF, ex.msg); |
| 1505 | | } |
| 1506 | | |
| 1507 | | // TODO: verify that SPD conforms to DTD by allowing parser to throw an exception |
| 1508 | | // then the DomainManager throws a CF::InvalidProfile if the SPD does not conform |
| 1509 | | SPDParser spdParser (_spdProfile); |
| 1510 | | |
| 1511 | | // query SPD for PRF |
| 1512 | | try |
| 1513 | | { |
| 1514 | | this->validate (spdParser.getPRFFile ()); |
| 1515 | | // check the profile for "_PRF.xml", throw exception otherwise |
| 1516 | | if ((strstr (spdParser.getPRFFile (), "_PRF.xml")) == NULL) |
| 1517 | | throw CF::InvalidFileName (CF::CFEEXIST, |
| 1518 | | "[DomainManager:validateSPD] ambiguous file name"); |
| 1519 | | } |
| 1520 | | catch (CF::InvalidFileName &) |
| 1521 | | { |
| 1522 | | // TODO: write FAILURE_ALARM |
| 1523 | | // TODO: output the error message from the invalid file name |
| 1524 | | throw CF::DomainManager::ApplicationInstallationError (CF::CFEBADF, |
| 1525 | | "[DomainManager:validateSPD] invalid PRF file"); |
| 1526 | | } |
| 1527 | | |
| 1528 | | // TODO: verify that PRF conforms to DTD by allowing parser to throw an exception |
| 1529 | | // then the DomainManager throws a CF::InvalidProfile if the PRF does not conform |
| 1530 | | PRFParser prfParser (spdParser.getPRFFile ()); |
| 1531 | | |
| 1532 | | // query SPD for SCD |
| 1533 | | try |
| 1534 | | { |
| 1535 | | this->validate (spdParser.getSCDFile ()); |
| 1536 | | // check the profile for "_SCD.xml", throw exception otherwise |
| 1537 | | if ((strstr (spdParser.getSCDFile (), "_SCD.xml")) == NULL) |
| 1538 | | throw CF::InvalidFileName (CF::CFEEXIST, |
| 1539 | | "[DomainManager:validateSPD] ambiguous file name"); |
| 1540 | | } |
| 1541 | | catch (CF::InvalidFileName &) |
| 1542 | | { |
| 1543 | | // TODO: write FAILURE_ALARM |
| 1544 | | // TODO: output the error message from the invalid file name |
| 1545 | | throw CF::DomainManager::ApplicationInstallationError (CF::CFEBADF, |
| 1546 | | "[DomainManager:validateSPD] invalid SCD file"); |
| 1547 | | } |
| 1548 | | |
| 1549 | | // TODO: verify that SCD conforms to DTD by allowing parser to throw an exception |
| 1550 | | // then the DomainManager throws a CF::InvalidProfile if the SCD does not conform |
| 1551 | | SCDParser scdParser (spdParser.getSCDFile ()); |
| 1552 | | |
| 1553 | | // this->validateSPD( spdParser.getSPDFile(), ++_cnt ); |
| | 1482 | if (_spdProfile == NULL) |
| | 1483 | return; |
| | 1484 | |
| | 1485 | /// \todo Figure out checks for xml conforming to dtd, through suitable exception if it doesn't. Possibly CF::InvalidProfile |
| | 1486 | |
| | 1487 | try |
| | 1488 | { |
| | 1489 | this->validate (_spdProfile); |
| | 1490 | |
| | 1491 | // check the filename ends with the extension given in the spec |
| | 1492 | if ((strstr (_spdProfile, ".spd.xml")) == NULL) |
| | 1493 | cerr << "File " << _spdProfile << " should end with .spd.xml" << endl; |
| | 1494 | |
| | 1495 | SPDParser spdParser (_spdProfile); |
| | 1496 | |
| | 1497 | // query SPD for PRF |
| | 1498 | this->validate (spdParser.getPRFFile ()); |
| | 1499 | |
| | 1500 | // check the file name ends with the extension given in the spec |
| | 1501 | if ((strstr (spdParser.getPRFFile (), ".prf.xml")) == NULL) |
| | 1502 | cerr << "File " << spdParser.getPRFFile() << " should end in .prf.xml." << endl; |
| | 1503 | |
| | 1504 | PRFParser prfParser (spdParser.getPRFFile ()); |
| | 1505 | |
| | 1506 | // query SPD for SCD |
| | 1507 | this->validate (spdParser.getSCDFile ()); |
| | 1508 | |
| | 1509 | // Check the filename ends with the extension given in the spec |
| | 1510 | if ((strstr (spdParser.getSCDFile (), ".scd.xml")) == NULL) |
| | 1511 | cerr << "File " << spdParser.getSCDFile() << " should end with .scd.xml." << endl; |
| | 1512 | |
| | 1513 | |
| | 1514 | SCDParser scdParser (spdParser.getSCDFile ()); |
| | 1515 | |
| | 1516 | /// \todo Figure out if this should go: this->validateSPD( spdParser.getSPDFile(), ++_cnt ); |
| | 1517 | |
| | 1518 | } catch (CF::InvalidFileName ex) { |
| | 1519 | throw CF::DomainManager::ApplicationInstallationError (CF::CFEBADF, ex.msg); |
| | 1520 | } |
| | 1521 | |
| | 1522 | |