diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-06-14 16:17:30 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-06-14 16:17:30 +0000 |
commit | 70bf2f6e9ec40a437d8181c8c2a9debfde584840 (patch) | |
tree | 8a791f73df28b9b55ebcf8d7baf5fa66a8f9f104 /cpp/src/IceGrid/Database.cpp | |
parent | Port to WinCE (diff) | |
download | ice-70bf2f6e9ec40a437d8181c8c2a9debfde584840.tar.bz2 ice-70bf2f6e9ec40a437d8181c8c2a9debfde584840.tar.xz ice-70bf2f6e9ec40a437d8181c8c2a9debfde584840.zip |
More fixes
Diffstat (limited to 'cpp/src/IceGrid/Database.cpp')
-rw-r--r-- | cpp/src/IceGrid/Database.cpp | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp index f33e788bdc0..d3f58f76136 100644 --- a/cpp/src/IceGrid/Database.cpp +++ b/cpp/src/IceGrid/Database.cpp @@ -226,9 +226,10 @@ Database::setRegistryObserver(const RegistryObserverPrx& observer) } void -Database::addApplicationDescriptor(const ApplicationDescriptorPtr& descriptor) +Database::addApplicationDescriptor(const ApplicationDescriptorPtr& newApp) { ServerEntrySeq entries; + ApplicationDescriptorPtr descriptor; { Lock sync(*this); @@ -236,16 +237,25 @@ Database::addApplicationDescriptor(const ApplicationDescriptorPtr& descriptor) // We first ensure that the application doesn't already exist // and that the application components don't already exist. // - if(_descriptors.find(descriptor->name) != _descriptors.end()) + if(_descriptors.find(newApp->name) != _descriptors.end()) { ApplicationExistsException ex; - ex.name = descriptor->name; + ex.name = newApp->name; throw ex; } - ApplicationDescriptorHelper helper(_communicator, descriptor); - helper.instantiate(); - descriptor = helper.getDescriptor(); + try + { + ApplicationDescriptorHelper helper(_communicator, newApp); + helper.instantiate(); + descriptor = helper.getDescriptor(); + } + catch(const string& msg) + { + DeploymentException ex; + ex.reason = msg; + throw ex; + } // // Ensure that the application servers, adapters and objects @@ -336,13 +346,24 @@ Database::updateApplicationDescriptor(const ApplicationUpdateDescriptor& update) // // Update the application descriptor. // - ApplicationDescriptorHelper helper(_communicator, p->second); - helper.update(update); + ApplicationDescriptorPtr descriptor; + try + { + ApplicationDescriptorHelper helper(_communicator, p->second); + helper.update(update); + descriptor = helper.getDescriptor(); + } + catch(const string& msg) + { + DeploymentException ex; + ex.reason = msg; + throw ex; + } // // Synchronize the application descriptor. // - syncApplicationDescriptorNoSync(p->second, helper.getDescriptor(), entries); + syncApplicationDescriptorNoSync(p->second, descriptor, entries); } // @@ -374,14 +395,24 @@ Database::syncApplicationDescriptor(const ApplicationDescriptorPtr& newDesc) throw ex; } - ApplicationDescriptorHelper helper(_communicator, newDesc); - helper.instantiate(); - + ApplicationDescriptorPtr descriptor; + try + { + ApplicationDescriptorHelper helper(_communicator, newDesc); + helper.instantiate(); + descriptor = helper.getDescriptor(); + } + catch(const string& msg) + { + DeploymentException ex; + ex.reason = msg; + throw ex; + } // // Synchronize the application descriptor. // - syncApplicationDescriptorNoSync(p->second, helper.getDescriptor(), entries); + syncApplicationDescriptorNoSync(p->second, descriptor, entries); } // |