summaryrefslogtreecommitdiff
path: root/src/YalpClients/EflClient
diff options
context:
space:
mode:
Diffstat (limited to 'src/YalpClients/EflClient')
-rwxr-xr-xsrc/YalpClients/EflClient/corba_example/client.py36
-rwxr-xr-xsrc/YalpClients/EflClient/corba_example/client.sh2
-rw-r--r--src/YalpClients/EflClient/corba_example/huhu.idl22
-rwxr-xr-xsrc/YalpClients/EflClient/corba_example/python_idl.sh2
-rwxr-xr-xsrc/YalpClients/EflClient/corba_example/server.py63
-rwxr-xr-xsrc/YalpClients/EflClient/corba_example/server.sh5
6 files changed, 130 insertions, 0 deletions
diff --git a/src/YalpClients/EflClient/corba_example/client.py b/src/YalpClients/EflClient/corba_example/client.py
new file mode 100755
index 0000000..b6eff0a
--- /dev/null
+++ b/src/YalpClients/EflClient/corba_example/client.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+import sys
+from omniORB import CORBA
+import HuhuItf, CosNaming
+
+orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
+
+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"),
+ CosNaming.NameComponent("blubb", "object")]
+
+try:
+ obj = root_context.resolve(name)
+
+except CosNaming.NamingContext.NotFound, ex:
+ print "Name not found"
+ sys.exit(1)
+
+blubb = obj._narrow(HuhuItf.Blubb)
+
+if blubb is None:
+ print "obj ref is not an dbsfeditf::dependency"
+ sys.exit(1)
+
+pkg = HuhuItf.Package("e17-data","0.16.999.063-1","now","amd64");
+deps = blubb.get_something(pkg)
+
+for dep in deps:
+ print dep.name, dep.version
diff --git a/src/YalpClients/EflClient/corba_example/client.sh b/src/YalpClients/EflClient/corba_example/client.sh
new file mode 100755
index 0000000..38dc635
--- /dev/null
+++ b/src/YalpClients/EflClient/corba_example/client.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+./client.py -ORBInitRef NameService=corbaloc:iiop:localhost:1055/NameService
diff --git a/src/YalpClients/EflClient/corba_example/huhu.idl b/src/YalpClients/EflClient/corba_example/huhu.idl
new file mode 100644
index 0000000..e455509
--- /dev/null
+++ b/src/YalpClients/EflClient/corba_example/huhu.idl
@@ -0,0 +1,22 @@
+module HuhuItf
+{
+ struct Package
+ {
+ string name;
+ string version;
+ string repo;
+ string arch;
+ };
+
+ struct Dependency
+ {
+ string name;
+ string version;
+ };
+ typedef sequence<Dependency> Dependency_list;
+
+ interface Blubb
+ {
+ Dependency_list get_something(in Package request);
+ };
+};
diff --git a/src/YalpClients/EflClient/corba_example/python_idl.sh b/src/YalpClients/EflClient/corba_example/python_idl.sh
new file mode 100755
index 0000000..f470887
--- /dev/null
+++ b/src/YalpClients/EflClient/corba_example/python_idl.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+omniidl -bpython huhu.idl
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()
diff --git a/src/YalpClients/EflClient/corba_example/server.sh b/src/YalpClients/EflClient/corba_example/server.sh
new file mode 100755
index 0000000..dd1e68d
--- /dev/null
+++ b/src/YalpClients/EflClient/corba_example/server.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+orbd -ORBInitialPort 1055 &
+sleep 3
+./server.py -ORBInitRef NameService=corbaloc:iiop:localhost:1055/NameService
+killall -9 orbd