Example #1
0
 def exception(self, current):
     if current.operation == "ice_ids":
         raise Test.TestIntfUserException()
     elif current.operation == "requestFailedException":
         raise Ice.ObjectNotExistException()
     elif current.operation == "unknownUserException":
         raise Ice.UnknownUserException("reason")
     elif current.operation == "unknownLocalException":
         raise Ice.UnknownLocalException("reason")
     elif current.operation == "unknownException":
         raise Ice.UnknownException("reason")
     elif current.operation == "userException":
         raise Test.TestIntfUserException()
     elif current.operation == "localException":
         raise Ice.SocketException(0)
     elif current.operation == "pythonException":
         raise RuntimeError("message")
     elif current.operation == "unknownExceptionWithServantException":
         raise Ice.UnknownException("reason")
     elif current.operation == "impossibleException":
         raise Test.TestIntfUserException(
         )  # Yes, it really is meant to be TestIntfUserException.
     elif current.operation == "intfUserException":
         raise Test.TestImpossibleException(
         )  # Yes, it really is meant to be TestImpossibleException.
     elif current.operation == "asyncResponse":
         raise Test.TestImpossibleException()
     elif current.operation == "asyncException":
         raise Test.TestImpossibleException()
Example #2
0
    def ice_ping(self, current=None):
        name = current.id.name

        if name == "ObjectNotExist":
            raise Ice.ObjectNotExistException()
        elif name == "FacetNotExist":
            raise Ice.FacetNotExistException()
Example #3
0
 def timestamp(self):
     self._lock.acquire()
     try:
         if self._destroy:
             raise Ice.ObjectNotExistException()
         return self._timestamp
     finally:
         self._lock.release()
Example #4
0
 def getName(self, c):
     self._lock.acquire()
     try:
         if self._destroy:
             raise Ice.ObjectNotExistException()
         return self._name
     finally:
         self._lock.release()
Example #5
0
 def refresh(self, c):
     self._lock.acquire()
     try:
         if self._destroy:
             raise Ice.ObjectNotExistException()
         self._timestamp = time.time()
     finally:
         self._lock.release()
Example #6
0
 def asyncException(self, current=None):
     #
     # We can't do this with futures.
     #
     #f = Ice.Future()
     #f.set_exception(Test.TestIntfUserException())
     #return f
     raise Ice.ObjectNotExistException()
Example #7
0
    def getName(self, current=None):
        name = current.id.name

        if name == "ObjectNotExist":
            raise Ice.ObjectNotExistException()
        elif name == "FacetNotExist":
            raise Ice.FacetNotExistException()

        return name
Example #8
0
    def createHello(self, current):
        with self._lock:
            if self._destroy:
                raise Ice.ObjectNotExistException()

            hello = Demo.HelloPrx.uncheckedCast(current.adapter.addWithUUID(HelloI(self._name, self._nextId)))
            self._nextId = self._nextId + 1
            self._objs.append(hello)
            return hello
Example #9
0
def throwEx(t):
    if t == LocalException:
        raise Ice.ObjectNotExistException()
    elif t == UserException:
        raise Test.TestIntfException()
    elif t == OtherException:
        raise RuntimeError()
    else:
        test(False)
Example #10
0
    def createHello(self, c):
        self._lock.acquire()
        try:
            if self._destroy:
                raise Ice.ObjectNotExistException()

            hello = Demo.HelloPrx.uncheckedCast(
                c.adapter.addWithUUID(HelloI(self._name, self._nextId)))
            self._nextId = self._nextId + 1
            self._objs.append(hello)
            return hello
        finally:
            self._lock.release()
Example #11
0
 def destroy(self, current):
     with self._lock:
         if self._destroy:
             raise Ice.ObjectNotExistException()
         self._destroy = True
         print("The session " + self._name + " is now destroyed.")
         try:
             current.adapter.remove(current.id)
             for p in self._objs:
                 current.adapter.remove(p.ice_getIdentity())
         except Ice.ObjectAdapterDeactivatedException as ex:
             # This method is called on shutdown of the server, in
             # which case this exception is expected.
             pass
         self._objs = []
Example #12
0
 def asyncResponse_async(self, cb, current=None):
     cb.ice_response()
     raise Ice.ObjectNotExistException()
Example #13
0
 def getName(self, current):
     with self._lock:
         if self._destroy:
             raise Ice.ObjectNotExistException()
         return self._name
Example #14
0
 def asyncResponse(self, current=None):
     #
     # We can't do this with futures.
     #
     #return Ice.Future.completed(None)
     raise Ice.ObjectNotExistException()
Example #15
0
 def unknownExceptionWithServantException(self, current=None):
     f = Ice.Future()
     f.set_exception(Ice.ObjectNotExistException())
     return f
Example #16
0
 def asyncException_async(self, cb, current=None):
     cb.ice_exception(Test.TestIntfUserException())
     raise Ice.ObjectNotExistException()
Example #17
0
 def unknownExceptionWithServantException(self, current=None):
     raise Ice.ObjectNotExistException()
Example #18
0
 def unknownExceptionWithServantException_async(self, cb, current=None):
     cb.ice_exception(Ice.ObjectNotExistException())