diff options
Diffstat (limited to 'src/YalpClients/EflClient/corba_example/server.py')
| -rwxr-xr-x | src/YalpClients/EflClient/corba_example/server.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/YalpClients/EflClient/corba_example/server.py b/src/YalpClients/EflClient/corba_example/server.py new file mode 100755 index 0000000..d12f773 --- /dev/null +++ b/src/YalpClients/EflClient/corba_example/server.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +import sys +import os +from omniORB import CORBA, PortableServer +import CosNaming, HuhuItf, HuhuItf__POA + +class Blubb_i (HuhuItf__POA.Blubb): + + def get_something (self, request): + + pkg_no = 10 + cdeps = [] + + while pkg_no > 0: + cdep = HuhuItf.Dependency ("hallo du", str (pkg_no)) + cdeps.append (cdep) + pkg_no = pkg_no - 1 + + return cdeps + +orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) +poa = orb.resolve_initial_references("RootPOA") + +blubb_i = Blubb_i() +blubb_o = blubb_i._this() +print orb.object_to_string(blubb_o) + +obj = orb.resolve_initial_references("NameService") +root_context = obj._narrow(CosNaming.NamingContext) + +if root_context is None: + print "Failed to narrow the root naming context" + sys.exit(1) + +name = [CosNaming.NameComponent("huhu", "project")] + +try: + huhu_context = root_context.bind_new_context(name) + print "dbsfed:project bound to naming service" + +except CosNaming.NamingContext.AlreadyBound, ex: + print "dbsfed:project already bount to naming service" + obj = root_context.resolve(name) + huhu_context = obj._narrow(CosNaming.NamingContext) + if huhu_context is None: + print "dbsfed:project exists but is not a naming context" + sys.exit(1) + +name = [CosNaming.NameComponent("blubb", "object")] + +try: + huhu_context.bind(name, blubb_o) + print "new aptd:apt object bound" + +except CosNaming.NamingContext.AlreadyBound: + huhu_context.rebind(name, blubb_o) + print "aptd:apt binding already existed, rebound" + +poaManager = poa._get_the_POAManager() +poaManager.activate() + +orb.run() |
