ICE 3.4.2
[php5-ice-freebsdport.git] / py / demo / Glacier2 / callback / Server.py
blob1ad915750ec4e0f4161c2afac708a59b83836dcb
1 #!/usr/bin/env python
2 # **********************************************************************
4 # Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
6 # This copy of Ice is licensed to you under the terms described in the
7 # ICE_LICENSE file included in this distribution.
9 # **********************************************************************
11 import sys, traceback, Ice
13 Ice.loadSlice('Callback.ice')
14 import Demo
16 class CallbackI(Demo.Callback):
17 def initiateCallback(self, proxy, current=None):
18 print "initiating callback to: " + current.adapter.getCommunicator().proxyToString(proxy)
19 try:
20 proxy.callback()
21 except:
22 traceback.print_exc()
24 def shutdown(self, current=None):
25 print "shutting down..."
26 current.adapter.getCommunicator().shutdown()
28 class Server(Ice.Application):
29 def run(self, args):
30 if len(args) > 1:
31 print self.appName() + ": too many arguments"
32 return 1
34 adapter = self.communicator().createObjectAdapter("Callback.Server")
35 adapter.add(CallbackI(), self.communicator().stringToIdentity("callback"))
36 adapter.activate()
37 self.communicator().waitForShutdown()
38 return 0
40 app = Server()
41 sys.exit(app.main(sys.argv, "config.server"))