summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/ObserverSessionI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceGrid/ObserverSessionI.cpp')
-rw-r--r--cpp/src/IceGrid/ObserverSessionI.cpp96
1 files changed, 92 insertions, 4 deletions
diff --git a/cpp/src/IceGrid/ObserverSessionI.cpp b/cpp/src/IceGrid/ObserverSessionI.cpp
index ae4a7c8e977..f2c4e8760a2 100644
--- a/cpp/src/IceGrid/ObserverSessionI.cpp
+++ b/cpp/src/IceGrid/ObserverSessionI.cpp
@@ -73,17 +73,49 @@ ObserverSessionI::setObserversByIdentity(const Ice::Identity& registryObserver,
}
void
-ObserverSessionI::startUpdate(int serial, const Ice::Current&)
+ObserverSessionI::startUpdate(int serial, const Ice::Current& current)
{
Lock sync(*this);
+ if(_destroyed)
+ {
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
+ }
+
_database->lock(serial, this, _userId);
_updating = true;
}
void
-ObserverSessionI::updateApplication(const ApplicationUpdateDescriptor& update, const Ice::Current&)
+ObserverSessionI::addApplication(const ApplicationDescriptorPtr& app, const Ice::Current& current)
{
Lock sync(*this);
+ if(_destroyed)
+ {
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
+ }
+
+ if(!_updating)
+ {
+ throw AccessDenied();
+ }
+ _database->addApplicationDescriptor(this, app);
+}
+
+void
+ObserverSessionI::updateApplication(const ApplicationUpdateDescriptor& update, const Ice::Current& current)
+{
+ Lock sync(*this);
+ if(_destroyed)
+ {
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
+ }
+
if(!_updating)
{
throw AccessDenied();
@@ -92,20 +124,76 @@ ObserverSessionI::updateApplication(const ApplicationUpdateDescriptor& update, c
}
void
-ObserverSessionI::finishUpdate(const Ice::Current&)
+ObserverSessionI::syncApplication(const ApplicationDescriptorPtr& app, const Ice::Current& current)
+{
+ Lock sync(*this);
+ if(_destroyed)
+ {
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
+ }
+
+ if(!_updating)
+ {
+ throw AccessDenied();
+ }
+ _database->syncApplicationDescriptor(this, app);
+}
+
+void
+ObserverSessionI::removeApplication(const string& name, const Ice::Current& current)
{
Lock sync(*this);
+ if(_destroyed)
+ {
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
+ }
+
if(!_updating)
{
throw AccessDenied();
}
+ _database->removeApplicationDescriptor(this, name);
+}
+void
+ObserverSessionI::finishUpdate(const Ice::Current& current)
+{
+ Lock sync(*this);
+ if(_destroyed)
+ {
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
+ }
+
+ if(!_updating)
+ {
+ throw AccessDenied();
+ }
_database->unlock(this);
+ _updating = false;
}
void
-ObserverSessionI::destroy(const Ice::Current&)
+ObserverSessionI::destroy(const Ice::Current& current)
{
+ Lock sync(*this);
+ if(_destroyed)
+ {
+ Ice::ObjectNotExistException ex(__FILE__, __LINE__);
+ ex.id = current.id;
+ throw ex;
+ }
+ if(_updating)
+ {
+ _database->unlock(this);
+ _updating = false;
+ }
+
//
// Unsubscribe from the topics.
//