summaryrefslogtreecommitdiff
path: root/py/demo/Glacier2/callback/SessionServer.py
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2005-11-17 18:26:29 +0000
committerDwayne Boone <dwayne@zeroc.com>2005-11-17 18:26:29 +0000
commit05d60f523e830ba7849827100ccec7659f73e23e (patch)
tree4f6d47ed248e26245b219fa81131dc014b247314 /py/demo/Glacier2/callback/SessionServer.py
parentFix (diff)
downloadice-05d60f523e830ba7849827100ccec7659f73e23e.tar.bz2
ice-05d60f523e830ba7849827100ccec7659f73e23e.tar.xz
ice-05d60f523e830ba7849827100ccec7659f73e23e.zip
Added IceGrid, IceStorm and Glacier2 demos
Diffstat (limited to 'py/demo/Glacier2/callback/SessionServer.py')
-rw-r--r--py/demo/Glacier2/callback/SessionServer.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/py/demo/Glacier2/callback/SessionServer.py b/py/demo/Glacier2/callback/SessionServer.py
new file mode 100644
index 00000000000..aa4b3666c77
--- /dev/null
+++ b/py/demo/Glacier2/callback/SessionServer.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import sys, traceback, Ice, Glacier2
+
+class DummyPermissionsVerifierI(Glacier2.PermissionsVerifier):
+ def checkPermissions(self, userId, password, current=None):
+ print "verified user `" + userId + "' with password `" + password + "'"
+ return (True, "")
+
+class SessionI(Glacier2.Session):
+ def __init__(self, userId):
+ self.userId = userId
+
+ def destroy(self, current=None):
+ print "destroying session for user `" + self.userId + "'"
+ current.adapter.remove(current.id)
+
+class SessionManagerI(Glacier2.SessionManager):
+ def create(self, userId, current=None):
+ print "creating session for user `" + userId + "'"
+ session = SessionI(userId)
+ return Glacier2.SessionPrx.uncheckedCast(current.adapter.addWithUUID(session))
+
+class SessionServer(Ice.Application):
+ def run(self, args):
+ adapter = self.communicator().createObjectAdapter("SessionServer")
+ adapter.add(DummyPermissionsVerifierI(), Ice.stringToIdentity("verifier"))
+ adapter.add(SessionManagerI(), Ice.stringToIdentity("sessionmanager"))
+ adapter.activate()
+ self.communicator().waitForShutdown()
+ return True
+
+app = SessionServer()
+sys.exit(app.main(sys.argv, "config.sessionserver"))