blob: d12f773008d5c40906fdc98ace1ecf89cb1204cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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()
|